nfs-ganesha 1.4

fsal_unlink.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 
00051 fsal_status_t FSAL_unlink(fsal_handle_t * parentdir_handle,     /* IN */
00052                           fsal_name_t * p_object_name,  /* IN */
00053                           fsal_op_context_t * p_context,        /* IN */
00054                           fsal_attrib_list_t * parentdir_attributes     /* [IN/OUT ] */
00055     )
00056 {
00057 
00058   fsal_status_t st;
00059   int rc;
00060   fsal_handle_t obj_handle;
00061 
00062   /* sanity checks.
00063    * note : parentdir_attributes are optional.
00064    *        parentdir_handle is mandatory,
00065    *        because, we do not allow to delete FS root !
00066    */
00067   if(!parentdir_handle || !p_context || !p_object_name)
00068     Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_unlink);
00069 
00070   TakeTokenFSCall();
00071 
00072   /* >> proceed you filesystem remove call << */
00073 
00074   ReleaseTokenFSCall();
00075 
00076   /* >> get post op attributes for the parent, if they are asked,
00077    * and your filesystem didn't return them << */
00078 
00079   if(parentdir_attributes)
00080     {
00081 
00082       st = FSAL_getattrs(parentdir_handle, p_context, parentdir_attributes);
00083 
00084       /* On error, we set a flag in the returned attributes */
00085 
00086       if(FSAL_IS_ERROR(st))
00087         {
00088           FSAL_CLEAR_MASK(parentdir_attributes->asked_attributes);
00089           FSAL_SET_MASK(parentdir_attributes->asked_attributes, FSAL_ATTR_RDATTR_ERR);
00090         }
00091     }
00092 
00093   /* OK */
00094   Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_unlink);
00095 
00096 }