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, 284aeb5952SPawel Dziepak OpLookUp = 15, 297bfa4fe8SPawel Dziepak OpLookUpUp = 16, 302a292557SPawel Dziepak OpOpen = 18, 312a292557SPawel Dziepak OpOpenConfirm = 20, 32bf31ee39SPawel Dziepak OpPutFH = 22, 334b48348fSPawel Dziepak OpPutRootFH = 24, 342f2e57d0SPawel Dziepak OpRead = 25, 352a292557SPawel Dziepak OpReadDir = 26, 36f2da914dSPawel Dziepak OpReadLink = 27, 3727a291deSPawel Dziepak OpRenew = 30, 382a292557SPawel Dziepak OpSetClientID = 35, 392a292557SPawel Dziepak OpSetClientIDConfirm = 36 404aeb5952SPawel Dziepak }; 414aeb5952SPawel Dziepak 424aeb5952SPawel Dziepak enum Access { 434aeb5952SPawel Dziepak ACCESS4_READ = 0x00000001, 444aeb5952SPawel Dziepak ACCESS4_LOOKUP = 0x00000002, 454aeb5952SPawel Dziepak ACCESS4_MODIFY = 0x00000004, 464aeb5952SPawel Dziepak ACCESS4_EXTEND = 0x00000008, 474aeb5952SPawel Dziepak ACCESS4_DELETE = 0x00000010, 484aeb5952SPawel Dziepak ACCESS4_EXECUTE = 0x00000020 494aeb5952SPawel Dziepak }; 504aeb5952SPawel Dziepak 514aeb5952SPawel Dziepak enum Attribute { 524aeb5952SPawel Dziepak // Mandatory Attributes 534aeb5952SPawel Dziepak FATTR4_SUPPORTED_ATTRS = 0, 544aeb5952SPawel Dziepak FATTR4_TYPE = 1, 554aeb5952SPawel Dziepak FATTR4_FH_EXPIRE_TYPE = 2, 564aeb5952SPawel Dziepak FATTR4_CHANGE = 3, 574aeb5952SPawel Dziepak FATTR4_SIZE = 4, 584aeb5952SPawel Dziepak FATTR4_LINK_SUPPORT = 5, 594aeb5952SPawel Dziepak FATTR4_SYMLINK_SUPPORT = 6, 604aeb5952SPawel Dziepak FATTR4_NAMED_ATTR = 7, 614aeb5952SPawel Dziepak FATTR4_FSID = 8, 624aeb5952SPawel Dziepak FATTR4_UNIQUE_HANDLES = 9, 634aeb5952SPawel Dziepak FATTR4_LEASE_TIME = 10, 644aeb5952SPawel Dziepak FATTR4_RDATTR_ERROR = 11, 654aeb5952SPawel Dziepak FATTR4_FILEHANDLE = 19, 664aeb5952SPawel Dziepak 674aeb5952SPawel Dziepak // Recommended Attributes 684aeb5952SPawel Dziepak FATTR4_ACL = 12, 694aeb5952SPawel Dziepak FATTR4_ACLSUPPORT = 13, 704aeb5952SPawel Dziepak FATTR4_ARCHIVE = 14, 714aeb5952SPawel Dziepak FATTR4_CANSETTIME = 15, 724aeb5952SPawel Dziepak FATTR4_CASE_INSENSITIVE = 16, 734aeb5952SPawel Dziepak FATTR4_CASE_PRESERVING = 17, 744aeb5952SPawel Dziepak FATTR4_CHOWN_RESTRICTED = 18, 754aeb5952SPawel Dziepak FATTR4_FILEID = 20, 764aeb5952SPawel Dziepak FATTR4_FILES_AVAIL = 21, 774aeb5952SPawel Dziepak FATTR4_FILES_FREE = 22, 784aeb5952SPawel Dziepak FATTR4_FILES_TOTAL = 23, 794aeb5952SPawel Dziepak FATTR4_FS_LOCATIONS = 24, 804aeb5952SPawel Dziepak FATTR4_HIDDEN = 25, 814aeb5952SPawel Dziepak FATTR4_HOMOGENEOUS = 26, 824aeb5952SPawel Dziepak FATTR4_MAXFILESIZE = 27, 834aeb5952SPawel Dziepak FATTR4_MAXLINK = 28, 844aeb5952SPawel Dziepak FATTR4_MAXNAME = 29, 854aeb5952SPawel Dziepak FATTR4_MAXREAD = 30, 864aeb5952SPawel Dziepak FATTR4_MAXWRITE = 31, 874aeb5952SPawel Dziepak FATTR4_MIMETYPE = 32, 884aeb5952SPawel Dziepak FATTR4_MODE = 33, 894aeb5952SPawel Dziepak FATTR4_NO_TRUNC = 34, 904aeb5952SPawel Dziepak FATTR4_NUMLINKS = 35, 914aeb5952SPawel Dziepak FATTR4_OWNER = 36, 924aeb5952SPawel Dziepak FATTR4_OWNER_GROUP = 37, 934aeb5952SPawel Dziepak FATTR4_QUOTA_AVAIL_HARD = 38, 944aeb5952SPawel Dziepak FATTR4_QUOTA_AVAIL_SOFT = 39, 954aeb5952SPawel Dziepak FATTR4_QUOTA_USED = 40, 964aeb5952SPawel Dziepak FATTR4_RAWDEV = 41, 974aeb5952SPawel Dziepak FATTR4_SPACE_AVAIL = 42, 984aeb5952SPawel Dziepak FATTR4_SPACE_FREE = 43, 994aeb5952SPawel Dziepak FATTR4_SPACE_TOTAL = 44, 1004aeb5952SPawel Dziepak FATTR4_SPACE_USED = 45, 1014aeb5952SPawel Dziepak FATTR4_SYSTEM = 46, 1024aeb5952SPawel Dziepak FATTR4_TIME_ACCESS = 47, 1034aeb5952SPawel Dziepak FATTR4_TIME_ACCESS_SET = 48, 1044aeb5952SPawel Dziepak FATTR4_TIME_BACKUP = 49, 1054aeb5952SPawel Dziepak FATTR4_TIME_CREATE = 50, 1064aeb5952SPawel Dziepak FATTR4_TIME_DELTA = 51, 1074aeb5952SPawel Dziepak FATTR4_TIME_METADATA = 52, 1084aeb5952SPawel Dziepak FATTR4_TIME_MODIFY = 53, 1094aeb5952SPawel Dziepak FATTR4_TIME_MODIFY_SET = 54, 110f29ac4afSPawel Dziepak FATTR4_MOUNTED_ON_FILEID = 55, 111f29ac4afSPawel Dziepak FATTR4_MAXIMUM_ATTR_ID 1124aeb5952SPawel Dziepak }; 1134aeb5952SPawel Dziepak 114d38e98d8SPawel Dziepak enum FileType { 115d38e98d8SPawel Dziepak NF4REG = 1, /* Regular File */ 116d38e98d8SPawel Dziepak NF4DIR = 2, /* Directory */ 117d38e98d8SPawel Dziepak NF4BLK = 3, /* Special File - block device */ 118d38e98d8SPawel Dziepak NF4CHR = 4, /* Special File - character device */ 119d38e98d8SPawel Dziepak NF4LNK = 5, /* Symbolic Link */ 120d38e98d8SPawel Dziepak NF4SOCK = 6, /* Special File - socket */ 121d38e98d8SPawel Dziepak NF4FIFO = 7, /* Special File - fifo */ 122d38e98d8SPawel Dziepak NF4ATTRDIR = 8, /* Attribute Directory */ 123d38e98d8SPawel Dziepak NF4NAMEDATTR = 9 /* Named Attribute */ 124d38e98d8SPawel Dziepak }; 125d38e98d8SPawel Dziepak 126d38e98d8SPawel Dziepak static const mode_t sNFSFileTypeToHaiku[] = { 127212de720SPawel Dziepak S_IFREG, S_IFREG, S_IFDIR, S_IFBLK, S_IFCHR, S_IFLNK, S_IFSOCK, S_IFIFO, 128212de720SPawel Dziepak S_IFDIR, S_IFREG 129d38e98d8SPawel Dziepak }; 130d38e98d8SPawel Dziepak 1314aeb5952SPawel Dziepak enum FileHandleExpiryType { 1324aeb5952SPawel Dziepak FH4_PERSISTENT = 0x00, 1334aeb5952SPawel Dziepak FH4_NOEXPIRE_WITH_OPEN = 0x01, 1344aeb5952SPawel Dziepak FH4_VOLATILE_ANY = 0x02, 1354aeb5952SPawel Dziepak FH4_VOL_MIGRATION = 0x04, 1364aeb5952SPawel Dziepak FH4_VOL_RENAME = 0x08 1374aeb5952SPawel Dziepak }; 1384aeb5952SPawel Dziepak 1392a292557SPawel Dziepak enum OpenAccess { 1402a292557SPawel Dziepak OPEN4_SHARE_ACCESS_READ = 1, 1412a292557SPawel Dziepak OPEN4_SHARE_ACCESS_WRITE = 2 1422a292557SPawel Dziepak }; 1432a292557SPawel Dziepak 1442a292557SPawel Dziepak enum OpenCreate { 1452a292557SPawel Dziepak OPEN4_NOCREATE = 0, 1462a292557SPawel Dziepak OPEN4_CREATE = 1 1472a292557SPawel Dziepak }; 1482a292557SPawel Dziepak 149*d1e6b61eSPawel Dziepak enum OpenClaim { 150*d1e6b61eSPawel Dziepak CLAIM_NULL = 0, 151*d1e6b61eSPawel Dziepak CLAIM_PREVIOUS = 1, 152*d1e6b61eSPawel Dziepak CLAIM_DELEGATE_CUR = 2, 153*d1e6b61eSPawel Dziepak CLAIM_DELEGATE_PREV = 3 154*d1e6b61eSPawel Dziepak }; 155*d1e6b61eSPawel Dziepak 1562a292557SPawel Dziepak enum OpenFlags { 1572a292557SPawel Dziepak OPEN4_RESULT_CONFIRM = 2, 1582a292557SPawel Dziepak OPEN4_RESULT_LOCKTYPE_POSIX = 4 1592a292557SPawel Dziepak }; 1602a292557SPawel Dziepak 1614aeb5952SPawel Dziepak enum Errors { 1624aeb5952SPawel Dziepak NFS4_OK = 0, 1634aeb5952SPawel Dziepak NFS4ERR_PERM = 1, 1644aeb5952SPawel Dziepak NFS4ERR_NOENT = 2, 1654aeb5952SPawel Dziepak NFS4ERR_IO = 5, 1664aeb5952SPawel Dziepak NFS4ERR_NXIO = 6, 1674aeb5952SPawel Dziepak NFS4ERR_ACCESS = 13, 1684aeb5952SPawel Dziepak NFS4ERR_EXIST = 17, 1694aeb5952SPawel Dziepak NFS4ERR_XDEV = 18, 1704aeb5952SPawel Dziepak NFS4ERR_NOTDIR = 20, 1714aeb5952SPawel Dziepak NFS4ERR_ISDIR = 21, 1724aeb5952SPawel Dziepak NFS4ERR_INVAL = 22, 173b268b6f2SPawel Dziepak NFS4ERR_FBIG = 27, 174b268b6f2SPawel Dziepak NFS4ERR_BADHANDLE = 10001, 175b268b6f2SPawel Dziepak NFS4ERR_BAD_COOKIE = 10003, 176b268b6f2SPawel Dziepak NFS4ERR_NOTSUPP = 10004, 177b268b6f2SPawel Dziepak NFS4ERR_TOOSMALL = 10005, 178b268b6f2SPawel Dziepak NFS4ERR_SERVERFAULT = 10006, 179b268b6f2SPawel Dziepak NFS4ERR_BADTYPE = 10007, 180b268b6f2SPawel Dziepak NFS4ERR_DELAY = 10008, 181b268b6f2SPawel Dziepak NFS4ERR_SAME = 10009, 182b268b6f2SPawel Dziepak NFS4ERR_DENIED = 10010, 183b268b6f2SPawel Dziepak NFS4ERR_EXPIRED = 10011, 184b268b6f2SPawel Dziepak NFS4ERR_LOCKED = 10012, 185b268b6f2SPawel Dziepak NFS4ERR_GRACE = 10013, 186b268b6f2SPawel Dziepak NFS4ERR_FHEXPIRED = 10014, 187b268b6f2SPawel Dziepak NFS4ERR_SHARE_DENIED = 10015, 188b268b6f2SPawel Dziepak NFS4ERR_WRONGSEC = 10016, 189b268b6f2SPawel Dziepak NFS4ERR_CLID_INUSE = 10017, 190b268b6f2SPawel Dziepak NFS4ERR_RESOURCE = 10018, 191b268b6f2SPawel Dziepak NFS4ERR_MOVED = 10019, 192b268b6f2SPawel Dziepak NFS4ERR_NOFILEHANDLE = 10020, 193b268b6f2SPawel Dziepak NFS4ERR_MINOR_VERS_MISMATCH = 10021, 194b268b6f2SPawel Dziepak NFS4ERR_STALE_CLIENTID = 10022, 195b268b6f2SPawel Dziepak NFS4ERR_STALE_STATEID = 10023, 196b268b6f2SPawel Dziepak NFS4ERR_OLD_STATEID = 10024, 197b268b6f2SPawel Dziepak NFS4ERR_BAD_STATEID = 10025, 198b268b6f2SPawel Dziepak NFS4ERR_BAD_SEQID = 10026, 199b268b6f2SPawel Dziepak NFS4ERR_NOT_SAME = 10027, 200b268b6f2SPawel Dziepak NFS4ERR_LOCK_RANGE = 10028, 201b268b6f2SPawel Dziepak NFS4ERR_SYMLINK = 10029, 202b268b6f2SPawel Dziepak NFS4ERR_RESTOREFH = 10030, 203b268b6f2SPawel Dziepak NFS4ERR_LEASE_MOVED = 10031, 204b268b6f2SPawel Dziepak NFS4ERR_ATTRNOTSUPP = 10032, 205b268b6f2SPawel Dziepak NFS4ERR_NO_GRACE = 10033, 206b268b6f2SPawel Dziepak NFS4ERR_RECLAIM_BAD = 10034, 207b268b6f2SPawel Dziepak NFS4ERR_RECLAIM_CONFLICT = 10035, 208b268b6f2SPawel Dziepak NFS4ERR_BADXDR = 10036, 209b268b6f2SPawel Dziepak NFS4ERR_LOCKS_HELD = 10037, 210b268b6f2SPawel Dziepak NFS4ERR_OPENMODE = 10038, 211b268b6f2SPawel Dziepak NFS4ERR_BADOWNER = 10039, 212b268b6f2SPawel Dziepak NFS4ERR_BADCHAR = 10040, 213b268b6f2SPawel Dziepak NFS4ERR_BADNAME = 10041, 214b268b6f2SPawel Dziepak NFS4ERR_BAD_RANGE = 10042, 215b268b6f2SPawel Dziepak NFS4ERR_LOCK_NOTSUPP = 10043, 216b268b6f2SPawel Dziepak NFS4ERR_OP_ILLEGAL = 10044, 217b268b6f2SPawel Dziepak NFS4ERR_DEADLOCK = 10045, 218b268b6f2SPawel Dziepak NFS4ERR_FILE_OPEN = 10046, 219b268b6f2SPawel Dziepak NFS4ERR_ADMIN_REVOKED = 10047, 220b268b6f2SPawel Dziepak NFS4ERR_CB_PATH_DOWN = 10048 2214aeb5952SPawel Dziepak }; 2224aeb5952SPawel Dziepak 2234aeb5952SPawel Dziepak 2244aeb5952SPawel Dziepak #endif // NFS4DEFS_H 2254aeb5952SPawel Dziepak 226