nfs-ganesha 1.4
|
00001 /* 00002 * vim:expandtab:shiftwidth=8:tabstop=8: 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 00035 #ifdef HAVE_CONFIG_H 00036 #include "config.h" 00037 #endif 00038 00039 #include "fsal.h" 00040 #include "fsal_internal.h" 00041 #include "fsal_convert.h" 00042 00074 fsal_status_t GPFSFSAL_access(fsal_handle_t * p_object_handle, /* IN */ 00075 fsal_op_context_t * p_context, /* IN */ 00076 fsal_accessflags_t access_type, /* IN */ 00077 fsal_attrib_list_t * p_object_attributes /* [ IN/OUT ] */ 00078 ) 00079 { 00080 00081 fsal_status_t status; 00082 00083 /* sanity checks. 00084 * note : object_attributes is optionnal in GPFSFSAL_getattrs. 00085 */ 00086 if(!p_object_handle || !p_context) 00087 Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_access); 00088 00089 /* 00090 * If an error occures during getattr operation, 00091 * it is returned, even though the access operation succeeded. 00092 */ 00093 00094 if(p_object_attributes) 00095 { 00096 00097 p_object_attributes->asked_attributes = GPFS_SUPPORTED_ATTRIBUTES; 00098 status = GPFSFSAL_getattrs(p_object_handle, p_context, p_object_attributes); 00099 00100 /* on error, we set a special bit in the mask. */ 00101 if(FSAL_IS_ERROR(status)) 00102 { 00103 FSAL_CLEAR_MASK(p_object_attributes->asked_attributes); 00104 FSAL_SET_MASK(p_object_attributes->asked_attributes, FSAL_ATTR_RDATTR_ERR); 00105 Return(status.major, status.minor, INDEX_FSAL_access); 00106 } 00107 00108 status = fsal_internal_access(p_context, p_object_handle, access_type, 00109 p_object_attributes); 00110 00111 } 00112 else 00113 { /* p_object_attributes is NULL */ 00114 fsal_attrib_list_t attrs; 00115 00116 FSAL_CLEAR_MASK(attrs.asked_attributes); 00117 attrs.asked_attributes = GPFS_SUPPORTED_ATTRIBUTES; 00118 00119 status = GPFSFSAL_getattrs(p_object_handle, p_context, &attrs); 00120 00121 /* on error, we set a special bit in the mask. */ 00122 if(FSAL_IS_ERROR(status)) 00123 Return(status.major, status.minor, INDEX_FSAL_access); 00124 00125 status = fsal_internal_access(p_context, p_object_handle, access_type, &attrs); 00126 } 00127 00128 Return(status.major, status.minor, INDEX_FSAL_access); 00129 00130 }