printf: Remove unused 'bprintf'
[drm/drm-misc.git] / include / linux / nfs.h
blob9ad727ddfedb34646b70f40da1f33ee9b04ae0d7
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * NFS protocol definitions
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
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>
18 /* The LOCALIO program is entirely private to Linux and is
19 * NOT part of the uapi.
21 #define NFS_LOCALIO_PROGRAM 400122
22 #define LOCALIOPROC_NULL 0
23 #define LOCALIOPROC_UUID_IS_LOCAL 1
26 * This is the kernel NFS client file handle representation
28 #define NFS_MAXFHSIZE 128
29 struct nfs_fh {
30 unsigned short size;
31 unsigned char data[NFS_MAXFHSIZE];
35 * Returns a zero iff the size and data fields match.
36 * Checks only "size" bytes in the data field.
38 static inline int nfs_compare_fh(const struct nfs_fh *a, const struct nfs_fh *b)
40 return a->size != b->size || memcmp(a->data, b->data, a->size) != 0;
43 static inline void nfs_copy_fh(struct nfs_fh *target, const struct nfs_fh *source)
45 target->size = source->size;
46 memcpy(target->data, source->data, source->size);
49 enum nfs3_stable_how {
50 NFS_UNSTABLE = 0,
51 NFS_DATA_SYNC = 1,
52 NFS_FILE_SYNC = 2,
54 /* used by direct.c to mark verf as invalid */
55 NFS_INVALID_STABLE_HOW = -1
58 #ifdef CONFIG_CRC32
59 /**
60 * nfs_fhandle_hash - calculate the crc32 hash for the filehandle
61 * @fh - pointer to filehandle
63 * returns a crc32 hash for the filehandle that is compatible with
64 * the one displayed by "wireshark".
66 static inline u32 nfs_fhandle_hash(const struct nfs_fh *fh)
68 return ~crc32_le(0xFFFFFFFF, &fh->data[0], fh->size);
70 #else /* CONFIG_CRC32 */
71 static inline u32 nfs_fhandle_hash(const struct nfs_fh *fh)
73 return 0;
75 #endif /* CONFIG_CRC32 */
76 #endif /* _LINUX_NFS_H */