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 /*
00041  * FS relative includes
00042  */
00043 #include <hpss_version.h>
00044 
00045 #if HPSS_MAJOR_VERSION == 5
00046 
00047 #include <u_signed64.h>         /* for cast64 function */
00048 #include <hpss_api.h>
00049 
00050 #elif (HPSS_MAJOR_VERSION == 6) || (HPSS_MAJOR_VERSION == 7)
00051 
00052 #include <u_signed64.h>         /* for cast64 function */
00053 #include <hpss_api.h>
00054 #include <acct_hpss.h>
00055 
00056 #endif
00057 
00058 /*
00059  * labels in the config file
00060  */
00061 
00062 # define CONF_LABEL_FS_SPECIFIC   "HPSS"
00063 
00064 /* -------------------------------------------
00065  *      HPSS dependant definitions
00066  * ------------------------------------------- */
00067 
00068 #include "fsal_glue_const.h"
00069 
00070 #define fsal_handle_t hpssfsal_handle_t
00071 #define fsal_op_context_t hpssfsal_op_context_t
00072 #define fsal_file_t hpssfsal_file_t
00073 #define fsal_dir_t hpssfsal_dir_t
00074 #define fsal_export_context_t hpssfsal_export_context_t
00075 #define fsal_cookie_t hpssfsal_cookie_t
00076 #define fs_specific_initinfo_t hpssfs_specific_initinfo_t
00077 #define fsal_cred_t hpssfsal_cred_t
00078 
00079 /* Filesystem handle */
00080 
00081 typedef union {
00082  struct 
00083   {
00084 
00085     /* The object type */
00086     fsal_nodetype_t obj_type;
00087 
00088     /* The hpss handle */
00089     ns_ObjHandle_t ns_handle;
00090   } data ;
00091   char pad[FSAL_HANDLE_T_SIZE];
00092 } hpssfsal_handle_t;
00093 
00096 #if HPSS_MAJOR_VERSION == 5
00097 
00098 typedef struct
00099 {
00100 
00101   time_t last_update;
00102   hsec_UserCred_t hpss_usercred;
00103 
00104 } hpssfsal_cred_t;
00105 
00106 #elif (HPSS_MAJOR_VERSION == 6) || (HPSS_MAJOR_VERSION == 7)
00107 
00108 typedef struct
00109 {
00110 
00111   time_t last_update;
00112   sec_cred_t hpss_usercred;
00113 
00114 } hpssfsal_cred_t;
00115 
00116 #endif
00117 
00118 typedef struct
00119 {
00120   fsal_staticfsinfo_t * fe_static_fs_info;     /* Must be the first entry in this structure */
00121 
00122   ns_ObjHandle_t fileset_root_handle;
00123   unsigned int default_cos;
00124 
00125 } hpssfsal_export_context_t;
00126 
00127 #define FSAL_EXPORT_CONTEXT_SPECIFIC( pexport_context ) (uint64_t)(pexport_context->default_cos)
00128 
00129 typedef struct
00130 {
00131   hpssfsal_export_context_t *export_context;    /* Must be the first entry in this structure */
00132   hpssfsal_cred_t credential;
00133 } hpssfsal_op_context_t;
00134 
00135 #if (HPSS_MAJOR_VERSION == 5)
00136 #define FSAL_OP_CONTEXT_TO_UID( pcontext ) ( pcontext->credential.hpss_usercred.SecPwent.Uid )
00137 #define FSAL_OP_CONTEXT_TO_GID( pcontext ) ( pcontext->credential.hpss_usercred.SecPwent.Gid )
00138 #elif (HPSS_MAJOR_VERSION == 6) || (HPSS_MAJOR_VERSION == 7)
00139 #define FSAL_OP_CONTEXT_TO_UID( pcontext ) ( pcontext->credential.hpss_usercred.Uid )
00140 #define FSAL_OP_CONTEXT_TO_GID( pcontext ) ( pcontext->credential.hpss_usercred.Gid )
00141 #endif
00142 
00144 typedef struct
00145 {
00146   hpssfsal_op_context_t context;        /* credential for readdir operations */
00147   hpssfsal_handle_t dir_handle; /* directory handle */
00148   int reserved;                 /* not used */
00149 } hpssfsal_dir_t;
00150 
00153 #if (HPSS_MAJOR_VERSION == 5)
00154 
00155 typedef struct
00156 {
00157   int filedes;                  /* file descriptor. */
00158   gss_token_t fileauthz;        /* data access credential. */
00159 } hpssfsal_file_t;
00160 
00161 #elif (HPSS_MAJOR_VERSION == 6)
00162 
00163 typedef struct
00164 {
00165   int filedes;                  /* file descriptor. */
00166   hpss_authz_token_t fileauthz; /* data access credential. */
00167 } hpssfsal_file_t;
00168 
00169 #elif (HPSS_MAJOR_VERSION == 7)
00170 
00171 typedef struct
00172 {
00173   int filedes;                  /* file descriptor. */
00174 } hpssfsal_file_t;
00175 
00176 #endif
00177 
00178 //#define FSAL_FILENO( p_fsal_file )  ( (p_fsal_file)->filedes )
00179 
00182 #if (HPSS_MAJOR_VERSION == 5)
00183 
00184 typedef struct
00185 {
00186 
00187   /* specifies the behavior for each init value : */
00188   struct behaviors
00189   {
00190     fsal_initflag_t
00191         /* client API configuration */
00192     PrincipalName, KeytabPath,
00193         /* Other specific configuration */
00194     CredentialLifetime, ReturnInconsistentDirent;
00195 
00196   } behaviors;
00197 
00198   /* client API configuration info : */
00199   api_config_t hpss_config;
00200 
00201   /* other configuration info */
00202   fsal_uint_t CredentialLifetime;
00203   fsal_uint_t ReturnInconsistentDirent;
00204 
00205 } hpssfs_specific_initinfo_t;
00206 
00207 #elif (HPSS_MAJOR_VERSION == 6) || (HPSS_MAJOR_VERSION == 7)
00208 
00209 typedef struct
00210 {
00211 
00212   /* specifies the behavior for each init value : */
00213   struct behaviors
00214   {
00215     fsal_initflag_t
00216         /* client API configuration */
00217     AuthnMech, NumRetries, BusyDelay, BusyRetries, MaxConnections, DebugPath,
00218         /* Other specific configuration */
00219     Principal, KeytabPath, CredentialLifetime, ReturnInconsistentDirent;
00220 
00221   } behaviors;
00222 
00223   /* client API configuration info : */
00224   api_config_t hpss_config;
00225 
00226   /* other configuration info */
00227   char Principal[FSAL_MAX_NAME_LEN];
00228   char KeytabPath[FSAL_MAX_PATH_LEN];
00229 
00230   fsal_uint_t CredentialLifetime;
00231   fsal_uint_t ReturnInconsistentDirent;
00232 
00233 } hpssfs_specific_initinfo_t;
00234 
00235 #endif
00236 
00238 typedef union {
00239   u_signed64 data ;
00240   char pad[FSAL_COOKIE_T_SIZE];
00241 } hpssfsal_cookie_t;
00242 
00243 //#define FSAL_READDIR_FROM_BEGINNING  (cast64(0))
00244 
00245 #if HPSS_LEVEL >= 730
00246 #define HAVE_XATTR_CREATE 1
00247 #endif
00248 
00249 
00250 #endif                          /* _FSAL_TYPES_SPECIFIC_H */