Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [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 _LINUX_NFS_H |
| 8 | #define _LINUX_NFS_H |
| 9 | |
David Woodhouse | 997b7af | 2006-04-25 14:51:45 +0100 | [diff] [blame] | 10 | #include <linux/sunrpc/msg_prot.h> |
| 11 | #include <linux/string.h> |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 12 | #include <uapi/linux/nfs.h> |
David Woodhouse | 997b7af | 2006-04-25 14:51:45 +0100 | [diff] [blame] | 13 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | /* |
| 15 | * This is the kernel NFS client file handle representation |
| 16 | */ |
| 17 | #define NFS_MAXFHSIZE 128 |
| 18 | struct nfs_fh { |
| 19 | unsigned short size; |
| 20 | unsigned char data[NFS_MAXFHSIZE]; |
| 21 | }; |
| 22 | |
| 23 | /* |
| 24 | * Returns a zero iff the size and data fields match. |
| 25 | * Checks only "size" bytes in the data field. |
| 26 | */ |
| 27 | static inline int nfs_compare_fh(const struct nfs_fh *a, const struct nfs_fh *b) |
| 28 | { |
| 29 | return a->size != b->size || memcmp(a->data, b->data, a->size) != 0; |
| 30 | } |
| 31 | |
| 32 | static inline void nfs_copy_fh(struct nfs_fh *target, const struct nfs_fh *source) |
| 33 | { |
| 34 | target->size = source->size; |
| 35 | memcpy(target->data, source->data, source->size); |
| 36 | } |
| 37 | |
| 38 | |
| 39 | /* |
| 40 | * This is really a general kernel constant, but since nothing like |
| 41 | * this is defined in the kernel headers, I have to do it here. |
| 42 | */ |
| 43 | #define NFS_OFFSET_MAX ((__s64)((~(__u64)0) >> 1)) |
| 44 | |
| 45 | |
| 46 | enum nfs3_stable_how { |
| 47 | NFS_UNSTABLE = 0, |
| 48 | NFS_DATA_SYNC = 1, |
Weston Andros Adamson | 5002c58 | 2014-05-15 11:56:54 -0400 | [diff] [blame] | 49 | NFS_FILE_SYNC = 2, |
| 50 | |
| 51 | /* used by direct.c to mark verf as invalid */ |
| 52 | NFS_INVALID_STABLE_HOW = -1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | #endif /* _LINUX_NFS_H */ |