nfs-ganesha 1.4

fsal_dirs.c

Go to the documentation of this file.
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 <string.h>
00022 
00047 fsal_status_t FSAL_opendir(fsal_handle_t * dir_handle,  /* IN */
00048                            fsal_op_context_t * p_context,       /* IN */
00049                            fsal_dir_t * dir_descriptor, /* OUT */
00050                            fsal_attrib_list_t * dir_attributes  /* [ IN/OUT ] */
00051     )
00052 {
00053   int rc;
00054   fsal_status_t st;
00055 
00056   /* sanity checks
00057    * note : dir_attributes is optionnal.
00058    */
00059   if(!dir_handle || !p_context || !dir_descriptor)
00060     Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_opendir);
00061 
00062   /* >> You can prepare your directory for beeing read  
00063    * and check that the user has the right for reading its content <<*/
00064 
00065   Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_opendir);
00066 
00067 }
00068 
00104 fsal_status_t FSAL_readdir(fsal_dir_t * dir_descriptor, /* IN */
00105                            fsal_cookie_t start_position,        /* IN */
00106                            fsal_attrib_mask_t get_attr_mask,    /* IN */
00107                            fsal_mdsize_t buffersize,    /* IN */
00108                            fsal_dirent_t * pdirent,     /* OUT */
00109                            fsal_cookie_t * end_position,        /* OUT */
00110                            fsal_count_t * nb_entries,   /* OUT */
00111                            fsal_boolean_t * end_of_dir  /* OUT */
00112     )
00113 {
00114 
00115   /* sanity checks */
00116 
00117   if(!dir_descriptor || !pdirent || !end_position || !nb_entries || !end_of_dir)
00118     Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_readdir);
00119 
00120   TakeTokenFSCall();
00121 
00122   /* >> read some entry from you filesystem << */
00123 
00124   ReleaseTokenFSCall();
00125 
00126   /* >> convert error code and return on error << */
00127 
00128   /* >> fill the output dirent array << */
00129 
00130   /* until the requested count is reached
00131    * or the end of dir is reached...
00132    */
00133 
00134   /* Don't forget setting output vars : end_position, nb_entries, end_of_dir  */
00135 
00136   Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_readdir);
00137 
00138 }
00139 
00153 fsal_status_t FSAL_closedir(fsal_dir_t * dir_descriptor /* IN */
00154     )
00155 {
00156 
00157   int rc;
00158 
00159   /* sanity checks */
00160   if(!dir_descriptor)
00161     Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_closedir);
00162 
00163   /* >> release the resources used for reading your directory << */
00164 
00165   Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_closedir);
00166 
00167 }