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