nfs-ganesha 1.4

mfsl.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 
00036 #ifndef _MFSL_H
00037 #define _MFSL_H
00038 
00039 /* fsal_types contains constants and type definitions for FSAL */
00040 #include "fsal.h"
00041 #include "mfsl_types.h"
00042 #include "common_utils.h"
00043 
00044 #ifndef _USE_SWIG
00045 
00046 #define MFSL_return( _code_, _minor_ ) do {                               \
00047                fsal_status_t _struct_status_ = FSAL_STATUS_NO_ERROR ;\
00048                (_struct_status_).major = (_code_) ;          \
00049                (_struct_status_).minor = (_minor_) ;         \
00050                return (_struct_status_);                     \
00051               } while(0)
00052 
00060 fsal_status_t MFSL_SetDefault_parameter(mfsl_parameter_t * out_parameter);
00061 
00080 fsal_status_t MFSL_load_parameter_from_conf(config_file_t in_config,
00081                                             mfsl_parameter_t * out_parameter);
00082 
00087 fsal_status_t MFSL_Init(mfsl_parameter_t * init_info    /* IN */
00088     );
00089 
00090 fsal_status_t MFSL_GetContext(mfsl_context_t * pcontext,
00091                               fsal_op_context_t * pfsal_context);
00092 
00093 fsal_status_t MFSL_RefreshContext(mfsl_context_t * pcontext,
00094                                   fsal_op_context_t * pfsal_context);
00095 
00096 #endif                          /* ! _USE_SWIG */
00097 
00098 /******************************************************
00099  *              Common Filesystem calls.
00100  ******************************************************/
00101 
00102 fsal_status_t MFSL_lookup(mfsl_object_t * parent_directory_handle,      /* IN */
00103                           fsal_name_t * p_filename,     /* IN */
00104                           fsal_op_context_t * p_context,        /* IN */
00105                           mfsl_context_t * p_mfsl_context,      /* IN */
00106                           mfsl_object_t * object_handle,        /* OUT */
00107                           fsal_attrib_list_t * object_attributes,        /* [ IN/OUT ] */
00108                           void * pextra
00109     );
00110 
00111 fsal_status_t MFSL_lookupPath(fsal_path_t * p_path,     /* IN */
00112                               fsal_op_context_t * p_context,    /* IN */
00113                               mfsl_context_t * p_mfsl_context,  /* IN */
00114                               mfsl_object_t * object_handle,    /* OUT */
00115                               fsal_attrib_list_t * object_attributes    /* [ IN/OUT ] */
00116     );
00117 
00118 fsal_status_t MFSL_lookupJunction(mfsl_object_t * p_junction_handle,    /* IN */
00119                                   fsal_op_context_t * p_context,        /* IN */
00120                                   mfsl_context_t * p_mfsl_context,      /* IN */
00121                                   mfsl_object_t * p_fsoot_handle,       /* OUT */
00122                                   fsal_attrib_list_t * p_fsroot_attributes      /* [ IN/OUT ] */
00123     );
00124 
00125 fsal_status_t MFSL_access(mfsl_object_t * object_handle,        /* IN */
00126                           fsal_op_context_t * p_context,        /* IN */
00127                           mfsl_context_t * p_mfsl_context,      /* IN */
00128                           fsal_accessflags_t access_type,       /* IN */
00129                           fsal_attrib_list_t * object_attributes,        /* [ IN/OUT ] */
00130                           void * pextra
00131     );
00132 
00133 fsal_status_t MFSL_create(mfsl_object_t * parent_directory_handle,      /* IN */
00134                           fsal_name_t * p_filename,     /* IN */
00135                           fsal_op_context_t * p_context,        /* IN */
00136                           mfsl_context_t * p_mfsl_context,      /* IN */
00137                           fsal_accessmode_t accessmode, /* IN */
00138                           mfsl_object_t * object_handle,        /* OUT */
00139                           fsal_attrib_list_t * object_attributes,       /* [ IN/OUT ] */
00140                           fsal_attrib_list_t * parent_attributes,        /* IN */
00141                           void * pextra
00142     );
00143 
00144 fsal_status_t MFSL_mkdir(mfsl_object_t * parent_directory_handle,       /* IN */
00145                          fsal_name_t * p_dirname,       /* IN */
00146                          fsal_op_context_t * p_context, /* IN */
00147                          mfsl_context_t * p_mfsl_context,       /* IN */
00148                          fsal_accessmode_t accessmode,  /* IN */
00149                          mfsl_object_t * object_handle, /* OUT */
00150                          fsal_attrib_list_t * object_attributes,        /* [ IN/OUT ] */
00151                          fsal_attrib_list_t * parent_attributes, /* IN */
00152                          void * pextra 
00153     );
00154 
00155 fsal_status_t MFSL_truncate(mfsl_object_t * filehandle, /* IN */
00156                             fsal_op_context_t * p_context,      /* IN */
00157                             mfsl_context_t * p_mfsl_context,    /* IN */
00158                             fsal_size_t length, /* IN */
00159                             mfsl_file_t * file_descriptor,      /* INOUT */
00160                             fsal_attrib_list_t * object_attributes,      /* [ IN/OUT ] */
00161                             void * pextra
00162     );
00163 
00164 fsal_status_t MFSL_getattrs(mfsl_object_t * filehandle, /* IN */
00165                             fsal_op_context_t * p_context,      /* IN */
00166                             mfsl_context_t * p_mfsl_context,    /* IN */
00167                             fsal_attrib_list_t * object_attributes,      /* IN/OUT */
00168                             void * pextra
00169     );
00170 
00171 fsal_status_t MFSL_setattrs(mfsl_object_t * filehandle, /* IN */
00172                             fsal_op_context_t * p_context,      /* IN */
00173                             mfsl_context_t * p_mfsl_context,    /* IN */
00174                             fsal_attrib_list_t * attrib_set,    /* IN */
00175                             fsal_attrib_list_t * object_attributes,      /* [ IN/OUT ] */
00176                             void * pextra
00177     );
00178 
00179 fsal_status_t MFSL_link(mfsl_object_t * target_handle,  /* IN */
00180                         mfsl_object_t * dir_handle,     /* IN */
00181                         fsal_name_t * p_link_name,      /* IN */
00182                         fsal_op_context_t * p_context,  /* IN */
00183                         mfsl_context_t * p_mfsl_context,        /* IN */
00184                         fsal_attrib_list_t * attributes,     /* [ IN/OUT ] */
00185                         void * pextra
00186     );
00187 
00188 fsal_status_t MFSL_opendir(mfsl_object_t * dir_handle,  /* IN */
00189                            fsal_op_context_t * p_context,       /* IN */
00190                            mfsl_context_t * p_mfsl_context,     /* IN */
00191                            fsal_dir_t * dir_descriptor, /* OUT */
00192                            fsal_attrib_list_t * dir_attributes,  /* [ IN/OUT ] */
00193                            void * pextra
00194     );
00195 
00196 fsal_status_t MFSL_readdir(fsal_dir_t * dir_descriptor, /* IN */
00197                            fsal_cookie_t start_position,        /* IN */
00198                            fsal_attrib_mask_t get_attr_mask,    /* IN */
00199                            fsal_mdsize_t buffersize,    /* IN */
00200                            fsal_dirent_t * pdirent,     /* OUT */
00201                            fsal_cookie_t * end_position,        /* OUT */
00202                            fsal_count_t * nb_entries,   /* OUT */
00203                            fsal_boolean_t * end_of_dir, /* OUT */
00204                            mfsl_context_t * p_mfsl_context,      /* IN */
00205                            void * pextra
00206     );
00207 
00208 fsal_status_t MFSL_closedir(fsal_dir_t * dir_descriptor,        /* IN */
00209                             mfsl_context_t * p_mfsl_context,     /* IN */
00210                             void * pextra
00211     );
00212 
00213 fsal_status_t MFSL_open(mfsl_object_t * filehandle,     /* IN */
00214                         fsal_op_context_t * p_context,  /* IN */
00215                         mfsl_context_t * p_mfsl_context,        /* IN */
00216                         fsal_openflags_t openflags,     /* IN */
00217                         mfsl_file_t * file_descriptor,  /* OUT */
00218                         fsal_attrib_list_t * file_attributes,    /* [ IN/OUT ] */
00219                         void * pextra
00220     );
00221 
00222 fsal_status_t MFSL_open_by_name(mfsl_object_t * dirhandle,      /* IN */
00223                                 fsal_name_t * filename, /* IN */
00224                                 fsal_op_context_t * p_context,  /* IN */
00225                                 mfsl_context_t * p_mfsl_context,        /* IN */
00226                                 fsal_openflags_t openflags,     /* IN */
00227                                 mfsl_file_t * file_descriptor,  /* OUT */
00228                                 fsal_attrib_list_t * file_attributes, /* [ IN/OUT ] */ 
00229                                 void * pextra);
00230 
00231 fsal_status_t MFSL_open_by_fileid(mfsl_object_t * filehandle,   /* IN */
00232                                   fsal_u64_t fileid,    /* IN */
00233                                   fsal_op_context_t * p_context,        /* IN */
00234                                   mfsl_context_t * p_mfsl_context,      /* IN */
00235                                   fsal_openflags_t openflags,   /* IN */
00236                                   mfsl_file_t * file_descriptor,        /* OUT */
00237                                   fsal_attrib_list_t * file_attributes, /* [ IN/OUT ] */ 
00238                                   void * pextra );
00239 
00240 fsal_status_t MFSL_read(mfsl_file_t * file_descriptor,  /*  IN  */
00241                         fsal_seek_t * seek_descriptor,  /* [IN] */
00242                         fsal_size_t buffer_size,        /*  IN  */
00243                         caddr_t buffer, /* OUT  */
00244                         fsal_size_t * read_amount,      /* OUT  */
00245                         fsal_boolean_t * end_of_file,   /* OUT  */
00246                         mfsl_context_t * p_mfsl_context, /* IN */
00247                         void * pextra
00248     );
00249 
00250 fsal_status_t MFSL_write(mfsl_file_t * file_descriptor, /* IN */
00251                          fsal_seek_t * seek_descriptor, /* IN */
00252                          fsal_size_t buffer_size,       /* IN */
00253                          caddr_t buffer,        /* IN */
00254                          fsal_size_t * write_amount,    /* OUT */
00255                          mfsl_context_t * p_mfsl_context,        /* IN */
00256                          void * pextra
00257     );
00258 
00259 fsal_status_t MFSL_close(mfsl_file_t * file_descriptor, /* IN */
00260                          mfsl_context_t * p_mfsl_context,        /* IN */
00261                          void * pextra
00262     );
00263 
00264 fsal_status_t MFSL_commit( mfsl_file_t * file_descriptor /* IN */,
00265                          fsal_off_t    offset,
00266                          fsal_size_t   length,
00267                          void * pextra);
00268 
00269 fsal_status_t MFSL_close_by_fileid(mfsl_file_t * file_descriptor /* IN */ ,
00270                                    fsal_u64_t fileid,
00271                                    mfsl_context_t * p_mfsl_context, /* IN */
00272                                    void * pextra ) ;
00273 
00274 fsal_status_t MFSL_readlink(mfsl_object_t * linkhandle, /* IN */
00275                             fsal_op_context_t * p_context,      /* IN */
00276                             mfsl_context_t * p_mfsl_context,    /* IN */
00277                             fsal_path_t * p_link_content,       /* OUT */
00278                             fsal_attrib_list_t * link_attributes,        /* [ IN/OUT ] */
00279                             void * pextra 
00280     );
00281 
00282 fsal_status_t MFSL_symlink(mfsl_object_t * parent_directory_handle,     /* IN */
00283                            fsal_name_t * p_linkname,    /* IN */
00284                            fsal_path_t * p_linkcontent, /* IN */
00285                            fsal_op_context_t * p_context,       /* IN */
00286                            mfsl_context_t * p_mfsl_context,     /* IN */
00287                            fsal_accessmode_t accessmode,        /* IN (ignored); */
00288                            mfsl_object_t * link_handle, /* OUT */
00289                            fsal_attrib_list_t * link_attributes, /* [ IN/OUT ] */
00290                            void * pextra
00291     );
00292 
00293 fsal_status_t MFSL_rename(mfsl_object_t * old_parentdir_handle, /* IN */
00294                           fsal_name_t * p_old_name,     /* IN */
00295                           mfsl_object_t * new_parentdir_handle, /* IN */
00296                           fsal_name_t * p_new_name,     /* IN */
00297                           fsal_op_context_t * p_context,        /* IN */
00298                           mfsl_context_t * p_mfsl_context,      /* IN */
00299                           fsal_attrib_list_t * src_dir_attributes,      /* [ IN/OUT ] */
00300                           fsal_attrib_list_t * tgt_dir_attributes,       /* [ IN/OUT ] */
00301                           void * pextra 
00302     );
00303 
00304 fsal_status_t MFSL_unlink(mfsl_object_t * parentdir_handle,     /* INOUT */
00305                           fsal_name_t * p_object_name,  /* IN */
00306                           mfsl_object_t * object_handle,        /* INOUT */
00307                           fsal_op_context_t * p_context,        /* IN */
00308                           mfsl_context_t * p_mfsl_context,      /* IN */
00309                           fsal_attrib_list_t * parentdir_attributes,     /* [IN/OUT ] */
00310                           void * pextra
00311     );
00312 
00313 fsal_status_t MFSL_mknode(mfsl_object_t * parentdir_handle,     /* IN */
00314                           fsal_name_t * p_node_name,    /* IN */
00315                           fsal_op_context_t * p_context,        /* IN */
00316                           mfsl_context_t * p_mfsl_context,      /* IN */
00317                           fsal_accessmode_t accessmode, /* IN */
00318                           fsal_nodetype_t nodetype,     /* IN */
00319                           fsal_dev_t * dev,     /* IN */
00320                           mfsl_object_t * p_object_handle,      /* OUT */
00321                           fsal_attrib_list_t * node_attributes,  /* [ IN/OUT ] */
00322                           void * pextra
00323     );
00324 
00325 fsal_status_t MFSL_rcp(mfsl_object_t * filehandle,      /* IN */
00326                        fsal_op_context_t * p_context,   /* IN */
00327                        mfsl_context_t * p_mfsl_context, /* IN */
00328                        fsal_path_t * p_local_path,      /* IN */
00329                        fsal_rcpflag_t transfer_opt,     /* IN */
00330                        void * pextra
00331     );
00332 
00333 /* To be called before exiting */
00334 fsal_status_t MFSL_terminate();
00335 
00336 #endif                          /* _MFSL_H */