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