Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_NFS_XDR_H |
| 2 | #define _LINUX_NFS_XDR_H |
| 3 | |
| 4 | #include <linux/sunrpc/xprt.h> |
Andreas Gruenbacher | b7fa055 | 2005-06-22 17:16:27 +0000 | [diff] [blame] | 5 | #include <linux/nfsacl.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | |
Chuck Lever | 40859d7 | 2005-11-30 18:09:02 -0500 | [diff] [blame] | 7 | /* |
| 8 | * To change the maximum rsize and wsize supported by the NFS client, adjust |
| 9 | * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can |
| 10 | * support a megabyte or more. The default is left at 4096 bytes, which is |
| 11 | * reasonable for NFS over UDP. |
| 12 | */ |
| 13 | #define NFS_MAX_FILE_IO_SIZE (1048576U) |
| 14 | #define NFS_DEF_FILE_IO_SIZE (4096U) |
| 15 | #define NFS_MIN_FILE_IO_SIZE (1024U) |
| 16 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | struct nfs4_fsid { |
| 18 | __u64 major; |
| 19 | __u64 minor; |
| 20 | }; |
| 21 | |
| 22 | struct nfs_fattr { |
| 23 | unsigned short valid; /* which fields are valid */ |
| 24 | __u64 pre_size; /* pre_op_attr.size */ |
| 25 | struct timespec pre_mtime; /* pre_op_attr.mtime */ |
| 26 | struct timespec pre_ctime; /* pre_op_attr.ctime */ |
| 27 | enum nfs_ftype type; /* always use NFSv2 types */ |
| 28 | __u32 mode; |
| 29 | __u32 nlink; |
| 30 | __u32 uid; |
| 31 | __u32 gid; |
| 32 | __u64 size; |
| 33 | union { |
| 34 | struct { |
| 35 | __u32 blocksize; |
| 36 | __u32 blocks; |
| 37 | } nfs2; |
| 38 | struct { |
| 39 | __u64 used; |
| 40 | } nfs3; |
| 41 | } du; |
| 42 | dev_t rdev; |
| 43 | union { |
| 44 | __u64 nfs3; /* also nfs2 */ |
| 45 | struct nfs4_fsid nfs4; |
| 46 | } fsid_u; |
| 47 | __u64 fileid; |
| 48 | struct timespec atime; |
| 49 | struct timespec mtime; |
| 50 | struct timespec ctime; |
| 51 | __u32 bitmap[2]; /* NFSv4 returned attribute bitmap */ |
| 52 | __u64 change_attr; /* NFSv4 change attribute */ |
| 53 | __u64 pre_change_attr;/* pre-op NFSv4 change attribute */ |
Trond Myklebust | 3380114 | 2005-10-27 22:12:39 -0400 | [diff] [blame] | 54 | unsigned long time_start; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | #define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */ |
| 58 | #define NFS_ATTR_FATTR 0x0002 /* post-op attributes */ |
| 59 | #define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */ |
| 60 | #define NFS_ATTR_FATTR_V4 0x0008 |
| 61 | #define NFS_ATTR_PRE_CHANGE 0x0010 |
| 62 | |
| 63 | /* |
| 64 | * Info on the file system |
| 65 | */ |
| 66 | struct nfs_fsinfo { |
| 67 | struct nfs_fattr *fattr; /* Post-op attributes */ |
| 68 | __u32 rtmax; /* max. read transfer size */ |
| 69 | __u32 rtpref; /* pref. read transfer size */ |
| 70 | __u32 rtmult; /* reads should be multiple of this */ |
| 71 | __u32 wtmax; /* max. write transfer size */ |
| 72 | __u32 wtpref; /* pref. write transfer size */ |
| 73 | __u32 wtmult; /* writes should be multiple of this */ |
| 74 | __u32 dtpref; /* pref. readdir transfer size */ |
| 75 | __u64 maxfilesize; |
| 76 | __u32 lease_time; /* in seconds */ |
| 77 | }; |
| 78 | |
| 79 | struct nfs_fsstat { |
| 80 | struct nfs_fattr *fattr; /* Post-op attributes */ |
| 81 | __u64 tbytes; /* total size in bytes */ |
| 82 | __u64 fbytes; /* # of free bytes */ |
| 83 | __u64 abytes; /* # of bytes available to user */ |
| 84 | __u64 tfiles; /* # of files */ |
| 85 | __u64 ffiles; /* # of free files */ |
| 86 | __u64 afiles; /* # of files available to user */ |
| 87 | }; |
| 88 | |
| 89 | struct nfs2_fsstat { |
| 90 | __u32 tsize; /* Server transfer size */ |
| 91 | __u32 bsize; /* Filesystem block size */ |
| 92 | __u32 blocks; /* No. of "bsize" blocks on filesystem */ |
| 93 | __u32 bfree; /* No. of free "bsize" blocks */ |
| 94 | __u32 bavail; /* No. of available "bsize" blocks */ |
| 95 | }; |
| 96 | |
| 97 | struct nfs_pathconf { |
| 98 | struct nfs_fattr *fattr; /* Post-op attributes */ |
| 99 | __u32 max_link; /* max # of hard links */ |
| 100 | __u32 max_namelen; /* max name length */ |
| 101 | }; |
| 102 | |
| 103 | struct nfs4_change_info { |
| 104 | u32 atomic; |
| 105 | u64 before; |
| 106 | u64 after; |
| 107 | }; |
| 108 | |
Trond Myklebust | cee54fc | 2005-10-18 14:20:12 -0700 | [diff] [blame] | 109 | struct nfs_seqid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | /* |
| 111 | * Arguments to the open call. |
| 112 | */ |
| 113 | struct nfs_openargs { |
| 114 | const struct nfs_fh * fh; |
Trond Myklebust | cee54fc | 2005-10-18 14:20:12 -0700 | [diff] [blame] | 115 | struct nfs_seqid * seqid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | int open_flags; |
| 117 | __u64 clientid; |
| 118 | __u32 id; |
| 119 | union { |
| 120 | struct iattr * attrs; /* UNCHECKED, GUARDED */ |
| 121 | nfs4_verifier verifier; /* EXCLUSIVE */ |
| 122 | nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */ |
| 123 | int delegation_type; /* CLAIM_PREVIOUS */ |
| 124 | } u; |
| 125 | const struct qstr * name; |
| 126 | const struct nfs_server *server; /* Needed for ID mapping */ |
| 127 | const u32 * bitmask; |
| 128 | __u32 claim; |
| 129 | }; |
| 130 | |
| 131 | struct nfs_openres { |
| 132 | nfs4_stateid stateid; |
| 133 | struct nfs_fh fh; |
| 134 | struct nfs4_change_info cinfo; |
| 135 | __u32 rflags; |
| 136 | struct nfs_fattr * f_attr; |
Trond Myklebust | 56ae19f | 2005-10-27 22:12:40 -0400 | [diff] [blame] | 137 | struct nfs_fattr * dir_attr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | const struct nfs_server *server; |
| 139 | int delegation_type; |
| 140 | nfs4_stateid delegation; |
| 141 | __u32 do_recall; |
| 142 | __u64 maxsize; |
| 143 | }; |
| 144 | |
| 145 | /* |
| 146 | * Arguments to the open_confirm call. |
| 147 | */ |
| 148 | struct nfs_open_confirmargs { |
| 149 | const struct nfs_fh * fh; |
Trond Myklebust | cdd4e68 | 2006-01-03 09:55:12 +0100 | [diff] [blame] | 150 | nfs4_stateid * stateid; |
Trond Myklebust | cee54fc | 2005-10-18 14:20:12 -0700 | [diff] [blame] | 151 | struct nfs_seqid * seqid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | }; |
| 153 | |
| 154 | struct nfs_open_confirmres { |
| 155 | nfs4_stateid stateid; |
| 156 | }; |
| 157 | |
| 158 | /* |
| 159 | * Arguments to the close call. |
| 160 | */ |
| 161 | struct nfs_closeargs { |
| 162 | struct nfs_fh * fh; |
Trond Myklebust | 9512135 | 2005-10-18 14:20:12 -0700 | [diff] [blame] | 163 | nfs4_stateid * stateid; |
Trond Myklebust | cee54fc | 2005-10-18 14:20:12 -0700 | [diff] [blame] | 164 | struct nfs_seqid * seqid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 165 | int open_flags; |
Trond Myklebust | 516a6af | 2005-10-27 22:12:41 -0400 | [diff] [blame] | 166 | const u32 * bitmask; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | }; |
| 168 | |
| 169 | struct nfs_closeres { |
| 170 | nfs4_stateid stateid; |
Trond Myklebust | 516a6af | 2005-10-27 22:12:41 -0400 | [diff] [blame] | 171 | struct nfs_fattr * fattr; |
| 172 | const struct nfs_server *server; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | }; |
| 174 | /* |
| 175 | * * Arguments to the lock,lockt, and locku call. |
| 176 | * */ |
| 177 | struct nfs_lowner { |
Trond Myklebust | 911d1aa | 2006-01-03 09:55:16 +0100 | [diff] [blame] | 178 | __u64 clientid; |
| 179 | u32 id; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | }; |
| 181 | |
Trond Myklebust | 911d1aa | 2006-01-03 09:55:16 +0100 | [diff] [blame] | 182 | struct nfs_lock_args { |
| 183 | struct nfs_fh * fh; |
| 184 | struct file_lock * fl; |
Trond Myklebust | 06735b3 | 2005-10-18 14:20:15 -0700 | [diff] [blame] | 185 | struct nfs_seqid * lock_seqid; |
| 186 | nfs4_stateid * lock_stateid; |
| 187 | struct nfs_seqid * open_seqid; |
| 188 | nfs4_stateid * open_stateid; |
Trond Myklebust | 911d1aa | 2006-01-03 09:55:16 +0100 | [diff] [blame] | 189 | struct nfs_lowner lock_owner; |
| 190 | unsigned char block : 1; |
| 191 | unsigned char reclaim : 1; |
| 192 | unsigned char new_lock_owner : 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 193 | }; |
| 194 | |
Trond Myklebust | 911d1aa | 2006-01-03 09:55:16 +0100 | [diff] [blame] | 195 | struct nfs_lock_res { |
| 196 | nfs4_stateid stateid; |
| 197 | }; |
| 198 | |
| 199 | struct nfs_locku_args { |
| 200 | struct nfs_fh * fh; |
| 201 | struct file_lock * fl; |
Trond Myklebust | cee54fc | 2005-10-18 14:20:12 -0700 | [diff] [blame] | 202 | struct nfs_seqid * seqid; |
Trond Myklebust | faf5f49 | 2005-10-18 14:20:15 -0700 | [diff] [blame] | 203 | nfs4_stateid * stateid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | }; |
| 205 | |
Trond Myklebust | 911d1aa | 2006-01-03 09:55:16 +0100 | [diff] [blame] | 206 | struct nfs_locku_res { |
| 207 | nfs4_stateid stateid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | }; |
| 209 | |
Trond Myklebust | 911d1aa | 2006-01-03 09:55:16 +0100 | [diff] [blame] | 210 | struct nfs_lockt_args { |
| 211 | struct nfs_fh * fh; |
| 212 | struct file_lock * fl; |
| 213 | struct nfs_lowner lock_owner; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | }; |
| 215 | |
Trond Myklebust | 911d1aa | 2006-01-03 09:55:16 +0100 | [diff] [blame] | 216 | struct nfs_lockt_res { |
| 217 | struct file_lock * denied; /* LOCK, LOCKT failed */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | }; |
| 219 | |
| 220 | struct nfs4_delegreturnargs { |
| 221 | const struct nfs_fh *fhandle; |
| 222 | const nfs4_stateid *stateid; |
| 223 | }; |
| 224 | |
| 225 | /* |
| 226 | * Arguments to the read call. |
| 227 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | struct nfs_readargs { |
| 229 | struct nfs_fh * fh; |
| 230 | struct nfs_open_context *context; |
| 231 | __u64 offset; |
| 232 | __u32 count; |
| 233 | unsigned int pgbase; |
| 234 | struct page ** pages; |
| 235 | }; |
| 236 | |
| 237 | struct nfs_readres { |
| 238 | struct nfs_fattr * fattr; |
| 239 | __u32 count; |
| 240 | int eof; |
| 241 | }; |
| 242 | |
| 243 | /* |
| 244 | * Arguments to the write call. |
| 245 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | struct nfs_writeargs { |
| 247 | struct nfs_fh * fh; |
| 248 | struct nfs_open_context *context; |
| 249 | __u64 offset; |
| 250 | __u32 count; |
| 251 | enum nfs3_stable_how stable; |
| 252 | unsigned int pgbase; |
| 253 | struct page ** pages; |
Trond Myklebust | 4f9838c | 2005-10-27 22:12:44 -0400 | [diff] [blame] | 254 | const u32 * bitmask; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | }; |
| 256 | |
| 257 | struct nfs_writeverf { |
| 258 | enum nfs3_stable_how committed; |
| 259 | __u32 verifier[2]; |
| 260 | }; |
| 261 | |
| 262 | struct nfs_writeres { |
| 263 | struct nfs_fattr * fattr; |
| 264 | struct nfs_writeverf * verf; |
| 265 | __u32 count; |
Trond Myklebust | 4f9838c | 2005-10-27 22:12:44 -0400 | [diff] [blame] | 266 | const struct nfs_server *server; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | }; |
| 268 | |
| 269 | /* |
| 270 | * Argument struct for decode_entry function |
| 271 | */ |
| 272 | struct nfs_entry { |
| 273 | __u64 ino; |
| 274 | __u64 cookie, |
| 275 | prev_cookie; |
| 276 | const char * name; |
| 277 | unsigned int len; |
| 278 | int eof; |
| 279 | struct nfs_fh * fh; |
| 280 | struct nfs_fattr * fattr; |
| 281 | }; |
| 282 | |
| 283 | /* |
| 284 | * The following types are for NFSv2 only. |
| 285 | */ |
| 286 | struct nfs_sattrargs { |
| 287 | struct nfs_fh * fh; |
| 288 | struct iattr * sattr; |
| 289 | }; |
| 290 | |
| 291 | struct nfs_diropargs { |
| 292 | struct nfs_fh * fh; |
| 293 | const char * name; |
| 294 | unsigned int len; |
| 295 | }; |
| 296 | |
| 297 | struct nfs_createargs { |
| 298 | struct nfs_fh * fh; |
| 299 | const char * name; |
| 300 | unsigned int len; |
| 301 | struct iattr * sattr; |
| 302 | }; |
| 303 | |
| 304 | struct nfs_renameargs { |
| 305 | struct nfs_fh * fromfh; |
| 306 | const char * fromname; |
| 307 | unsigned int fromlen; |
| 308 | struct nfs_fh * tofh; |
| 309 | const char * toname; |
| 310 | unsigned int tolen; |
| 311 | }; |
| 312 | |
| 313 | struct nfs_setattrargs { |
| 314 | struct nfs_fh * fh; |
| 315 | nfs4_stateid stateid; |
| 316 | struct iattr * iap; |
| 317 | const struct nfs_server * server; /* Needed for name mapping */ |
| 318 | const u32 * bitmask; |
| 319 | }; |
| 320 | |
J. Bruce Fields | 23ec696 | 2005-06-22 17:16:22 +0000 | [diff] [blame] | 321 | struct nfs_setaclargs { |
| 322 | struct nfs_fh * fh; |
| 323 | size_t acl_len; |
| 324 | unsigned int acl_pgbase; |
| 325 | struct page ** acl_pages; |
| 326 | }; |
| 327 | |
J. Bruce Fields | 029d105 | 2005-06-22 17:16:22 +0000 | [diff] [blame] | 328 | struct nfs_getaclargs { |
| 329 | struct nfs_fh * fh; |
| 330 | size_t acl_len; |
| 331 | unsigned int acl_pgbase; |
| 332 | struct page ** acl_pages; |
| 333 | }; |
| 334 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | struct nfs_setattrres { |
| 336 | struct nfs_fattr * fattr; |
| 337 | const struct nfs_server * server; |
| 338 | }; |
| 339 | |
| 340 | struct nfs_linkargs { |
| 341 | struct nfs_fh * fromfh; |
| 342 | struct nfs_fh * tofh; |
| 343 | const char * toname; |
| 344 | unsigned int tolen; |
| 345 | }; |
| 346 | |
| 347 | struct nfs_symlinkargs { |
| 348 | struct nfs_fh * fromfh; |
| 349 | const char * fromname; |
| 350 | unsigned int fromlen; |
| 351 | const char * topath; |
| 352 | unsigned int tolen; |
| 353 | struct iattr * sattr; |
| 354 | }; |
| 355 | |
| 356 | struct nfs_readdirargs { |
| 357 | struct nfs_fh * fh; |
| 358 | __u32 cookie; |
| 359 | unsigned int count; |
| 360 | struct page ** pages; |
| 361 | }; |
| 362 | |
Andreas Gruenbacher | b7fa055 | 2005-06-22 17:16:27 +0000 | [diff] [blame] | 363 | struct nfs3_getaclargs { |
| 364 | struct nfs_fh * fh; |
| 365 | int mask; |
| 366 | struct page ** pages; |
| 367 | }; |
| 368 | |
| 369 | struct nfs3_setaclargs { |
| 370 | struct inode * inode; |
| 371 | int mask; |
| 372 | struct posix_acl * acl_access; |
| 373 | struct posix_acl * acl_default; |
| 374 | struct page ** pages; |
| 375 | }; |
| 376 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | struct nfs_diropok { |
| 378 | struct nfs_fh * fh; |
| 379 | struct nfs_fattr * fattr; |
| 380 | }; |
| 381 | |
| 382 | struct nfs_readlinkargs { |
| 383 | struct nfs_fh * fh; |
| 384 | unsigned int pgbase; |
| 385 | unsigned int pglen; |
| 386 | struct page ** pages; |
| 387 | }; |
| 388 | |
| 389 | struct nfs3_sattrargs { |
| 390 | struct nfs_fh * fh; |
| 391 | struct iattr * sattr; |
| 392 | unsigned int guard; |
| 393 | struct timespec guardtime; |
| 394 | }; |
| 395 | |
| 396 | struct nfs3_diropargs { |
| 397 | struct nfs_fh * fh; |
| 398 | const char * name; |
| 399 | unsigned int len; |
| 400 | }; |
| 401 | |
| 402 | struct nfs3_accessargs { |
| 403 | struct nfs_fh * fh; |
| 404 | __u32 access; |
| 405 | }; |
| 406 | |
| 407 | struct nfs3_createargs { |
| 408 | struct nfs_fh * fh; |
| 409 | const char * name; |
| 410 | unsigned int len; |
| 411 | struct iattr * sattr; |
| 412 | enum nfs3_createmode createmode; |
| 413 | __u32 verifier[2]; |
| 414 | }; |
| 415 | |
| 416 | struct nfs3_mkdirargs { |
| 417 | struct nfs_fh * fh; |
| 418 | const char * name; |
| 419 | unsigned int len; |
| 420 | struct iattr * sattr; |
| 421 | }; |
| 422 | |
| 423 | struct nfs3_symlinkargs { |
| 424 | struct nfs_fh * fromfh; |
| 425 | const char * fromname; |
| 426 | unsigned int fromlen; |
| 427 | const char * topath; |
| 428 | unsigned int tolen; |
| 429 | struct iattr * sattr; |
| 430 | }; |
| 431 | |
| 432 | struct nfs3_mknodargs { |
| 433 | struct nfs_fh * fh; |
| 434 | const char * name; |
| 435 | unsigned int len; |
| 436 | enum nfs3_ftype type; |
| 437 | struct iattr * sattr; |
| 438 | dev_t rdev; |
| 439 | }; |
| 440 | |
| 441 | struct nfs3_renameargs { |
| 442 | struct nfs_fh * fromfh; |
| 443 | const char * fromname; |
| 444 | unsigned int fromlen; |
| 445 | struct nfs_fh * tofh; |
| 446 | const char * toname; |
| 447 | unsigned int tolen; |
| 448 | }; |
| 449 | |
| 450 | struct nfs3_linkargs { |
| 451 | struct nfs_fh * fromfh; |
| 452 | struct nfs_fh * tofh; |
| 453 | const char * toname; |
| 454 | unsigned int tolen; |
| 455 | }; |
| 456 | |
| 457 | struct nfs3_readdirargs { |
| 458 | struct nfs_fh * fh; |
| 459 | __u64 cookie; |
| 460 | __u32 verf[2]; |
| 461 | int plus; |
| 462 | unsigned int count; |
| 463 | struct page ** pages; |
| 464 | }; |
| 465 | |
| 466 | struct nfs3_diropres { |
| 467 | struct nfs_fattr * dir_attr; |
| 468 | struct nfs_fh * fh; |
| 469 | struct nfs_fattr * fattr; |
| 470 | }; |
| 471 | |
| 472 | struct nfs3_accessres { |
| 473 | struct nfs_fattr * fattr; |
| 474 | __u32 access; |
| 475 | }; |
| 476 | |
| 477 | struct nfs3_readlinkargs { |
| 478 | struct nfs_fh * fh; |
| 479 | unsigned int pgbase; |
| 480 | unsigned int pglen; |
| 481 | struct page ** pages; |
| 482 | }; |
| 483 | |
| 484 | struct nfs3_renameres { |
| 485 | struct nfs_fattr * fromattr; |
| 486 | struct nfs_fattr * toattr; |
| 487 | }; |
| 488 | |
| 489 | struct nfs3_linkres { |
| 490 | struct nfs_fattr * dir_attr; |
| 491 | struct nfs_fattr * fattr; |
| 492 | }; |
| 493 | |
| 494 | struct nfs3_readdirres { |
| 495 | struct nfs_fattr * dir_attr; |
| 496 | __u32 * verf; |
| 497 | int plus; |
| 498 | }; |
| 499 | |
Andreas Gruenbacher | b7fa055 | 2005-06-22 17:16:27 +0000 | [diff] [blame] | 500 | struct nfs3_getaclres { |
| 501 | struct nfs_fattr * fattr; |
| 502 | int mask; |
| 503 | unsigned int acl_access_count; |
| 504 | unsigned int acl_default_count; |
| 505 | struct posix_acl * acl_access; |
| 506 | struct posix_acl * acl_default; |
| 507 | }; |
| 508 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 509 | #ifdef CONFIG_NFS_V4 |
| 510 | |
| 511 | typedef u64 clientid4; |
| 512 | |
| 513 | struct nfs4_accessargs { |
| 514 | const struct nfs_fh * fh; |
| 515 | u32 access; |
| 516 | }; |
| 517 | |
| 518 | struct nfs4_accessres { |
| 519 | u32 supported; |
| 520 | u32 access; |
| 521 | }; |
| 522 | |
| 523 | struct nfs4_create_arg { |
| 524 | u32 ftype; |
| 525 | union { |
| 526 | struct qstr * symlink; /* NF4LNK */ |
| 527 | struct { |
| 528 | u32 specdata1; |
| 529 | u32 specdata2; |
| 530 | } device; /* NF4BLK, NF4CHR */ |
| 531 | } u; |
| 532 | const struct qstr * name; |
| 533 | const struct nfs_server * server; |
| 534 | const struct iattr * attrs; |
| 535 | const struct nfs_fh * dir_fh; |
| 536 | const u32 * bitmask; |
| 537 | }; |
| 538 | |
| 539 | struct nfs4_create_res { |
| 540 | const struct nfs_server * server; |
| 541 | struct nfs_fh * fh; |
| 542 | struct nfs_fattr * fattr; |
| 543 | struct nfs4_change_info dir_cinfo; |
Trond Myklebust | 56ae19f | 2005-10-27 22:12:40 -0400 | [diff] [blame] | 544 | struct nfs_fattr * dir_fattr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 545 | }; |
| 546 | |
| 547 | struct nfs4_fsinfo_arg { |
| 548 | const struct nfs_fh * fh; |
| 549 | const u32 * bitmask; |
| 550 | }; |
| 551 | |
| 552 | struct nfs4_getattr_arg { |
| 553 | const struct nfs_fh * fh; |
| 554 | const u32 * bitmask; |
| 555 | }; |
| 556 | |
| 557 | struct nfs4_getattr_res { |
| 558 | const struct nfs_server * server; |
| 559 | struct nfs_fattr * fattr; |
| 560 | }; |
| 561 | |
| 562 | struct nfs4_link_arg { |
| 563 | const struct nfs_fh * fh; |
| 564 | const struct nfs_fh * dir_fh; |
| 565 | const struct qstr * name; |
Trond Myklebust | 91ba2ee | 2005-10-27 22:12:42 -0400 | [diff] [blame] | 566 | const u32 * bitmask; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 567 | }; |
| 568 | |
Trond Myklebust | 91ba2ee | 2005-10-27 22:12:42 -0400 | [diff] [blame] | 569 | struct nfs4_link_res { |
| 570 | const struct nfs_server * server; |
| 571 | struct nfs_fattr * fattr; |
| 572 | struct nfs4_change_info cinfo; |
| 573 | struct nfs_fattr * dir_attr; |
| 574 | }; |
| 575 | |
| 576 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 577 | struct nfs4_lookup_arg { |
| 578 | const struct nfs_fh * dir_fh; |
| 579 | const struct qstr * name; |
| 580 | const u32 * bitmask; |
| 581 | }; |
| 582 | |
| 583 | struct nfs4_lookup_res { |
| 584 | const struct nfs_server * server; |
| 585 | struct nfs_fattr * fattr; |
| 586 | struct nfs_fh * fh; |
| 587 | }; |
| 588 | |
| 589 | struct nfs4_lookup_root_arg { |
| 590 | const u32 * bitmask; |
| 591 | }; |
| 592 | |
| 593 | struct nfs4_pathconf_arg { |
| 594 | const struct nfs_fh * fh; |
| 595 | const u32 * bitmask; |
| 596 | }; |
| 597 | |
| 598 | struct nfs4_readdir_arg { |
| 599 | const struct nfs_fh * fh; |
| 600 | u64 cookie; |
| 601 | nfs4_verifier verifier; |
| 602 | u32 count; |
| 603 | struct page ** pages; /* zero-copy data */ |
| 604 | unsigned int pgbase; /* zero-copy data */ |
| 605 | const u32 * bitmask; |
| 606 | }; |
| 607 | |
| 608 | struct nfs4_readdir_res { |
| 609 | nfs4_verifier verifier; |
| 610 | unsigned int pgbase; |
| 611 | }; |
| 612 | |
| 613 | struct nfs4_readlink { |
| 614 | const struct nfs_fh * fh; |
| 615 | unsigned int pgbase; |
| 616 | unsigned int pglen; /* zero-copy data */ |
| 617 | struct page ** pages; /* zero-copy data */ |
| 618 | }; |
| 619 | |
| 620 | struct nfs4_remove_arg { |
| 621 | const struct nfs_fh * fh; |
| 622 | const struct qstr * name; |
Trond Myklebust | 16e4295 | 2005-10-27 22:12:44 -0400 | [diff] [blame] | 623 | const u32 * bitmask; |
| 624 | }; |
| 625 | |
| 626 | struct nfs4_remove_res { |
| 627 | const struct nfs_server * server; |
| 628 | struct nfs4_change_info cinfo; |
| 629 | struct nfs_fattr * dir_attr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 630 | }; |
| 631 | |
| 632 | struct nfs4_rename_arg { |
| 633 | const struct nfs_fh * old_dir; |
| 634 | const struct nfs_fh * new_dir; |
| 635 | const struct qstr * old_name; |
| 636 | const struct qstr * new_name; |
Trond Myklebust | 6caf2c8 | 2005-10-27 22:12:43 -0400 | [diff] [blame] | 637 | const u32 * bitmask; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 638 | }; |
| 639 | |
| 640 | struct nfs4_rename_res { |
Trond Myklebust | 6caf2c8 | 2005-10-27 22:12:43 -0400 | [diff] [blame] | 641 | const struct nfs_server * server; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 642 | struct nfs4_change_info old_cinfo; |
Trond Myklebust | 6caf2c8 | 2005-10-27 22:12:43 -0400 | [diff] [blame] | 643 | struct nfs_fattr * old_fattr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 644 | struct nfs4_change_info new_cinfo; |
Trond Myklebust | 6caf2c8 | 2005-10-27 22:12:43 -0400 | [diff] [blame] | 645 | struct nfs_fattr * new_fattr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 646 | }; |
| 647 | |
| 648 | struct nfs4_setclientid { |
| 649 | const nfs4_verifier * sc_verifier; /* request */ |
| 650 | unsigned int sc_name_len; |
| 651 | char sc_name[32]; /* request */ |
| 652 | u32 sc_prog; /* request */ |
| 653 | unsigned int sc_netid_len; |
| 654 | char sc_netid[4]; /* request */ |
| 655 | unsigned int sc_uaddr_len; |
| 656 | char sc_uaddr[24]; /* request */ |
| 657 | u32 sc_cb_ident; /* request */ |
| 658 | }; |
| 659 | |
| 660 | struct nfs4_statfs_arg { |
| 661 | const struct nfs_fh * fh; |
| 662 | const u32 * bitmask; |
| 663 | }; |
| 664 | |
| 665 | struct nfs4_server_caps_res { |
| 666 | u32 attr_bitmask[2]; |
| 667 | u32 acl_bitmask; |
| 668 | u32 has_links; |
| 669 | u32 has_symlinks; |
| 670 | }; |
| 671 | |
| 672 | #endif /* CONFIG_NFS_V4 */ |
| 673 | |
| 674 | struct nfs_page; |
| 675 | |
Chuck Lever | 40859d7 | 2005-11-30 18:09:02 -0500 | [diff] [blame] | 676 | #define NFS_PAGEVEC_SIZE (8U) |
| 677 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 678 | struct nfs_read_data { |
| 679 | int flags; |
| 680 | struct rpc_task task; |
| 681 | struct inode *inode; |
| 682 | struct rpc_cred *cred; |
| 683 | struct nfs_fattr fattr; /* fattr storage */ |
| 684 | struct list_head pages; /* Coalesced read requests */ |
| 685 | struct nfs_page *req; /* multi ops per nfs_page */ |
Chuck Lever | 40859d7 | 2005-11-30 18:09:02 -0500 | [diff] [blame] | 686 | struct page **pagevec; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 687 | struct nfs_readargs args; |
| 688 | struct nfs_readres res; |
| 689 | #ifdef CONFIG_NFS_V4 |
| 690 | unsigned long timestamp; /* For lease renewal */ |
| 691 | #endif |
| 692 | void (*complete) (struct nfs_read_data *, int); |
Chuck Lever | 40859d7 | 2005-11-30 18:09:02 -0500 | [diff] [blame] | 693 | struct page *page_array[NFS_PAGEVEC_SIZE + 1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 694 | }; |
| 695 | |
| 696 | struct nfs_write_data { |
| 697 | int flags; |
| 698 | struct rpc_task task; |
| 699 | struct inode *inode; |
| 700 | struct rpc_cred *cred; |
| 701 | struct nfs_fattr fattr; |
| 702 | struct nfs_writeverf verf; |
| 703 | struct list_head pages; /* Coalesced requests we wish to flush */ |
| 704 | struct nfs_page *req; /* multi ops per nfs_page */ |
Chuck Lever | 40859d7 | 2005-11-30 18:09:02 -0500 | [diff] [blame] | 705 | struct page **pagevec; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 706 | struct nfs_writeargs args; /* argument struct */ |
| 707 | struct nfs_writeres res; /* result struct */ |
| 708 | #ifdef CONFIG_NFS_V4 |
| 709 | unsigned long timestamp; /* For lease renewal */ |
| 710 | #endif |
| 711 | void (*complete) (struct nfs_write_data *, int); |
Chuck Lever | 40859d7 | 2005-11-30 18:09:02 -0500 | [diff] [blame] | 712 | struct page *page_array[NFS_PAGEVEC_SIZE + 1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 713 | }; |
| 714 | |
| 715 | struct nfs_access_entry; |
| 716 | |
| 717 | /* |
| 718 | * RPC procedure vector for NFSv2/NFSv3 demuxing |
| 719 | */ |
| 720 | struct nfs_rpc_ops { |
| 721 | int version; /* Protocol version */ |
| 722 | struct dentry_operations *dentry_ops; |
| 723 | struct inode_operations *dir_inode_ops; |
J. Bruce Fields | 92cfc62 | 2005-06-22 17:16:22 +0000 | [diff] [blame] | 724 | struct inode_operations *file_inode_ops; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 725 | |
| 726 | int (*getroot) (struct nfs_server *, struct nfs_fh *, |
| 727 | struct nfs_fsinfo *); |
| 728 | int (*getattr) (struct nfs_server *, struct nfs_fh *, |
| 729 | struct nfs_fattr *); |
| 730 | int (*setattr) (struct dentry *, struct nfs_fattr *, |
| 731 | struct iattr *); |
| 732 | int (*lookup) (struct inode *, struct qstr *, |
| 733 | struct nfs_fh *, struct nfs_fattr *); |
| 734 | int (*access) (struct inode *, struct nfs_access_entry *); |
| 735 | int (*readlink)(struct inode *, struct page *, unsigned int, |
| 736 | unsigned int); |
| 737 | int (*read) (struct nfs_read_data *); |
| 738 | int (*write) (struct nfs_write_data *); |
| 739 | int (*commit) (struct nfs_write_data *); |
| 740 | int (*create) (struct inode *, struct dentry *, |
Trond Myklebust | 02a913a | 2005-10-18 14:20:17 -0700 | [diff] [blame] | 741 | struct iattr *, int, struct nameidata *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 742 | int (*remove) (struct inode *, struct qstr *); |
| 743 | int (*unlink_setup) (struct rpc_message *, |
| 744 | struct dentry *, struct qstr *); |
| 745 | int (*unlink_done) (struct dentry *, struct rpc_task *); |
| 746 | int (*rename) (struct inode *, struct qstr *, |
| 747 | struct inode *, struct qstr *); |
| 748 | int (*link) (struct inode *, struct inode *, struct qstr *); |
| 749 | int (*symlink) (struct inode *, struct qstr *, struct qstr *, |
| 750 | struct iattr *, struct nfs_fh *, |
| 751 | struct nfs_fattr *); |
| 752 | int (*mkdir) (struct inode *, struct dentry *, struct iattr *); |
| 753 | int (*rmdir) (struct inode *, struct qstr *); |
| 754 | int (*readdir) (struct dentry *, struct rpc_cred *, |
| 755 | u64, struct page *, unsigned int, int); |
| 756 | int (*mknod) (struct inode *, struct dentry *, struct iattr *, |
| 757 | dev_t); |
| 758 | int (*statfs) (struct nfs_server *, struct nfs_fh *, |
| 759 | struct nfs_fsstat *); |
| 760 | int (*fsinfo) (struct nfs_server *, struct nfs_fh *, |
| 761 | struct nfs_fsinfo *); |
| 762 | int (*pathconf) (struct nfs_server *, struct nfs_fh *, |
| 763 | struct nfs_pathconf *); |
| 764 | u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); |
| 765 | void (*read_setup) (struct nfs_read_data *); |
| 766 | void (*write_setup) (struct nfs_write_data *, int how); |
| 767 | void (*commit_setup) (struct nfs_write_data *, int how); |
| 768 | int (*file_open) (struct inode *, struct file *); |
| 769 | int (*file_release) (struct inode *, struct file *); |
| 770 | int (*lock)(struct file *, int, struct file_lock *); |
Trond Myklebust | ada70d9 | 2005-06-22 17:16:22 +0000 | [diff] [blame] | 771 | void (*clear_acl_cache)(struct inode *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 772 | }; |
| 773 | |
| 774 | /* |
| 775 | * NFS_CALL(getattr, inode, (fattr)); |
| 776 | * into |
| 777 | * NFS_PROTO(inode)->getattr(fattr); |
| 778 | */ |
| 779 | #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args |
| 780 | |
| 781 | /* |
| 782 | * Function vectors etc. for the NFS client |
| 783 | */ |
| 784 | extern struct nfs_rpc_ops nfs_v2_clientops; |
| 785 | extern struct nfs_rpc_ops nfs_v3_clientops; |
| 786 | extern struct nfs_rpc_ops nfs_v4_clientops; |
| 787 | extern struct rpc_version nfs_version2; |
| 788 | extern struct rpc_version nfs_version3; |
| 789 | extern struct rpc_version nfs_version4; |
| 790 | |
Andreas Gruenbacher | b7fa055 | 2005-06-22 17:16:27 +0000 | [diff] [blame] | 791 | extern struct rpc_version nfsacl_version3; |
| 792 | extern struct rpc_program nfsacl_program; |
| 793 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 794 | #endif |