nfs-ganesha 1.4

mfsl_proxy_rpcsecgss.c

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 #include "config.h"
00037 
00038 /* fsal_types contains constants and type definitions for FSAL */
00039 #include "fsal_types.h"
00040 #include "fsal.h"
00041 #include "mfsl_types.h"
00042 #include "mfsl.h"
00043 #include "common_utils.h"
00044 
00045 #ifndef _USE_SWIG
00046 /******************************************************
00047  *            Attribute mask management.
00048  ******************************************************/
00049 
00057 fsal_status_t MFSL_SetDefault_parameter(mfsl_parameter_t * out_parameter)
00058 {
00059   fsal_status_t status;
00060 
00061   status.major = ERR_FSAL_NO_ERROR;
00062   status.minor = 0;
00063 
00064   return status;
00065 }                               /* MFSL_SetDefault_parameter */
00066 
00085 fsal_status_t MFSL_load_parameter_from_conf(config_file_t in_config,
00086                                             mfsl_parameter_t * out_parameter)
00087 {
00088   fsal_status_t status;
00089 
00090   status.major = ERR_FSAL_NO_ERROR;
00091   status.minor = 0;
00092 
00093   return status;
00094 }
00095 
00100 fsal_status_t MFSL_Init(mfsl_parameter_t * init_info    /* IN */
00101     )
00102 {
00103   fsal_status_t status;
00104 
00105   status.major = ERR_FSAL_NO_ERROR;
00106   status.minor = 0;
00107 
00108   return status;
00109 }
00110 
00111 fsal_status_t MFSL_GetContext(mfsl_context_t * pcontext)
00112 {
00113   fsal_status_t status;
00114 
00115   status.major = ERR_FSAL_NO_ERROR;
00116   status.minor = 0;
00117 
00118   return status;
00119 }
00120 
00121 #endif                          /* ! _USE_SWIG */
00122 
00123 /******************************************************
00124  *              Common Filesystem calls.
00125  ******************************************************/
00126 
00127 fsal_status_t MFSL_lookup(mfsl_object_t * parent_directory_handle,      /* IN */
00128                           fsal_name_t * p_filename,     /* IN */
00129                           fsal_op_context_t * p_context,        /* IN */
00130                           mfsl_context_t * p_mfsl_context,      /* IN */
00131                           mfsl_object_t * object_handle,        /* OUT */
00132                           fsal_attrib_list_t * object_attributes        /* [ IN/OUT ] */
00133     )
00134 {
00135   return FSAL_lookup(&parent_directory_handle->handle,
00136                      p_filename, p_context, &object_handle->handle, object_attributes);
00137 }                               /* MFSL_lookup */
00138 
00139 fsal_status_t MFSL_lookupPath(fsal_path_t * p_path,     /* IN */
00140                               fsal_op_context_t * p_context,    /* IN */
00141                               mfsl_context_t * p_mfsl_context,  /* IN */
00142                               mfsl_object_t * object_handle,    /* OUT */
00143                               fsal_attrib_list_t * object_attributes    /* [ IN/OUT ] */
00144     )
00145 {
00146   return FSAL_lookupPath(p_path, p_context, &object_handle->handle, object_attributes);
00147 }                               /* MFSL_lookupPath */
00148 
00149 fsal_status_t MFSL_lookupJunction(mfsl_object_t * p_junction_handle,    /* IN */
00150                                   fsal_op_context_t * p_context,        /* IN */
00151                                   mfsl_context_t * p_mfsl_context,      /* IN */
00152                                   mfsl_object_t * p_fsoot_handle,       /* OUT */
00153                                   fsal_attrib_list_t * p_fsroot_attributes      /* [ IN/OUT ] */
00154     )
00155 {
00156   return FSAL_lookupJunction(&p_junction_handle->handle,
00157                              p_context, &p_fsoot_handle->handle, p_fsroot_attributes);
00158 }                               /* MFSL_lookupJunction */
00159 
00160 fsal_status_t MFSL_access(mfsl_object_t * object_handle,        /* IN */
00161                           fsal_op_context_t * p_context,        /* IN */
00162                           mfsl_context_t * p_mfsl_context,      /* IN */
00163                           fsal_accessflags_t access_type,       /* IN */
00164                           fsal_attrib_list_t * object_attributes        /* [ IN/OUT ] */
00165     )
00166 {
00167   return FSAL_access(&object_handle->handle, p_context, access_type, object_attributes);
00168 }                               /* MFSL_access */
00169 
00170 fsal_status_t MFSL_create(mfsl_object_t * parent_directory_handle,      /* IN */
00171                           fsal_name_t * p_filename,     /* IN */
00172                           fsal_op_context_t * p_context,        /* IN */
00173                           mfsl_context_t * p_mfsl_context,      /* IN */
00174                           fsal_accessmode_t accessmode, /* IN */
00175                           mfsl_object_t * object_handle,        /* OUT */
00176                           fsal_attrib_list_t * object_attributes        /* [ IN/OUT ] */
00177     )
00178 {
00179   return FSAL_create(&parent_directory_handle->handle,
00180                      p_filename,
00181                      p_context, accessmode, &object_handle->handle, object_attributes);
00182 }                               /* MFSL_create */
00183 
00184 fsal_status_t MFSL_mkdir(mfsl_object_t * parent_directory_handle,       /* IN */
00185                          fsal_name_t * p_dirname,       /* IN */
00186                          fsal_op_context_t * p_context, /* IN */
00187                          mfsl_context_t * p_mfsl_context,       /* IN */
00188                          fsal_accessmode_t accessmode,  /* IN */
00189                          mfsl_object_t * object_handle, /* OUT */
00190                          fsal_attrib_list_t * object_attributes /* [ IN/OUT ] */
00191     )
00192 {
00193   return FSAL_mkdir(&parent_directory_handle->handle,
00194                     p_dirname,
00195                     p_context, accessmode, &object_handle->handle, object_attributes);
00196 }                               /* MFSL_mkdir */
00197 
00198 fsal_status_t MFSL_truncate(mfsl_object_t * filehandle, /* IN */
00199                             fsal_op_context_t * p_context,      /* IN */
00200                             mfsl_context_t * p_mfsl_context,    /* IN */
00201                             fsal_size_t length, /* IN */
00202                             fsal_file_t * file_descriptor,      /* INOUT */
00203                             fsal_attrib_list_t * object_attributes      /* [ IN/OUT ] */
00204     )
00205 {
00206   return FSAL_truncate(&filehandle->handle,
00207                        p_context, length, file_descriptor, object_attributes);
00208 }                               /* MFSL_truncate */
00209 
00210 fsal_status_t MFSL_getattrs(mfsl_object_t * filehandle, /* IN */
00211                             fsal_op_context_t * p_context,      /* IN */
00212                             mfsl_context_t * p_mfsl_context,    /* IN */
00213                             fsal_attrib_list_t * object_attributes      /* IN/OUT */
00214     )
00215 {
00216   return FSAL_getattrs(&filehandle->handle, p_context, object_attributes);
00217 }                               /* MFSL_getattrs */
00218 
00219 fsal_status_t MFSL_setattrs(mfsl_object_t * filehandle, /* IN */
00220                             fsal_op_context_t * p_context,      /* IN */
00221                             mfsl_context_t * p_mfsl_context,    /* IN */
00222                             fsal_attrib_list_t * attrib_set,    /* IN */
00223                             fsal_attrib_list_t * object_attributes      /* [ IN/OUT ] */
00224     )
00225 {
00226   return FSAL_setattrs(&filehandle->handle, p_context, attrib_set, object_attributes);
00227 }                               /* MFSL_setattrs */
00228 
00229 fsal_status_t MFSL_link(mfsl_object_t * target_handle,  /* IN */
00230                         mfsl_object_t * dir_handle,     /* IN */
00231                         fsal_name_t * p_link_name,      /* IN */
00232                         fsal_op_context_t * p_context,  /* IN */
00233                         mfsl_context_t * p_mfsl_context,        /* IN */
00234                         fsal_attrib_list_t * attributes /* [ IN/OUT ] */
00235     )
00236 {
00237   return FSAL_link(&target_handle->handle,
00238                    &dir_handle->handle, p_link_name, p_context, attributes);
00239 }                               /* MFSL_link */
00240 
00241 fsal_status_t MFSL_opendir(mfsl_object_t * dir_handle,  /* IN */
00242                            fsal_op_context_t * p_context,       /* IN */
00243                            mfsl_context_t * p_mfsl_context,     /* IN */
00244                            fsal_dir_t * dir_descriptor, /* OUT */
00245                            fsal_attrib_list_t * dir_attributes  /* [ IN/OUT ] */
00246     )
00247 {
00248   return FSAL_opendir(&dir_handle->handle, p_context, dir_descriptor, dir_attributes);
00249 }                               /* MFSL_opendir */
00250 
00251 fsal_status_t MFSL_readdir(fsal_dir_t * dir_descriptor, /* IN */
00252                            fsal_cookie_t start_position,        /* IN */
00253                            fsal_attrib_mask_t get_attr_mask,    /* IN */
00254                            fsal_mdsize_t buffersize,    /* IN */
00255                            fsal_dirent_t * pdirent,     /* OUT */
00256                            fsal_cookie_t * end_position,        /* OUT */
00257                            fsal_count_t * nb_entries,   /* OUT */
00258                            fsal_boolean_t * end_of_dir, /* OUT */
00259                            mfsl_context_t * p_mfsl_context      /* IN */
00260     )
00261 {
00262   return FSAL_readdir(dir_descriptor,
00263                       start_position,
00264                       get_attr_mask,
00265                       buffersize, pdirent, end_position, nb_entries, end_of_dir);
00266 
00267 }                               /* MFSL_readdir */
00268 
00269 fsal_status_t MFSL_closedir(fsal_dir_t * dir_descriptor,        /* IN */
00270                             mfsl_context_t * p_mfsl_context     /* IN */
00271     )
00272 {
00273   return FSAL_closedir(dir_descriptor);
00274 }                               /* FSAL_closedir */
00275 
00276 fsal_status_t MFSL_open(mfsl_object_t * filehandle,     /* IN */
00277                         fsal_op_context_t * p_context,  /* IN */
00278                         mfsl_context_t * p_mfsl_context,        /* IN */
00279                         fsal_openflags_t openflags,     /* IN */
00280                         fsal_file_t * file_descriptor,  /* OUT */
00281                         fsal_attrib_list_t * file_attributes    /* [ IN/OUT ] */
00282     )
00283 {
00284   return FSAL_open(&filehandle->handle,
00285                    p_context, openflags, file_descriptor, file_attributes);
00286 }                               /* MFSL_open */
00287 
00288 fsal_status_t MFSL_open_by_name(mfsl_object_t * dirhandle,      /* IN */
00289                                 fsal_name_t * filename, /* IN */
00290                                 fsal_op_context_t * p_context,  /* IN */
00291                                 mfsl_context_t * p_mfsl_context,        /* IN */
00292                                 fsal_openflags_t openflags,     /* IN */
00293                                 fsal_file_t * file_descriptor,  /* OUT */
00294                                 fsal_attrib_list_t * file_attributes /* [ IN/OUT ] */ )
00295 {
00296   return FSAL_open_by_name(&dirhandle->handle,
00297                            filename,
00298                            p_context, openflags, file_descriptor, file_attributes);
00299 }                               /* MFSL_open_by_name */
00300 
00301 fsal_status_t MFSL_open_by_fileid(mfsl_object_t * filehandle,   /* IN */
00302                                   fsal_u64_t fileid,    /* IN */
00303                                   fsal_op_context_t * p_context,        /* IN */
00304                                   mfsl_context_t * p_mfsl_context,      /* IN */
00305                                   fsal_openflags_t openflags,   /* IN */
00306                                   fsal_file_t * file_descriptor,        /* OUT */
00307                                   fsal_attrib_list_t * file_attributes /* [ IN/OUT ] */ )
00308 {
00309   return FSAL_open_by_fileid(&filehandle->handle,
00310                              fileid,
00311                              p_context, openflags, file_descriptor, file_attributes);
00312 }                               /* MFSL_open_by_fileid */
00313 
00314 fsal_status_t MFSL_read(fsal_file_t * file_descriptor,  /*  IN  */
00315                         fsal_seek_t * seek_descriptor,  /* [IN] */
00316                         fsal_size_t buffer_size,        /*  IN  */
00317                         caddr_t buffer, /* OUT  */
00318                         fsal_size_t * read_amount,      /* OUT  */
00319                         fsal_boolean_t * end_of_file,   /* OUT  */
00320                         mfsl_context_t * p_mfsl_context /* IN */
00321     )
00322 {
00323   return FSAL_read(file_descriptor,
00324                    seek_descriptor, buffer_size, buffer, read_amount, end_of_file);
00325 }                               /* MFSL_read */
00326 
00327 fsal_status_t MFSL_write(fsal_file_t * file_descriptor, /* IN */
00328                          fsal_seek_t * seek_descriptor, /* IN */
00329                          fsal_size_t buffer_size,       /* IN */
00330                          caddr_t buffer,        /* IN */
00331                          fsal_size_t * write_amount,    /* OUT */
00332                          mfsl_context_t * p_mfsl_context        /* IN */
00333     )
00334 {
00335   return FSAL_write(file_descriptor, seek_descriptor, buffer_size, buffer, write_amount);
00336 }                               /* MFSL_write */
00337 
00338 fsal_status_t MFSL_close(fsal_file_t * file_descriptor, /* IN */
00339                          mfsl_context_t * p_mfsl_context        /* IN */
00340     )
00341 {
00342   return FSAL_close(file_descriptor);
00343 }                               /* MFSL_close */
00344 
00345 fsal_status_t MFSL_commit(mfsl_file_t * file_descriptor /* IN */,
00346                          void * pextra)
00347 {
00348    return FSAL_commit( &file_descriptor->fsal_file ) ;
00349 }
00350 
00351 fsal_status_t MFSL_close_by_fileid(fsal_file_t * file_descriptor /* IN */ ,
00352                                    fsal_u64_t fileid, mfsl_context_t * p_mfsl_context)  /* IN */
00353 {
00354   return FSAL_close_by_fileid(file_descriptor, fileid);
00355 }                               /* MFSL_close_by_fileid */
00356 
00357 fsal_status_t MFSL_readlink(mfsl_object_t * linkhandle, /* IN */
00358                             fsal_op_context_t * p_context,      /* IN */
00359                             mfsl_context_t * p_mfsl_context,    /* IN */
00360                             fsal_path_t * p_link_content,       /* OUT */
00361                             fsal_attrib_list_t * link_attributes        /* [ IN/OUT ] */
00362     )
00363 {
00364   return FSAL_readlink(&linkhandle->handle, p_context, p_link_content, link_attributes);
00365 }                               /* MFSL_readlink */
00366 
00367 fsal_status_t MFSL_symlink(mfsl_object_t * parent_directory_handle,     /* IN */
00368                            fsal_name_t * p_linkname,    /* IN */
00369                            fsal_path_t * p_linkcontent, /* IN */
00370                            fsal_op_context_t * p_context,       /* IN */
00371                            mfsl_context_t * p_mfsl_context,     /* IN */
00372                            fsal_accessmode_t accessmode,        /* IN (ignored); */
00373                            mfsl_object_t * link_handle, /* OUT */
00374                            fsal_attrib_list_t * link_attributes /* [ IN/OUT ] */
00375     )
00376 {
00377   return FSAL_symlink(&parent_directory_handle->handle,
00378                       p_linkname,
00379                       p_linkcontent,
00380                       p_context, accessmode, &link_handle->handle, link_attributes);
00381 }                               /* MFSL_symlink */
00382 
00383 fsal_status_t MFSL_rename(mfsl_object_t * old_parentdir_handle, /* IN */
00384                           fsal_name_t * p_old_name,     /* IN */
00385                           mfsl_object_t * new_parentdir_handle, /* IN */
00386                           fsal_name_t * p_new_name,     /* IN */
00387                           fsal_op_context_t * p_context,        /* IN */
00388                           mfsl_context_t * p_mfsl_context,      /* IN */
00389                           fsal_attrib_list_t * src_dir_attributes,      /* [ IN/OUT ] */
00390                           fsal_attrib_list_t * tgt_dir_attributes       /* [ IN/OUT ] */
00391     )
00392 {
00393   return FSAL_rename(&old_parentdir_handle->handle,
00394                      p_old_name,
00395                      &new_parentdir_handle->handle,
00396                      p_new_name, p_context, src_dir_attributes, tgt_dir_attributes);
00397 }                               /* MFSL_rename */
00398 
00399 fsal_status_t MFSL_unlink(mfsl_object_t * parentdir_handle,     /* IN */
00400                           fsal_name_t * p_object_name,  /* IN */
00401                           fsal_op_context_t * p_context,        /* IN */
00402                           mfsl_context_t * p_mfsl_context,      /* IN */
00403                           fsal_attrib_list_t * parentdir_attributes     /* [IN/OUT ] */
00404     )
00405 {
00406   return FSAL_unlink(&parentdir_handle->handle,
00407                      p_object_name, p_context, parentdir_attributes);
00408 }                               /* MFSL_unlink */
00409 
00410 fsal_status_t MFSL_mknode(mfsl_object_t * parentdir_handle,     /* IN */
00411                           fsal_name_t * p_node_name,    /* IN */
00412                           fsal_op_context_t * p_context,        /* IN */
00413                           mfsl_context_t * p_mfsl_context,      /* IN */
00414                           fsal_accessmode_t accessmode, /* IN */
00415                           fsal_nodetype_t nodetype,     /* IN */
00416                           fsal_dev_t * dev,     /* IN */
00417                           mfsl_object_t * p_object_handle,      /* OUT */
00418                           fsal_attrib_list_t * node_attributes  /* [ IN/OUT ] */
00419     )
00420 {
00421   return FSAL_mknode(&parentdir_handle->handle,
00422                      p_node_name,
00423                      p_context,
00424                      accessmode,
00425                      nodetype, dev, &p_object_handle->handle, node_attributes);
00426 }                               /* MFSL_mknode */
00427 
00428 fsal_status_t MFSL_rcp(mfsl_object_t * filehandle,      /* IN */
00429                        fsal_op_context_t * p_context,   /* IN */
00430                        mfsl_context_t * p_mfsl_context, /* IN */
00431                        fsal_path_t * p_local_path,      /* IN */
00432                        fsal_rcpflag_t transfer_opt      /* IN */
00433     )
00434 {
00435   return FSAL_rcp(&filehandle->handle, p_context, p_local_path, transfer_opt);
00436 }                               /* MFSL_rcp */
00437 
00438 /* To be called before exiting */
00439 fsal_status_t MFSL_terminate(void)
00440 {
00441   fsal_status_t status;
00442 
00443   status.major = ERR_FSAL_NO_ERROR;
00444   status.minor = 0;
00445 
00446   return status;
00447 
00448 }                               /* MFSL_terminate */