nfs_xdr.h 19 KB

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