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 00022 #include <hpss_errno.h> 00023 00058 fsal_status_t HPSSFSAL_access(hpssfsal_handle_t * object_handle, /* IN */ 00059 hpssfsal_op_context_t * p_context, /* IN */ 00060 fsal_accessflags_t access_type, /* IN */ 00061 fsal_attrib_list_t * object_attributes /* [ IN/OUT ] */ 00062 ) 00063 { 00064 00065 int hpss_test_mode = 0; 00066 int rc; 00067 fsal_status_t st; 00068 00069 /* sanity checks. 00070 * note : object_attributes is optionnal in FSAL_getattrs. 00071 */ 00072 if(!object_handle || !p_context) 00073 Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_access); 00074 00075 /* converts fsal access type to hpss access type */ 00076 00077 hpss_test_mode = fsal2hpss_testperm(access_type); 00078 00079 /* call to HPSS access */ 00080 00081 TakeTokenFSCall(); 00082 00083 rc = hpss_AccessHandle(&(object_handle->data.ns_handle), /* IN - parent object handle */ 00084 NULL, /* IN - path of file to check access rights */ 00085 hpss_test_mode, /* IN - Type of access to be checked */ 00086 &p_context->credential.hpss_usercred /* IN - user credentials */ 00087 #if HPSS_MAJOR_VERSION < 7 00088 , NULL /* OUT - authorization ticket */ 00089 #endif 00090 ); 00091 00092 ReleaseTokenFSCall(); 00093 00094 /* convert returned code */ 00095 /* The HPSS_ENOENT error actually means that handle is STALE */ 00096 if(rc == HPSS_ENOENT) 00097 Return(ERR_FSAL_STALE, -rc, INDEX_FSAL_access); 00098 else if(rc) 00099 Return(hpss2fsal_error(rc), -rc, INDEX_FSAL_access); 00100 00101 /* get attributes if object_attributes is not null. 00102 * If an error occures during getattr operation, 00103 * it is returned, even though the access operation succeeded. 00104 */ 00105 if(object_attributes) 00106 { 00107 fsal_status_t status; 00108 00109 status = FSAL_getattrs(object_handle, p_context, object_attributes); 00110 00111 /* on error, we set a special bit in the mask. */ 00112 if(FSAL_IS_ERROR(status)) 00113 { 00114 FSAL_CLEAR_MASK(object_attributes->asked_attributes); 00115 FSAL_SET_MASK(object_attributes->asked_attributes, FSAL_ATTR_RDATTR_ERR); 00116 } 00117 00118 } 00119 00120 Return(ERR_FSAL_NO_ERROR, 0, INDEX_FSAL_access); 00121 00122 }