nfs-ganesha 1.4

fsal_types.h

Go to the documentation of this file.
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 #include <sys/types.h>
00052 #include <sys/stat.h>
00053 #include <unistd.h>
00054 #include <fcntl.h>
00055 #include <ctype.h>
00056 
00057 #ifndef LPX64
00058 #define LPX64 "%#llx"
00059 #endif
00060 
00061 #ifndef LPX64i
00062 #define LPX64i "%llx"
00063 #endif
00064 
00065 #ifndef DFID_NOBRACE
00066 #define DFID_NOBRACE    LPX64":0x%x:0x%x"
00067 #endif
00068 
00069 #include <asm/types.h>
00070 #include <lustre/liblustreapi.h>
00071 
00072 #define fsal_handle_t lustrefsal_handle_t
00073 #define fsal_op_context_t lustrefsal_op_context_t
00074 #define fsal_file_t lustrefsal_file_t
00075 #define fsal_dir_t lustrefsal_dir_t
00076 #define fsal_export_context_t lustrefsal_export_context_t
00077 #define fsal_lockdesc_t lustrefsal_lockdesc_t
00078 #define fsal_cookie_t lustrefsal_cookie_t
00079 #define fs_specific_initinfo_t lustrefs_specific_initinfo_t
00080 #define fsal_cred_t lustrefsal_cred_t
00081 
00082 /*
00083  * labels in the config file
00084  */
00085 
00086 #define CONF_LABEL_FS_SPECIFIC   "LUSTRE"
00087 
00088 /* -------------------------------------------
00089  *      POSIX FS dependant definitions
00090  * ------------------------------------------- */
00091 #include "fsal_glue_const.h"
00092 
00093 typedef union {
00094  struct
00095   {
00096     lustre_fid fid;
00097     /* used for FSAL_DIGEST_FILEID */
00098     unsigned long long inode;
00099   } data ;
00100   char pad[FSAL_HANDLE_T_SIZE];
00101 } lustrefsal_handle_t;  
00105 typedef struct lustrefsal_cred__
00106 {
00107   uid_t user;
00108   gid_t group;
00109   fsal_count_t nbgroups;
00110   gid_t alt_groups[FSAL_NGROUPS_MAX];
00111 } lustrefsal_cred_t;
00112 
00113 #define MAX_LUSTRE_FSNAME 128
00114 typedef struct lustrefsal_export_context_t
00115 {
00116   fsal_staticfsinfo_t * fe_static_fs_info;     /* Must be the first entry in this structure */
00117 
00118   char mount_point[FSAL_MAX_PATH_LEN];
00119   unsigned int mnt_len;         /* for optimizing concatenation */
00120   char fsname[MAX_LUSTRE_FSNAME];
00121   dev_t dev_id;
00122 } lustrefsal_export_context_t;
00123 
00124 //#define FSAL_EXPORT_CONTEXT_SPECIFIC( _pexport_context ) (uint64_t)((_pexport_context)->dev_id)
00125 
00126 typedef struct
00127 {
00128   lustrefsal_export_context_t *export_context;  /* Must be the first entry in this structure */
00129   struct user_credentials credential;
00130 } lustrefsal_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   int dummy;
00138 } lustrefs_specific_initinfo_t;
00139 
00141 typedef union
00142 {
00143  struct 
00144   {
00145     off_t cookie;
00146   } data ;
00147   char pad[FSAL_COOKIE_T_SIZE];
00148 } lustrefsal_cookie_t;
00149 
00150 #define FSAL_SET_PCOOKIE_BY_OFFSET( __pfsal_cookie, __cookie )           \
00151 do                                                                       \
00152 {                                                                        \
00153    ((lustrefsal_cookie_t *)__pfsal_cookie)->data.cookie = (off_t)__cookie ; \
00154 } while( 0 )
00155 
00156 #define FSAL_SET_OFFSET_BY_PCOOKIE( __pfsal_cookie, __cookie )           \
00157 do                                                                       \
00158 {                                                                        \
00159    __cookie =  ((lustrefsal_cookie_t *)__pfsal_cookie)->data.cookie ;       \
00160 } while( 0 )
00161 
00162 
00163 //static const lustrefsal_cookie_t FSAL_READDIR_FROM_BEGINNING = { 0 };
00164 
00165 /* Directory stream descriptor. */
00166 
00167 typedef struct
00168 {
00169   DIR *p_dir;
00170   lustrefsal_op_context_t context;      /* credential for accessing the directory */
00171   fsal_path_t path;
00172   lustrefsal_handle_t handle;
00173 } lustrefsal_dir_t;
00174 
00175 typedef struct
00176 {
00177   int fd;
00178   int ro;                       /* read only file ? */
00179 } lustrefsal_file_t;
00180 
00181 //#define FSAL_FILENO( p_fsal_file )  ( (p_fsal_file)->fd )
00182 
00183 
00184 #endif                          /* _FSAL_TYPES__SPECIFIC_H */