aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c274
1 files changed, 168 insertions, 106 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index c08738441f73..badd73b7ca12 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -72,10 +72,15 @@ static int nfs4_stat_to_errno(int);
72 */ 72 */
73#define open_owner_id_maxsz (1 + 4) 73#define open_owner_id_maxsz (1 + 4)
74#define lock_owner_id_maxsz (1 + 4) 74#define lock_owner_id_maxsz (1 + 4)
75#define decode_lockowner_maxsz (1 + XDR_QUADLEN(IDMAP_NAMESZ))
75#define compound_encode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2)) 76#define compound_encode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2))
76#define compound_decode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2)) 77#define compound_decode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2))
77#define op_encode_hdr_maxsz (1) 78#define op_encode_hdr_maxsz (1)
78#define op_decode_hdr_maxsz (2) 79#define op_decode_hdr_maxsz (2)
80#define encode_stateid_maxsz (XDR_QUADLEN(NFS4_STATEID_SIZE))
81#define decode_stateid_maxsz (XDR_QUADLEN(NFS4_STATEID_SIZE))
82#define encode_verifier_maxsz (XDR_QUADLEN(NFS4_VERIFIER_SIZE))
83#define decode_verifier_maxsz (XDR_QUADLEN(NFS4_VERIFIER_SIZE))
79#define encode_putfh_maxsz (op_encode_hdr_maxsz + 1 + \ 84#define encode_putfh_maxsz (op_encode_hdr_maxsz + 1 + \
80 (NFS4_FHSIZE >> 2)) 85 (NFS4_FHSIZE >> 2))
81#define decode_putfh_maxsz (op_decode_hdr_maxsz) 86#define decode_putfh_maxsz (op_decode_hdr_maxsz)
@@ -96,6 +101,11 @@ static int nfs4_stat_to_errno(int);
96#define nfs4_fattr_maxsz (nfs4_fattr_bitmap_maxsz + \ 101#define nfs4_fattr_maxsz (nfs4_fattr_bitmap_maxsz + \
97 nfs4_fattr_value_maxsz) 102 nfs4_fattr_value_maxsz)
98#define decode_getattr_maxsz (op_decode_hdr_maxsz + nfs4_fattr_maxsz) 103#define decode_getattr_maxsz (op_decode_hdr_maxsz + nfs4_fattr_maxsz)
104#define encode_attrs_maxsz (nfs4_fattr_bitmap_maxsz + \
105 1 + 2 + 1 + \
106 nfs4_owner_maxsz + \
107 nfs4_group_maxsz + \
108 4 + 4)
99#define encode_savefh_maxsz (op_encode_hdr_maxsz) 109#define encode_savefh_maxsz (op_encode_hdr_maxsz)
100#define decode_savefh_maxsz (op_decode_hdr_maxsz) 110#define decode_savefh_maxsz (op_decode_hdr_maxsz)
101#define encode_restorefh_maxsz (op_encode_hdr_maxsz) 111#define encode_restorefh_maxsz (op_encode_hdr_maxsz)
@@ -123,7 +133,7 @@ static int nfs4_stat_to_errno(int);
123#define decode_lookup_maxsz (op_decode_hdr_maxsz) 133#define decode_lookup_maxsz (op_decode_hdr_maxsz)
124#define encode_share_access_maxsz \ 134#define encode_share_access_maxsz \
125 (2) 135 (2)
126#define encode_createmode_maxsz (1 + nfs4_fattr_maxsz) 136#define encode_createmode_maxsz (1 + encode_attrs_maxsz)
127#define encode_opentype_maxsz (1 + encode_createmode_maxsz) 137#define encode_opentype_maxsz (1 + encode_createmode_maxsz)
128#define encode_claim_null_maxsz (1 + nfs4_name_maxsz) 138#define encode_claim_null_maxsz (1 + nfs4_name_maxsz)
129#define encode_open_maxsz (op_encode_hdr_maxsz + \ 139#define encode_open_maxsz (op_encode_hdr_maxsz + \
@@ -132,14 +142,52 @@ static int nfs4_stat_to_errno(int);
132 encode_opentype_maxsz + \ 142 encode_opentype_maxsz + \
133 encode_claim_null_maxsz) 143 encode_claim_null_maxsz)
134#define decode_ace_maxsz (3 + nfs4_owner_maxsz) 144#define decode_ace_maxsz (3 + nfs4_owner_maxsz)
135#define decode_delegation_maxsz (1 + XDR_QUADLEN(NFS4_STATEID_SIZE) + 1 + \ 145#define decode_delegation_maxsz (1 + decode_stateid_maxsz + 1 + \
136 decode_ace_maxsz) 146 decode_ace_maxsz)
137#define decode_change_info_maxsz (5) 147#define decode_change_info_maxsz (5)
138#define decode_open_maxsz (op_decode_hdr_maxsz + \ 148#define decode_open_maxsz (op_decode_hdr_maxsz + \
139 XDR_QUADLEN(NFS4_STATEID_SIZE) + \ 149 decode_stateid_maxsz + \
140 decode_change_info_maxsz + 1 + \ 150 decode_change_info_maxsz + 1 + \
141 nfs4_fattr_bitmap_maxsz + \ 151 nfs4_fattr_bitmap_maxsz + \
142 decode_delegation_maxsz) 152 decode_delegation_maxsz)
153#define encode_open_confirm_maxsz \
154 (op_encode_hdr_maxsz + \
155 encode_stateid_maxsz + 1)
156#define decode_open_confirm_maxsz \
157 (op_decode_hdr_maxsz + \
158 decode_stateid_maxsz)
159#define encode_open_downgrade_maxsz \
160 (op_encode_hdr_maxsz + \
161 encode_stateid_maxsz + 1 + \
162 encode_share_access_maxsz)
163#define decode_open_downgrade_maxsz \
164 (op_decode_hdr_maxsz + \
165 decode_stateid_maxsz)
166#define encode_close_maxsz (op_encode_hdr_maxsz + \
167 1 + encode_stateid_maxsz)
168#define decode_close_maxsz (op_decode_hdr_maxsz + \
169 decode_stateid_maxsz)
170#define encode_setattr_maxsz (op_encode_hdr_maxsz + \
171 encode_stateid_maxsz + \
172 encode_attrs_maxsz)
173#define decode_setattr_maxsz (op_decode_hdr_maxsz + \
174 nfs4_fattr_bitmap_maxsz)
175#define encode_read_maxsz (op_encode_hdr_maxsz + \
176 encode_stateid_maxsz + 3)
177#define decode_read_maxsz (op_decode_hdr_maxsz + 2)
178#define encode_readdir_maxsz (op_encode_hdr_maxsz + \
179 2 + encode_verifier_maxsz + 5)
180#define decode_readdir_maxsz (op_decode_hdr_maxsz + \
181 decode_verifier_maxsz)
182#define encode_readlink_maxsz (op_encode_hdr_maxsz)
183#define decode_readlink_maxsz (op_decode_hdr_maxsz + 1)
184#define encode_write_maxsz (op_encode_hdr_maxsz + \
185 encode_stateid_maxsz + 4)
186#define decode_write_maxsz (op_decode_hdr_maxsz + \
187 2 + decode_verifier_maxsz)
188#define encode_commit_maxsz (op_encode_hdr_maxsz + 3)
189#define decode_commit_maxsz (op_decode_hdr_maxsz + \
190 decode_verifier_maxsz)
143#define encode_remove_maxsz (op_encode_hdr_maxsz + \ 191#define encode_remove_maxsz (op_encode_hdr_maxsz + \
144 nfs4_name_maxsz) 192 nfs4_name_maxsz)
145#define encode_rename_maxsz (op_encode_hdr_maxsz + \ 193#define encode_rename_maxsz (op_encode_hdr_maxsz + \
@@ -148,19 +196,44 @@ static int nfs4_stat_to_errno(int);
148#define encode_link_maxsz (op_encode_hdr_maxsz + \ 196#define encode_link_maxsz (op_encode_hdr_maxsz + \
149 nfs4_name_maxsz) 197 nfs4_name_maxsz)
150#define decode_link_maxsz (op_decode_hdr_maxsz + 5) 198#define decode_link_maxsz (op_decode_hdr_maxsz + 5)
199#define encode_lock_maxsz (op_encode_hdr_maxsz + \
200 7 + \
201 1 + encode_stateid_maxsz + 8)
202#define decode_lock_denied_maxsz \
203 (8 + decode_lockowner_maxsz)
204#define decode_lock_maxsz (op_decode_hdr_maxsz + \
205 decode_lock_denied_maxsz)
206#define encode_lockt_maxsz (op_encode_hdr_maxsz + 12)
207#define decode_lockt_maxsz (op_decode_hdr_maxsz + \
208 decode_lock_denied_maxsz)
209#define encode_locku_maxsz (op_encode_hdr_maxsz + 3 + \
210 encode_stateid_maxsz + \
211 4)
212#define decode_locku_maxsz (op_decode_hdr_maxsz + \
213 decode_stateid_maxsz)
214#define encode_access_maxsz (op_encode_hdr_maxsz + 1)
215#define decode_access_maxsz (op_decode_hdr_maxsz + 2)
151#define encode_symlink_maxsz (op_encode_hdr_maxsz + \ 216#define encode_symlink_maxsz (op_encode_hdr_maxsz + \
152 1 + nfs4_name_maxsz + \ 217 1 + nfs4_name_maxsz + \
153 1 + \ 218 1 + \
154 nfs4_fattr_maxsz) 219 nfs4_fattr_maxsz)
155#define decode_symlink_maxsz (op_decode_hdr_maxsz + 8) 220#define decode_symlink_maxsz (op_decode_hdr_maxsz + 8)
156#define encode_create_maxsz (op_encode_hdr_maxsz + \ 221#define encode_create_maxsz (op_encode_hdr_maxsz + \
157 2 + nfs4_name_maxsz + \ 222 1 + 2 + nfs4_name_maxsz + \
158 nfs4_fattr_maxsz) 223 encode_attrs_maxsz)
159#define decode_create_maxsz (op_decode_hdr_maxsz + \ 224#define decode_create_maxsz (op_decode_hdr_maxsz + \
160 decode_change_info_maxsz + \ 225 decode_change_info_maxsz + \
161 nfs4_fattr_bitmap_maxsz) 226 nfs4_fattr_bitmap_maxsz)
227#define encode_statfs_maxsz (encode_getattr_maxsz)
228#define decode_statfs_maxsz (decode_getattr_maxsz)
162#define encode_delegreturn_maxsz (op_encode_hdr_maxsz + 4) 229#define encode_delegreturn_maxsz (op_encode_hdr_maxsz + 4)
163#define decode_delegreturn_maxsz (op_decode_hdr_maxsz) 230#define decode_delegreturn_maxsz (op_decode_hdr_maxsz)
231#define encode_getacl_maxsz (encode_getattr_maxsz)
232#define decode_getacl_maxsz (op_decode_hdr_maxsz + \
233 nfs4_fattr_bitmap_maxsz + 1)
234#define encode_setacl_maxsz (op_encode_hdr_maxsz + \
235 encode_stateid_maxsz + 3)
236#define decode_setacl_maxsz (decode_setattr_maxsz)
164#define encode_fs_locations_maxsz \ 237#define encode_fs_locations_maxsz \
165 (encode_getattr_maxsz) 238 (encode_getattr_maxsz)
166#define decode_fs_locations_maxsz \ 239#define decode_fs_locations_maxsz \
@@ -169,37 +242,37 @@ static int nfs4_stat_to_errno(int);
169#define NFS4_dec_compound_sz (1024) /* XXX: large enough? */ 242#define NFS4_dec_compound_sz (1024) /* XXX: large enough? */
170#define NFS4_enc_read_sz (compound_encode_hdr_maxsz + \ 243#define NFS4_enc_read_sz (compound_encode_hdr_maxsz + \
171 encode_putfh_maxsz + \ 244 encode_putfh_maxsz + \
172 op_encode_hdr_maxsz + 7) 245 encode_read_maxsz)
173#define NFS4_dec_read_sz (compound_decode_hdr_maxsz + \ 246#define NFS4_dec_read_sz (compound_decode_hdr_maxsz + \
174 decode_putfh_maxsz + \ 247 decode_putfh_maxsz + \
175 op_decode_hdr_maxsz + 2) 248 decode_read_maxsz)
176#define NFS4_enc_readlink_sz (compound_encode_hdr_maxsz + \ 249#define NFS4_enc_readlink_sz (compound_encode_hdr_maxsz + \
177 encode_putfh_maxsz + \ 250 encode_putfh_maxsz + \
178 op_encode_hdr_maxsz) 251 encode_readlink_maxsz)
179#define NFS4_dec_readlink_sz (compound_decode_hdr_maxsz + \ 252#define NFS4_dec_readlink_sz (compound_decode_hdr_maxsz + \
180 decode_putfh_maxsz + \ 253 decode_putfh_maxsz + \
181 op_decode_hdr_maxsz) 254 decode_readlink_maxsz)
182#define NFS4_enc_readdir_sz (compound_encode_hdr_maxsz + \ 255#define NFS4_enc_readdir_sz (compound_encode_hdr_maxsz + \
183 encode_putfh_maxsz + \ 256 encode_putfh_maxsz + \
184 op_encode_hdr_maxsz + 9) 257 encode_readdir_maxsz)
185#define NFS4_dec_readdir_sz (compound_decode_hdr_maxsz + \ 258#define NFS4_dec_readdir_sz (compound_decode_hdr_maxsz + \
186 decode_putfh_maxsz + \ 259 decode_putfh_maxsz + \
187 op_decode_hdr_maxsz + 2) 260 decode_readdir_maxsz)
188#define NFS4_enc_write_sz (compound_encode_hdr_maxsz + \ 261#define NFS4_enc_write_sz (compound_encode_hdr_maxsz + \
189 encode_putfh_maxsz + \ 262 encode_putfh_maxsz + \
190 op_encode_hdr_maxsz + 8 + \ 263 encode_write_maxsz + \
191 encode_getattr_maxsz) 264 encode_getattr_maxsz)
192#define NFS4_dec_write_sz (compound_decode_hdr_maxsz + \ 265#define NFS4_dec_write_sz (compound_decode_hdr_maxsz + \
193 decode_putfh_maxsz + \ 266 decode_putfh_maxsz + \
194 op_decode_hdr_maxsz + 4 + \ 267 decode_write_maxsz + \
195 decode_getattr_maxsz) 268 decode_getattr_maxsz)
196#define NFS4_enc_commit_sz (compound_encode_hdr_maxsz + \ 269#define NFS4_enc_commit_sz (compound_encode_hdr_maxsz + \
197 encode_putfh_maxsz + \ 270 encode_putfh_maxsz + \
198 op_encode_hdr_maxsz + 3 + \ 271 encode_commit_maxsz + \
199 encode_getattr_maxsz) 272 encode_getattr_maxsz)
200#define NFS4_dec_commit_sz (compound_decode_hdr_maxsz + \ 273#define NFS4_dec_commit_sz (compound_decode_hdr_maxsz + \
201 decode_putfh_maxsz + \ 274 decode_putfh_maxsz + \
202 op_decode_hdr_maxsz + 2 + \ 275 decode_commit_maxsz + \
203 decode_getattr_maxsz) 276 decode_getattr_maxsz)
204#define NFS4_enc_open_sz (compound_encode_hdr_maxsz + \ 277#define NFS4_enc_open_sz (compound_encode_hdr_maxsz + \
205 encode_putfh_maxsz + \ 278 encode_putfh_maxsz + \
@@ -217,13 +290,14 @@ static int nfs4_stat_to_errno(int);
217 decode_getattr_maxsz + \ 290 decode_getattr_maxsz + \
218 decode_restorefh_maxsz + \ 291 decode_restorefh_maxsz + \
219 decode_getattr_maxsz) 292 decode_getattr_maxsz)
220#define NFS4_enc_open_confirm_sz \ 293#define NFS4_enc_open_confirm_sz \
221 (compound_encode_hdr_maxsz + \ 294 (compound_encode_hdr_maxsz + \
222 encode_putfh_maxsz + \ 295 encode_putfh_maxsz + \
223 op_encode_hdr_maxsz + 5) 296 encode_open_confirm_maxsz)
224#define NFS4_dec_open_confirm_sz (compound_decode_hdr_maxsz + \ 297#define NFS4_dec_open_confirm_sz \
225 decode_putfh_maxsz + \ 298 (compound_decode_hdr_maxsz + \
226 op_decode_hdr_maxsz + 4) 299 decode_putfh_maxsz + \
300 decode_open_confirm_maxsz)
227#define NFS4_enc_open_noattr_sz (compound_encode_hdr_maxsz + \ 301#define NFS4_enc_open_noattr_sz (compound_encode_hdr_maxsz + \
228 encode_putfh_maxsz + \ 302 encode_putfh_maxsz + \
229 encode_open_maxsz + \ 303 encode_open_maxsz + \
@@ -234,31 +308,30 @@ static int nfs4_stat_to_errno(int);
234 decode_getattr_maxsz) 308 decode_getattr_maxsz)
235#define NFS4_enc_open_downgrade_sz \ 309#define NFS4_enc_open_downgrade_sz \
236 (compound_encode_hdr_maxsz + \ 310 (compound_encode_hdr_maxsz + \
237 encode_putfh_maxsz + \ 311 encode_putfh_maxsz + \
238 op_encode_hdr_maxsz + 7 + \ 312 encode_open_downgrade_maxsz + \
239 encode_getattr_maxsz) 313 encode_getattr_maxsz)
240#define NFS4_dec_open_downgrade_sz \ 314#define NFS4_dec_open_downgrade_sz \
241 (compound_decode_hdr_maxsz + \ 315 (compound_decode_hdr_maxsz + \
242 decode_putfh_maxsz + \ 316 decode_putfh_maxsz + \
243 op_decode_hdr_maxsz + 4 + \ 317 decode_open_downgrade_maxsz + \
244 decode_getattr_maxsz) 318 decode_getattr_maxsz)
245#define NFS4_enc_close_sz (compound_encode_hdr_maxsz + \ 319#define NFS4_enc_close_sz (compound_encode_hdr_maxsz + \
246 encode_putfh_maxsz + \ 320 encode_putfh_maxsz + \
247 op_encode_hdr_maxsz + 5 + \ 321 encode_close_maxsz + \
248 encode_getattr_maxsz) 322 encode_getattr_maxsz)
249#define NFS4_dec_close_sz (compound_decode_hdr_maxsz + \ 323#define NFS4_dec_close_sz (compound_decode_hdr_maxsz + \
250 decode_putfh_maxsz + \ 324 decode_putfh_maxsz + \
251 op_decode_hdr_maxsz + 4 + \ 325 decode_close_maxsz + \
252 decode_getattr_maxsz) 326 decode_getattr_maxsz)
253#define NFS4_enc_setattr_sz (compound_encode_hdr_maxsz + \ 327#define NFS4_enc_setattr_sz (compound_encode_hdr_maxsz + \
254 encode_putfh_maxsz + \ 328 encode_putfh_maxsz + \
255 op_encode_hdr_maxsz + 4 + \ 329 encode_setattr_maxsz + \
256 nfs4_fattr_maxsz + \ 330 encode_getattr_maxsz)
257 encode_getattr_maxsz) 331#define NFS4_dec_setattr_sz (compound_decode_hdr_maxsz + \
258#define NFS4_dec_setattr_sz (compound_decode_hdr_maxsz + \ 332 decode_putfh_maxsz + \
259 decode_putfh_maxsz + \ 333 decode_setattr_maxsz + \
260 op_decode_hdr_maxsz + 3 + \ 334 decode_getattr_maxsz)
261 nfs4_fattr_maxsz)
262#define NFS4_enc_fsinfo_sz (compound_encode_hdr_maxsz + \ 335#define NFS4_enc_fsinfo_sz (compound_encode_hdr_maxsz + \
263 encode_putfh_maxsz + \ 336 encode_putfh_maxsz + \
264 encode_fsinfo_maxsz) 337 encode_fsinfo_maxsz)
@@ -285,39 +358,28 @@ static int nfs4_stat_to_errno(int);
285 decode_fsinfo_maxsz) 358 decode_fsinfo_maxsz)
286#define NFS4_enc_lock_sz (compound_encode_hdr_maxsz + \ 359#define NFS4_enc_lock_sz (compound_encode_hdr_maxsz + \
287 encode_putfh_maxsz + \ 360 encode_putfh_maxsz + \
288 encode_getattr_maxsz + \ 361 encode_lock_maxsz)
289 op_encode_hdr_maxsz + \
290 1 + 1 + 2 + 2 + \
291 1 + 4 + 1 + 2 + \
292 lock_owner_id_maxsz)
293#define NFS4_dec_lock_sz (compound_decode_hdr_maxsz + \ 362#define NFS4_dec_lock_sz (compound_decode_hdr_maxsz + \
294 decode_putfh_maxsz + \ 363 decode_putfh_maxsz + \
295 decode_getattr_maxsz + \ 364 decode_lock_maxsz)
296 op_decode_hdr_maxsz + \
297 2 + 2 + 1 + 2 + \
298 lock_owner_id_maxsz)
299#define NFS4_enc_lockt_sz (compound_encode_hdr_maxsz + \ 365#define NFS4_enc_lockt_sz (compound_encode_hdr_maxsz + \
300 encode_putfh_maxsz + \ 366 encode_putfh_maxsz + \
301 encode_getattr_maxsz + \ 367 encode_lockt_maxsz)
302 op_encode_hdr_maxsz + \ 368#define NFS4_dec_lockt_sz (compound_decode_hdr_maxsz + \
303 1 + 2 + 2 + 2 + \ 369 decode_putfh_maxsz + \
304 lock_owner_id_maxsz) 370 decode_lockt_maxsz)
305#define NFS4_dec_lockt_sz (NFS4_dec_lock_sz)
306#define NFS4_enc_locku_sz (compound_encode_hdr_maxsz + \ 371#define NFS4_enc_locku_sz (compound_encode_hdr_maxsz + \
307 encode_putfh_maxsz + \ 372 encode_putfh_maxsz + \
308 encode_getattr_maxsz + \ 373 encode_locku_maxsz)
309 op_encode_hdr_maxsz + \
310 1 + 1 + 4 + 2 + 2)
311#define NFS4_dec_locku_sz (compound_decode_hdr_maxsz + \ 374#define NFS4_dec_locku_sz (compound_decode_hdr_maxsz + \
312 decode_putfh_maxsz + \ 375 decode_putfh_maxsz + \
313 decode_getattr_maxsz + \ 376 decode_locku_maxsz)
314 op_decode_hdr_maxsz + 4)
315#define NFS4_enc_access_sz (compound_encode_hdr_maxsz + \ 377#define NFS4_enc_access_sz (compound_encode_hdr_maxsz + \
316 encode_putfh_maxsz + \ 378 encode_putfh_maxsz + \
317 op_encode_hdr_maxsz + 1) 379 encode_access_maxsz)
318#define NFS4_dec_access_sz (compound_decode_hdr_maxsz + \ 380#define NFS4_dec_access_sz (compound_decode_hdr_maxsz + \
319 decode_putfh_maxsz + \ 381 decode_putfh_maxsz + \
320 op_decode_hdr_maxsz + 2) 382 decode_access_maxsz)
321#define NFS4_enc_getattr_sz (compound_encode_hdr_maxsz + \ 383#define NFS4_enc_getattr_sz (compound_encode_hdr_maxsz + \
322 encode_putfh_maxsz + \ 384 encode_putfh_maxsz + \
323 encode_getattr_maxsz) 385 encode_getattr_maxsz)
@@ -416,10 +478,10 @@ static int nfs4_stat_to_errno(int);
416 decode_getattr_maxsz) 478 decode_getattr_maxsz)
417#define NFS4_enc_statfs_sz (compound_encode_hdr_maxsz + \ 479#define NFS4_enc_statfs_sz (compound_encode_hdr_maxsz + \
418 encode_putfh_maxsz + \ 480 encode_putfh_maxsz + \
419 encode_getattr_maxsz) 481 encode_statfs_maxsz)
420#define NFS4_dec_statfs_sz (compound_decode_hdr_maxsz + \ 482#define NFS4_dec_statfs_sz (compound_decode_hdr_maxsz + \
421 decode_putfh_maxsz + \ 483 decode_putfh_maxsz + \
422 op_decode_hdr_maxsz + 12) 484 decode_statfs_maxsz)
423#define NFS4_enc_server_caps_sz (compound_encode_hdr_maxsz + \ 485#define NFS4_enc_server_caps_sz (compound_encode_hdr_maxsz + \
424 encode_putfh_maxsz + \ 486 encode_putfh_maxsz + \
425 encode_getattr_maxsz) 487 encode_getattr_maxsz)
@@ -435,18 +497,16 @@ static int nfs4_stat_to_errno(int);
435 decode_getattr_maxsz) 497 decode_getattr_maxsz)
436#define NFS4_enc_getacl_sz (compound_encode_hdr_maxsz + \ 498#define NFS4_enc_getacl_sz (compound_encode_hdr_maxsz + \
437 encode_putfh_maxsz + \ 499 encode_putfh_maxsz + \
438 encode_getattr_maxsz) 500 encode_getacl_maxsz)
439#define NFS4_dec_getacl_sz (compound_decode_hdr_maxsz + \ 501#define NFS4_dec_getacl_sz (compound_decode_hdr_maxsz + \
440 decode_putfh_maxsz + \ 502 decode_putfh_maxsz + \
441 op_decode_hdr_maxsz + \ 503 decode_getacl_maxsz)
442 nfs4_fattr_bitmap_maxsz + 1)
443#define NFS4_enc_setacl_sz (compound_encode_hdr_maxsz + \ 504#define NFS4_enc_setacl_sz (compound_encode_hdr_maxsz + \
444 encode_putfh_maxsz + \ 505 encode_putfh_maxsz + \
445 op_encode_hdr_maxsz + 4 + \ 506 encode_setacl_maxsz)
446 nfs4_fattr_bitmap_maxsz + 1)
447#define NFS4_dec_setacl_sz (compound_decode_hdr_maxsz + \ 507#define NFS4_dec_setacl_sz (compound_decode_hdr_maxsz + \
448 decode_putfh_maxsz + \ 508 decode_putfh_maxsz + \
449 op_decode_hdr_maxsz + nfs4_fattr_bitmap_maxsz) 509 decode_setacl_maxsz)
450#define NFS4_enc_fs_locations_sz \ 510#define NFS4_enc_fs_locations_sz \
451 (compound_encode_hdr_maxsz + \ 511 (compound_encode_hdr_maxsz + \
452 encode_putfh_maxsz + \ 512 encode_putfh_maxsz + \
@@ -1108,12 +1168,10 @@ static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args)
1108 1168
1109static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req) 1169static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req)
1110{ 1170{
1111 struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
1112 uint32_t attrs[2] = { 1171 uint32_t attrs[2] = {
1113 FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID, 1172 FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID,
1114 FATTR4_WORD1_MOUNTED_ON_FILEID, 1173 FATTR4_WORD1_MOUNTED_ON_FILEID,
1115 }; 1174 };
1116 int replen;
1117 __be32 *p; 1175 __be32 *p;
1118 1176
1119 RESERVE_SPACE(12+NFS4_VERIFIER_SIZE+20); 1177 RESERVE_SPACE(12+NFS4_VERIFIER_SIZE+20);
@@ -1138,37 +1196,16 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
1138 attrs[0] & readdir->bitmask[0], 1196 attrs[0] & readdir->bitmask[0],
1139 attrs[1] & readdir->bitmask[1]); 1197 attrs[1] & readdir->bitmask[1]);
1140 1198
1141 /* set up reply kvec
1142 * toplevel_status + taglen + rescount + OP_PUTFH + status
1143 * + OP_READDIR + status + verifer(2) = 9
1144 */
1145 replen = (RPC_REPHDRSIZE + auth->au_rslack + 9) << 2;
1146 xdr_inline_pages(&req->rq_rcv_buf, replen, readdir->pages,
1147 readdir->pgbase, readdir->count);
1148 dprintk("%s: inlined page args = (%u, %p, %u, %u)\n",
1149 __FUNCTION__, replen, readdir->pages,
1150 readdir->pgbase, readdir->count);
1151
1152 return 0; 1199 return 0;
1153} 1200}
1154 1201
1155static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *readlink, struct rpc_rqst *req) 1202static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *readlink, struct rpc_rqst *req)
1156{ 1203{
1157 struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
1158 unsigned int replen;
1159 __be32 *p; 1204 __be32 *p;
1160 1205
1161 RESERVE_SPACE(4); 1206 RESERVE_SPACE(4);
1162 WRITE32(OP_READLINK); 1207 WRITE32(OP_READLINK);
1163 1208
1164 /* set up reply kvec
1165 * toplevel_status + taglen + rescount + OP_PUTFH + status
1166 * + OP_READLINK + status + string length = 8
1167 */
1168 replen = (RPC_REPHDRSIZE + auth->au_rslack + 8) << 2;
1169 xdr_inline_pages(&req->rq_rcv_buf, replen, readlink->pages,
1170 readlink->pgbase, readlink->pglen);
1171
1172 return 0; 1209 return 0;
1173} 1210}
1174 1211
@@ -1398,7 +1435,7 @@ out:
1398/* 1435/*
1399 * Encode REMOVE request 1436 * Encode REMOVE request
1400 */ 1437 */
1401static int nfs4_xdr_enc_remove(struct rpc_rqst *req, __be32 *p, const struct nfs4_remove_arg *args) 1438static int nfs4_xdr_enc_remove(struct rpc_rqst *req, __be32 *p, const struct nfs_removeargs *args)
1402{ 1439{
1403 struct xdr_stream xdr; 1440 struct xdr_stream xdr;
1404 struct compound_hdr hdr = { 1441 struct compound_hdr hdr = {
@@ -1410,7 +1447,7 @@ static int nfs4_xdr_enc_remove(struct rpc_rqst *req, __be32 *p, const struct nfs
1410 encode_compound_hdr(&xdr, &hdr); 1447 encode_compound_hdr(&xdr, &hdr);
1411 if ((status = encode_putfh(&xdr, args->fh)) != 0) 1448 if ((status = encode_putfh(&xdr, args->fh)) != 0)
1412 goto out; 1449 goto out;
1413 if ((status = encode_remove(&xdr, args->name)) != 0) 1450 if ((status = encode_remove(&xdr, &args->name)) != 0)
1414 goto out; 1451 goto out;
1415 status = encode_getfattr(&xdr, args->bitmask); 1452 status = encode_getfattr(&xdr, args->bitmask);
1416out: 1453out:
@@ -1734,6 +1771,8 @@ static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, __be32 *p, const struct n
1734 struct compound_hdr hdr = { 1771 struct compound_hdr hdr = {
1735 .nops = 2, 1772 .nops = 2,
1736 }; 1773 };
1774 struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
1775 unsigned int replen;
1737 int status; 1776 int status;
1738 1777
1739 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1778 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1742,6 +1781,15 @@ static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, __be32 *p, const struct n
1742 if(status) 1781 if(status)
1743 goto out; 1782 goto out;
1744 status = encode_readlink(&xdr, args, req); 1783 status = encode_readlink(&xdr, args, req);
1784
1785 /* set up reply kvec
1786 * toplevel_status + taglen + rescount + OP_PUTFH + status
1787 * + OP_READLINK + status + string length = 8
1788 */
1789 replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_readlink_sz) << 2;
1790 xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages,
1791 args->pgbase, args->pglen);
1792
1745out: 1793out:
1746 return status; 1794 return status;
1747} 1795}
@@ -1755,6 +1803,8 @@ static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nf
1755 struct compound_hdr hdr = { 1803 struct compound_hdr hdr = {
1756 .nops = 2, 1804 .nops = 2,
1757 }; 1805 };
1806 struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;
1807 int replen;
1758 int status; 1808 int status;
1759 1809
1760 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1810 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1763,6 +1813,18 @@ static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nf
1763 if(status) 1813 if(status)
1764 goto out; 1814 goto out;
1765 status = encode_readdir(&xdr, args, req); 1815 status = encode_readdir(&xdr, args, req);
1816
1817 /* set up reply kvec
1818 * toplevel_status + taglen + rescount + OP_PUTFH + status
1819 * + OP_READDIR + status + verifer(2) = 9
1820 */
1821 replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_readdir_sz) << 2;
1822 xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages,
1823 args->pgbase, args->count);
1824 dprintk("%s: inlined page args = (%u, %p, %u, %u)\n",
1825 __FUNCTION__, replen, args->pages,
1826 args->pgbase, args->count);
1827
1766out: 1828out:
1767 return status; 1829 return status;
1768} 1830}
@@ -3161,11 +3223,12 @@ static int decode_getfh(struct xdr_stream *xdr, struct nfs_fh *fh)
3161 uint32_t len; 3223 uint32_t len;
3162 int status; 3224 int status;
3163 3225
3226 /* Zero handle first to allow comparisons */
3227 memset(fh, 0, sizeof(*fh));
3228
3164 status = decode_op_hdr(xdr, OP_GETFH); 3229 status = decode_op_hdr(xdr, OP_GETFH);
3165 if (status) 3230 if (status)
3166 return status; 3231 return status;
3167 /* Zero handle first to allow comparisons */
3168 memset(fh, 0, sizeof(*fh));
3169 3232
3170 READ_BUF(4); 3233 READ_BUF(4);
3171 READ32(len); 3234 READ32(len);
@@ -3772,7 +3835,7 @@ out:
3772/* 3835/*
3773 * Decode REMOVE response 3836 * Decode REMOVE response
3774 */ 3837 */
3775static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_remove_res *res) 3838static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, __be32 *p, struct nfs_removeres *res)
3776{ 3839{
3777 struct xdr_stream xdr; 3840 struct xdr_stream xdr;
3778 struct compound_hdr hdr; 3841 struct compound_hdr hdr;
@@ -3785,7 +3848,7 @@ static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, __be32 *p, struct nfs4_re
3785 goto out; 3848 goto out;
3786 if ((status = decode_remove(&xdr, &res->cinfo)) != 0) 3849 if ((status = decode_remove(&xdr, &res->cinfo)) != 0)
3787 goto out; 3850 goto out;
3788 decode_getfattr(&xdr, res->dir_attr, res->server); 3851 decode_getfattr(&xdr, &res->dir_attr, res->server);
3789out: 3852out:
3790 return status; 3853 return status;
3791} 3854}
@@ -4030,12 +4093,11 @@ static int nfs4_xdr_dec_open(struct rpc_rqst *rqstp, __be32 *p, struct nfs_openr
4030 status = decode_open(&xdr, res); 4093 status = decode_open(&xdr, res);
4031 if (status) 4094 if (status)
4032 goto out; 4095 goto out;
4033 status = decode_getfh(&xdr, &res->fh); 4096 if (decode_getfh(&xdr, &res->fh) != 0)
4034 if (status)
4035 goto out; 4097 goto out;
4036 if (decode_getfattr(&xdr, res->f_attr, res->server) != 0) 4098 if (decode_getfattr(&xdr, res->f_attr, res->server) != 0)
4037 goto out; 4099 goto out;
4038 if ((status = decode_restorefh(&xdr)) != 0) 4100 if (decode_restorefh(&xdr) != 0)
4039 goto out; 4101 goto out;
4040 decode_getfattr(&xdr, res->dir_attr, res->server); 4102 decode_getfattr(&xdr, res->dir_attr, res->server);
4041out: 4103out: