xref: /haiku/src/add-ons/kernel/file_systems/nfs4/NFS4Defs.h (revision 212de7205336baeee1889f9d5fb595e028b19a83)
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 
12d38e98d8SPawel Dziepak #include <sys/stat.h>
13d38e98d8SPawel Dziepak 
1445aa18acSPawel Dziepak #include <SupportDefs.h>
1545aa18acSPawel Dziepak 
1645aa18acSPawel Dziepak 
17196403c9SPawel Dziepak #define NFS4_FHSIZE	128
18196403c9SPawel Dziepak 
19196403c9SPawel Dziepak struct Filehandle {
20196403c9SPawel Dziepak 	uint8			fSize;
21196403c9SPawel Dziepak 	uint8			fFH[NFS4_FHSIZE];
22196403c9SPawel Dziepak };
23196403c9SPawel Dziepak 
244aeb5952SPawel Dziepak enum Procedure {
254aeb5952SPawel Dziepak 	ProcNull		= 0,
264aeb5952SPawel Dziepak 	ProcCompound	= 1
274aeb5952SPawel Dziepak };
284aeb5952SPawel Dziepak 
294aeb5952SPawel Dziepak enum Opcode {
304aeb5952SPawel Dziepak 	OpAccess		= 3,
314aeb5952SPawel Dziepak 	OpGetAttr		= 9,
324aeb5952SPawel Dziepak 	OpGetFH			= 10,
334aeb5952SPawel Dziepak 	OpLookUp		= 15,
34bf31ee39SPawel Dziepak 	OpPutFH			= 22,
354aeb5952SPawel Dziepak 	OpPutRootFH		= 24
364aeb5952SPawel Dziepak };
374aeb5952SPawel Dziepak 
384aeb5952SPawel Dziepak enum Access {
394aeb5952SPawel Dziepak 	ACCESS4_READ		= 0x00000001,
404aeb5952SPawel Dziepak 	ACCESS4_LOOKUP		= 0x00000002,
414aeb5952SPawel Dziepak 	ACCESS4_MODIFY		= 0x00000004,
424aeb5952SPawel Dziepak 	ACCESS4_EXTEND		= 0x00000008,
434aeb5952SPawel Dziepak 	ACCESS4_DELETE		= 0x00000010,
444aeb5952SPawel Dziepak 	ACCESS4_EXECUTE		= 0x00000020
454aeb5952SPawel Dziepak };
464aeb5952SPawel Dziepak 
474aeb5952SPawel Dziepak enum Attribute {
484aeb5952SPawel Dziepak 	// Mandatory Attributes
494aeb5952SPawel Dziepak 	FATTR4_SUPPORTED_ATTRS		= 0,
504aeb5952SPawel Dziepak 	FATTR4_TYPE					= 1,
514aeb5952SPawel Dziepak 	FATTR4_FH_EXPIRE_TYPE		= 2,
524aeb5952SPawel Dziepak 	FATTR4_CHANGE				= 3,
534aeb5952SPawel Dziepak 	FATTR4_SIZE					= 4,
544aeb5952SPawel Dziepak 	FATTR4_LINK_SUPPORT			= 5,
554aeb5952SPawel Dziepak 	FATTR4_SYMLINK_SUPPORT		= 6,
564aeb5952SPawel Dziepak 	FATTR4_NAMED_ATTR			= 7,
574aeb5952SPawel Dziepak 	FATTR4_FSID					= 8,
584aeb5952SPawel Dziepak 	FATTR4_UNIQUE_HANDLES		= 9,
594aeb5952SPawel Dziepak 	FATTR4_LEASE_TIME			= 10,
604aeb5952SPawel Dziepak 	FATTR4_RDATTR_ERROR			= 11,
614aeb5952SPawel Dziepak 	FATTR4_FILEHANDLE			= 19,
624aeb5952SPawel Dziepak 
634aeb5952SPawel Dziepak 	// Recommended Attributes
644aeb5952SPawel Dziepak 	FATTR4_ACL					= 12,
654aeb5952SPawel Dziepak 	FATTR4_ACLSUPPORT			= 13,
664aeb5952SPawel Dziepak 	FATTR4_ARCHIVE				= 14,
674aeb5952SPawel Dziepak 	FATTR4_CANSETTIME			= 15,
684aeb5952SPawel Dziepak 	FATTR4_CASE_INSENSITIVE		= 16,
694aeb5952SPawel Dziepak 	FATTR4_CASE_PRESERVING		= 17,
704aeb5952SPawel Dziepak 	FATTR4_CHOWN_RESTRICTED		= 18,
714aeb5952SPawel Dziepak 	FATTR4_FILEID				= 20,
724aeb5952SPawel Dziepak 	FATTR4_FILES_AVAIL			= 21,
734aeb5952SPawel Dziepak 	FATTR4_FILES_FREE			= 22,
744aeb5952SPawel Dziepak 	FATTR4_FILES_TOTAL			= 23,
754aeb5952SPawel Dziepak 	FATTR4_FS_LOCATIONS			= 24,
764aeb5952SPawel Dziepak 	FATTR4_HIDDEN				= 25,
774aeb5952SPawel Dziepak 	FATTR4_HOMOGENEOUS			= 26,
784aeb5952SPawel Dziepak 	FATTR4_MAXFILESIZE			= 27,
794aeb5952SPawel Dziepak 	FATTR4_MAXLINK				= 28,
804aeb5952SPawel Dziepak 	FATTR4_MAXNAME				= 29,
814aeb5952SPawel Dziepak 	FATTR4_MAXREAD				= 30,
824aeb5952SPawel Dziepak 	FATTR4_MAXWRITE				= 31,
834aeb5952SPawel Dziepak 	FATTR4_MIMETYPE				= 32,
844aeb5952SPawel Dziepak 	FATTR4_MODE					= 33,
854aeb5952SPawel Dziepak 	FATTR4_NO_TRUNC				= 34,
864aeb5952SPawel Dziepak 	FATTR4_NUMLINKS				= 35,
874aeb5952SPawel Dziepak 	FATTR4_OWNER				= 36,
884aeb5952SPawel Dziepak 	FATTR4_OWNER_GROUP			= 37,
894aeb5952SPawel Dziepak 	FATTR4_QUOTA_AVAIL_HARD		= 38,
904aeb5952SPawel Dziepak 	FATTR4_QUOTA_AVAIL_SOFT		= 39,
914aeb5952SPawel Dziepak 	FATTR4_QUOTA_USED			= 40,
924aeb5952SPawel Dziepak 	FATTR4_RAWDEV				= 41,
934aeb5952SPawel Dziepak 	FATTR4_SPACE_AVAIL			= 42,
944aeb5952SPawel Dziepak 	FATTR4_SPACE_FREE			= 43,
954aeb5952SPawel Dziepak 	FATTR4_SPACE_TOTAL			= 44,
964aeb5952SPawel Dziepak 	FATTR4_SPACE_USED			= 45,
974aeb5952SPawel Dziepak 	FATTR4_SYSTEM				= 46,
984aeb5952SPawel Dziepak 	FATTR4_TIME_ACCESS			= 47,
994aeb5952SPawel Dziepak 	FATTR4_TIME_ACCESS_SET		= 48,
1004aeb5952SPawel Dziepak 	FATTR4_TIME_BACKUP			= 49,
1014aeb5952SPawel Dziepak 	FATTR4_TIME_CREATE			= 50,
1024aeb5952SPawel Dziepak 	FATTR4_TIME_DELTA			= 51,
1034aeb5952SPawel Dziepak 	FATTR4_TIME_METADATA		= 52,
1044aeb5952SPawel Dziepak 	FATTR4_TIME_MODIFY			= 53,
1054aeb5952SPawel Dziepak 	FATTR4_TIME_MODIFY_SET		= 54,
1064aeb5952SPawel Dziepak 	FATTR4_MOUNTED_ON_FILEID	= 55
1074aeb5952SPawel Dziepak };
1084aeb5952SPawel Dziepak 
109d38e98d8SPawel Dziepak enum FileType {
110d38e98d8SPawel Dziepak 	NF4REG			= 1,    /* Regular File */
111d38e98d8SPawel Dziepak 	NF4DIR			= 2,    /* Directory */
112d38e98d8SPawel Dziepak 	NF4BLK			= 3,    /* Special File - block device */
113d38e98d8SPawel Dziepak 	NF4CHR			= 4,    /* Special File - character device */
114d38e98d8SPawel Dziepak 	NF4LNK			= 5,    /* Symbolic Link */
115d38e98d8SPawel Dziepak 	NF4SOCK			= 6,    /* Special File - socket */
116d38e98d8SPawel Dziepak 	NF4FIFO			= 7,    /* Special File - fifo */
117d38e98d8SPawel Dziepak 	NF4ATTRDIR		= 8,    /* Attribute Directory */
118d38e98d8SPawel Dziepak 	NF4NAMEDATTR	= 9     /* Named Attribute */
119d38e98d8SPawel Dziepak };
120d38e98d8SPawel Dziepak 
121d38e98d8SPawel Dziepak static const mode_t sNFSFileTypeToHaiku[] = {
122*212de720SPawel Dziepak 	S_IFREG, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, S_IFSOCK, S_IFIFO,
123*212de720SPawel Dziepak 	S_IFDIR, S_IFREG
124d38e98d8SPawel Dziepak };
125d38e98d8SPawel Dziepak 
1264aeb5952SPawel Dziepak enum FileHandleExpiryType {
1274aeb5952SPawel Dziepak 	FH4_PERSISTENT			= 0x00,
1284aeb5952SPawel Dziepak 	FH4_NOEXPIRE_WITH_OPEN	= 0x01,
1294aeb5952SPawel Dziepak 	FH4_VOLATILE_ANY		= 0x02,
1304aeb5952SPawel Dziepak 	FH4_VOL_MIGRATION		= 0x04,
1314aeb5952SPawel Dziepak 	FH4_VOL_RENAME			= 0x08
1324aeb5952SPawel Dziepak };
1334aeb5952SPawel Dziepak 
1344aeb5952SPawel Dziepak enum Errors {
1354aeb5952SPawel Dziepak 	NFS4_OK			= 0,
1364aeb5952SPawel Dziepak 	NFS4ERR_PERM	= 1,
1374aeb5952SPawel Dziepak 	NFS4ERR_NOENT	= 2,
1384aeb5952SPawel Dziepak 	NFS4ERR_IO		= 5,
1394aeb5952SPawel Dziepak 	NFS4ERR_NXIO	= 6,
1404aeb5952SPawel Dziepak 	NFS4ERR_ACCESS	= 13,
1414aeb5952SPawel Dziepak 	NFS4ERR_EXIST	= 17,
1424aeb5952SPawel Dziepak 	NFS4ERR_XDEV	= 18,
1434aeb5952SPawel Dziepak 	NFS4ERR_NOTDIR	= 20,
1444aeb5952SPawel Dziepak 	NFS4ERR_ISDIR	= 21,
1454aeb5952SPawel Dziepak 	NFS4ERR_INVAL	= 22,
1464aeb5952SPawel Dziepak 	NFS4ERR_FBIG	= 27
1474aeb5952SPawel Dziepak 	//...
1484aeb5952SPawel Dziepak };
1494aeb5952SPawel Dziepak 
1504aeb5952SPawel Dziepak 
1514aeb5952SPawel Dziepak #endif	// NFS4DEFS_H
1524aeb5952SPawel Dziepak 
153