Add proper per-file copyright notices/licenses and top-level license.
[bluesky.git] / TBBT / trace_play / nfsd_nfsfh_cust.h
1 #define __u32 unsigned int
2 #define u32 unsigned int
3 #define __u16 unsigned short
4 #define u16 unsigned short
5 #define __u64 unsigned long long
6 #define u64 unsigned long long
7 #define __u8 unsigned char
8 #define u8 unsigned char
9 #define __s64 signed long long
10
11 struct nfs_fhbase_old {
12         __u32           fb_dcookie;     /* dentry cookie - always 0xfeebbaca */
13         __u32           fb_ino;         /* our inode number */
14         __u32           fb_dirino;      /* dir inode number, 0 for directories */
15         __u32           fb_dev;         /* our device */
16         __u32           fb_xdev;
17         __u32           fb_xino;
18         __u32           fb_generation;
19 };
20
21 /*
22  * This is the new flexible, extensible style NFSv2/v3 file handle.
23  * by Neil Brown <neilb@cse.unsw.edu.au> - March 2000
24  *
25  * The file handle is seens as a list of 4byte words.
26  * The first word contains a version number (1) and four descriptor bytes
27  * that tell how the remaining 3 variable length fields should be handled.
28  * These three bytes are auth_type, fsid_type and fileid_type.
29  *
30  * All 4byte values are in host-byte-order.
31  *
32  * The auth_type field specifies how the filehandle can be authenticated
33  * This might allow a file to be confirmed to be in a writable part of a
34  * filetree without checking the path from it upto the root.
35  * Current values:
36  *     0  - No authentication.  fb_auth is 0 bytes long
37  * Possible future values:
38  *     1  - 4 bytes taken from MD5 hash of the remainer of the file handle
39  *          prefixed by a secret and with the important export flags.
40  *
41  * The fsid_type identifies how the filesystem (or export point) is
42  *    encoded.
43  *  Current values:
44  *     0  - 4 byte device id (ms-2-bytes major, ls-2-bytes minor), 4byte inode number
45  *        NOTE: we cannot use the kdev_t device id value, because kdev_t.h
46  *              says we mustn't.  We must break it up and reassemble.
47  *  Possible future encodings:
48  *     1  - 4 byte user specified identifier
49  *
50  * The fileid_type identified how the file within the filesystem is encoded.
51  * This is (will be) passed to, and set by, the underlying filesystem if it supports
52  * filehandle operations.  The filesystem must not use the value '0' or '0xff' and may
53  * only use the values 1 and 2 as defined below:
54  *  Current values:
55  *    0   - The root, or export point, of the filesystem.  fb_fileid is 0 bytes.
56  *    1   - 32bit inode number, 32 bit generation number.
57  *    2   - 32bit inode number, 32 bit generation number, 32 bit parent directory inode number.
58  *
59  */
60 struct nfs_fhbase_new {
61         __u8            fb_version;     /* == 1, even => nfs_fhbase_old */
62         __u8            fb_auth_type;
63         __u8            fb_fsid_type;
64         __u8            fb_fileid_type;
65 #ifndef RFS
66         __u32           fb_auth[1];
67 /*      __u32           fb_fsid[0]; floating */
68 /*      __u32           fb_fileid[0]; floating */
69 #else
70         __u16           fb_dev_major;
71         __u16           fb_dev_minor;
72         __u32           fb_dev_ino;
73         __u32           fb_ino;
74         __u32           fb_generation;
75         __u32           fb_dirino;
76 #endif
77         
78 };
79
80 // RFS struct knfsd_fh {                        
81 struct knfs_fh {                                                                                                // RFS
82         unsigned int    fh_size;        /* significant for NFSv3.
83                                          * Points to the current size while building
84                                          * a new file handle
85                                          */
86         union {
87                 struct nfs_fhbase_old   fh_old;
88                 __u32                   fh_pad[NFS3_FHSIZE/4];
89                 struct nfs_fhbase_new   fh_new;
90         } fh_base;
91 };
92
93 #define ofh_dcookie             fh_base.fh_old.fb_dcookie
94 #define ofh_ino                 fh_base.fh_old.fb_ino
95 #define ofh_dirino              fh_base.fh_old.fb_dirino
96 #define ofh_dev                 fh_base.fh_old.fb_dev
97 #define ofh_xdev                fh_base.fh_old.fb_xdev
98 #define ofh_xino                fh_base.fh_old.fb_xino
99 #define ofh_generation          fh_base.fh_old.fb_generation
100
101 #define fh_version              fh_base.fh_new.fb_version
102 #define fh_fsid_type            fh_base.fh_new.fb_fsid_type
103 #define fh_auth_type            fh_base.fh_new.fb_auth_type
104 #define fh_fileid_type          fh_base.fh_new.fb_fileid_type
105 #define fh_auth                 fh_base.fh_new.fb_auth
106
107 // RFS
108 #define fh_dev_major    fh_base.fh_new.fb_dev_major
109 #define fh_dev_minor    fh_base.fh_new.fb_dev_minor
110 #define fh_dev_ino              fh_base.fh_new.fb_dev_ino
111 #define fh_ino                  fh_base.fh_new.fb_ino
112 #define fh_generation   fh_base.fh_new.fb_generation
113 #define fh_dirino               fh_base.fh_new.fb_dirino
114