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 167bfa4fe8SPawel Dziepak #include "Filehandle.h" 17196403c9SPawel Dziepak 184aeb5952SPawel Dziepak enum Procedure { 194aeb5952SPawel Dziepak ProcNull = 0, 204aeb5952SPawel Dziepak ProcCompound = 1 214aeb5952SPawel Dziepak }; 224aeb5952SPawel Dziepak 234aeb5952SPawel Dziepak enum Opcode { 244aeb5952SPawel Dziepak OpAccess = 3, 2560a8140dSPawel Dziepak OpClose = 4, 264aeb5952SPawel Dziepak OpGetAttr = 9, 274aeb5952SPawel Dziepak OpGetFH = 10, 28*c0de7acaSPawel Dziepak OpLink = 11, 294aeb5952SPawel Dziepak OpLookUp = 15, 307bfa4fe8SPawel Dziepak OpLookUpUp = 16, 312a292557SPawel Dziepak OpOpen = 18, 322a292557SPawel Dziepak OpOpenConfirm = 20, 33bf31ee39SPawel Dziepak OpPutFH = 22, 344b48348fSPawel Dziepak OpPutRootFH = 24, 352f2e57d0SPawel Dziepak OpRead = 25, 362a292557SPawel Dziepak OpReadDir = 26, 37f2da914dSPawel Dziepak OpReadLink = 27, 386fb3845bSPawel Dziepak OpRemove = 28, 391ec6b0c1SPawel Dziepak OpRename = 29, 4027a291deSPawel Dziepak OpRenew = 30, 411ec6b0c1SPawel Dziepak OpSaveFH = 32, 422a292557SPawel Dziepak OpSetClientID = 35, 43cf511f24SPawel Dziepak OpSetClientIDConfirm = 36, 44cf511f24SPawel Dziepak OpVerify = 37 454aeb5952SPawel Dziepak }; 464aeb5952SPawel Dziepak 474aeb5952SPawel Dziepak enum Access { 484aeb5952SPawel Dziepak ACCESS4_READ = 0x00000001, 494aeb5952SPawel Dziepak ACCESS4_LOOKUP = 0x00000002, 504aeb5952SPawel Dziepak ACCESS4_MODIFY = 0x00000004, 514aeb5952SPawel Dziepak ACCESS4_EXTEND = 0x00000008, 524aeb5952SPawel Dziepak ACCESS4_DELETE = 0x00000010, 534aeb5952SPawel Dziepak ACCESS4_EXECUTE = 0x00000020 544aeb5952SPawel Dziepak }; 554aeb5952SPawel Dziepak 564aeb5952SPawel Dziepak enum Attribute { 574aeb5952SPawel Dziepak // Mandatory Attributes 584aeb5952SPawel Dziepak FATTR4_SUPPORTED_ATTRS = 0, 594aeb5952SPawel Dziepak FATTR4_TYPE = 1, 604aeb5952SPawel Dziepak FATTR4_FH_EXPIRE_TYPE = 2, 614aeb5952SPawel Dziepak FATTR4_CHANGE = 3, 624aeb5952SPawel Dziepak FATTR4_SIZE = 4, 634aeb5952SPawel Dziepak FATTR4_LINK_SUPPORT = 5, 644aeb5952SPawel Dziepak FATTR4_SYMLINK_SUPPORT = 6, 654aeb5952SPawel Dziepak FATTR4_NAMED_ATTR = 7, 664aeb5952SPawel Dziepak FATTR4_FSID = 8, 674aeb5952SPawel Dziepak FATTR4_UNIQUE_HANDLES = 9, 684aeb5952SPawel Dziepak FATTR4_LEASE_TIME = 10, 694aeb5952SPawel Dziepak FATTR4_RDATTR_ERROR = 11, 704aeb5952SPawel Dziepak FATTR4_FILEHANDLE = 19, 714aeb5952SPawel Dziepak 724aeb5952SPawel Dziepak // Recommended Attributes 734aeb5952SPawel Dziepak FATTR4_ACL = 12, 744aeb5952SPawel Dziepak FATTR4_ACLSUPPORT = 13, 754aeb5952SPawel Dziepak FATTR4_ARCHIVE = 14, 764aeb5952SPawel Dziepak FATTR4_CANSETTIME = 15, 774aeb5952SPawel Dziepak FATTR4_CASE_INSENSITIVE = 16, 784aeb5952SPawel Dziepak FATTR4_CASE_PRESERVING = 17, 794aeb5952SPawel Dziepak FATTR4_CHOWN_RESTRICTED = 18, 804aeb5952SPawel Dziepak FATTR4_FILEID = 20, 814aeb5952SPawel Dziepak FATTR4_FILES_AVAIL = 21, 824aeb5952SPawel Dziepak FATTR4_FILES_FREE = 22, 834aeb5952SPawel Dziepak FATTR4_FILES_TOTAL = 23, 844aeb5952SPawel Dziepak FATTR4_FS_LOCATIONS = 24, 854aeb5952SPawel Dziepak FATTR4_HIDDEN = 25, 864aeb5952SPawel Dziepak FATTR4_HOMOGENEOUS = 26, 874aeb5952SPawel Dziepak FATTR4_MAXFILESIZE = 27, 884aeb5952SPawel Dziepak FATTR4_MAXLINK = 28, 894aeb5952SPawel Dziepak FATTR4_MAXNAME = 29, 904aeb5952SPawel Dziepak FATTR4_MAXREAD = 30, 914aeb5952SPawel Dziepak FATTR4_MAXWRITE = 31, 924aeb5952SPawel Dziepak FATTR4_MIMETYPE = 32, 934aeb5952SPawel Dziepak FATTR4_MODE = 33, 944aeb5952SPawel Dziepak FATTR4_NO_TRUNC = 34, 954aeb5952SPawel Dziepak FATTR4_NUMLINKS = 35, 964aeb5952SPawel Dziepak FATTR4_OWNER = 36, 974aeb5952SPawel Dziepak FATTR4_OWNER_GROUP = 37, 984aeb5952SPawel Dziepak FATTR4_QUOTA_AVAIL_HARD = 38, 994aeb5952SPawel Dziepak FATTR4_QUOTA_AVAIL_SOFT = 39, 1004aeb5952SPawel Dziepak FATTR4_QUOTA_USED = 40, 1014aeb5952SPawel Dziepak FATTR4_RAWDEV = 41, 1024aeb5952SPawel Dziepak FATTR4_SPACE_AVAIL = 42, 1034aeb5952SPawel Dziepak FATTR4_SPACE_FREE = 43, 1044aeb5952SPawel Dziepak FATTR4_SPACE_TOTAL = 44, 1054aeb5952SPawel Dziepak FATTR4_SPACE_USED = 45, 1064aeb5952SPawel Dziepak FATTR4_SYSTEM = 46, 1074aeb5952SPawel Dziepak FATTR4_TIME_ACCESS = 47, 1084aeb5952SPawel Dziepak FATTR4_TIME_ACCESS_SET = 48, 1094aeb5952SPawel Dziepak FATTR4_TIME_BACKUP = 49, 1104aeb5952SPawel Dziepak FATTR4_TIME_CREATE = 50, 1114aeb5952SPawel Dziepak FATTR4_TIME_DELTA = 51, 1124aeb5952SPawel Dziepak FATTR4_TIME_METADATA = 52, 1134aeb5952SPawel Dziepak FATTR4_TIME_MODIFY = 53, 1144aeb5952SPawel Dziepak FATTR4_TIME_MODIFY_SET = 54, 115f29ac4afSPawel Dziepak FATTR4_MOUNTED_ON_FILEID = 55, 116f29ac4afSPawel Dziepak FATTR4_MAXIMUM_ATTR_ID 1174aeb5952SPawel Dziepak }; 1184aeb5952SPawel Dziepak 119d38e98d8SPawel Dziepak enum FileType { 120d38e98d8SPawel Dziepak NF4REG = 1, /* Regular File */ 121d38e98d8SPawel Dziepak NF4DIR = 2, /* Directory */ 122d38e98d8SPawel Dziepak NF4BLK = 3, /* Special File - block device */ 123d38e98d8SPawel Dziepak NF4CHR = 4, /* Special File - character device */ 124d38e98d8SPawel Dziepak NF4LNK = 5, /* Symbolic Link */ 125d38e98d8SPawel Dziepak NF4SOCK = 6, /* Special File - socket */ 126d38e98d8SPawel Dziepak NF4FIFO = 7, /* Special File - fifo */ 127d38e98d8SPawel Dziepak NF4ATTRDIR = 8, /* Attribute Directory */ 128d38e98d8SPawel Dziepak NF4NAMEDATTR = 9 /* Named Attribute */ 129d38e98d8SPawel Dziepak }; 130d38e98d8SPawel Dziepak 131d38e98d8SPawel Dziepak static const mode_t sNFSFileTypeToHaiku[] = { 132212de720SPawel Dziepak S_IFREG, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, S_IFSOCK, S_IFIFO, 133212de720SPawel Dziepak S_IFDIR, S_IFREG 134d38e98d8SPawel Dziepak }; 135d38e98d8SPawel Dziepak 1364aeb5952SPawel Dziepak enum FileHandleExpiryType { 1374aeb5952SPawel Dziepak FH4_PERSISTENT = 0x00, 1384aeb5952SPawel Dziepak FH4_NOEXPIRE_WITH_OPEN = 0x01, 1394aeb5952SPawel Dziepak FH4_VOLATILE_ANY = 0x02, 1404aeb5952SPawel Dziepak FH4_VOL_MIGRATION = 0x04, 1414aeb5952SPawel Dziepak FH4_VOL_RENAME = 0x08 1424aeb5952SPawel Dziepak }; 1434aeb5952SPawel Dziepak 1442a292557SPawel Dziepak enum OpenAccess { 1452a292557SPawel Dziepak OPEN4_SHARE_ACCESS_READ = 1, 1462a292557SPawel Dziepak OPEN4_SHARE_ACCESS_WRITE = 2 1472a292557SPawel Dziepak }; 1482a292557SPawel Dziepak 1492a292557SPawel Dziepak enum OpenCreate { 1502a292557SPawel Dziepak OPEN4_NOCREATE = 0, 1512a292557SPawel Dziepak OPEN4_CREATE = 1 1522a292557SPawel Dziepak }; 1532a292557SPawel Dziepak 154d1e6b61eSPawel Dziepak enum OpenClaim { 155d1e6b61eSPawel Dziepak CLAIM_NULL = 0, 156d1e6b61eSPawel Dziepak CLAIM_PREVIOUS = 1, 157d1e6b61eSPawel Dziepak CLAIM_DELEGATE_CUR = 2, 158d1e6b61eSPawel Dziepak CLAIM_DELEGATE_PREV = 3 159d1e6b61eSPawel Dziepak }; 160d1e6b61eSPawel Dziepak 1612a292557SPawel Dziepak enum OpenFlags { 1622a292557SPawel Dziepak OPEN4_RESULT_CONFIRM = 2, 1632a292557SPawel Dziepak OPEN4_RESULT_LOCKTYPE_POSIX = 4 1642a292557SPawel Dziepak }; 1652a292557SPawel Dziepak 1664aeb5952SPawel Dziepak enum Errors { 1674aeb5952SPawel Dziepak NFS4_OK = 0, 1684aeb5952SPawel Dziepak NFS4ERR_PERM = 1, 1694aeb5952SPawel Dziepak NFS4ERR_NOENT = 2, 1704aeb5952SPawel Dziepak NFS4ERR_IO = 5, 1714aeb5952SPawel Dziepak NFS4ERR_NXIO = 6, 1724aeb5952SPawel Dziepak NFS4ERR_ACCESS = 13, 1734aeb5952SPawel Dziepak NFS4ERR_EXIST = 17, 1744aeb5952SPawel Dziepak NFS4ERR_XDEV = 18, 1754aeb5952SPawel Dziepak NFS4ERR_NOTDIR = 20, 1764aeb5952SPawel Dziepak NFS4ERR_ISDIR = 21, 1774aeb5952SPawel Dziepak NFS4ERR_INVAL = 22, 178b268b6f2SPawel Dziepak NFS4ERR_FBIG = 27, 179b268b6f2SPawel Dziepak NFS4ERR_BADHANDLE = 10001, 180b268b6f2SPawel Dziepak NFS4ERR_BAD_COOKIE = 10003, 181b268b6f2SPawel Dziepak NFS4ERR_NOTSUPP = 10004, 182b268b6f2SPawel Dziepak NFS4ERR_TOOSMALL = 10005, 183b268b6f2SPawel Dziepak NFS4ERR_SERVERFAULT = 10006, 184b268b6f2SPawel Dziepak NFS4ERR_BADTYPE = 10007, 185b268b6f2SPawel Dziepak NFS4ERR_DELAY = 10008, 186b268b6f2SPawel Dziepak NFS4ERR_SAME = 10009, 187b268b6f2SPawel Dziepak NFS4ERR_DENIED = 10010, 188b268b6f2SPawel Dziepak NFS4ERR_EXPIRED = 10011, 189b268b6f2SPawel Dziepak NFS4ERR_LOCKED = 10012, 190b268b6f2SPawel Dziepak NFS4ERR_GRACE = 10013, 191b268b6f2SPawel Dziepak NFS4ERR_FHEXPIRED = 10014, 192b268b6f2SPawel Dziepak NFS4ERR_SHARE_DENIED = 10015, 193b268b6f2SPawel Dziepak NFS4ERR_WRONGSEC = 10016, 194b268b6f2SPawel Dziepak NFS4ERR_CLID_INUSE = 10017, 195b268b6f2SPawel Dziepak NFS4ERR_RESOURCE = 10018, 196b268b6f2SPawel Dziepak NFS4ERR_MOVED = 10019, 197b268b6f2SPawel Dziepak NFS4ERR_NOFILEHANDLE = 10020, 198b268b6f2SPawel Dziepak NFS4ERR_MINOR_VERS_MISMATCH = 10021, 199b268b6f2SPawel Dziepak NFS4ERR_STALE_CLIENTID = 10022, 200b268b6f2SPawel Dziepak NFS4ERR_STALE_STATEID = 10023, 201b268b6f2SPawel Dziepak NFS4ERR_OLD_STATEID = 10024, 202b268b6f2SPawel Dziepak NFS4ERR_BAD_STATEID = 10025, 203b268b6f2SPawel Dziepak NFS4ERR_BAD_SEQID = 10026, 204b268b6f2SPawel Dziepak NFS4ERR_NOT_SAME = 10027, 205b268b6f2SPawel Dziepak NFS4ERR_LOCK_RANGE = 10028, 206b268b6f2SPawel Dziepak NFS4ERR_SYMLINK = 10029, 207b268b6f2SPawel Dziepak NFS4ERR_RESTOREFH = 10030, 208b268b6f2SPawel Dziepak NFS4ERR_LEASE_MOVED = 10031, 209b268b6f2SPawel Dziepak NFS4ERR_ATTRNOTSUPP = 10032, 210b268b6f2SPawel Dziepak NFS4ERR_NO_GRACE = 10033, 211b268b6f2SPawel Dziepak NFS4ERR_RECLAIM_BAD = 10034, 212b268b6f2SPawel Dziepak NFS4ERR_RECLAIM_CONFLICT = 10035, 213b268b6f2SPawel Dziepak NFS4ERR_BADXDR = 10036, 214b268b6f2SPawel Dziepak NFS4ERR_LOCKS_HELD = 10037, 215b268b6f2SPawel Dziepak NFS4ERR_OPENMODE = 10038, 216b268b6f2SPawel Dziepak NFS4ERR_BADOWNER = 10039, 217b268b6f2SPawel Dziepak NFS4ERR_BADCHAR = 10040, 218b268b6f2SPawel Dziepak NFS4ERR_BADNAME = 10041, 219b268b6f2SPawel Dziepak NFS4ERR_BAD_RANGE = 10042, 220b268b6f2SPawel Dziepak NFS4ERR_LOCK_NOTSUPP = 10043, 221b268b6f2SPawel Dziepak NFS4ERR_OP_ILLEGAL = 10044, 222b268b6f2SPawel Dziepak NFS4ERR_DEADLOCK = 10045, 223b268b6f2SPawel Dziepak NFS4ERR_FILE_OPEN = 10046, 224b268b6f2SPawel Dziepak NFS4ERR_ADMIN_REVOKED = 10047, 225b268b6f2SPawel Dziepak NFS4ERR_CB_PATH_DOWN = 10048 2264aeb5952SPawel Dziepak }; 2274aeb5952SPawel Dziepak 2284aeb5952SPawel Dziepak 2294aeb5952SPawel Dziepak #endif // NFS4DEFS_H 2304aeb5952SPawel Dziepak 231