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