xref: /reactos/base/services/nfsd/nfs41_types.h (revision c2c66aff)
1 /* NFSv4.1 client for Windows
2  * Copyright � 2012 The Regents of the University of Michigan
3  *
4  * Olga Kornievskaia <aglo@umich.edu>
5  * Casey Bodley <cbodley@umich.edu>
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation; either version 2.1 of the License, or (at
10  * your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * without any warranty; without even the implied warranty of merchantability
14  * or fitness for a particular purpose.  See the GNU Lesser General Public
15  * License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  */
21 
22 #ifndef __NFS41_DAEMON_TYPES_H__
23 #define __NFS41_DAEMON_TYPES_H__
24 
25 #include "wintirpc.h"
26 #include "rpc/xdr.h"
27 #include "nfs41_const.h"
28 
29 typedef char*       caddr_t;
30 
31 static const int64_t    NFS4_INT64_MAX      = 0x7fffffffffffffff;
32 static const uint64_t   NFS4_UINT64_MAX     = 0xffffffffffffffff;
33 static const int32_t    NFS4_INT32_MAX      = 0x7fffffff;
34 static const uint32_t   NFS4_UINT32_MAX     = 0xffffffff;
35 
36 static const uint64_t   NFS4_MAXFILELEN     = 0xffffffffffffffff;
37 static const uint64_t   NFS4_MAXFILEOFF     = 0xfffffffffffffffe;
38 
39 
40 /* common nfs types */
41 typedef struct __nfs41_abs_path {
42     char            path[NFS41_MAX_PATH_LEN];
43     unsigned short  len;
44     SRWLOCK         lock;
45 } nfs41_abs_path;
46 
47 typedef struct __nfs41_component {
48     const char      *name;
49     unsigned short  len;
50 } nfs41_component;
51 
52 typedef struct __nfs41_fh {
53     unsigned char   fh[NFS4_FHSIZE];
54     uint32_t        len;
55     uint64_t        fileid;
56     struct __nfs41_superblock *superblock;
57 } nfs41_fh;
58 
59 typedef struct __nfs41_path_fh {
60     nfs41_abs_path  *path;
61     nfs41_component name;
62     nfs41_fh        fh;
63 } nfs41_path_fh;
64 
65 typedef struct __nfs41_fsid {
66     uint64_t        major;
67     uint64_t        minor;
68 } nfs41_fsid;
69 
70 typedef struct __nfs41_readdir_cookie {
71     uint64_t        cookie;
72     unsigned char   verf[NFS4_VERIFIER_SIZE];
73 } nfs41_readdir_cookie;
74 
75 typedef struct __nfs41_write_verf {
76     unsigned char   verf[NFS4_VERIFIER_SIZE];
77     unsigned char   expected[NFS4_VERIFIER_SIZE];
78 #ifdef __REACTOS__
79     uint32_t committed;
80 #else
81     enum stable_how4 committed;
82 #endif
83 } nfs41_write_verf;
84 
85 typedef struct __netaddr4 {
86     char            netid[NFS41_NETWORK_ID_LEN+1];
87     char            uaddr[NFS41_UNIVERSAL_ADDR_LEN+1];
88 } netaddr4;
89 
90 typedef struct __multi_addr4 {
91     netaddr4        arr[NFS41_ADDRS_PER_SERVER];
92     uint32_t        count;
93 } multi_addr4;
94 
95 typedef struct __bitmap4 {
96     uint32_t        count;
97     uint32_t        arr[3];
98 } bitmap4;
99 
100 typedef struct __nfstime4 {
101     int64_t         seconds;
102     uint32_t        nseconds;
103 } nfstime4;
104 
105 typedef struct __client_owner4 {
106     unsigned char   co_verifier[NFS4_VERIFIER_SIZE];
107     uint32_t        co_ownerid_len;
108     unsigned char   co_ownerid[NFS4_OPAQUE_LIMIT];
109 } client_owner4;
110 
111 typedef struct __server_owner4 {
112     uint64_t        so_minor_id;
113     uint32_t        so_major_id_len;
114     char            so_major_id[NFS4_OPAQUE_LIMIT];
115 } server_owner4;
116 
117 typedef struct __state_owner4 {
118     uint32_t        owner_len;
119     unsigned char   owner[NFS4_OPAQUE_LIMIT];
120 } state_owner4;
121 
122 typedef struct __nfs_impl_id4 {
123     uint32_t        nii_domain_len;
124     unsigned char   *nii_domain;
125     uint32_t        nii_name_len;
126     unsigned char   *nii_name;
127     nfstime4        nii_date;
128 } nfs_impl_id4;
129 
130 typedef struct __nfsace4 {
131     uint32_t        acetype;
132     uint32_t        aceflag;
133     uint32_t        acemask;
134     char            who[NFS4_OPAQUE_LIMIT];
135 } nfsace4;
136 
137 typedef struct __nfsacl41 {
138     uint32_t        flag;
139     nfsace4         *aces;
140     uint32_t        count;
141 } nfsacl41;
142 
143 typedef struct __stateid4 {
144     uint32_t        seqid;
145     unsigned char   other[NFS4_STATEID_OTHER];
146 } stateid4;
147 
148 typedef struct __open_delegation4 {
149     stateid4 stateid;
150     nfsace4 permissions;
151 #ifdef __REACTOS__
152     uint32_t type;
153 #else
154     enum open_delegation_type4 type;
155 #endif
156     bool_t recalled;
157 } open_delegation4;
158 
159 typedef struct __fattr4 {
160     bitmap4         attrmask;
161     uint32_t        attr_vals_len;
162     unsigned char   attr_vals[NFS4_OPAQUE_LIMIT];
163 } fattr4;
164 
165 typedef struct __change_info4 {
166     bool_t          atomic;
167     uint64_t        before;
168     uint64_t        after;
169 } change_info4;
170 
171 typedef struct __fs_location_server {
172     /* 'address' represents one of a traditional DNS host name,
173      * IPv4 address, IPv6 address, or a zero-length string */
174     char            address[NFS41_HOSTNAME_LEN+1];
175 } fs_location_server;
176 
177 typedef struct __fs_location4 {
178     nfs41_abs_path  path; /* path to fs from referred server's root */
179     fs_location_server *servers;
180     uint32_t        server_count;
181 } fs_location4;
182 
183 typedef struct __fs_locations4 {
184     nfs41_abs_path  path; /* path to fs from referring server's root */
185     fs_location4    *locations;
186     uint32_t        location_count;
187 } fs_locations4;
188 
189 enum {
190     MDSTHRESH_READ = 0,
191     MDSTHRESH_WRITE,
192     MDSTHRESH_READ_IO,
193     MDSTHRESH_WRITE_IO,
194 
195     MAX_MDSTHRESH_HINTS
196 };
197 typedef struct __threshold_item4 {
198     uint32_t        type;
199     uint64_t        hints[MAX_MDSTHRESH_HINTS];
200 } threshold_item4;
201 
202 #define MAX_MDSTHRESHOLD_ITEMS 1
203 typedef struct __mdsthreshold4 {
204     uint32_t        count;
205     threshold_item4 items[MAX_MDSTHRESHOLD_ITEMS];
206 } mdsthreshold4;
207 
208 typedef struct __nfs41_file_info {
209     nfs41_fsid              fsid;
210     mdsthreshold4           mdsthreshold;
211     nfstime4                time_access;
212     nfstime4                time_create;
213     nfstime4                time_modify;
214     nfsacl41                *acl;
215     nfstime4                *time_delta; /* XXX: per-fs */
216     bitmap4                 attrmask;
217     bitmap4                 *supported_attrs; /* XXX: per-fs */
218     bitmap4                 *suppattr_exclcreat; /* XXX: per-fs */
219     uint64_t                maxread; /* XXX: per-fs */
220     uint64_t                maxwrite; /* XXX: per-fs */
221     uint64_t                change;
222     uint64_t                size;
223     uint64_t                fileid;
224     uint64_t                space_avail; /* XXX: per-fs */
225     uint64_t                space_free; /* XXX: per-fs */
226     uint64_t                space_total; /* XXX: per-fs */
227     uint32_t                type;
228     uint32_t                numlinks;
229     uint32_t                rdattr_error;
230     uint32_t                mode;
231     uint32_t                mode_mask;
232     fs_locations4           *fs_locations; /* XXX: per-fs */
233     uint32_t                lease_time; /* XXX: per-server */
234     uint32_t                fs_layout_types; /* pnfs, XXX: per-fs */
235     bool_t                  hidden;
236     bool_t                  system;
237     bool_t                  archive;
238     bool_t                  cansettime; /* XXX: per-fs */
239     bool_t                  case_insensitive;
240     bool_t                  case_preserving;
241     bool_t                  symlink_dir;
242     bool_t                  symlink_support;
243     bool_t                  link_support;
244     char                    *owner;
245     char                    *owner_group;
246     uint32_t                aclsupport;
247 } nfs41_file_info;
248 
249 #endif /* !__NFS41_DAEMON_TYPES_H__ */
250