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 #ifdef _SOLARIS
00045 #include "solaris_port.h"
00046 #endif                          /* _SOLARIS */
00047 
00048 /*
00049  * FS relative includes
00050  */
00051 
00052 #include <sys/types.h>
00053 #include <sys/time.h>
00054 #include <sys/stat.h>
00055 #include <dirent.h>
00056 #include <fcntl.h>
00057 #include <stdio.h>
00058 #include <limits.h>
00059 #include <unistd.h>
00060 
00061 /*
00062  * labels in the config file
00063  */
00064 
00065 #define CONF_LABEL_FS_SPECIFIC   "POSIX"
00066 
00067 #define fsal_handle_t posixfsal_handle_t
00068 #define fsal_op_context_t posixfsal_op_context_t
00069 #define fsal_file_t posixfsal_file_t
00070 #define fsal_dir_t posixfsal_dir_t
00071 #define fsal_export_context_t posixfsal_export_context_t
00072 #define fsal_lockdesc_t posixfsal_lockdesc_t
00073 #define fsal_cookie_t posixfsal_cookie_t
00074 #define fs_specific_initinfo_t posixfs_specific_initinfo_t
00075 #define fsal_cred_t posixfsal_cred_t
00076 
00077 /* other includes */
00078 #include <sys/types.h>
00079 #include <sys/param.h>
00080 #include "config_parsing.h"
00081 #include "err_fsal.h"
00082 
00083 /* -------------------------------------------
00084  *      POSIX FS dependant definitions
00085  * ------------------------------------------- */
00086 
00087 #include "fsal_glue_const.h"
00088 
00090 typedef struct
00091 {
00092   dev_t devid;
00093   ino_t inode;
00094   int nlink;
00095   time_t ctime;
00096   fsal_nodetype_t ftype;
00097 } fsal_posixdb_fileinfo_t;
00098 
00099 typedef union {
00100  struct
00101   {
00102     fsal_u64_t id;
00103     int ts;                       /* timestamp */
00104     fsal_posixdb_fileinfo_t info; /* info from the database, related to the object on the FS */
00105   } data ;
00106   char pad[FSAL_HANDLE_T_SIZE];
00107 } posixfsal_handle_t;  
00113 #include "posixdb.h"
00114 
00115 //typedef void *fsal_export_context_t;
00116 typedef struct
00117 {
00118   fsal_staticfsinfo_t * fe_static_fs_info;     /* Must be the first entry in this structure */
00119 
00120   void *data;
00121 } posixfsal_export_context_t;
00122 
00123 #define FSAL_EXPORT_CONTEXT_SPECIFIC( pexport_context ) (uint64_t)(*pexport_context)
00124 
00125 typedef struct
00126 {
00127   posixfsal_export_context_t *export_context;   /* Must be the first entry in this structure */
00128   struct user_credentials credential;
00129   fsal_posixdb_conn *p_conn;
00130 } posixfsal_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   fsal_posixdb_conn_params_t dbparams;
00138 } posixfs_specific_initinfo_t;
00139 
00141 typedef union {
00142  struct 
00143   {
00144     off_t cookie;
00145   } data ;
00146   char pad[FSAL_COOKIE_T_SIZE];
00147 } posixfsal_cookie_t;
00148 
00149 /* Directory stream descriptor. */
00150 
00151 typedef struct
00152 {
00153   DIR *p_dir;
00154   posixfsal_op_context_t context;       /* credential for accessing the directory */
00155   fsal_path_t path;
00156   posixfsal_handle_t handle;
00157 #ifdef _USE_POSIXDB_READDIR_BLOCK
00158   fsal_posixdb_child *p_dbentries;
00159   int dbentries_count;        
00160 #endif
00161 } posixfsal_dir_t;
00162 
00163 #ifdef _FSAL_POSIX_USE_STREAM
00164 typedef struct
00165 {
00166   FILE *p_file;
00167   int ro;                       /* read only file ? */
00168 } posixfsal_file_t;
00169 
00170 //#define FSAL_FILENO( p_fsal_file )  ( fileno( (p_fsal_file)->p_file ) )
00171 
00172 #else
00173 typedef struct
00174 {
00175   int filefd;
00176   int ro;                       /* read only file ? */
00177 } posixfsal_file_t;
00178 
00179 //#define FSAL_FILENO(p_fsal_file)  ((p_fsal_file)->filefd )
00180 
00181 #endif                          /* _FSAL_POSIX_USE_STREAM */
00182 
00183 
00184 #endif                          /* _FSAL_TYPES__SPECIFIC_H */