nfs-ganesha 1.4

fsal_types.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Copyright CEA/DAM/DIF  (2005)
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 
00035 #ifndef _FSAL_TYPES_SPECIFIC_H
00036 #define _FSAL_TYPES_SPECIFIC_H
00037 
00038 #include "ganesha_fuse_wrap.h"
00039 
00040 # define CONF_LABEL_FS_SPECIFIC   "FUSE"
00041 
00042 #include <sys/types.h>
00043 #include <sys/param.h>
00044 #include "config_parsing.h"
00045 #include "err_fsal.h"
00046 
00047 #include "fsal_glue_const.h"
00048 
00049 #define fsal_handle_t fusefsal_handle_t
00050 #define fsal_op_context_t fusefsal_op_context_t
00051 #define fsal_file_t fusefsal_file_t
00052 #define fsal_dir_t fusefsal_dir_t
00053 #define fsal_export_context_t fusefsal_export_context_t
00054 #define fsal_lockdesc_t fusefsal_lockdesc_t
00055 #define fsal_cookie_t fusefsal_cookie_t
00056 #define fs_specific_initinfo_t fusefs_specific_initinfo_t
00057 #define fsal_cred_t fusefsal_cred_t
00058 
00059   /* In this section, you must define your own FSAL internal types.
00060    * Here are some template types :
00061    */
00062 
00063 typedef union {
00064   struct 
00065   {
00066     ino_t inode;
00067     dev_t device;
00068     unsigned int validator;       /* because fuse filesystem
00069                                    can reuse their old inode numbers,
00070                                    which is not NFS compliant. */
00071   } data ;
00072   char pad[FSAL_HANDLE_T_SIZE];
00073 } fusefsal_handle_t;
00074 
00075 typedef struct
00076 {
00077   fsal_staticfsinfo_t * fe_static_fs_info;     /* Must be the first entry in this structure */
00078 
00079   fusefsal_handle_t root_handle;
00080   fsal_path_t root_full_path;   /* not expected to change when filesystem is mounted ! */
00081   struct ganefuse *ganefuse;
00082 } fusefsal_export_context_t;
00083 
00084 #define FSAL_EXPORT_CONTEXT_SPECIFIC( pexport_context ) (uint64_t)(FSAL_Handle_to_RBTIndex( &(pexport_context->root_handle), 0 ) )
00085 
00086 typedef struct
00087 {
00088   fusefsal_export_context_t *export_context;    /* Must be the first entry in this structure */
00089   struct user_credentials credential;
00090   struct ganefuse_context ganefuse_context;
00091 } fusefsal_op_context_t;
00092 
00093 #define FSAL_OP_CONTEXT_TO_UID( pcontext ) ( pcontext->credential.user )
00094 #define FSAL_OP_CONTEXT_TO_GID( pcontext ) ( pcontext->credential.group )
00095 
00096 typedef struct
00097 {
00098   fusefsal_handle_t dir_handle;
00099   fusefsal_op_context_t context;
00100   struct ganefuse_file_info dir_info;
00101 } fusefsal_dir_t;
00102 
00103 typedef struct
00104 {
00105   fusefsal_handle_t file_handle;
00106   fusefsal_op_context_t context;
00107   struct ganefuse_file_info file_info;
00108   fsal_off_t current_offset;
00109 } fusefsal_file_t;
00110 
00111 //# define FSAL_FILENO(_p_f) ( (_p_f)->file_info.fh )
00112 
00113 typedef union {
00114   off_t data;
00115   char pad[FSAL_COOKIE_T_SIZE];
00116 } fusefsal_cookie_t;
00117 
00118 //#define FSAL_READDIR_FROM_BEGINNING ((fusefsal_cookie_t)0)
00119 
00120 typedef struct
00121 {
00122   struct ganefuse_operations *fs_ops;
00123   void *user_data;
00124 
00125 } fusefs_specific_initinfo_t;
00126 
00127 #endif                          /* _FSAL_TYPES_SPECIFIC_H */