nfs-ganesha 1.4

fsal_glue.c

Go to the documentation of this file.
00001 /*
00002  * vim:expandtab:shiftwidth=4:tabstop=4:
00003  */
00004 
00010 #ifdef HAVE_CONFIG_H
00011 #include "config.h"
00012 #endif
00013 
00014 
00015 #include <string.h> /* For strncpy */
00016 
00017 #define fsal_increment_nbcall( _f_,_struct_status_ )
00018 
00019 #include "fsal.h"
00020 #include "fsal_glue.h"
00021 #include "fsal_up.h"
00022 
00023 int __thread my_fsalid = -1 ;
00024 
00025 fsal_functions_t fsal_functions_array[NB_AVAILABLE_FSAL];
00026 fsal_const_t fsal_consts_array[NB_AVAILABLE_FSAL];
00027 
00028 #define fsal_functions fsal_functions_array[0]
00029 #define fsal_consts fsal_consts_array[0]
00030 
00031 #ifdef _USE_PNFS_MDS
00032 fsal_mdsfunctions_t fsal_mdsfunctions;
00033 #endif /* _USE_PNFS_MDS */
00034 #ifdef _USE_PNFS_DS
00035 fsal_dsfunctions_t fsal_dsfunctions;
00036 #endif /* _USE_PNFS_DS */
00037 
00038 fsal_status_t FSAL_access(fsal_handle_t * object_handle,        /* IN */
00039                           fsal_op_context_t * p_context,        /* IN */
00040                           fsal_accessflags_t access_type,       /* IN */
00041                           fsal_attrib_list_t * object_attributes /* [ IN/OUT ] */ )
00042 {
00043   return fsal_functions.fsal_access(object_handle, p_context, access_type,
00044                                     object_attributes);
00045 }
00046 
00047 fsal_status_t FSAL_getattrs(fsal_handle_t * p_filehandle,       /* IN */
00048                             fsal_op_context_t * p_context,      /* IN */
00049                             fsal_attrib_list_t * p_object_attributes /* IN/OUT */ )
00050 {
00051   return fsal_functions.fsal_getattrs(p_filehandle, p_context, p_object_attributes);
00052 }
00053 
00054 fsal_status_t FSAL_getattrs_descriptor(fsal_file_t * p_file_descriptor,         /* IN */
00055                                        fsal_handle_t * p_filehandle,            /* IN */
00056                                        fsal_op_context_t * p_context,           /* IN */
00057                                        fsal_attrib_list_t * p_object_attributes /* IN/OUT */ )
00058 {
00059    if(fsal_functions.fsal_getattrs_descriptor != NULL && p_file_descriptor != NULL)
00060     {
00061       LogFullDebug(COMPONENT_FSAL,
00062                    "FSAL_getattrs_descriptor calling fsal_getattrs_descriptor");
00063       return fsal_functions.fsal_getattrs_descriptor(p_file_descriptor, p_filehandle, p_context, p_object_attributes);
00064     }
00065   else
00066     {
00067       LogFullDebug(COMPONENT_FSAL,
00068                    "FSAL_getattrs_descriptor calling fsal_getattrs");
00069       return fsal_functions.fsal_getattrs(p_filehandle, p_context, p_object_attributes);
00070     }
00071 }
00072 
00073 fsal_status_t FSAL_setattrs(fsal_handle_t * p_filehandle,       /* IN */
00074                             fsal_op_context_t * p_context,      /* IN */
00075                             fsal_attrib_list_t * p_attrib_set,  /* IN */
00076                             fsal_attrib_list_t * p_object_attributes /* [ IN/OUT ] */ )
00077 {
00078   return fsal_functions.fsal_setattrs(p_filehandle, p_context, p_attrib_set,
00079                                       p_object_attributes);
00080 }
00081 
00082 fsal_status_t FSAL_BuildExportContext(fsal_export_context_t * p_export_context, /* OUT */
00083                                       fsal_path_t * p_export_path,      /* IN */
00084                                       char *fs_specific_options /* IN */ )
00085 {
00086   return fsal_functions.fsal_buildexportcontext(p_export_context, p_export_path,
00087                                                 fs_specific_options);
00088 }
00089 
00090 fsal_status_t FSAL_CleanUpExportContext(fsal_export_context_t * p_export_context) /* IN */
00091 {
00092   return fsal_functions.fsal_cleanupexportcontext(p_export_context);
00093 }
00094 
00095 fsal_status_t FSAL_cookie_to_uint64(fsal_handle_t * handle,
00096                                     fsal_op_context_t * context,
00097                                     fsal_cookie_t * cookie,
00098                                     uint64_t *data)
00099 {
00100   if (fsal_functions.fsal_cookie_to_uint64)
00101     {
00102       return fsal_functions.fsal_cookie_to_uint64(handle,
00103                                                   cookie,
00104                                                   data);
00105     }
00106   else
00107     {
00108       *data = 0LL ;
00109       memcpy(data, cookie, sizeof(uint64_t));
00110       ReturnCode(ERR_FSAL_NO_ERROR, 0);
00111     }
00112 }
00113 
00114 fsal_status_t FSAL_uint64_to_cookie(fsal_handle_t *handle,
00115                                     fsal_op_context_t *context,
00116                                     uint64_t *data,
00117                                     fsal_cookie_t *cookie)
00118 {
00119   if (fsal_functions.fsal_uint64_to_cookie)
00120     {
00121       return fsal_functions.fsal_uint64_to_cookie(handle,
00122                                                   data,
00123                                                   cookie);
00124     }
00125   else
00126     {
00127       memset(cookie, 0, sizeof(fsal_cookie_t));
00128       memcpy(cookie, data, sizeof(uint64_t));
00129       ReturnCode(ERR_FSAL_NO_ERROR, 0);
00130     }
00131 }
00132 
00133 fsal_status_t FSAL_get_cookieverf(fsal_handle_t * handle,
00134                                   fsal_op_context_t * context,
00135                                   uint64_t * verf)
00136 {
00137   if (fsal_functions.fsal_get_cookieverf)
00138     {
00139       return fsal_functions.fsal_get_cookieverf(handle,
00140                                                 verf);
00141     }
00142   else
00143     {
00144       fsal_attrib_list_t attributes;
00145       fsal_status_t status;
00146 
00147       memset(&attributes, 0, sizeof(fsal_attrib_list_t));
00148       attributes.asked_attributes = FSAL_ATTR_MTIME;
00149       status = FSAL_getattrs(handle,
00150                              context,
00151                              &attributes);
00152       if (FSAL_IS_ERROR(status))
00153         {
00154           return status;
00155         }
00156       else
00157         {
00158           memcpy(verf, &attributes.mtime, sizeof(uint64_t));
00159           ReturnCode(ERR_FSAL_NO_ERROR, 0);
00160         }
00161     }
00162   ReturnCode(ERR_FSAL_NO_ERROR, 0);
00163 }
00164 
00165 
00166 fsal_status_t FSAL_InitClientContext(fsal_op_context_t * p_thr_context)
00167 {
00168   return fsal_functions.fsal_initclientcontext(p_thr_context);
00169 }
00170 
00171 fsal_status_t FSAL_GetClientContext(fsal_op_context_t * p_thr_context,  /* IN/OUT  */
00172                                     fsal_export_context_t * p_export_context,   /* IN */
00173                                     fsal_uid_t uid,     /* IN */
00174                                     fsal_gid_t gid,     /* IN */
00175                                     fsal_gid_t * alt_groups,    /* IN */
00176                                     fsal_count_t nb_alt_groups /* IN */ )
00177 {
00178   return fsal_functions.fsal_getclientcontext(p_thr_context, p_export_context,
00179                                               uid, gid,
00180                                               alt_groups, nb_alt_groups);
00181 }
00182 
00183 fsal_status_t FSAL_create(fsal_handle_t * p_parent_directory_handle,    /* IN */
00184                           fsal_name_t * p_filename,     /* IN */
00185                           fsal_op_context_t * p_context,        /* IN */
00186                           fsal_accessmode_t accessmode, /* IN */
00187                           fsal_handle_t * p_object_handle,      /* OUT */
00188                           fsal_attrib_list_t * p_object_attributes /* [ IN/OUT ] */ )
00189 {
00190   return fsal_functions.fsal_create(p_parent_directory_handle, p_filename, p_context,
00191                                     accessmode, p_object_handle, p_object_attributes);
00192 }
00193 
00194 fsal_status_t FSAL_mkdir(fsal_handle_t * p_parent_directory_handle,     /* IN */
00195                          fsal_name_t * p_dirname,       /* IN */
00196                          fsal_op_context_t * p_context, /* IN */
00197                          fsal_accessmode_t accessmode,  /* IN */
00198                          fsal_handle_t * p_object_handle,       /* OUT */
00199                          fsal_attrib_list_t * p_object_attributes /* [ IN/OUT ] */ )
00200 {
00201   return fsal_functions.fsal_mkdir(p_parent_directory_handle, p_dirname, p_context,
00202                                    accessmode, p_object_handle, p_object_attributes);
00203 }
00204 
00205 fsal_status_t FSAL_link(fsal_handle_t * p_target_handle,        /* IN */
00206                         fsal_handle_t * p_dir_handle,   /* IN */
00207                         fsal_name_t * p_link_name,      /* IN */
00208                         fsal_op_context_t * p_context,  /* IN */
00209                         fsal_attrib_list_t * p_attributes /* [ IN/OUT ] */ )
00210 {
00211   return fsal_functions.fsal_link(p_target_handle, p_dir_handle, p_link_name, p_context,
00212                                   p_attributes);
00213 }
00214 
00215 fsal_status_t FSAL_mknode(fsal_handle_t * parentdir_handle,     /* IN */
00216                           fsal_name_t * p_node_name,    /* IN */
00217                           fsal_op_context_t * p_context,        /* IN */
00218                           fsal_accessmode_t accessmode, /* IN */
00219                           fsal_nodetype_t nodetype,     /* IN */
00220                           fsal_dev_t * dev,     /* IN */
00221                           fsal_handle_t * p_object_handle,      /* OUT (handle to the created node) */
00222                           fsal_attrib_list_t * node_attributes /* [ IN/OUT ] */ )
00223 {
00224   return fsal_functions.fsal_mknode(parentdir_handle, p_node_name, p_context, accessmode,
00225                                     nodetype, dev, p_object_handle, node_attributes);
00226 }
00227 
00228 fsal_status_t FSAL_opendir(fsal_handle_t * p_dir_handle,        /* IN */
00229                            fsal_op_context_t * p_context,       /* IN */
00230                            fsal_dir_t * p_dir_descriptor,       /* OUT */
00231                            fsal_attrib_list_t * p_dir_attributes /* [ IN/OUT ] */ )
00232 {
00233   return fsal_functions.fsal_opendir(p_dir_handle, p_context, p_dir_descriptor,
00234                                      p_dir_attributes);
00235 }
00236 
00237 fsal_status_t FSAL_readdir(fsal_dir_t * p_dir_descriptor,       /* IN */
00238                            fsal_cookie_t start_position,        /* IN */
00239                            fsal_attrib_mask_t get_attr_mask,    /* IN */
00240                            fsal_mdsize_t buffersize,    /* IN */
00241                            fsal_dirent_t * p_pdirent,   /* OUT */
00242                            fsal_cookie_t * p_end_position,      /* OUT */
00243                            fsal_count_t * p_nb_entries, /* OUT */
00244                            fsal_boolean_t * p_end_of_dir /* OUT */ )
00245 {
00246   return fsal_functions.fsal_readdir(p_dir_descriptor, start_position, get_attr_mask,
00247                                      buffersize, p_pdirent, p_end_position, p_nb_entries,
00248                                      p_end_of_dir);
00249 }
00250 
00251 fsal_status_t FSAL_closedir(fsal_dir_t * p_dir_descriptor /* IN */ )
00252 {
00253   return fsal_functions.fsal_closedir(p_dir_descriptor);
00254 }
00255 
00256 fsal_status_t FSAL_open_by_name(fsal_handle_t * dirhandle,      /* IN */
00257                                 fsal_name_t * filename, /* IN */
00258                                 fsal_op_context_t * p_context,  /* IN */
00259                                 fsal_openflags_t openflags,     /* IN */
00260                                 fsal_file_t * file_descriptor,  /* OUT */
00261                                 fsal_attrib_list_t * file_attributes /* [ IN/OUT ] */ )
00262 {
00263   return fsal_functions.fsal_open_by_name(dirhandle, filename, p_context, openflags,
00264                                           file_descriptor, file_attributes);
00265 }
00266 
00267 fsal_status_t FSAL_open(fsal_handle_t * p_filehandle,   /* IN */
00268                         fsal_op_context_t * p_context,  /* IN */
00269                         fsal_openflags_t openflags,     /* IN */
00270                         fsal_file_t * p_file_descriptor,        /* OUT */
00271                         fsal_attrib_list_t * p_file_attributes /* [ IN/OUT ] */ )
00272 {
00273   return fsal_functions.fsal_open(p_filehandle, p_context, openflags, p_file_descriptor,
00274                                   p_file_attributes);
00275 }
00276 
00277 fsal_status_t FSAL_read(fsal_file_t * p_file_descriptor,        /* IN */
00278                         fsal_seek_t * p_seek_descriptor,        /* [IN] */
00279                         fsal_size_t buffer_size,        /* IN */
00280                         caddr_t buffer, /* OUT */
00281                         fsal_size_t * p_read_amount,    /* OUT */
00282                         fsal_boolean_t * p_end_of_file /* OUT */ )
00283 {
00284   return fsal_functions.fsal_read(p_file_descriptor, p_seek_descriptor, buffer_size,
00285                                   buffer, p_read_amount, p_end_of_file);
00286 }
00287 
00288 fsal_status_t FSAL_write(fsal_file_t * p_file_descriptor,       /* IN */
00289                          fsal_op_context_t * p_context,         /* IN */
00290                          fsal_seek_t * p_seek_descriptor,       /* IN */
00291                          fsal_size_t buffer_size,       /* IN */
00292                          caddr_t buffer,        /* IN */
00293                          fsal_size_t * p_write_amount /* OUT */ )
00294 {
00295   return fsal_functions.fsal_write(p_file_descriptor, p_context,
00296                                    p_seek_descriptor, buffer_size,
00297                                    buffer, p_write_amount);
00298 }
00299 
00300 fsal_status_t FSAL_commit( fsal_file_t * p_file_descriptor, 
00301                          fsal_off_t    offset,
00302                          fsal_size_t   length )
00303 {
00304   return fsal_functions.fsal_commit(p_file_descriptor, offset, length );
00305 }
00306 
00307 fsal_status_t FSAL_close(fsal_file_t * p_file_descriptor /* IN */ )
00308 {
00309   return fsal_functions.fsal_close(p_file_descriptor);
00310 }
00311 
00312 fsal_status_t FSAL_open_by_fileid(fsal_handle_t * filehandle,   /* IN */
00313                                   fsal_u64_t fileid,    /* IN */
00314                                   fsal_op_context_t * p_context,        /* IN */
00315                                   fsal_openflags_t openflags,   /* IN */
00316                                   fsal_file_t * file_descriptor,        /* OUT */
00317                                   fsal_attrib_list_t * file_attributes /* [ IN/OUT ] */ )
00318 {
00319   return fsal_functions.fsal_open_by_fileid(filehandle, fileid, p_context, openflags,
00320                                             file_descriptor, file_attributes);
00321 }
00322 
00323 fsal_status_t FSAL_close_by_fileid(fsal_file_t * file_descriptor /* IN */ ,
00324                                    fsal_u64_t fileid)
00325 {
00326   return fsal_functions.fsal_close_by_fileid(file_descriptor, fileid);
00327 }
00328 
00329 fsal_status_t FSAL_dynamic_fsinfo(fsal_handle_t * p_filehandle, /* IN */
00330                                   fsal_op_context_t * p_context,        /* IN */
00331                                   fsal_dynamicfsinfo_t * p_dynamicinfo /* OUT */ )
00332 {
00333   return fsal_functions.fsal_dynamic_fsinfo(p_filehandle, p_context, p_dynamicinfo);
00334 }
00335 
00336 fsal_status_t FSAL_Init(fsal_parameter_t * init_info /* IN */ )
00337 {
00338   return fsal_functions.fsal_init(init_info);
00339 }
00340 
00341 fsal_status_t FSAL_terminate()
00342 {
00343   return fsal_functions.fsal_terminate();
00344 }
00345 
00346 fsal_status_t FSAL_test_access(fsal_op_context_t * p_context,   /* IN */
00347                                fsal_accessflags_t access_type,  /* IN */
00348                                fsal_attrib_list_t * p_object_attributes /* IN */ )
00349 {
00350   return fsal_functions.fsal_test_access(p_context, access_type, p_object_attributes);
00351 }
00352 
00353 fsal_status_t FSAL_setattr_access(fsal_op_context_t * p_context,        /* IN */
00354                                   fsal_attrib_list_t * candidate_attributes,    /* IN */
00355                                   fsal_attrib_list_t * object_attributes /* IN */ )
00356 {
00357   return fsal_functions.fsal_setattr_access(p_context, candidate_attributes,
00358                                             object_attributes);
00359 }
00360 
00361 fsal_status_t FSAL_rename_access(fsal_op_context_t * pcontext,  /* IN */
00362                                  fsal_attrib_list_t * pattrsrc, /* IN */
00363                                  fsal_attrib_list_t * pattrdest)        /* IN */
00364 {
00365   return fsal_functions.fsal_rename_access(pcontext, pattrsrc, pattrdest);
00366 }
00367 
00368 fsal_status_t FSAL_create_access(fsal_op_context_t * pcontext,  /* IN */
00369                                  fsal_attrib_list_t * pattr)    /* IN */
00370 {
00371   return fsal_functions.fsal_create_access(pcontext, pattr);
00372 }
00373 
00374 fsal_status_t FSAL_unlink_access(fsal_op_context_t * pcontext,  /* IN */
00375                                  fsal_attrib_list_t * pattr)    /* IN */
00376 {
00377   return fsal_functions.fsal_unlink_access(pcontext, pattr);
00378 }
00379 
00380 fsal_status_t FSAL_link_access(fsal_op_context_t * pcontext,    /* IN */
00381                                fsal_attrib_list_t * pattr)      /* IN */
00382 {
00383   return fsal_functions.fsal_link_access(pcontext, pattr);
00384 }
00385 
00386 fsal_status_t FSAL_merge_attrs(fsal_attrib_list_t * pinit_attr,
00387                                fsal_attrib_list_t * pnew_attr,
00388                                fsal_attrib_list_t * presult_attr)
00389 {
00390   return fsal_functions.fsal_merge_attrs(pinit_attr, pnew_attr, presult_attr);
00391 }
00392 
00393 fsal_status_t FSAL_lookup(fsal_handle_t * p_parent_directory_handle,    /* IN */
00394                           fsal_name_t * p_filename,     /* IN */
00395                           fsal_op_context_t * p_context,        /* IN */
00396                           fsal_handle_t * p_object_handle,      /* OUT */
00397                           fsal_attrib_list_t * p_object_attributes /* [ IN/OUT ] */ )
00398 {
00399   return fsal_functions.fsal_lookup(p_parent_directory_handle, p_filename, p_context,
00400                                     p_object_handle, p_object_attributes);
00401 }
00402 
00403 fsal_status_t FSAL_lookupPath(fsal_path_t * p_path,     /* IN */
00404                               fsal_op_context_t * p_context,    /* IN */
00405                               fsal_handle_t * object_handle,    /* OUT */
00406                               fsal_attrib_list_t * p_object_attributes /* [ IN/OUT ] */ )
00407 {
00408   return fsal_functions.fsal_lookuppath(p_path, p_context, object_handle,
00409                                         p_object_attributes);
00410 }
00411 
00412 fsal_status_t FSAL_lookupJunction(fsal_handle_t * p_junction_handle,    /* IN */
00413                                   fsal_op_context_t * p_context,        /* IN */
00414                                   fsal_handle_t * p_fsoot_handle,       /* OUT */
00415                                   fsal_attrib_list_t *
00416                                   p_fsroot_attributes /* [ IN/OUT ] */ )
00417 {
00418   return fsal_functions.fsal_lookupjunction(p_junction_handle, p_context, p_fsoot_handle,
00419                                             p_fsroot_attributes);
00420 }
00421 
00422 fsal_status_t FSAL_CleanObjectResources(fsal_handle_t * in_fsal_handle)
00423 {
00424   return fsal_functions.fsal_cleanobjectresources(in_fsal_handle);
00425 }
00426 
00427 fsal_status_t FSAL_set_quota(fsal_path_t * pfsal_path,  /* IN */
00428                              int quota_type,    /* IN */
00429                              fsal_uid_t fsal_uid,       /* IN */
00430                              fsal_quota_t * pquota,     /* IN */
00431                              fsal_quota_t * presquota)  /* OUT */
00432 {
00433   return fsal_functions.fsal_set_quota(pfsal_path, quota_type, fsal_uid, pquota,
00434                                        presquota);
00435 }
00436 
00437 fsal_status_t FSAL_get_quota(fsal_path_t * pfsal_path,  /* IN */
00438                              int quota_type,    /* IN */
00439                              fsal_uid_t fsal_uid,       /* IN */
00440                              fsal_quota_t * pquota)     /* OUT */
00441 {
00442   return fsal_functions.fsal_get_quota(pfsal_path, quota_type, fsal_uid, pquota);
00443 }
00444 
00445 fsal_status_t FSAL_check_quota( char *path,  /* IN */
00446                                 fsal_quota_type_t   quota_type,
00447                                 fsal_uid_t          fsal_uid)      /* IN */
00448 {
00449   return fsal_functions.fsal_check_quota( path, quota_type, fsal_uid ) ;
00450 }
00451 
00452 fsal_status_t FSAL_rcp(fsal_handle_t * filehandle,      /* IN */
00453                        fsal_op_context_t * p_context,   /* IN */
00454                        fsal_path_t * p_local_path,      /* IN */
00455                        fsal_rcpflag_t transfer_opt /* IN */ )
00456 {
00457   return fsal_functions.fsal_rcp(filehandle, p_context, p_local_path, transfer_opt);
00458 }
00459 
00460 fsal_status_t FSAL_rename(fsal_handle_t * p_old_parentdir_handle,       /* IN */
00461                           fsal_name_t * p_old_name,     /* IN */
00462                           fsal_handle_t * p_new_parentdir_handle,       /* IN */
00463                           fsal_name_t * p_new_name,     /* IN */
00464                           fsal_op_context_t * p_context,        /* IN */
00465                           fsal_attrib_list_t * p_src_dir_attributes,    /* [ IN/OUT ] */
00466                           fsal_attrib_list_t * p_tgt_dir_attributes /* [ IN/OUT ] */ )
00467 {
00468   return fsal_functions.fsal_rename(p_old_parentdir_handle, p_old_name,
00469                                     p_new_parentdir_handle, p_new_name, p_context,
00470                                     p_src_dir_attributes, p_tgt_dir_attributes);
00471 }
00472 
00473 void FSAL_get_stats(fsal_statistics_t * stats,  /* OUT */
00474                     fsal_boolean_t reset /* IN */ )
00475 {
00476   return fsal_functions.fsal_get_stats(stats, reset);
00477 }
00478 
00479 fsal_status_t FSAL_readlink(fsal_handle_t * p_linkhandle,       /* IN */
00480                             fsal_op_context_t * p_context,      /* IN */
00481                             fsal_path_t * p_link_content,       /* OUT */
00482                             fsal_attrib_list_t * p_link_attributes /* [ IN/OUT ] */ )
00483 {
00484   return fsal_functions.fsal_readlink(p_linkhandle, p_context, p_link_content,
00485                                       p_link_attributes);
00486 }
00487 
00488 fsal_status_t FSAL_symlink(fsal_handle_t * p_parent_directory_handle,   /* IN */
00489                            fsal_name_t * p_linkname,    /* IN */
00490                            fsal_path_t * p_linkcontent, /* IN */
00491                            fsal_op_context_t * p_context,       /* IN */
00492                            fsal_accessmode_t accessmode,        /* IN (ignored) */
00493                            fsal_handle_t * p_link_handle,       /* OUT */
00494                            fsal_attrib_list_t * p_link_attributes /* [ IN/OUT ] */ )
00495 {
00496   return fsal_functions.fsal_symlink(p_parent_directory_handle, p_linkname, p_linkcontent,
00497                                      p_context, accessmode, p_link_handle,
00498                                      p_link_attributes);
00499 }
00500 
00501 int FSAL_handlecmp(fsal_handle_t * handle1, fsal_handle_t * handle2,
00502                    fsal_status_t * status)
00503 {
00504   return fsal_functions.fsal_handlecmp(handle1, handle2, status);
00505 }
00506 
00507 unsigned int FSAL_Handle_to_HashIndex(fsal_handle_t * p_handle,
00508                                       unsigned int cookie,
00509                                       unsigned int alphabet_len, unsigned int index_size)
00510 {
00511   return fsal_functions.fsal_handle_to_hashindex(p_handle, cookie, alphabet_len,
00512                                                  index_size);
00513 }
00514 
00515 unsigned int FSAL_Handle_to_RBTIndex(fsal_handle_t * p_handle, unsigned int cookie)
00516 {
00517   return fsal_functions.fsal_handle_to_rbtindex(p_handle, cookie);
00518 }
00519 
00520 unsigned int FSAL_Handle_to_Hash_both(fsal_handle_t * p_handle, unsigned int cookie, unsigned int alphabet_len,
00521                                       unsigned int index_size, unsigned int * phashval, unsigned int *prbtval ) 
00522 {
00523   if( fsal_functions.fsal_handle_to_hash_both != NULL ) 
00524     return fsal_functions.fsal_handle_to_hash_both( p_handle, cookie, alphabet_len, index_size, phashval, prbtval) ;
00525   else
00526     {
00527         if( phashval == NULL || prbtval == NULL )
00528            return 0 ;
00529 
00530         *phashval = fsal_functions.fsal_handle_to_hashindex( p_handle, cookie, alphabet_len, index_size ) ;
00531         *prbtval = fsal_functions.fsal_handle_to_rbtindex( p_handle, cookie);
00532 
00533         return 1 ;
00534     }
00535 }
00536 
00537 fsal_status_t FSAL_DigestHandle(fsal_export_context_t * p_expcontext,   /* IN */
00538                                 fsal_digesttype_t output_type,  /* IN */
00539                                 fsal_handle_t * p_in_fsal_handle,       /* IN */
00540                                 struct fsal_handle_desc *fh_desc /* OUT */ )
00541 {
00542   return fsal_functions.fsal_digesthandle(p_expcontext, output_type,
00543                                           p_in_fsal_handle, fh_desc);
00544 }
00545 
00546 fsal_status_t FSAL_ExpandHandle(fsal_export_context_t * p_expcontext,   /* IN */
00547                                 fsal_digesttype_t in_type,      /* IN */
00548                                 struct fsal_handle_desc *fh_desc        /* IN OUT */ )
00549 {
00550   return fsal_functions.fsal_expandhandle(p_expcontext, in_type, fh_desc);
00551 }
00552 
00553 fsal_status_t FSAL_SetDefault_FSAL_parameter(fsal_parameter_t * out_parameter)
00554 {
00555   return fsal_functions.fsal_setdefault_fsal_parameter(out_parameter);
00556 }
00557 
00558 fsal_status_t FSAL_SetDefault_FS_common_parameter(fsal_parameter_t * out_parameter)
00559 {
00560   return fsal_functions.fsal_setdefault_fs_common_parameter(out_parameter);
00561 }
00562 
00563 fsal_status_t FSAL_SetDefault_FS_specific_parameter(fsal_parameter_t * out_parameter)
00564 {
00565   return fsal_functions.fsal_setdefault_fs_specific_parameter(out_parameter);
00566 }
00567 
00568 fsal_status_t FSAL_load_FSAL_parameter_from_conf(config_file_t in_config,
00569                                                  fsal_parameter_t * out_parameter)
00570 {
00571   return fsal_functions.fsal_load_fsal_parameter_from_conf(in_config, out_parameter);
00572 }
00573 
00574 fsal_status_t FSAL_load_FS_common_parameter_from_conf(config_file_t in_config,
00575                                                       fsal_parameter_t * out_parameter)
00576 {
00577   return fsal_functions.fsal_load_fs_common_parameter_from_conf(in_config, out_parameter);
00578 }
00579 
00580 fsal_status_t FSAL_load_FS_specific_parameter_from_conf(config_file_t in_config,
00581                                                         fsal_parameter_t * out_parameter)
00582 {
00583   return fsal_functions.fsal_load_fs_specific_parameter_from_conf(in_config,
00584                                                                   out_parameter);
00585 }
00586 
00587 fsal_status_t FSAL_truncate(fsal_handle_t * p_filehandle,
00588                             fsal_op_context_t * p_context,
00589                             fsal_size_t length,
00590                             fsal_file_t * file_descriptor,
00591                             fsal_attrib_list_t * p_object_attributes)
00592 {
00593   return fsal_functions.fsal_truncate(p_filehandle, p_context, length, file_descriptor,
00594                                       p_object_attributes);
00595 }
00596 
00597 fsal_status_t FSAL_unlink(fsal_handle_t * p_parent_directory_handle,    /* IN */
00598                           fsal_name_t * p_object_name,  /* IN */
00599                           fsal_op_context_t * p_context,        /* IN */
00600                           fsal_attrib_list_t *
00601                           p_parent_directory_attributes /* [IN/OUT ] */ )
00602 {
00603   return fsal_functions.fsal_unlink(p_parent_directory_handle, p_object_name, p_context,
00604                                     p_parent_directory_attributes);
00605 }
00606 
00607 char *FSAL_GetFSName()
00608 {
00609   return fsal_functions.fsal_getfsname();
00610 }
00611 
00612 fsal_status_t FSAL_GetXAttrAttrs(fsal_handle_t * p_objecthandle,        /* IN */
00613                                  fsal_op_context_t * p_context, /* IN */
00614                                  unsigned int xattr_id, /* IN */
00615                                  fsal_attrib_list_t * p_attrs)
00616 {
00617   return fsal_functions.fsal_getxattrattrs(p_objecthandle, p_context, xattr_id, p_attrs);
00618 }
00619 
00620 fsal_status_t FSAL_ListXAttrs(fsal_handle_t * p_objecthandle,   /* IN */
00621                               unsigned int cookie,      /* IN */
00622                               fsal_op_context_t * p_context,    /* IN */
00623                               fsal_xattrent_t * xattrs_tab,     /* IN/OUT */
00624                               unsigned int xattrs_tabsize,      /* IN */
00625                               unsigned int *p_nb_returned,      /* OUT */
00626                               int *end_of_list /* OUT */ )
00627 {
00628   return fsal_functions.fsal_listxattrs(p_objecthandle, cookie, p_context,
00629                                         xattrs_tab, xattrs_tabsize, p_nb_returned,
00630                                         end_of_list);
00631 }
00632 
00633 fsal_status_t FSAL_GetXAttrValueById(fsal_handle_t * p_objecthandle,    /* IN */
00634                                      unsigned int xattr_id,     /* IN */
00635                                      fsal_op_context_t * p_context,     /* IN */
00636                                      caddr_t buffer_addr,       /* IN/OUT */
00637                                      size_t buffer_size,        /* IN */
00638                                      size_t * p_output_size /* OUT */ )
00639 {
00640   return fsal_functions.fsal_getxattrvaluebyid(p_objecthandle, xattr_id, p_context,
00641                                                buffer_addr, buffer_size, p_output_size);
00642 }
00643 
00644 fsal_status_t FSAL_GetXAttrIdByName(fsal_handle_t * p_objecthandle,     /* IN */
00645                                     const fsal_name_t * xattr_name,     /* IN */
00646                                     fsal_op_context_t * p_context,      /* IN */
00647                                     unsigned int *pxattr_id /* OUT */ )
00648 {
00649   return fsal_functions.fsal_getxattridbyname(p_objecthandle, xattr_name, p_context,
00650                                               pxattr_id);
00651 }
00652 
00653 fsal_status_t FSAL_GetXAttrValueByName(fsal_handle_t * p_objecthandle,  /* IN */
00654                                        const fsal_name_t * xattr_name,  /* IN */
00655                                        fsal_op_context_t * p_context,   /* IN */
00656                                        caddr_t buffer_addr,     /* IN/OUT */
00657                                        size_t buffer_size,      /* IN */
00658                                        size_t * p_output_size /* OUT */ )
00659 {
00660   return fsal_functions.fsal_getxattrvaluebyname(p_objecthandle, xattr_name, p_context,
00661                                                  buffer_addr, buffer_size, p_output_size);
00662 }
00663 
00664 fsal_status_t FSAL_SetXAttrValue(fsal_handle_t * p_objecthandle,        /* IN */
00665                                  const fsal_name_t * xattr_name,        /* IN */
00666                                  fsal_op_context_t * p_context, /* IN */
00667                                  caddr_t buffer_addr,   /* IN */
00668                                  size_t buffer_size,    /* IN */
00669                                  int create /* IN */ )
00670 {
00671   return fsal_functions.fsal_setxattrvalue(p_objecthandle, xattr_name, p_context,
00672                                            buffer_addr, buffer_size, create);
00673 }
00674 
00675 fsal_status_t FSAL_SetXAttrValueById(fsal_handle_t * p_objecthandle,    /* IN */
00676                                      unsigned int xattr_id,     /* IN */
00677                                      fsal_op_context_t * p_context,     /* IN */
00678                                      caddr_t buffer_addr,       /* IN */
00679                                      size_t buffer_size /* IN */ )
00680 {
00681   return fsal_functions.fsal_setxattrvaluebyid(p_objecthandle, xattr_id, p_context,
00682                                                buffer_addr, buffer_size);
00683 }
00684 
00685 fsal_status_t FSAL_RemoveXAttrById(fsal_handle_t * p_objecthandle,      /* IN */
00686                                    fsal_op_context_t * p_context,       /* IN */
00687                                    unsigned int xattr_id)       /* IN */
00688 {
00689   return fsal_functions.fsal_removexattrbyid(p_objecthandle, p_context, xattr_id);
00690 }
00691 
00692 fsal_status_t FSAL_RemoveXAttrByName(fsal_handle_t * p_objecthandle,    /* IN */
00693                                      fsal_op_context_t * p_context,     /* IN */
00694                                      const fsal_name_t * xattr_name)    /* IN */
00695 {
00696   return fsal_functions.fsal_removexattrbyname(p_objecthandle, p_context, xattr_name);
00697 }
00698 
00699 unsigned int FSAL_GetFileno(fsal_file_t * pfile)
00700 {
00701   return fsal_functions.fsal_getfileno(pfile);
00702 }
00703 
00704 fsal_status_t FSAL_getextattrs( fsal_handle_t * p_filehandle, /* IN */
00705                                 fsal_op_context_t * p_context,        /* IN */
00706                                 fsal_extattrib_list_t * p_object_attributes /* OUT */)
00707 {
00708    return fsal_functions.fsal_getextattrs( p_filehandle, p_context, p_object_attributes ) ;
00709 }
00710 
00711 fsal_status_t FSAL_lock_op( fsal_file_t       * p_file_descriptor,   /* IN */
00712                             fsal_handle_t     * p_filehandle,        /* IN */
00713                             fsal_op_context_t * p_context,           /* IN */
00714                             void              * p_owner,             /* IN (opaque to FSAL) */
00715                             fsal_lock_op_t      lock_op,             /* IN */
00716                             fsal_lock_param_t   request_lock,        /* IN */
00717                             fsal_lock_param_t * conflicting_lock)    /* OUT */
00718 {
00719   if(fsal_functions.fsal_lock_op != NULL)
00720     return fsal_functions.fsal_lock_op(p_file_descriptor,
00721                                        p_filehandle,
00722                                        p_context,
00723                                        p_owner,
00724                                        lock_op,
00725                                        request_lock,
00726                                        conflicting_lock);
00727 
00728   Return(ERR_FSAL_NOTSUPP, 0, INDEX_FSAL_lock_op);
00729 }
00730 
00731 fsal_status_t FSAL_share_op( fsal_file_t       * p_file_descriptor,   /* IN */
00732                              fsal_handle_t     * p_filehandle,        /* IN */
00733                              fsal_op_context_t * p_context,           /* IN */
00734                              void              * p_owner,             /* IN (opaque to FSAL) */
00735                              fsal_share_param_t  request_share)       /* IN */
00736 {
00737   if(fsal_functions.fsal_share_op != NULL)
00738     return fsal_functions.fsal_share_op(p_file_descriptor,
00739                                         p_filehandle,
00740                                         p_context,
00741                                         p_owner,
00742                                         request_share);
00743 
00744   Return(ERR_FSAL_NOTSUPP, 0, INDEX_FSAL_share_op);
00745 }
00746 
00747 /* FSAL_UP functions */
00748 #ifdef _USE_FSAL_UP
00749 fsal_status_t FSAL_UP_Init( fsal_up_event_bus_parameter_t * pebparam,      /* IN */
00750                                fsal_up_event_bus_context_t * pupebcontext     /* OUT */)
00751 {
00752   if (fsal_functions.fsal_up_init == NULL)
00753     Return(ERR_FSAL_NOTSUPP, 0, INDEX_FSAL_UP_init);
00754   else
00755     return fsal_functions.fsal_up_init(pebparam, pupebcontext);
00756 }
00757 
00758 fsal_status_t FSAL_UP_AddFilter( fsal_up_event_bus_filter_t * pupebfilter,  /* IN */
00759                                     fsal_up_event_bus_context_t * pupebcontext /* INOUT */ )
00760 {
00761   if (fsal_functions.fsal_up_addfilter == NULL)
00762     Return(ERR_FSAL_NOTSUPP, 0, INDEX_FSAL_UP_addfilter);
00763   else
00764     return fsal_functions.fsal_up_addfilter(pupebfilter, pupebcontext);
00765 }
00766 
00767 fsal_status_t FSAL_UP_GetEvents( struct glist_head * pevent_head,            /* OUT */
00768                                  fsal_count_t * event_nb,          /* IN */
00769                                  fsal_time_t timeout,                       /* IN */
00770                                  fsal_count_t * peventfound,                /* OUT */
00771                                  fsal_up_event_bus_context_t * pupebcontext /* IN */ )
00772 {
00773   if (fsal_functions.fsal_up_getevents == NULL)
00774     Return(ERR_FSAL_NOTSUPP, 0, INDEX_FSAL_UP_getevents);
00775   else
00776     return fsal_functions.fsal_up_getevents(pevent_head, event_nb, timeout,
00777                                             peventfound, pupebcontext);
00778 }
00779 #endif /* _USE_FSAL_UP */
00780 
00781 int FSAL_LoadLibrary(char *path)
00782 {
00783   return 1;                     /* Does nothing, this is the "static" case */
00784 }
00785 
00786 void FSAL_LoadFunctions(void)
00787 {
00788   fsal_functions = FSAL_GetFunctions();
00789 }
00790 
00791 void FSAL_LoadConsts(void)
00792 {
00793   fsal_consts = FSAL_GetConsts();
00794 }
00795 
00796 #ifdef _USE_PNFS_MDS
00797 void FSAL_LoadMDSFunctions(void)
00798 {
00799   fsal_mdsfunctions = FSAL_GetMDSFunctions();
00800 }
00801 #endif /* _USE_PNFS_MDS */
00802 
00803 #ifdef _USE_PNFS_DS
00804 void FSAL_LoadDSFunctions(void)
00805 {
00806   fsal_dsfunctions = FSAL_GetDSFunctions();
00807 }
00808 #endif /* _USE_PNFS_DS */