nfs-ganesha 1.4
|
00001 /* 00002 * vim:expandtab:shiftwidth=8:tabstop=8: 00003 */ 00004 00014 #ifdef HAVE_CONFIG_H 00015 #include "config.h" 00016 #endif 00017 00018 #include "fsal.h" 00019 #include "fsal_internal.h" 00020 #include "fsal_convert.h" 00021 #include "fsal_common.h" 00022 00059 fsal_status_t FSAL_create(fsal_handle_t * parent_directory_handle, /* IN */ 00060 fsal_name_t * p_filename, /* IN */ 00061 fsal_op_context_t * p_context, /* IN */ 00062 fsal_accessmode_t accessmode, /* IN */ 00063 fsal_handle_t * object_handle, /* OUT */ 00064 fsal_attrib_list_t * object_attributes /* [ IN/OUT ] */ 00065 ) 00066 { 00067 00068 int rc; 00069 00070 /* sanity checks. 00071 * note : object_attributes is optional. 00072 */ 00073 if(!parent_directory_handle || !p_context || !object_handle || !p_filename) 00074 Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_create); 00075 00076 /* >> convert fsal args to your fs args. 00077 * Don't forget applying FSAL umask : 00078 * mode = mode & ~global_fs_info.umask << */ 00079 00080 TakeTokenFSCall(); 00081 00082 /* >> call your FS create function << */ 00083 00084 ReleaseTokenFSCall(); 00085 00086 /* >> interpret returned error << */ 00087 00088 /* >> set output handle << */ 00089 00090 if(object_attributes) 00091 { 00092 /* >> fill output attributes if asked << */ 00093 } 00094 00095 /* OK */ 00096 Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_create); 00097 00098 } 00099 00137 fsal_status_t FSAL_mkdir(fsal_handle_t * parent_directory_handle, /* IN */ 00138 fsal_name_t * p_dirname, /* IN */ 00139 fsal_op_context_t * p_context, /* IN */ 00140 fsal_accessmode_t accessmode, /* IN */ 00141 fsal_handle_t * object_handle, /* OUT */ 00142 fsal_attrib_list_t * object_attributes /* [ IN/OUT ] */ 00143 ) 00144 { 00145 00146 int rc; 00147 00148 /* sanity checks. 00149 * note : object_attributes is optional. 00150 */ 00151 if(!parent_directory_handle || !p_context || !object_handle || !p_dirname) 00152 Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_mkdir); 00153 00154 /* >> convert fsal args to your fs args. 00155 * Don't forget applying FSAL umask : 00156 * mode = mode & ~global_fs_info.umask << */ 00157 00158 TakeTokenFSCall(); 00159 00160 /* >> call your FS mkdir function << */ 00161 00162 ReleaseTokenFSCall(); 00163 00164 /* >> interpret returned error << */ 00165 00166 /* >> set output handle << */ 00167 00168 if(object_attributes) 00169 { 00170 /* >> fill output attributes if asked << */ 00171 } 00172 00173 /* OK */ 00174 Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_mkdir); 00175 00176 } 00177 00215 fsal_status_t FSAL_link(fsal_handle_t * target_handle, /* IN */ 00216 fsal_handle_t * dir_handle, /* IN */ 00217 fsal_name_t * p_link_name, /* IN */ 00218 fsal_op_context_t * p_context, /* IN */ 00219 fsal_attrib_list_t * attributes /* [ IN/OUT ] */ 00220 ) 00221 { 00222 00223 int rc; 00224 00225 /* sanity checks. 00226 * note : attributes is optional. 00227 */ 00228 if(!target_handle || !dir_handle || !p_context || !p_link_name) 00229 Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_link); 00230 00231 /* Tests if hardlinking is allowed by configuration. */ 00232 00233 if(!global_fs_info.link_support) 00234 Return(ERR_FSAL_NOTSUPP, 0, INDEX_FSAL_link); 00235 00236 TakeTokenFSCall(); 00237 00238 /* >> call your FS link function << */ 00239 00240 ReleaseTokenFSCall(); 00241 00242 /* >> interpret returned error << */ 00243 00244 if(attributes) 00245 { 00246 /* >> fill output attributes if asked << */ 00247 } 00248 00249 /* OK */ 00250 Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_link); 00251 00252 } 00253 00261 fsal_status_t FSAL_mknode(fsal_handle_t * parentdir_handle, /* IN */ 00262 fsal_name_t * p_node_name, /* IN */ 00263 fsal_op_context_t * p_context, /* IN */ 00264 fsal_accessmode_t accessmode, /* IN */ 00265 fsal_nodetype_t nodetype, /* IN */ 00266 fsal_dev_t * dev, /* IN */ 00267 fsal_handle_t * p_object_handle, /* OUT (handle to the created node) */ 00268 fsal_attrib_list_t * node_attributes /* [ IN/OUT ] */ 00269 ) 00270 { 00271 00272 /* sanity checks. 00273 * note : link_attributes is optional. 00274 */ 00275 if(!parentdir_handle || !p_context || !nodetype || !dev || !p_node_name) 00276 Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_mknode); 00277 00278 /* Not implemented */ 00279 Return(ERR_FSAL_NOTSUPP, 0, INDEX_FSAL_mknode); 00280 00281 }