David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 1 | /* |
| 2 | * NFS protocol definitions |
| 3 | * |
| 4 | * This file contains constants mostly for Version 2 of the protocol, |
| 5 | * but also has a couple of NFSv3 bits in (notably the error codes). |
| 6 | */ |
| 7 | #ifndef _UAPI_LINUX_NFS_H |
| 8 | #define _UAPI_LINUX_NFS_H |
| 9 | |
Peng Tao | b9788a4 | 2015-10-21 03:18:16 +0800 | [diff] [blame] | 10 | #include <linux/types.h> |
| 11 | |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 12 | #define NFS_PROGRAM 100003 |
| 13 | #define NFS_PORT 2049 |
| 14 | #define NFS_MAXDATA 8192 |
| 15 | #define NFS_MAXPATHLEN 1024 |
| 16 | #define NFS_MAXNAMLEN 255 |
| 17 | #define NFS_MAXGROUPS 16 |
| 18 | #define NFS_FHSIZE 32 |
| 19 | #define NFS_COOKIESIZE 4 |
| 20 | #define NFS_FIFO_DEV (-1) |
| 21 | #define NFSMODE_FMT 0170000 |
| 22 | #define NFSMODE_DIR 0040000 |
| 23 | #define NFSMODE_CHR 0020000 |
| 24 | #define NFSMODE_BLK 0060000 |
| 25 | #define NFSMODE_REG 0100000 |
| 26 | #define NFSMODE_LNK 0120000 |
| 27 | #define NFSMODE_SOCK 0140000 |
| 28 | #define NFSMODE_FIFO 0010000 |
| 29 | |
| 30 | #define NFS_MNT_PROGRAM 100005 |
| 31 | #define NFS_MNT_VERSION 1 |
| 32 | #define NFS_MNT3_VERSION 3 |
| 33 | |
| 34 | #define NFS_PIPE_DIRNAME "nfs" |
| 35 | |
Peng Tao | bea51b3 | 2015-09-26 02:24:36 +0800 | [diff] [blame] | 36 | /* NFS ioctls */ |
| 37 | /* Let's follow btrfs lead on CLONE to avoid messing userspace */ |
Peng Tao | a340abc | 2015-09-26 02:24:39 +0800 | [diff] [blame] | 38 | #define NFS_IOC_CLONE _IOW(0x94, 9, int) |
| 39 | #define NFS_IOC_CLONE_RANGE _IOW(0x94, 13, int) |
| 40 | |
| 41 | struct nfs_ioctl_clone_range_args { |
| 42 | __s64 src_fd; |
| 43 | __u64 src_off, count; |
| 44 | __u64 dst_off; |
| 45 | }; |
Peng Tao | bea51b3 | 2015-09-26 02:24:36 +0800 | [diff] [blame] | 46 | |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 47 | /* |
| 48 | * NFS stats. The good thing with these values is that NFSv3 errors are |
| 49 | * a superset of NFSv2 errors (with the exception of NFSERR_WFLUSH which |
| 50 | * no-one uses anyway), so we can happily mix code as long as we make sure |
| 51 | * no NFSv3 errors are returned to NFSv2 clients. |
| 52 | * Error codes that have a `--' in the v2 column are not part of the |
| 53 | * standard, but seem to be widely used nevertheless. |
| 54 | */ |
| 55 | enum nfs_stat { |
| 56 | NFS_OK = 0, /* v2 v3 v4 */ |
| 57 | NFSERR_PERM = 1, /* v2 v3 v4 */ |
| 58 | NFSERR_NOENT = 2, /* v2 v3 v4 */ |
| 59 | NFSERR_IO = 5, /* v2 v3 v4 */ |
| 60 | NFSERR_NXIO = 6, /* v2 v3 v4 */ |
| 61 | NFSERR_EAGAIN = 11, /* v2 v3 */ |
| 62 | NFSERR_ACCES = 13, /* v2 v3 v4 */ |
| 63 | NFSERR_EXIST = 17, /* v2 v3 v4 */ |
| 64 | NFSERR_XDEV = 18, /* v3 v4 */ |
| 65 | NFSERR_NODEV = 19, /* v2 v3 v4 */ |
| 66 | NFSERR_NOTDIR = 20, /* v2 v3 v4 */ |
| 67 | NFSERR_ISDIR = 21, /* v2 v3 v4 */ |
| 68 | NFSERR_INVAL = 22, /* v2 v3 v4 */ |
| 69 | NFSERR_FBIG = 27, /* v2 v3 v4 */ |
| 70 | NFSERR_NOSPC = 28, /* v2 v3 v4 */ |
| 71 | NFSERR_ROFS = 30, /* v2 v3 v4 */ |
| 72 | NFSERR_MLINK = 31, /* v3 v4 */ |
| 73 | NFSERR_OPNOTSUPP = 45, /* v2 v3 */ |
| 74 | NFSERR_NAMETOOLONG = 63, /* v2 v3 v4 */ |
| 75 | NFSERR_NOTEMPTY = 66, /* v2 v3 v4 */ |
| 76 | NFSERR_DQUOT = 69, /* v2 v3 v4 */ |
| 77 | NFSERR_STALE = 70, /* v2 v3 v4 */ |
| 78 | NFSERR_REMOTE = 71, /* v2 v3 */ |
| 79 | NFSERR_WFLUSH = 99, /* v2 */ |
| 80 | NFSERR_BADHANDLE = 10001, /* v3 v4 */ |
| 81 | NFSERR_NOT_SYNC = 10002, /* v3 */ |
| 82 | NFSERR_BAD_COOKIE = 10003, /* v3 v4 */ |
| 83 | NFSERR_NOTSUPP = 10004, /* v3 v4 */ |
| 84 | NFSERR_TOOSMALL = 10005, /* v3 v4 */ |
| 85 | NFSERR_SERVERFAULT = 10006, /* v3 v4 */ |
| 86 | NFSERR_BADTYPE = 10007, /* v3 v4 */ |
| 87 | NFSERR_JUKEBOX = 10008, /* v3 v4 */ |
| 88 | NFSERR_SAME = 10009, /* v4 */ |
| 89 | NFSERR_DENIED = 10010, /* v4 */ |
| 90 | NFSERR_EXPIRED = 10011, /* v4 */ |
| 91 | NFSERR_LOCKED = 10012, /* v4 */ |
| 92 | NFSERR_GRACE = 10013, /* v4 */ |
| 93 | NFSERR_FHEXPIRED = 10014, /* v4 */ |
| 94 | NFSERR_SHARE_DENIED = 10015, /* v4 */ |
| 95 | NFSERR_WRONGSEC = 10016, /* v4 */ |
| 96 | NFSERR_CLID_INUSE = 10017, /* v4 */ |
| 97 | NFSERR_RESOURCE = 10018, /* v4 */ |
| 98 | NFSERR_MOVED = 10019, /* v4 */ |
| 99 | NFSERR_NOFILEHANDLE = 10020, /* v4 */ |
| 100 | NFSERR_MINOR_VERS_MISMATCH = 10021, /* v4 */ |
| 101 | NFSERR_STALE_CLIENTID = 10022, /* v4 */ |
| 102 | NFSERR_STALE_STATEID = 10023, /* v4 */ |
| 103 | NFSERR_OLD_STATEID = 10024, /* v4 */ |
| 104 | NFSERR_BAD_STATEID = 10025, /* v4 */ |
| 105 | NFSERR_BAD_SEQID = 10026, /* v4 */ |
| 106 | NFSERR_NOT_SAME = 10027, /* v4 */ |
| 107 | NFSERR_LOCK_RANGE = 10028, /* v4 */ |
| 108 | NFSERR_SYMLINK = 10029, /* v4 */ |
| 109 | NFSERR_RESTOREFH = 10030, /* v4 */ |
| 110 | NFSERR_LEASE_MOVED = 10031, /* v4 */ |
| 111 | NFSERR_ATTRNOTSUPP = 10032, /* v4 */ |
| 112 | NFSERR_NO_GRACE = 10033, /* v4 */ |
| 113 | NFSERR_RECLAIM_BAD = 10034, /* v4 */ |
| 114 | NFSERR_RECLAIM_CONFLICT = 10035,/* v4 */ |
| 115 | NFSERR_BAD_XDR = 10036, /* v4 */ |
| 116 | NFSERR_LOCKS_HELD = 10037, /* v4 */ |
| 117 | NFSERR_OPENMODE = 10038, /* v4 */ |
| 118 | NFSERR_BADOWNER = 10039, /* v4 */ |
| 119 | NFSERR_BADCHAR = 10040, /* v4 */ |
| 120 | NFSERR_BADNAME = 10041, /* v4 */ |
| 121 | NFSERR_BAD_RANGE = 10042, /* v4 */ |
| 122 | NFSERR_LOCK_NOTSUPP = 10043, /* v4 */ |
| 123 | NFSERR_OP_ILLEGAL = 10044, /* v4 */ |
| 124 | NFSERR_DEADLOCK = 10045, /* v4 */ |
| 125 | NFSERR_FILE_OPEN = 10046, /* v4 */ |
| 126 | NFSERR_ADMIN_REVOKED = 10047, /* v4 */ |
| 127 | NFSERR_CB_PATH_DOWN = 10048, /* v4 */ |
| 128 | }; |
| 129 | |
| 130 | /* NFSv2 file types - beware, these are not the same in NFSv3 */ |
| 131 | |
| 132 | enum nfs_ftype { |
| 133 | NFNON = 0, |
| 134 | NFREG = 1, |
| 135 | NFDIR = 2, |
| 136 | NFBLK = 3, |
| 137 | NFCHR = 4, |
| 138 | NFLNK = 5, |
| 139 | NFSOCK = 6, |
| 140 | NFBAD = 7, |
| 141 | NFFIFO = 8 |
| 142 | }; |
| 143 | |
| 144 | #endif /* _UAPI_LINUX_NFS_H */ |