nfs_xdr.h 19 KB

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