Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * NFS protocol definitions
0004  *
0005  * This file contains constants mostly for Version 2 of the protocol,
0006  * but also has a couple of NFSv3 bits in (notably the error codes).
0007  */
0008 #ifndef _LINUX_NFS_H
0009 #define _LINUX_NFS_H
0010 
0011 #include <linux/sunrpc/msg_prot.h>
0012 #include <linux/string.h>
0013 #include <uapi/linux/nfs.h>
0014 
0015 /*
0016  * This is the kernel NFS client file handle representation
0017  */
0018 #define NFS_MAXFHSIZE       128
0019 struct nfs_fh {
0020     unsigned short      size;
0021     unsigned char       data[NFS_MAXFHSIZE];
0022 };
0023 
0024 /*
0025  * Returns a zero iff the size and data fields match.
0026  * Checks only "size" bytes in the data field.
0027  */
0028 static inline int nfs_compare_fh(const struct nfs_fh *a, const struct nfs_fh *b)
0029 {
0030     return a->size != b->size || memcmp(a->data, b->data, a->size) != 0;
0031 }
0032 
0033 static inline void nfs_copy_fh(struct nfs_fh *target, const struct nfs_fh *source)
0034 {
0035     target->size = source->size;
0036     memcpy(target->data, source->data, source->size);
0037 }
0038 
0039 enum nfs3_stable_how {
0040     NFS_UNSTABLE = 0,
0041     NFS_DATA_SYNC = 1,
0042     NFS_FILE_SYNC = 2,
0043 
0044     /* used by direct.c to mark verf as invalid */
0045     NFS_INVALID_STABLE_HOW = -1
0046 };
0047 #endif /* _LINUX_NFS_H */