nfs-ganesha 1.4

mfsl_async_lookup.c

Go to the documentation of this file.
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 #ifdef HAVE_CONFIG_H
00037 #include "config.h"
00038 #endif
00039 
00040 /* fsal_types contains constants and type definitions for FSAL */
00041 #include "fsal_types.h"
00042 #include "fsal.h"
00043 #include "mfsl_types.h"
00044 #include "mfsl.h"
00045 #include "common_utils.h"
00046 
00060 fsal_status_t MFSL_lookup(mfsl_object_t * parent_directory_handle,      /* IN */
00061                           fsal_name_t * p_filename,     /* IN */
00062                           fsal_op_context_t * p_context,        /* IN */
00063                           mfsl_context_t * p_mfsl_context,      /* IN */
00064                           mfsl_object_t * object_handle,        /* OUT */
00065                           fsal_attrib_list_t * object_attributes /* [ IN/OUT ] */ )
00066 {
00067   fsal_status_t fsal_status;
00068   mfsl_object_specific_data_t *pasyncdata;
00069 
00070   P(parent_directory_handle->lock);
00071   fsal_status = FSAL_lookup(&parent_directory_handle->handle,
00072                             p_filename,
00073                             p_context, &object_handle->handle, object_attributes);
00074   V(parent_directory_handle->lock);
00075 
00076   if(FSAL_IS_ERROR(fsal_status))
00077     return fsal_status;
00078 
00079   if(mfsl_async_get_specdata(object_handle, &pasyncdata))
00080     {
00081       /* if object is asynchronous and deleted, then return ENOENT */
00082       if(pasyncdata->deleted == TRUE)
00083         MFSL_return(ERR_FSAL_NOENT, ENOENT);
00084     }
00085 
00086   /* object was found in FSAL, is not asynchronously deleted, everything is OK */
00087   MFSL_return(ERR_FSAL_NO_ERROR, 0);
00088 }                               /* MFSL_lookup */