nfs-ganesha 1.4
|
00001 /* 00002 * vim:expandtab:shiftwidth=4:tabstop=4: 00003 */ 00004 00015 #ifdef HAVE_CONFIG_H 00016 #include "config.h" 00017 #endif 00018 00019 #ifdef _SOLARIS 00020 #include "solaris_port.h" 00021 #endif /* _SOLARIS */ 00022 00023 #include "fsal.h" 00024 00037 fsal_boolean_t fsal_is_retryable(fsal_status_t status) 00038 { 00039 00040 switch (status.major) 00041 { 00042 00044 case ERR_FSAL_DELAY: 00045 return TRUE; 00046 00047 default: 00048 return FALSE; 00049 } 00050 00051 } 00052 00053 /* Function names for logging and SNMP stats etc. */ 00054 00055 const char *fsal_function_names[] = { 00056 "FSAL_lookup", "FSAL_access", "FSAL_create", "FSAL_mkdir", "FSAL_truncate", 00057 "FSAL_getattrs", "FSAL_setattrs", "FSAL_link", "FSAL_opendir", "FSAL_readdir", 00058 "FSAL_closedir", "FSAL_open", "FSAL_read", "FSAL_write", "FSAL_close", 00059 "FSAL_readlink", "FSAL_symlink", "FSAL_rename", "FSAL_unlink", "FSAL_mknode", 00060 "FSAL_unused_20", "FSAL_dynamic_fsinfo", "FSAL_rcp", "FSAL_Init", 00061 "FSAL_get_stats", "FSAL_unused_25", "FSAL_unused_26", "FSAL_unused_27", 00062 "FSAL_BuildExportContext", "FSAL_InitClientContext", "FSAL_GetClientContext", 00063 "FSAL_lookupPath", "FSAL_lookupJunction", "FSAL_test_access", 00064 "FSAL_rmdir", "FSAL_CleanObjectResources", "FSAL_open_by_name", "FSAL_open_by_fileid", 00065 "FSAL_ListXAttrs", "FSAL_GetXAttrValue", "FSAL_SetXAttrValue", "FSAL_GetXAttrAttrs", 00066 "FSAL_close_by_fileid", "FSAL_setattr_access", "FSAL_merge_attrs", "FSAL_rename_access", 00067 "FSAL_unlink_access", "FSAL_link_access", "FSAL_create_access", "FSAL_unused_49", "FSAL_CleanUpExportContext", 00068 "FSAL_getextattrs", "FSAL_commit", "FSAL_getattrs_descriptor", "FSAL_lock_op", 00069 "FSAL_UP_init", "FSAL_UP_addfilter", "FSAL_UP_getevents", "FSAL_unused_58", 00070 "FSAL_layoutget", "FSAL_layoutreturn", "FSAL_layoutcommit", "FSAL_getdeviceinfo", 00071 "FSAL_getdevicelist", "FSAL_ds_read", "FSAL_ds_write", "FSAL_ds_commit", "FSAL_share_op" 00072 }; 00073 00074 family_error_t __attribute__ ((__unused__)) tab_errstatus_FSAL[] = 00075 { 00076 { 00077 ERR_FSAL_NO_ERROR, "ERR_FSAL_NO_ERROR", "No error"}, 00078 { 00079 ERR_FSAL_PERM, "ERR_FSAL_PERM", "Forbidden action"}, 00080 { 00081 ERR_FSAL_NOENT, "ERR_FSAL_NOENT", "No such file or directory"}, 00082 { 00083 ERR_FSAL_IO, "ERR_FSAL_IO", "I/O error"}, 00084 { 00085 ERR_FSAL_NXIO, "ERR_FSAL_NXIO", "No such device or address"}, 00086 { 00087 ERR_FSAL_NOMEM, "ERR_FSAL_NOMEM", "Not enough memory"}, 00088 { 00089 ERR_FSAL_ACCESS, "ERR_FSAL_ACCESS", "Permission denied"}, 00090 { 00091 ERR_FSAL_FAULT, "ERR_FSAL_FAULT", "Bad address"}, 00092 { 00093 ERR_FSAL_EXIST, "ERR_FSAL_EXIST", "This object already exists"}, 00094 { 00095 ERR_FSAL_XDEV, "ERR_FSAL_XDEV", "This operation can't cross filesystems"}, 00096 { 00097 ERR_FSAL_NOTDIR, "ERR_FSAL_NOTDIR", "This object is not a directory"}, 00098 { 00099 ERR_FSAL_ISDIR, "ERR_FSAL_ISDIR", "Directory used in a nondirectory operation"}, 00100 { 00101 ERR_FSAL_INVAL, "ERR_FSAL_INVAL", "Invalid object type"}, 00102 { 00103 ERR_FSAL_FBIG, "ERR_FSAL_FBIG", "File exceeds max file size"}, 00104 { 00105 ERR_FSAL_NOSPC, "ERR_FSAL_NOSPC", "No space left on filesystem"}, 00106 { 00107 ERR_FSAL_ROFS, "ERR_FSAL_ROFS", "Read-only filesystem"}, 00108 { 00109 ERR_FSAL_MLINK, "ERR_FSAL_MLINK", "Too many hard links"}, 00110 { 00111 ERR_FSAL_DQUOT, "ERR_FSAL_DQUOT", "Quota exceeded"}, 00112 { 00113 ERR_FSAL_NAMETOOLONG, "ERR_FSAL_NAMETOOLONG", "Max name length exceeded"}, 00114 { 00115 ERR_FSAL_NOTEMPTY, "ERR_FSAL_NOTEMPTY", "The directory is not empty"}, 00116 { 00117 ERR_FSAL_STALE, "ERR_FSAL_STALE", "The file no longer exists"}, 00118 { 00119 ERR_FSAL_BADHANDLE, "ERR_FSAL_BADHANDLE", "Illegal filehandle"}, 00120 { 00121 ERR_FSAL_BADCOOKIE, "ERR_FSAL_BADCOOKIE", "Invalid cookie"}, 00122 { 00123 ERR_FSAL_NOTSUPP, "ERR_FSAL_NOTSUPP", "Operation not supported"}, 00124 { 00125 ERR_FSAL_TOOSMALL, "ERR_FSAL_TOOSMALL", "Output buffer too small"}, 00126 { 00127 ERR_FSAL_SERVERFAULT, "ERR_FSAL_SERVERFAULT", "Undefined server error"}, 00128 { 00129 ERR_FSAL_BADTYPE, "ERR_FSAL_BADTYPE", "Invalid type for create operation"}, 00130 { 00131 ERR_FSAL_DELAY, "ERR_FSAL_DELAY", "File busy, retry"}, 00132 { 00133 ERR_FSAL_FHEXPIRED, "ERR_FSAL_FHEXPIRED", "Filehandle expired"}, 00134 { 00135 ERR_FSAL_SYMLINK, "ERR_FSAL_SYMLINK", 00136 "This is a symbolic link, should be file/directory"}, 00137 { 00138 ERR_FSAL_ATTRNOTSUPP, "ERR_FSAL_ATTRNOTSUPP", "Attribute not supported"}, 00139 { 00140 ERR_FSAL_NOT_INIT, "ERR_FSAL_NOT_INIT", "Filesystem not initialized"}, 00141 { 00142 ERR_FSAL_ALREADY_INIT, "ERR_FSAL_ALREADY_INIT", "Filesystem already initialised"}, 00143 { 00144 ERR_FSAL_BAD_INIT, "ERR_FSAL_BAD_INIT", "Filesystem initialisation error"}, 00145 { 00146 ERR_FSAL_SEC, "ERR_FSAL_SEC", "Security context error"}, 00147 { 00148 ERR_FSAL_NO_QUOTA, "ERR_FSAL_NO_QUOTA", "No Quota available"}, 00149 { 00150 ERR_FSAL_NOT_OPENED, "ERR_FSAL_NOT_OPENED", "File/directory not opened"}, 00151 { 00152 ERR_FSAL_DEADLOCK, "ERR_FSAL_DEADLOCK", "Deadlock"}, 00153 { 00154 ERR_FSAL_OVERFLOW, "ERR_FSAL_OVERFLOW", "Overflow"}, 00155 { 00156 ERR_FSAL_INTERRUPT, "ERR_FSAL_INTERRUPT", "Operation Interrupted"}, 00157 { 00158 ERR_FSAL_BLOCKED, "ERR_FSAL_BLOCKED", "Lock Blocked"}, 00159 { 00160 ERR_NULL, "ERR_NULL", ""} 00161 }; 00162 00163 const char * msg_fsal_err(fsal_errors_t fsal_err) 00164 { 00165 int i; 00166 00167 for(i = 0; tab_errstatus_FSAL[i].numero != fsal_err && 00168 tab_errstatus_FSAL[i].numero != ERR_NULL; i++) 00169 ; 00170 00171 return tab_errstatus_FSAL[i].msg; 00172 } 00173 00174 const char * label_fsal_err(fsal_errors_t fsal_err) 00175 { 00176 int i; 00177 00178 for(i = 0; tab_errstatus_FSAL[i].numero != fsal_err && 00179 tab_errstatus_FSAL[i].numero != ERR_NULL; i++) 00180 ; 00181 00182 return tab_errstatus_FSAL[i].label; 00183 }