nfs_xdr.h 19 KB

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