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; |
Trond Myklebust | fa178f2 | 2006-01-03 09:55:38 +0100 | [diff] [blame] | 223 | const u32 * bitmask; |
| 224 | }; |
| 225 | |
| 226 | struct nfs4_delegreturnres { |
| 227 | struct nfs_fattr * fattr; |
| 228 | const struct nfs_server *server; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | }; |
| 230 | |
| 231 | /* |
| 232 | * Arguments to the read call. |
| 233 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | struct nfs_readargs { |
| 235 | struct nfs_fh * fh; |
| 236 | struct nfs_open_context *context; |
| 237 | __u64 offset; |
| 238 | __u32 count; |
| 239 | unsigned int pgbase; |
| 240 | struct page ** pages; |
| 241 | }; |
| 242 | |
| 243 | struct nfs_readres { |
| 244 | struct nfs_fattr * fattr; |
| 245 | __u32 count; |
| 246 | int eof; |
| 247 | }; |
| 248 | |
| 249 | /* |
| 250 | * Arguments to the write call. |
| 251 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | struct nfs_writeargs { |
| 253 | struct nfs_fh * fh; |
| 254 | struct nfs_open_context *context; |
| 255 | __u64 offset; |
| 256 | __u32 count; |
| 257 | enum nfs3_stable_how stable; |
| 258 | unsigned int pgbase; |
| 259 | struct page ** pages; |
Trond Myklebust | 4f9838c | 2005-10-27 22:12:44 -0400 | [diff] [blame] | 260 | const u32 * bitmask; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | }; |
| 262 | |
| 263 | struct nfs_writeverf { |
| 264 | enum nfs3_stable_how committed; |
| 265 | __u32 verifier[2]; |
| 266 | }; |
| 267 | |
| 268 | struct nfs_writeres { |
| 269 | struct nfs_fattr * fattr; |
| 270 | struct nfs_writeverf * verf; |
| 271 | __u32 count; |
Trond Myklebust | 4f9838c | 2005-10-27 22:12:44 -0400 | [diff] [blame] | 272 | const struct nfs_server *server; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | }; |
| 274 | |
| 275 | /* |
| 276 | * Argument struct for decode_entry function |
| 277 | */ |
| 278 | struct nfs_entry { |
| 279 | __u64 ino; |
| 280 | __u64 cookie, |
| 281 | prev_cookie; |
| 282 | const char * name; |
| 283 | unsigned int len; |
| 284 | int eof; |
| 285 | struct nfs_fh * fh; |
| 286 | struct nfs_fattr * fattr; |
| 287 | }; |
| 288 | |
| 289 | /* |
| 290 | * The following types are for NFSv2 only. |
| 291 | */ |
| 292 | struct nfs_sattrargs { |
| 293 | struct nfs_fh * fh; |
| 294 | struct iattr * sattr; |
| 295 | }; |
| 296 | |
| 297 | struct nfs_diropargs { |
| 298 | struct nfs_fh * fh; |
| 299 | const char * name; |
| 300 | unsigned int len; |
| 301 | }; |
| 302 | |
| 303 | struct nfs_createargs { |
| 304 | struct nfs_fh * fh; |
| 305 | const char * name; |
| 306 | unsigned int len; |
| 307 | struct iattr * sattr; |
| 308 | }; |
| 309 | |
| 310 | struct nfs_renameargs { |
| 311 | struct nfs_fh * fromfh; |
| 312 | const char * fromname; |
| 313 | unsigned int fromlen; |
| 314 | struct nfs_fh * tofh; |
| 315 | const char * toname; |
| 316 | unsigned int tolen; |
| 317 | }; |
| 318 | |
| 319 | struct nfs_setattrargs { |
| 320 | struct nfs_fh * fh; |
| 321 | nfs4_stateid stateid; |
| 322 | struct iattr * iap; |
| 323 | const struct nfs_server * server; /* Needed for name mapping */ |
| 324 | const u32 * bitmask; |
| 325 | }; |
| 326 | |
J. Bruce Fields | 23ec696 | 2005-06-22 17:16:22 +0000 | [diff] [blame] | 327 | struct nfs_setaclargs { |
| 328 | struct nfs_fh * fh; |
| 329 | size_t acl_len; |
| 330 | unsigned int acl_pgbase; |
| 331 | struct page ** acl_pages; |
| 332 | }; |
| 333 | |
J. Bruce Fields | 029d105 | 2005-06-22 17:16:22 +0000 | [diff] [blame] | 334 | struct nfs_getaclargs { |
| 335 | struct nfs_fh * fh; |
| 336 | size_t acl_len; |
| 337 | unsigned int acl_pgbase; |
| 338 | struct page ** acl_pages; |
| 339 | }; |
| 340 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | struct nfs_setattrres { |
| 342 | struct nfs_fattr * fattr; |
| 343 | const struct nfs_server * server; |
| 344 | }; |
| 345 | |
| 346 | struct nfs_linkargs { |
| 347 | struct nfs_fh * fromfh; |
| 348 | struct nfs_fh * tofh; |
| 349 | const char * toname; |
| 350 | unsigned int tolen; |
| 351 | }; |
| 352 | |
| 353 | struct nfs_symlinkargs { |
| 354 | struct nfs_fh * fromfh; |
| 355 | const char * fromname; |
| 356 | unsigned int fromlen; |
| 357 | const char * topath; |
| 358 | unsigned int tolen; |
| 359 | struct iattr * sattr; |
| 360 | }; |
| 361 | |
| 362 | struct nfs_readdirargs { |
| 363 | struct nfs_fh * fh; |
| 364 | __u32 cookie; |
| 365 | unsigned int count; |
| 366 | struct page ** pages; |
| 367 | }; |
| 368 | |
Andreas Gruenbacher | b7fa055 | 2005-06-22 17:16:27 +0000 | [diff] [blame] | 369 | struct nfs3_getaclargs { |
| 370 | struct nfs_fh * fh; |
| 371 | int mask; |
| 372 | struct page ** pages; |
| 373 | }; |
| 374 | |
| 375 | struct nfs3_setaclargs { |
| 376 | struct inode * inode; |
| 377 | int mask; |
| 378 | struct posix_acl * acl_access; |
| 379 | struct posix_acl * acl_default; |
| 380 | struct page ** pages; |
| 381 | }; |
| 382 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | struct nfs_diropok { |
| 384 | struct nfs_fh * fh; |
| 385 | struct nfs_fattr * fattr; |
| 386 | }; |
| 387 | |
| 388 | struct nfs_readlinkargs { |
| 389 | struct nfs_fh * fh; |
| 390 | unsigned int pgbase; |
| 391 | unsigned int pglen; |
| 392 | struct page ** pages; |
| 393 | }; |
| 394 | |
| 395 | struct nfs3_sattrargs { |
| 396 | struct nfs_fh * fh; |
| 397 | struct iattr * sattr; |
| 398 | unsigned int guard; |
| 399 | struct timespec guardtime; |
| 400 | }; |
| 401 | |
| 402 | struct nfs3_diropargs { |
| 403 | struct nfs_fh * fh; |
| 404 | const char * name; |
| 405 | unsigned int len; |
| 406 | }; |
| 407 | |
| 408 | struct nfs3_accessargs { |
| 409 | struct nfs_fh * fh; |
| 410 | __u32 access; |
| 411 | }; |
| 412 | |
| 413 | struct nfs3_createargs { |
| 414 | struct nfs_fh * fh; |
| 415 | const char * name; |
| 416 | unsigned int len; |
| 417 | struct iattr * sattr; |
| 418 | enum nfs3_createmode createmode; |
| 419 | __u32 verifier[2]; |
| 420 | }; |
| 421 | |
| 422 | struct nfs3_mkdirargs { |
| 423 | struct nfs_fh * fh; |
| 424 | const char * name; |
| 425 | unsigned int len; |
| 426 | struct iattr * sattr; |
| 427 | }; |
| 428 | |
| 429 | struct nfs3_symlinkargs { |
| 430 | struct nfs_fh * fromfh; |
| 431 | const char * fromname; |
| 432 | unsigned int fromlen; |
| 433 | const char * topath; |
| 434 | unsigned int tolen; |
| 435 | struct iattr * sattr; |
| 436 | }; |
| 437 | |
| 438 | struct nfs3_mknodargs { |
| 439 | struct nfs_fh * fh; |
| 440 | const char * name; |
| 441 | unsigned int len; |
| 442 | enum nfs3_ftype type; |
| 443 | struct iattr * sattr; |
| 444 | dev_t rdev; |
| 445 | }; |
| 446 | |
| 447 | struct nfs3_renameargs { |
| 448 | struct nfs_fh * fromfh; |
| 449 | const char * fromname; |
| 450 | unsigned int fromlen; |
| 451 | struct nfs_fh * tofh; |
| 452 | const char * toname; |
| 453 | unsigned int tolen; |
| 454 | }; |
| 455 | |
| 456 | struct nfs3_linkargs { |
| 457 | struct nfs_fh * fromfh; |
| 458 | struct nfs_fh * tofh; |
| 459 | const char * toname; |
| 460 | unsigned int tolen; |
| 461 | }; |
| 462 | |
| 463 | struct nfs3_readdirargs { |
| 464 | struct nfs_fh * fh; |
| 465 | __u64 cookie; |
| 466 | __u32 verf[2]; |
| 467 | int plus; |
| 468 | unsigned int count; |
| 469 | struct page ** pages; |
| 470 | }; |
| 471 | |
| 472 | struct nfs3_diropres { |
| 473 | struct nfs_fattr * dir_attr; |
| 474 | struct nfs_fh * fh; |
| 475 | struct nfs_fattr * fattr; |
| 476 | }; |
| 477 | |
| 478 | struct nfs3_accessres { |
| 479 | struct nfs_fattr * fattr; |
| 480 | __u32 access; |
| 481 | }; |
| 482 | |
| 483 | struct nfs3_readlinkargs { |
| 484 | struct nfs_fh * fh; |
| 485 | unsigned int pgbase; |
| 486 | unsigned int pglen; |
| 487 | struct page ** pages; |
| 488 | }; |
| 489 | |
| 490 | struct nfs3_renameres { |
| 491 | struct nfs_fattr * fromattr; |
| 492 | struct nfs_fattr * toattr; |
| 493 | }; |
| 494 | |
| 495 | struct nfs3_linkres { |
| 496 | struct nfs_fattr * dir_attr; |
| 497 | struct nfs_fattr * fattr; |
| 498 | }; |
| 499 | |
| 500 | struct nfs3_readdirres { |
| 501 | struct nfs_fattr * dir_attr; |
| 502 | __u32 * verf; |
| 503 | int plus; |
| 504 | }; |
| 505 | |
Andreas Gruenbacher | b7fa055 | 2005-06-22 17:16:27 +0000 | [diff] [blame] | 506 | struct nfs3_getaclres { |
| 507 | struct nfs_fattr * fattr; |
| 508 | int mask; |
| 509 | unsigned int acl_access_count; |
| 510 | unsigned int acl_default_count; |
| 511 | struct posix_acl * acl_access; |
| 512 | struct posix_acl * acl_default; |
| 513 | }; |
| 514 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 515 | #ifdef CONFIG_NFS_V4 |
| 516 | |
| 517 | typedef u64 clientid4; |
| 518 | |
| 519 | struct nfs4_accessargs { |
| 520 | const struct nfs_fh * fh; |
| 521 | u32 access; |
| 522 | }; |
| 523 | |
| 524 | struct nfs4_accessres { |
| 525 | u32 supported; |
| 526 | u32 access; |
| 527 | }; |
| 528 | |
| 529 | struct nfs4_create_arg { |
| 530 | u32 ftype; |
| 531 | union { |
| 532 | struct qstr * symlink; /* NF4LNK */ |
| 533 | struct { |
| 534 | u32 specdata1; |
| 535 | u32 specdata2; |
| 536 | } device; /* NF4BLK, NF4CHR */ |
| 537 | } u; |
| 538 | const struct qstr * name; |
| 539 | const struct nfs_server * server; |
| 540 | const struct iattr * attrs; |
| 541 | const struct nfs_fh * dir_fh; |
| 542 | const u32 * bitmask; |
| 543 | }; |
| 544 | |
| 545 | struct nfs4_create_res { |
| 546 | const struct nfs_server * server; |
| 547 | struct nfs_fh * fh; |
| 548 | struct nfs_fattr * fattr; |
| 549 | struct nfs4_change_info dir_cinfo; |
Trond Myklebust | 56ae19f | 2005-10-27 22:12:40 -0400 | [diff] [blame] | 550 | struct nfs_fattr * dir_fattr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | }; |
| 552 | |
| 553 | struct nfs4_fsinfo_arg { |
| 554 | const struct nfs_fh * fh; |
| 555 | const u32 * bitmask; |
| 556 | }; |
| 557 | |
| 558 | struct nfs4_getattr_arg { |
| 559 | const struct nfs_fh * fh; |
| 560 | const u32 * bitmask; |
| 561 | }; |
| 562 | |
| 563 | struct nfs4_getattr_res { |
| 564 | const struct nfs_server * server; |
| 565 | struct nfs_fattr * fattr; |
| 566 | }; |
| 567 | |
| 568 | struct nfs4_link_arg { |
| 569 | const struct nfs_fh * fh; |
| 570 | const struct nfs_fh * dir_fh; |
| 571 | const struct qstr * name; |
Trond Myklebust | 91ba2ee | 2005-10-27 22:12:42 -0400 | [diff] [blame] | 572 | const u32 * bitmask; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 573 | }; |
| 574 | |
Trond Myklebust | 91ba2ee | 2005-10-27 22:12:42 -0400 | [diff] [blame] | 575 | struct nfs4_link_res { |
| 576 | const struct nfs_server * server; |
| 577 | struct nfs_fattr * fattr; |
| 578 | struct nfs4_change_info cinfo; |
| 579 | struct nfs_fattr * dir_attr; |
| 580 | }; |
| 581 | |
| 582 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 583 | struct nfs4_lookup_arg { |
| 584 | const struct nfs_fh * dir_fh; |
| 585 | const struct qstr * name; |
| 586 | const u32 * bitmask; |
| 587 | }; |
| 588 | |
| 589 | struct nfs4_lookup_res { |
| 590 | const struct nfs_server * server; |
| 591 | struct nfs_fattr * fattr; |
| 592 | struct nfs_fh * fh; |
| 593 | }; |
| 594 | |
| 595 | struct nfs4_lookup_root_arg { |
| 596 | const u32 * bitmask; |
| 597 | }; |
| 598 | |
| 599 | struct nfs4_pathconf_arg { |
| 600 | const struct nfs_fh * fh; |
| 601 | const u32 * bitmask; |
| 602 | }; |
| 603 | |
| 604 | struct nfs4_readdir_arg { |
| 605 | const struct nfs_fh * fh; |
| 606 | u64 cookie; |
| 607 | nfs4_verifier verifier; |
| 608 | u32 count; |
| 609 | struct page ** pages; /* zero-copy data */ |
| 610 | unsigned int pgbase; /* zero-copy data */ |
| 611 | const u32 * bitmask; |
| 612 | }; |
| 613 | |
| 614 | struct nfs4_readdir_res { |
| 615 | nfs4_verifier verifier; |
| 616 | unsigned int pgbase; |
| 617 | }; |
| 618 | |
| 619 | struct nfs4_readlink { |
| 620 | const struct nfs_fh * fh; |
| 621 | unsigned int pgbase; |
| 622 | unsigned int pglen; /* zero-copy data */ |
| 623 | struct page ** pages; /* zero-copy data */ |
| 624 | }; |
| 625 | |
| 626 | struct nfs4_remove_arg { |
| 627 | const struct nfs_fh * fh; |
| 628 | const struct qstr * name; |
Trond Myklebust | 16e4295 | 2005-10-27 22:12:44 -0400 | [diff] [blame] | 629 | const u32 * bitmask; |
| 630 | }; |
| 631 | |
| 632 | struct nfs4_remove_res { |
| 633 | const struct nfs_server * server; |
| 634 | struct nfs4_change_info cinfo; |
| 635 | struct nfs_fattr * dir_attr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 636 | }; |
| 637 | |
| 638 | struct nfs4_rename_arg { |
| 639 | const struct nfs_fh * old_dir; |
| 640 | const struct nfs_fh * new_dir; |
| 641 | const struct qstr * old_name; |
| 642 | const struct qstr * new_name; |
Trond Myklebust | 6caf2c8 | 2005-10-27 22:12:43 -0400 | [diff] [blame] | 643 | const u32 * bitmask; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 644 | }; |
| 645 | |
| 646 | struct nfs4_rename_res { |
Trond Myklebust | 6caf2c8 | 2005-10-27 22:12:43 -0400 | [diff] [blame] | 647 | const struct nfs_server * server; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 648 | struct nfs4_change_info old_cinfo; |
Trond Myklebust | 6caf2c8 | 2005-10-27 22:12:43 -0400 | [diff] [blame] | 649 | struct nfs_fattr * old_fattr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 650 | struct nfs4_change_info new_cinfo; |
Trond Myklebust | 6caf2c8 | 2005-10-27 22:12:43 -0400 | [diff] [blame] | 651 | struct nfs_fattr * new_fattr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 652 | }; |
| 653 | |
| 654 | struct nfs4_setclientid { |
| 655 | const nfs4_verifier * sc_verifier; /* request */ |
| 656 | unsigned int sc_name_len; |
| 657 | char sc_name[32]; /* request */ |
| 658 | u32 sc_prog; /* request */ |
| 659 | unsigned int sc_netid_len; |
| 660 | char sc_netid[4]; /* request */ |
| 661 | unsigned int sc_uaddr_len; |
| 662 | char sc_uaddr[24]; /* request */ |
| 663 | u32 sc_cb_ident; /* request */ |
| 664 | }; |
| 665 | |
| 666 | struct nfs4_statfs_arg { |
| 667 | const struct nfs_fh * fh; |
| 668 | const u32 * bitmask; |
| 669 | }; |
| 670 | |
| 671 | struct nfs4_server_caps_res { |
| 672 | u32 attr_bitmask[2]; |
| 673 | u32 acl_bitmask; |
| 674 | u32 has_links; |
| 675 | u32 has_symlinks; |
| 676 | }; |
| 677 | |
| 678 | #endif /* CONFIG_NFS_V4 */ |
| 679 | |
| 680 | struct nfs_page; |
| 681 | |
Chuck Lever | 40859d7 | 2005-11-30 18:09:02 -0500 | [diff] [blame] | 682 | #define NFS_PAGEVEC_SIZE (8U) |
| 683 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 684 | struct nfs_read_data { |
| 685 | int flags; |
| 686 | struct rpc_task task; |
| 687 | struct inode *inode; |
| 688 | struct rpc_cred *cred; |
| 689 | struct nfs_fattr fattr; /* fattr storage */ |
| 690 | struct list_head pages; /* Coalesced read requests */ |
| 691 | struct nfs_page *req; /* multi ops per nfs_page */ |
Chuck Lever | 40859d7 | 2005-11-30 18:09:02 -0500 | [diff] [blame] | 692 | struct page **pagevec; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 693 | struct nfs_readargs args; |
| 694 | struct nfs_readres res; |
| 695 | #ifdef CONFIG_NFS_V4 |
| 696 | unsigned long timestamp; /* For lease renewal */ |
| 697 | #endif |
Chuck Lever | 40859d7 | 2005-11-30 18:09:02 -0500 | [diff] [blame] | 698 | struct page *page_array[NFS_PAGEVEC_SIZE + 1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 699 | }; |
| 700 | |
| 701 | struct nfs_write_data { |
| 702 | int flags; |
| 703 | struct rpc_task task; |
| 704 | struct inode *inode; |
| 705 | struct rpc_cred *cred; |
| 706 | struct nfs_fattr fattr; |
| 707 | struct nfs_writeverf verf; |
| 708 | struct list_head pages; /* Coalesced requests we wish to flush */ |
| 709 | struct nfs_page *req; /* multi ops per nfs_page */ |
Chuck Lever | 40859d7 | 2005-11-30 18:09:02 -0500 | [diff] [blame] | 710 | struct page **pagevec; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 711 | struct nfs_writeargs args; /* argument struct */ |
| 712 | struct nfs_writeres res; /* result struct */ |
| 713 | #ifdef CONFIG_NFS_V4 |
| 714 | unsigned long timestamp; /* For lease renewal */ |
| 715 | #endif |
Chuck Lever | 40859d7 | 2005-11-30 18:09:02 -0500 | [diff] [blame] | 716 | struct page *page_array[NFS_PAGEVEC_SIZE + 1]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 717 | }; |
| 718 | |
| 719 | struct nfs_access_entry; |
| 720 | |
| 721 | /* |
| 722 | * RPC procedure vector for NFSv2/NFSv3 demuxing |
| 723 | */ |
| 724 | struct nfs_rpc_ops { |
| 725 | int version; /* Protocol version */ |
| 726 | struct dentry_operations *dentry_ops; |
| 727 | struct inode_operations *dir_inode_ops; |
J. Bruce Fields | 92cfc62 | 2005-06-22 17:16:22 +0000 | [diff] [blame] | 728 | struct inode_operations *file_inode_ops; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 729 | |
| 730 | int (*getroot) (struct nfs_server *, struct nfs_fh *, |
| 731 | struct nfs_fsinfo *); |
| 732 | int (*getattr) (struct nfs_server *, struct nfs_fh *, |
| 733 | struct nfs_fattr *); |
| 734 | int (*setattr) (struct dentry *, struct nfs_fattr *, |
| 735 | struct iattr *); |
| 736 | int (*lookup) (struct inode *, struct qstr *, |
| 737 | struct nfs_fh *, struct nfs_fattr *); |
| 738 | int (*access) (struct inode *, struct nfs_access_entry *); |
| 739 | int (*readlink)(struct inode *, struct page *, unsigned int, |
| 740 | unsigned int); |
| 741 | int (*read) (struct nfs_read_data *); |
| 742 | int (*write) (struct nfs_write_data *); |
| 743 | int (*commit) (struct nfs_write_data *); |
| 744 | int (*create) (struct inode *, struct dentry *, |
Trond Myklebust | 02a913a | 2005-10-18 14:20:17 -0700 | [diff] [blame] | 745 | struct iattr *, int, struct nameidata *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 746 | int (*remove) (struct inode *, struct qstr *); |
| 747 | int (*unlink_setup) (struct rpc_message *, |
| 748 | struct dentry *, struct qstr *); |
| 749 | int (*unlink_done) (struct dentry *, struct rpc_task *); |
| 750 | int (*rename) (struct inode *, struct qstr *, |
| 751 | struct inode *, struct qstr *); |
| 752 | int (*link) (struct inode *, struct inode *, struct qstr *); |
| 753 | int (*symlink) (struct inode *, struct qstr *, struct qstr *, |
| 754 | struct iattr *, struct nfs_fh *, |
| 755 | struct nfs_fattr *); |
| 756 | int (*mkdir) (struct inode *, struct dentry *, struct iattr *); |
| 757 | int (*rmdir) (struct inode *, struct qstr *); |
| 758 | int (*readdir) (struct dentry *, struct rpc_cred *, |
| 759 | u64, struct page *, unsigned int, int); |
| 760 | int (*mknod) (struct inode *, struct dentry *, struct iattr *, |
| 761 | dev_t); |
| 762 | int (*statfs) (struct nfs_server *, struct nfs_fh *, |
| 763 | struct nfs_fsstat *); |
| 764 | int (*fsinfo) (struct nfs_server *, struct nfs_fh *, |
| 765 | struct nfs_fsinfo *); |
| 766 | int (*pathconf) (struct nfs_server *, struct nfs_fh *, |
| 767 | struct nfs_pathconf *); |
| 768 | u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); |
| 769 | void (*read_setup) (struct nfs_read_data *); |
Trond Myklebust | ec06c09 | 2006-03-20 13:44:27 -0500 | [diff] [blame] | 770 | int (*read_done) (struct rpc_task *, struct nfs_read_data *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 771 | void (*write_setup) (struct nfs_write_data *, int how); |
Trond Myklebust | 788e7a8 | 2006-03-20 13:44:27 -0500 | [diff] [blame] | 772 | int (*write_done) (struct rpc_task *, struct nfs_write_data *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 773 | void (*commit_setup) (struct nfs_write_data *, int how); |
Trond Myklebust | 788e7a8 | 2006-03-20 13:44:27 -0500 | [diff] [blame] | 774 | int (*commit_done) (struct rpc_task *, struct nfs_write_data *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 775 | int (*file_open) (struct inode *, struct file *); |
| 776 | int (*file_release) (struct inode *, struct file *); |
| 777 | int (*lock)(struct file *, int, struct file_lock *); |
Trond Myklebust | ada70d9 | 2005-06-22 17:16:22 +0000 | [diff] [blame] | 778 | void (*clear_acl_cache)(struct inode *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 779 | }; |
| 780 | |
| 781 | /* |
| 782 | * NFS_CALL(getattr, inode, (fattr)); |
| 783 | * into |
| 784 | * NFS_PROTO(inode)->getattr(fattr); |
| 785 | */ |
| 786 | #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args |
| 787 | |
| 788 | /* |
| 789 | * Function vectors etc. for the NFS client |
| 790 | */ |
| 791 | extern struct nfs_rpc_ops nfs_v2_clientops; |
| 792 | extern struct nfs_rpc_ops nfs_v3_clientops; |
| 793 | extern struct nfs_rpc_ops nfs_v4_clientops; |
| 794 | extern struct rpc_version nfs_version2; |
| 795 | extern struct rpc_version nfs_version3; |
| 796 | extern struct rpc_version nfs_version4; |
| 797 | |
Andreas Gruenbacher | b7fa055 | 2005-06-22 17:16:27 +0000 | [diff] [blame] | 798 | extern struct rpc_version nfsacl_version3; |
| 799 | extern struct rpc_program nfsacl_program; |
| 800 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 801 | #endif |