| 1 |
|
| 2 | |
| 3 | * NFS protocol definitions
|
| 4 | *
|
| 5 | * This file contains constants mostly for Version 2 of the protocol,
|
| 6 | * but also has a couple of NFSv3 bits in (notably the error codes).
|
| 7 |
|
| 8 | #ifndef _LINUX_NFS_H
|
| 9 | #define _LINUX_NFS_H
|
| 10 |
|
| 11 | #include <linux/cred.h>
|
| 12 | #include <linux/sunrpc/auth.h>
|
| 13 | #include <linux/sunrpc/msg_prot.h>
|
| 14 | #include <linux/string.h>
|
| 15 | #include <linux/crc32.h>
|
| 16 | #include <uapi/linux/nfs.h>
|
| 17 |
|
| 18 | |
| 19 | * NOT part of the uapi.
|
| 20 |
|
| 21 | #define NFS_LOCALIO_PROGRAM 400122
|
| 22 | #define LOCALIOPROC_NULL 0
|
| 23 | #define LOCALIOPROC_UUID_IS_LOCAL 1
|
| 24 |
|
| 25 | |
| 26 | * This is the kernel NFS client file handle representation
|
| 27 |
|
| 28 | #define NFS_MAXFHSIZE 128
|
| 29 | struct nfs_fh {
|
| 30 | unsigned short size;
|
| 31 | unsigned char data[NFS_MAXFHSIZE];
|
| 32 | };
|
| 33 |
|
| 34 | |
| 35 | * Returns a zero iff the size and data fields match.
|
| 36 | * Checks only "size" bytes in the data field.
|
| 37 |
|
| 38 | static inline int nfs_compare_fh(const struct nfs_fh *a, const struct nfs_fh *b)
|
| 39 | {
|
| 40 | return a->size != b->size || memcmp(a->data, b->data, a->size) != 0;
|
| 41 | }
|
| 42 |
|
| 43 | static inline void nfs_copy_fh(struct nfs_fh *target, const struct nfs_fh *source)
|
| 44 | {
|
| 45 | target->size = source->size;
|
| 46 | memcpy(target->data, source->data, source->size);
|
| 47 | }
|
| 48 |
|
| 49 | enum nfs3_stable_how {
|
| 50 | NFS_UNSTABLE = 0,
|
| 51 | NFS_DATA_SYNC = 1,
|
| 52 | NFS_FILE_SYNC = 2,
|
| 53 |
|
| 54 |
|
| 55 | NFS_INVALID_STABLE_HOW = -1
|
| 56 | };
|
| 57 |
|
| 58 | |
| 59 | * nfs_fhandle_hash - calculate the crc32 hash for the filehandle
|
| 60 | * @fh - pointer to filehandle
|
| 61 | *
|
| 62 | * returns a crc32 hash for the filehandle that is compatible with
|
| 63 | * the one displayed by "wireshark".
|
| 64 |
|
| 65 | static inline u32 nfs_fhandle_hash(const struct nfs_fh *fh)
|
| 66 | {
|
| 67 | return ~crc32_le(0xFFFFFFFF, &fh->data[0], fh->size);
|
| 68 | }
|
| 69 | #endif
|