xref: /haiku/src/add-ons/kernel/file_systems/nfs4/NFS4Defs.h (revision 25a7b01d15612846f332751841da3579db313082)
14aeb5952SPawel Dziepak /*
24aeb5952SPawel Dziepak  * Copyright 2012 Haiku, Inc. All rights reserved.
34aeb5952SPawel Dziepak  * Distributed under the terms of the MIT License.
44aeb5952SPawel Dziepak  *
54aeb5952SPawel Dziepak  * Authors:
64aeb5952SPawel Dziepak  *		Paweł Dziepak, pdziepak@quarnos.org
74aeb5952SPawel Dziepak  */
84aeb5952SPawel Dziepak #ifndef NFS4DEFS_H
94aeb5952SPawel Dziepak #define NFS4DEFS_H
104aeb5952SPawel Dziepak 
114aeb5952SPawel Dziepak 
127d0b8c97SPawel Dziepak #include <fcntl.h>
13d38e98d8SPawel Dziepak #include <sys/stat.h>
14d38e98d8SPawel Dziepak 
1545aa18acSPawel Dziepak #include <SupportDefs.h>
1645aa18acSPawel Dziepak 
17196403c9SPawel Dziepak 
184aeb5952SPawel Dziepak enum Procedure {
194aeb5952SPawel Dziepak 	ProcNull		= 0,
204aeb5952SPawel Dziepak 	ProcCompound	= 1
214aeb5952SPawel Dziepak };
224aeb5952SPawel Dziepak 
2394c47dc6SPawel Dziepak enum CallbackProcedure {
2494c47dc6SPawel Dziepak 	CallbackProcNull		= 0,
2594c47dc6SPawel Dziepak 	CallbackProcCompound	= 1
2694c47dc6SPawel Dziepak };
2794c47dc6SPawel Dziepak 
284a153753SPawel Dziepak enum CallbackOpcode {
29224d6022SPawel Dziepak 	OpCallbackGetAttr		= 3,
304a153753SPawel Dziepak 	OpCallbackRecall		= 4
314a153753SPawel Dziepak };
324a153753SPawel Dziepak 
334aeb5952SPawel Dziepak enum Opcode {
344aeb5952SPawel Dziepak 	OpAccess				= 3,
3560a8140dSPawel Dziepak 	OpClose					= 4,
3636577ed5SPawel Dziepak 	OpCommit				= 5,
37f5baf2efSPawel Dziepak 	OpCreate				= 6,
384a153753SPawel Dziepak 	OpDelegReturn			= 8,
394aeb5952SPawel Dziepak 	OpGetAttr				= 9,
404aeb5952SPawel Dziepak 	OpGetFH					= 10,
41c0de7acaSPawel Dziepak 	OpLink					= 11,
427d0b8c97SPawel Dziepak 	OpLock					= 12,
437d0b8c97SPawel Dziepak 	OpLockT					= 13,
447d0b8c97SPawel Dziepak 	OpLockU					= 14,
454aeb5952SPawel Dziepak 	OpLookUp				= 15,
467bfa4fe8SPawel Dziepak 	OpLookUpUp				= 16,
4797378968SPawel Dziepak 	OpNverify				= 17,
482a292557SPawel Dziepak 	OpOpen					= 18,
49f7c35cf4SPawel Dziepak 	OpOpenAttrDir			= 19,
502a292557SPawel Dziepak 	OpOpenConfirm			= 20,
51bf31ee39SPawel Dziepak 	OpPutFH					= 22,
524b48348fSPawel Dziepak 	OpPutRootFH				= 24,
532f2e57d0SPawel Dziepak 	OpRead					= 25,
542a292557SPawel Dziepak 	OpReadDir				= 26,
55f2da914dSPawel Dziepak 	OpReadLink				= 27,
566fb3845bSPawel Dziepak 	OpRemove				= 28,
571ec6b0c1SPawel Dziepak 	OpRename				= 29,
5827a291deSPawel Dziepak 	OpRenew					= 30,
591ec6b0c1SPawel Dziepak 	OpSaveFH				= 32,
60abba2fddSPawel Dziepak 	OpSetAttr				= 34,
612a292557SPawel Dziepak 	OpSetClientID			= 35,
62cf511f24SPawel Dziepak 	OpSetClientIDConfirm	= 36,
63e36a5442SPawel Dziepak 	OpVerify				= 37,
641a082070SPawel Dziepak 	OpWrite					= 38,
651a082070SPawel Dziepak 	OpReleaseLockOwner		= 39
664aeb5952SPawel Dziepak };
674aeb5952SPawel Dziepak 
684aeb5952SPawel Dziepak enum Access {
694aeb5952SPawel Dziepak 	ACCESS4_READ		= 0x00000001,
704aeb5952SPawel Dziepak 	ACCESS4_LOOKUP		= 0x00000002,
714aeb5952SPawel Dziepak 	ACCESS4_MODIFY		= 0x00000004,
724aeb5952SPawel Dziepak 	ACCESS4_EXTEND		= 0x00000008,
734aeb5952SPawel Dziepak 	ACCESS4_DELETE		= 0x00000010,
744aeb5952SPawel Dziepak 	ACCESS4_EXECUTE		= 0x00000020
754aeb5952SPawel Dziepak };
764aeb5952SPawel Dziepak 
774aeb5952SPawel Dziepak enum Attribute {
784aeb5952SPawel Dziepak 	// Mandatory Attributes
794aeb5952SPawel Dziepak 	FATTR4_SUPPORTED_ATTRS		= 0,
804aeb5952SPawel Dziepak 	FATTR4_TYPE					= 1,
814aeb5952SPawel Dziepak 	FATTR4_FH_EXPIRE_TYPE		= 2,
824aeb5952SPawel Dziepak 	FATTR4_CHANGE				= 3,
834aeb5952SPawel Dziepak 	FATTR4_SIZE					= 4,
844aeb5952SPawel Dziepak 	FATTR4_LINK_SUPPORT			= 5,
854aeb5952SPawel Dziepak 	FATTR4_SYMLINK_SUPPORT		= 6,
864aeb5952SPawel Dziepak 	FATTR4_NAMED_ATTR			= 7,
874aeb5952SPawel Dziepak 	FATTR4_FSID					= 8,
884aeb5952SPawel Dziepak 	FATTR4_UNIQUE_HANDLES		= 9,
894aeb5952SPawel Dziepak 	FATTR4_LEASE_TIME			= 10,
904aeb5952SPawel Dziepak 	FATTR4_RDATTR_ERROR			= 11,
914aeb5952SPawel Dziepak 	FATTR4_FILEHANDLE			= 19,
924aeb5952SPawel Dziepak 
934aeb5952SPawel Dziepak 	// Recommended Attributes
944aeb5952SPawel Dziepak 	FATTR4_ACL					= 12,
954aeb5952SPawel Dziepak 	FATTR4_ACLSUPPORT			= 13,
964aeb5952SPawel Dziepak 	FATTR4_ARCHIVE				= 14,
974aeb5952SPawel Dziepak 	FATTR4_CANSETTIME			= 15,
984aeb5952SPawel Dziepak 	FATTR4_CASE_INSENSITIVE		= 16,
994aeb5952SPawel Dziepak 	FATTR4_CASE_PRESERVING		= 17,
1004aeb5952SPawel Dziepak 	FATTR4_CHOWN_RESTRICTED		= 18,
1014aeb5952SPawel Dziepak 	FATTR4_FILEID				= 20,
1024aeb5952SPawel Dziepak 	FATTR4_FILES_AVAIL			= 21,
1034aeb5952SPawel Dziepak 	FATTR4_FILES_FREE			= 22,
1044aeb5952SPawel Dziepak 	FATTR4_FILES_TOTAL			= 23,
1054aeb5952SPawel Dziepak 	FATTR4_FS_LOCATIONS			= 24,
1064aeb5952SPawel Dziepak 	FATTR4_HIDDEN				= 25,
1074aeb5952SPawel Dziepak 	FATTR4_HOMOGENEOUS			= 26,
1084aeb5952SPawel Dziepak 	FATTR4_MAXFILESIZE			= 27,
1094aeb5952SPawel Dziepak 	FATTR4_MAXLINK				= 28,
1104aeb5952SPawel Dziepak 	FATTR4_MAXNAME				= 29,
1114aeb5952SPawel Dziepak 	FATTR4_MAXREAD				= 30,
1124aeb5952SPawel Dziepak 	FATTR4_MAXWRITE				= 31,
1134aeb5952SPawel Dziepak 	FATTR4_MIMETYPE				= 32,
1144aeb5952SPawel Dziepak 	FATTR4_MODE					= 33,
1154aeb5952SPawel Dziepak 	FATTR4_NO_TRUNC				= 34,
1164aeb5952SPawel Dziepak 	FATTR4_NUMLINKS				= 35,
1174aeb5952SPawel Dziepak 	FATTR4_OWNER				= 36,
1184aeb5952SPawel Dziepak 	FATTR4_OWNER_GROUP			= 37,
1194aeb5952SPawel Dziepak 	FATTR4_QUOTA_AVAIL_HARD		= 38,
1204aeb5952SPawel Dziepak 	FATTR4_QUOTA_AVAIL_SOFT		= 39,
1214aeb5952SPawel Dziepak 	FATTR4_QUOTA_USED			= 40,
1224aeb5952SPawel Dziepak 	FATTR4_RAWDEV				= 41,
1234aeb5952SPawel Dziepak 	FATTR4_SPACE_AVAIL			= 42,
1244aeb5952SPawel Dziepak 	FATTR4_SPACE_FREE			= 43,
1254aeb5952SPawel Dziepak 	FATTR4_SPACE_TOTAL			= 44,
1264aeb5952SPawel Dziepak 	FATTR4_SPACE_USED			= 45,
1274aeb5952SPawel Dziepak 	FATTR4_SYSTEM				= 46,
1284aeb5952SPawel Dziepak 	FATTR4_TIME_ACCESS			= 47,
1294aeb5952SPawel Dziepak 	FATTR4_TIME_ACCESS_SET		= 48,
1304aeb5952SPawel Dziepak 	FATTR4_TIME_BACKUP			= 49,
1314aeb5952SPawel Dziepak 	FATTR4_TIME_CREATE			= 50,
1324aeb5952SPawel Dziepak 	FATTR4_TIME_DELTA			= 51,
1334aeb5952SPawel Dziepak 	FATTR4_TIME_METADATA		= 52,
1344aeb5952SPawel Dziepak 	FATTR4_TIME_MODIFY			= 53,
1354aeb5952SPawel Dziepak 	FATTR4_TIME_MODIFY_SET		= 54,
136f29ac4afSPawel Dziepak 	FATTR4_MOUNTED_ON_FILEID	= 55,
137f29ac4afSPawel Dziepak 	FATTR4_MAXIMUM_ATTR_ID
1384aeb5952SPawel Dziepak };
1394aeb5952SPawel Dziepak 
140224d6022SPawel Dziepak enum CallbackAttr {
141224d6022SPawel Dziepak 	CallbackAttrSize			= 1,
142224d6022SPawel Dziepak 	CallbackAttrChange			= 2
143224d6022SPawel Dziepak };
144f7bf941aSPawel Dziepak 
sIsAttrSet(Attribute attr,const uint32 * bitmap,uint32 count)145f7bf941aSPawel Dziepak static inline bool sIsAttrSet(Attribute attr, const uint32* bitmap,
146f7bf941aSPawel Dziepak 	uint32 count)
147f7bf941aSPawel Dziepak {
148f7bf941aSPawel Dziepak 	if ((uint32)attr / 32 >= count)
149f7bf941aSPawel Dziepak 		return false;
150f7bf941aSPawel Dziepak 
151f7bf941aSPawel Dziepak 	return (bitmap[attr / 32] & 1 << attr % 32) != 0;
152f7bf941aSPawel Dziepak }
153f7bf941aSPawel Dziepak 
154f7bf941aSPawel Dziepak 
155d38e98d8SPawel Dziepak enum FileType {
156d38e98d8SPawel Dziepak 	NF4REG			= 1,	/* Regular File */
157d38e98d8SPawel Dziepak 	NF4DIR			= 2,	/* Directory */
158d38e98d8SPawel Dziepak 	NF4BLK			= 3,	/* Special File - block device */
159d38e98d8SPawel Dziepak 	NF4CHR			= 4,	/* Special File - character device */
160d38e98d8SPawel Dziepak 	NF4LNK			= 5,	/* Symbolic Link */
161d38e98d8SPawel Dziepak 	NF4SOCK			= 6,	/* Special File - socket */
162d38e98d8SPawel Dziepak 	NF4FIFO			= 7,	/* Special File - fifo */
163d38e98d8SPawel Dziepak 	NF4ATTRDIR		= 8,	/* Attribute Directory */
164d38e98d8SPawel Dziepak 	NF4NAMEDATTR	= 9		/* Named Attribute */
165d38e98d8SPawel Dziepak };
166d38e98d8SPawel Dziepak 
167d38e98d8SPawel Dziepak static const mode_t sNFSFileTypeToHaiku[] = {
168212de720SPawel Dziepak 	S_IFREG, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, S_IFSOCK, S_IFIFO,
169212de720SPawel Dziepak 	S_IFDIR, S_IFREG
170d38e98d8SPawel Dziepak };
171d38e98d8SPawel Dziepak 
1724aeb5952SPawel Dziepak enum FileHandleExpiryType {
1734aeb5952SPawel Dziepak 	FH4_PERSISTENT			= 0x00,
1744aeb5952SPawel Dziepak 	FH4_NOEXPIRE_WITH_OPEN	= 0x01,
1754aeb5952SPawel Dziepak 	FH4_VOLATILE_ANY		= 0x02,
1764aeb5952SPawel Dziepak 	FH4_VOL_MIGRATION		= 0x04,
1774aeb5952SPawel Dziepak 	FH4_VOL_RENAME			= 0x08
1784aeb5952SPawel Dziepak };
1794aeb5952SPawel Dziepak 
1802a292557SPawel Dziepak enum OpenAccess {
1812a292557SPawel Dziepak 	OPEN4_SHARE_ACCESS_READ		= 1,
18220bd3ee1SPawel Dziepak 	OPEN4_SHARE_ACCESS_WRITE	= 2,
18320bd3ee1SPawel Dziepak 	OPEN4_SHARE_ACCESS_BOTH		= 3
1842a292557SPawel Dziepak };
1852a292557SPawel Dziepak 
1866ebe67d0SPawel Dziepak 
1876ebe67d0SPawel Dziepak static inline OpenAccess
sModeToAccess(int mode)1886ebe67d0SPawel Dziepak sModeToAccess(int mode)
1896ebe67d0SPawel Dziepak {
1906ebe67d0SPawel Dziepak 	switch (mode & O_RWMASK) {
1916ebe67d0SPawel Dziepak 		case O_RDONLY:
1926ebe67d0SPawel Dziepak 			return OPEN4_SHARE_ACCESS_READ;
1936ebe67d0SPawel Dziepak 		case O_WRONLY:
1946ebe67d0SPawel Dziepak 			return OPEN4_SHARE_ACCESS_WRITE;
1956ebe67d0SPawel Dziepak 		case O_RDWR:
1966ebe67d0SPawel Dziepak 			return OPEN4_SHARE_ACCESS_BOTH;
1976ebe67d0SPawel Dziepak 	}
1986ebe67d0SPawel Dziepak 
1996ebe67d0SPawel Dziepak 	return OPEN4_SHARE_ACCESS_READ;
2006ebe67d0SPawel Dziepak }
2016ebe67d0SPawel Dziepak 
2026ebe67d0SPawel Dziepak 
2032a292557SPawel Dziepak enum OpenCreate {
2042a292557SPawel Dziepak 	OPEN4_NOCREATE			= 0,
2052a292557SPawel Dziepak 	OPEN4_CREATE			= 1
2062a292557SPawel Dziepak };
2072a292557SPawel Dziepak 
20820bd3ee1SPawel Dziepak enum OpenCreateHow {
20920bd3ee1SPawel Dziepak 	UNCHECKED4				= 0,
21020bd3ee1SPawel Dziepak 	GUARDED4				= 1,
21120bd3ee1SPawel Dziepak 	EXCLUSIVE4				= 2
21220bd3ee1SPawel Dziepak };
21320bd3ee1SPawel Dziepak 
214d1e6b61eSPawel Dziepak enum OpenClaim {
215d1e6b61eSPawel Dziepak 	CLAIM_NULL				= 0,
216d1e6b61eSPawel Dziepak 	CLAIM_PREVIOUS			= 1,
217d1e6b61eSPawel Dziepak 	CLAIM_DELEGATE_CUR		= 2,
218d1e6b61eSPawel Dziepak 	CLAIM_DELEGATE_PREV		= 3
219d1e6b61eSPawel Dziepak };
220d1e6b61eSPawel Dziepak 
22199092223SPawel Dziepak enum OpenDelegation {
22299092223SPawel Dziepak 	OPEN_DELEGATE_NONE		= 0,
22399092223SPawel Dziepak 	OPEN_DELEGATE_READ		= 1,
22499092223SPawel Dziepak 	OPEN_DELEGATE_WRITE		= 2
22599092223SPawel Dziepak };
22699092223SPawel Dziepak 
22799092223SPawel Dziepak struct OpenDelegationData {
22899092223SPawel Dziepak 	OpenDelegation	fType;
22999092223SPawel Dziepak 
23099092223SPawel Dziepak 	uint32			fStateSeq;
23199092223SPawel Dziepak 	uint32			fStateID[3];
23299092223SPawel Dziepak 
23399092223SPawel Dziepak 	bool			fRecall;
23499092223SPawel Dziepak 	uint64			fSpaceLimit;
23599092223SPawel Dziepak };
23699092223SPawel Dziepak 
2372a292557SPawel Dziepak enum OpenFlags {
2382a292557SPawel Dziepak 	OPEN4_RESULT_CONFIRM		= 2,
2392a292557SPawel Dziepak 	OPEN4_RESULT_LOCKTYPE_POSIX	= 4
2402a292557SPawel Dziepak };
2412a292557SPawel Dziepak 
24299092223SPawel Dziepak enum {
24399092223SPawel Dziepak 	NFS_LIMIT_SIZE		= 1,
24499092223SPawel Dziepak 	NFS_LIMIT_BLOCKS	= 2
24599092223SPawel Dziepak };
24699092223SPawel Dziepak 
2470dbff361SPawel Dziepak struct ChangeInfo {
2480dbff361SPawel Dziepak 	bool	fAtomic;
2490dbff361SPawel Dziepak 	uint64	fBefore;
2500dbff361SPawel Dziepak 	uint64	fAfter;
2510dbff361SPawel Dziepak };
2520dbff361SPawel Dziepak 
253e36a5442SPawel Dziepak enum WriteStable {
254e36a5442SPawel Dziepak 	UNSTABLE4				= 0,
255e36a5442SPawel Dziepak 	DATA_SYNC4				= 1,
256e36a5442SPawel Dziepak 	FILE_SYNC4				= 2
257e36a5442SPawel Dziepak };
258e36a5442SPawel Dziepak 
2597d0b8c97SPawel Dziepak enum LockType {
2607d0b8c97SPawel Dziepak 	READ_LT			= 1,
2617d0b8c97SPawel Dziepak 	WRITE_LT		= 2,
2627d0b8c97SPawel Dziepak 	READW_LT		= 3,
2637d0b8c97SPawel Dziepak 	WRITEW_LT		= 4
2647d0b8c97SPawel Dziepak };
2657d0b8c97SPawel Dziepak 
2667d0b8c97SPawel Dziepak 
2676ebe67d0SPawel Dziepak static inline LockType
sGetLockType(short type,bool wait)2686ebe67d0SPawel Dziepak sGetLockType(short type, bool wait) {
2697d0b8c97SPawel Dziepak 	switch (type) {
2707d0b8c97SPawel Dziepak 		case F_RDLCK:	return wait ? READW_LT : READ_LT;
2717d0b8c97SPawel Dziepak 		case F_WRLCK:	return wait ? WRITEW_LT : WRITE_LT;
2727d0b8c97SPawel Dziepak 		default:		return READ_LT;
2737d0b8c97SPawel Dziepak 	}
2747d0b8c97SPawel Dziepak }
2757d0b8c97SPawel Dziepak 
2767d0b8c97SPawel Dziepak 
2776ebe67d0SPawel Dziepak static inline short
sLockTypeToHaiku(LockType type)2786ebe67d0SPawel Dziepak sLockTypeToHaiku(LockType type) {
2797d0b8c97SPawel Dziepak 	switch (type) {
2807d0b8c97SPawel Dziepak 		case READ_LT:
2817d0b8c97SPawel Dziepak 		case READW_LT:
2827d0b8c97SPawel Dziepak 						return F_RDLCK;
2837d0b8c97SPawel Dziepak 
2847d0b8c97SPawel Dziepak 		case WRITE_LT:
2857d0b8c97SPawel Dziepak 		case WRITEW_LT:
2867d0b8c97SPawel Dziepak 						return F_WRLCK;
2877d0b8c97SPawel Dziepak 
2887d0b8c97SPawel Dziepak 		default:		return F_UNLCK;
2897d0b8c97SPawel Dziepak 	}
2907d0b8c97SPawel Dziepak }
2917d0b8c97SPawel Dziepak 
2927d0b8c97SPawel Dziepak 
2934aeb5952SPawel Dziepak enum Errors {
2944aeb5952SPawel Dziepak 	NFS4_OK						= 0,
2954aeb5952SPawel Dziepak 	NFS4ERR_PERM				= 1,
2964aeb5952SPawel Dziepak 	NFS4ERR_NOENT				= 2,
2974aeb5952SPawel Dziepak 	NFS4ERR_IO					= 5,
2984aeb5952SPawel Dziepak 	NFS4ERR_NXIO				= 6,
2994aeb5952SPawel Dziepak 	NFS4ERR_ACCESS				= 13,
3004aeb5952SPawel Dziepak 	NFS4ERR_EXIST				= 17,
3014aeb5952SPawel Dziepak 	NFS4ERR_XDEV				= 18,
3024aeb5952SPawel Dziepak 	NFS4ERR_NOTDIR				= 20,
3034aeb5952SPawel Dziepak 	NFS4ERR_ISDIR				= 21,
3044aeb5952SPawel Dziepak 	NFS4ERR_INVAL				= 22,
305b268b6f2SPawel Dziepak 	NFS4ERR_FBIG				= 27,
3067c6cdb83SPawel Dziepak 	NFS4ERR_NOSPC				= 28,
3077c6cdb83SPawel Dziepak 	NFS4ERR_ROFS				= 30,
3087c6cdb83SPawel Dziepak 	NFS4ERR_MLINK				= 31,
3097c6cdb83SPawel Dziepak 	NFS4ERR_NAMETOOLONG			= 63,
3107c6cdb83SPawel Dziepak 	NFS4ERR_NOTEMPTY			= 66,
3117c6cdb83SPawel Dziepak 	NFS4ERR_DQUOT				= 69,
3127c6cdb83SPawel Dziepak 	NFS4ERR_STALE				= 70,
313b268b6f2SPawel Dziepak 	NFS4ERR_BADHANDLE			= 10001,
314b268b6f2SPawel Dziepak 	NFS4ERR_BAD_COOKIE			= 10003,
315b268b6f2SPawel Dziepak 	NFS4ERR_NOTSUPP				= 10004,
316b268b6f2SPawel Dziepak 	NFS4ERR_TOOSMALL			= 10005,
317b268b6f2SPawel Dziepak 	NFS4ERR_SERVERFAULT			= 10006,
318b268b6f2SPawel Dziepak 	NFS4ERR_BADTYPE				= 10007,
319b268b6f2SPawel Dziepak 	NFS4ERR_DELAY				= 10008,
320b268b6f2SPawel Dziepak 	NFS4ERR_SAME				= 10009,
321b268b6f2SPawel Dziepak 	NFS4ERR_DENIED				= 10010,
322b268b6f2SPawel Dziepak 	NFS4ERR_EXPIRED				= 10011,
323b268b6f2SPawel Dziepak 	NFS4ERR_LOCKED				= 10012,
324b268b6f2SPawel Dziepak 	NFS4ERR_GRACE				= 10013,
325b268b6f2SPawel Dziepak 	NFS4ERR_FHEXPIRED			= 10014,
326b268b6f2SPawel Dziepak 	NFS4ERR_SHARE_DENIED		= 10015,
327b268b6f2SPawel Dziepak 	NFS4ERR_WRONGSEC			= 10016,
328b268b6f2SPawel Dziepak 	NFS4ERR_CLID_INUSE			= 10017,
329b268b6f2SPawel Dziepak 	NFS4ERR_RESOURCE			= 10018,
330b268b6f2SPawel Dziepak 	NFS4ERR_MOVED				= 10019,
331b268b6f2SPawel Dziepak 	NFS4ERR_NOFILEHANDLE		= 10020,
332b268b6f2SPawel Dziepak 	NFS4ERR_MINOR_VERS_MISMATCH	= 10021,
333b268b6f2SPawel Dziepak 	NFS4ERR_STALE_CLIENTID		= 10022,
334b268b6f2SPawel Dziepak 	NFS4ERR_STALE_STATEID		= 10023,
335b268b6f2SPawel Dziepak 	NFS4ERR_OLD_STATEID			= 10024,
336b268b6f2SPawel Dziepak 	NFS4ERR_BAD_STATEID			= 10025,
337b268b6f2SPawel Dziepak 	NFS4ERR_BAD_SEQID			= 10026,
338b268b6f2SPawel Dziepak 	NFS4ERR_NOT_SAME			= 10027,
339b268b6f2SPawel Dziepak 	NFS4ERR_LOCK_RANGE			= 10028,
340b268b6f2SPawel Dziepak 	NFS4ERR_SYMLINK				= 10029,
341b268b6f2SPawel Dziepak 	NFS4ERR_RESTOREFH			= 10030,
342b268b6f2SPawel Dziepak 	NFS4ERR_LEASE_MOVED			= 10031,
343b268b6f2SPawel Dziepak 	NFS4ERR_ATTRNOTSUPP			= 10032,
344b268b6f2SPawel Dziepak 	NFS4ERR_NO_GRACE			= 10033,
345b268b6f2SPawel Dziepak 	NFS4ERR_RECLAIM_BAD			= 10034,
346b268b6f2SPawel Dziepak 	NFS4ERR_RECLAIM_CONFLICT	= 10035,
347b268b6f2SPawel Dziepak 	NFS4ERR_BADXDR				= 10036,
348b268b6f2SPawel Dziepak 	NFS4ERR_LOCKS_HELD			= 10037,
349b268b6f2SPawel Dziepak 	NFS4ERR_OPENMODE			= 10038,
350b268b6f2SPawel Dziepak 	NFS4ERR_BADOWNER			= 10039,
351b268b6f2SPawel Dziepak 	NFS4ERR_BADCHAR				= 10040,
352b268b6f2SPawel Dziepak 	NFS4ERR_BADNAME				= 10041,
353b268b6f2SPawel Dziepak 	NFS4ERR_BAD_RANGE			= 10042,
354b268b6f2SPawel Dziepak 	NFS4ERR_LOCK_NOTSUPP		= 10043,
355b268b6f2SPawel Dziepak 	NFS4ERR_OP_ILLEGAL			= 10044,
356b268b6f2SPawel Dziepak 	NFS4ERR_DEADLOCK			= 10045,
357b268b6f2SPawel Dziepak 	NFS4ERR_FILE_OPEN			= 10046,
358b268b6f2SPawel Dziepak 	NFS4ERR_ADMIN_REVOKED		= 10047,
359b268b6f2SPawel Dziepak 	NFS4ERR_CB_PATH_DOWN		= 10048
3604aeb5952SPawel Dziepak };
3614aeb5952SPawel Dziepak 
3624aeb5952SPawel Dziepak 
363ceed5fe0SPawel Dziepak static inline bigtime_t
sSecToBigTime(uint32 sec)364ceed5fe0SPawel Dziepak sSecToBigTime(uint32 sec)
365ceed5fe0SPawel Dziepak {
366ceed5fe0SPawel Dziepak 	return static_cast<bigtime_t>(sec) * 1000000;
367ceed5fe0SPawel Dziepak }
368ceed5fe0SPawel Dziepak 
369ceed5fe0SPawel Dziepak 
370*fa1ca5e2SPawel Dziepak static inline bool
IsFileHandleInvalid(uint32 error)371*fa1ca5e2SPawel Dziepak IsFileHandleInvalid(uint32 error)
372*fa1ca5e2SPawel Dziepak {
373*fa1ca5e2SPawel Dziepak 	return error == NFS4ERR_BADHANDLE || error == NFS4ERR_FHEXPIRED
374*fa1ca5e2SPawel Dziepak 		|| error == NFS4ERR_STALE;
375*fa1ca5e2SPawel Dziepak }
376*fa1ca5e2SPawel Dziepak 
377*fa1ca5e2SPawel Dziepak 
3784aeb5952SPawel Dziepak #endif	// NFS4DEFS_H
3794aeb5952SPawel Dziepak 
380