nfs-ganesha 1.4
|
00001 /* 00002 * 00003 * 00004 * Copyright CEA/DAM/DIF (2008) 00005 * contributeur : Philippe DENIEL philippe.deniel@cea.fr 00006 * Thomas LEIBOVICI thomas.leibovici@cea.fr 00007 * 00008 * 00009 * This program is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 3 of the License, or (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00022 * 00023 * --------------------------------------- 00024 */ 00025 00037 #ifndef _FSAL_TYPES_SPECIFIC_H 00038 #define _FSAL_TYPES_SPECIFIC_H 00039 00040 #ifdef HAVE_CONFIG_H 00041 #include "config.h" 00042 #endif 00043 00044 /* 00045 * FS relative includes 00046 */ 00047 00048 #include "config_parsing.h" 00049 #include "err_fsal.h" 00050 00051 #ifndef _GNU_SOURCE 00052 #define _GNU_SOURCE 00053 #endif /* _GNU_SOURCE */ 00054 00055 #ifndef _ATFILE_SOURCE 00056 #define _ATFILE_SOURCE 00057 #endif /* _ATFILE_SOURCE */ 00058 00059 #include <sys/types.h> 00060 #include <sys/stat.h> 00061 #include <sys/syscall.h> 00062 #include <dirent.h> 00063 #include <fcntl.h> 00064 #include <xfs/xfs.h> 00065 #include <xfs/handle.h> 00066 #include <stdio.h> 00067 #include <unistd.h> 00068 #include <string.h> 00069 #include <errno.h> 00070 00071 /* 00072 * labels in the config file 00073 */ 00074 00075 #define CONF_LABEL_FS_SPECIFIC "XFS" 00076 00077 /* ------------------------------------------- 00078 * POSIX FS dependant definitions 00079 * ------------------------------------------- */ 00080 00081 #define FSAL_XFS_HANDLE_LEN 29 00082 #define FSAL_XFS_FSHANDLE_LEN 64 00083 00084 #include "fsal_glue_const.h" 00085 00086 #define fsal_handle_t xfsfsal_handle_t 00087 #define fsal_op_context_t xfsfsal_op_context_t 00088 #define fsal_file_t xfsfsal_file_t 00089 #define fsal_dir_t xfsfsal_dir_t 00090 #define fsal_export_context_t xfsfsal_export_context_t 00091 #define fsal_lockdesc_t xfsfsal_lockdesc_t 00092 #define fsal_cookie_t xfsfsal_cookie_t 00093 #define fs_specific_initinfo_t xfsfs_specific_initinfo_t 00094 #define fsal_cred_t xfsfsal_cred_t 00095 00096 typedef union { 00097 struct 00098 { 00099 uint64_t inode; 00100 unsigned int handle_len; 00101 char type; 00102 char handle_val[FSAL_XFS_HANDLE_LEN]; 00103 } data ; 00104 char pad[FSAL_HANDLE_T_SIZE]; 00105 } xfsfsal_handle_t; 00109 typedef struct 00110 { 00111 fsal_staticfsinfo_t * fe_static_fs_info; /* Must be the first entry in this structure */ 00112 00113 char mount_point[FSAL_MAX_PATH_LEN]; 00114 char mnt_handle_val[FSAL_XFS_HANDLE_LEN]; 00115 char mnt_fshandle_val[FSAL_XFS_FSHANDLE_LEN]; 00116 00117 unsigned int mnt_handle_len; /* for optimizing concatenation */ 00118 unsigned int mnt_fshandle_len; /* for optimizing concatenation */ 00119 dev_t dev_id; 00120 } xfsfsal_export_context_t; 00121 00122 #define FSAL_EXPORT_CONTEXT_SPECIFIC( _pexport_context ) (uint64_t)((_pexport_context)->dev_id) 00123 00124 //#define FSAL_GET_EXP_CTX( popctx ) (fsal_export_context_t *)(( (xfsfsal_op_context_t *)popctx)->export_context) 00125 00126 typedef struct 00127 { 00128 xfsfsal_export_context_t *export_context; /* Must be the first entry in this structure */ 00129 struct user_credentials credential; 00130 } xfsfsal_op_context_t; 00131 00132 #define FSAL_OP_CONTEXT_TO_UID( pcontext ) ( pcontext->credential.user ) 00133 #define FSAL_OP_CONTEXT_TO_GID( pcontext ) ( pcontext->credential.group ) 00134 00135 typedef struct 00136 { 00137 char xfs_mount_point[MAXPATHLEN]; 00138 } xfsfs_specific_initinfo_t; 00139 00141 typedef union { 00142 struct 00143 { 00144 off_t cookie; 00145 } data ; 00146 char pad[FSAL_COOKIE_T_SIZE]; 00147 } xfsfsal_cookie_t; 00148 00149 #define FSAL_SET_PCOOKIE_BY_OFFSET( __pfsal_cookie, __cookie ) \ 00150 do \ 00151 { \ 00152 ((xfsfsal_cookie_t *)__pfsal_cookie)->data.cookie = (off_t)__cookie ; \ 00153 } while( 0 ) 00154 00155 #define FSAL_SET_OFFSET_BY_PCOOKIE( __pfsal_cookie, __cookie ) \ 00156 do \ 00157 { \ 00158 __cookie = ((xfsfsal_cookie_t *)__pfsal_cookie)->data.cookie ; \ 00159 } while( 0 ) 00160 00161 00162 00163 //static const xfsfsal_cookie_t FSAL_READDIR_FROM_BEGINNING = { 0 }; 00164 00165 /* Directory stream descriptor. */ 00166 00167 typedef struct 00168 { 00169 int fd; 00170 xfsfsal_op_context_t context; /* credential for accessing the directory */ 00171 fsal_path_t path; 00172 unsigned int dir_offset; 00173 xfsfsal_handle_t handle; 00174 } xfsfsal_dir_t; 00175 00176 typedef struct 00177 { 00178 int fd; 00179 int ro; /* read only file ? */ 00180 } xfsfsal_file_t; 00181 00182 //#define FSAL_GET_EXP_CTX( popctx ) (fsal_export_context_t *)(( (xfsfsal_op_context_t *)popctx)->export_context) 00183 //#define FSAL_FILENO( p_fsal_file ) ((xfsfsal_file_t *)p_fsal_file)->fd 00184 00185 #endif /* _FSAL_TYPES__SPECIFIC_H */