nfs-ganesha 1.4
|
00001 /* 00002 * vim:expandtab:shiftwidth=8:tabstop=8: 00003 */ 00004 00009 #ifdef HAVE_CONFIG_H 00010 #include "config.h" 00011 #endif 00012 00013 #include "fsal_common.h" 00014 #include "fsal_internal.h" 00015 00016 #include <hpss_errno.h> 00017 00018 #define STRCMP strcasecmp 00019 00029 int HPSSFSAL_GetFilesetRoot(char *fileset_name, ns_ObjHandle_t * p_root_hdl) 00030 { 00031 int rc; 00032 00033 /* if fileset_name is null, root fileset is returned */ 00034 00035 if(fileset_name == NULL || fileset_name[0] == '\0') 00036 { 00037 hpss_fileattr_t root_attr; 00038 00039 rc = hpss_FileGetAttributes("/", &root_attr); 00040 if(rc) 00041 return rc; 00042 00043 *p_root_hdl = root_attr.ObjectHandle; 00044 return 0; 00045 00046 } 00047 else 00048 { 00049 ns_FilesetAttrBits_t attrBits; 00050 ns_FilesetAttrs_t fsattrs; 00051 00052 attrBits = cast64m(0); 00053 attrBits = orbit64m(attrBits, NS_FS_ATTRINDEX_FILESET_HANDLE); 00054 00055 rc = hpss_FilesetGetAttributes(fileset_name, NULL, NULL, NULL, attrBits, &fsattrs); 00056 00057 if(rc) 00058 return rc; 00059 00060 *p_root_hdl = fsattrs.FilesetHandle; 00061 return 0; 00062 00063 } 00064 } 00065 00080 void HPSSFSAL_BuildCos(fsal_uint_t CosId, 00081 hpss_cos_hints_t * hints, hpss_cos_priorities_t * hintpri) 00082 { 00083 00084 /* clears the structures */ 00085 memset(hints, 0, sizeof(hpss_cos_hints_t)); 00086 memset(hintpri, 0, sizeof(hpss_cos_priorities_t)); 00087 00088 hints->COSId = (unsigned32) CosId; 00089 hintpri->COSIdPriority = REQUIRED_PRIORITY; 00090 00091 hintpri->COSNamePriority = NO_PRIORITY; 00092 hintpri->WriteOpsPriority = NO_PRIORITY; 00093 hintpri->ReadOpsPriority = NO_PRIORITY; 00094 hintpri->AccessFrequencyPriority = NO_PRIORITY; 00095 hintpri->TransferRatePriority = NO_PRIORITY; 00096 hintpri->MinFileSizePriority = NO_PRIORITY; 00097 hintpri->MaxFileSizePriority = NO_PRIORITY; 00098 hintpri->OptimumAccessSizePriority = NO_PRIORITY; 00099 hintpri->AvgLatencyPriority = NO_PRIORITY; 00100 hintpri->StageCodePriority = NO_PRIORITY; 00101 00102 return; 00103 00104 } 00105 00106 int HPSSFSAL_IsStaleHandle(ns_ObjHandle_t * p_hdl, TYPE_CRED_HPSS * p_cred) 00107 { 00108 int rc; 00109 00110 TakeTokenFSCall(); 00111 00112 rc = HPSSFSAL_GetRawAttrHandle(p_hdl, NULL, p_cred, FALSE, /* don't solve junctions */ 00113 NULL, NULL, NULL); 00114 00115 ReleaseTokenFSCall(); 00116 00117 if((rc == HPSS_ENOENT) || (rc == HPSS_ENOTDIR)) 00118 return TRUE; 00119 00120 return FALSE; 00121 }