nfs_xdr.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842
  1. #ifndef _LINUX_NFS_XDR_H
  2. #define _LINUX_NFS_XDR_H
  3. #include <linux/sunrpc/xprt.h>
  4. #include <linux/nfsacl.h>
  5. /*
  6. * To change the maximum rsize and wsize supported by the NFS client, adjust
  7. * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can
  8. * support a megabyte or more. The default is left at 4096 bytes, which is
  9. * reasonable for NFS over UDP.
  10. */
  11. #define NFS_MAX_FILE_IO_SIZE (1048576U)
  12. #define NFS_DEF_FILE_IO_SIZE (4096U)
  13. #define NFS_MIN_FILE_IO_SIZE (1024U)
  14. struct nfs_fsid {
  15. uint64_t major;
  16. uint64_t minor;
  17. };
  18. /*
  19. * Helper for checking equality between 2 fsids.
  20. */
  21. static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
  22. {
  23. return a->major == b->major && a->minor == b->minor;
  24. }
  25. struct nfs_fattr {
  26. unsigned short valid; /* which fields are valid */
  27. __u64 pre_size; /* pre_op_attr.size */
  28. struct timespec pre_mtime; /* pre_op_attr.mtime */
  29. struct timespec pre_ctime; /* pre_op_attr.ctime */
  30. enum nfs_ftype type; /* always use NFSv2 types */
  31. __u32 mode;
  32. __u32 nlink;
  33. __u32 uid;
  34. __u32 gid;
  35. __u64 size;
  36. union {
  37. struct {
  38. __u32 blocksize;
  39. __u32 blocks;
  40. } nfs2;
  41. struct {
  42. __u64 used;
  43. } nfs3;
  44. } du;
  45. dev_t rdev;
  46. struct nfs_fsid fsid;
  47. __u64 fileid;
  48. struct timespec atime;
  49. struct timespec mtime;
  50. struct timespec ctime;
  51. __u32 bitmap[2]; /* NFSv4 returned attribute bitmap */
  52. __u64 change_attr; /* NFSv4 change attribute */
  53. __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
  54. unsigned long time_start;
  55. };
  56. #define NFS_ATTR_WCC 0x0001 /* pre-op WCC data */
  57. #define NFS_ATTR_FATTR 0x0002 /* post-op attributes */
  58. #define NFS_ATTR_FATTR_V3 0x0004 /* NFSv3 attributes */
  59. #define NFS_ATTR_FATTR_V4 0x0008 /* NFSv4 change attribute */
  60. #define NFS_ATTR_FATTR_V4_REFERRAL 0x0010 /* 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. __u32 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. };
  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. u32 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. __u32 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. * Argument struct for decode_entry function
  251. */
  252. struct nfs_entry {
  253. __u64 ino;
  254. __u64 cookie,
  255. prev_cookie;
  256. const char * name;
  257. unsigned int len;
  258. int eof;
  259. struct nfs_fh * fh;
  260. struct nfs_fattr * fattr;
  261. };
  262. /*
  263. * The following types are for NFSv2 only.
  264. */
  265. struct nfs_sattrargs {
  266. struct nfs_fh * fh;
  267. struct iattr * sattr;
  268. };
  269. struct nfs_diropargs {
  270. struct nfs_fh * fh;
  271. const char * name;
  272. unsigned int len;
  273. };
  274. struct nfs_createargs {
  275. struct nfs_fh * fh;
  276. const char * name;
  277. unsigned int len;
  278. struct iattr * sattr;
  279. };
  280. struct nfs_renameargs {
  281. struct nfs_fh * fromfh;
  282. const char * fromname;
  283. unsigned int fromlen;
  284. struct nfs_fh * tofh;
  285. const char * toname;
  286. unsigned int tolen;
  287. };
  288. struct nfs_setattrargs {
  289. struct nfs_fh * fh;
  290. nfs4_stateid stateid;
  291. struct iattr * iap;
  292. const struct nfs_server * server; /* Needed for name mapping */
  293. const u32 * bitmask;
  294. };
  295. struct nfs_setaclargs {
  296. struct nfs_fh * fh;
  297. size_t acl_len;
  298. unsigned int acl_pgbase;
  299. struct page ** acl_pages;
  300. };
  301. struct nfs_getaclargs {
  302. struct nfs_fh * fh;
  303. size_t acl_len;
  304. unsigned int acl_pgbase;
  305. struct page ** acl_pages;
  306. };
  307. struct nfs_setattrres {
  308. struct nfs_fattr * fattr;
  309. const struct nfs_server * server;
  310. };
  311. struct nfs_linkargs {
  312. struct nfs_fh * fromfh;
  313. struct nfs_fh * tofh;
  314. const char * toname;
  315. unsigned int tolen;
  316. };
  317. struct nfs_symlinkargs {
  318. struct nfs_fh * fromfh;
  319. const char * fromname;
  320. unsigned int fromlen;
  321. const char * topath;
  322. unsigned int tolen;
  323. struct iattr * sattr;
  324. };
  325. struct nfs_readdirargs {
  326. struct nfs_fh * fh;
  327. __u32 cookie;
  328. unsigned int count;
  329. struct page ** pages;
  330. };
  331. struct nfs3_getaclargs {
  332. struct nfs_fh * fh;
  333. int mask;
  334. struct page ** pages;
  335. };
  336. struct nfs3_setaclargs {
  337. struct inode * inode;
  338. int mask;
  339. struct posix_acl * acl_access;
  340. struct posix_acl * acl_default;
  341. struct page ** pages;
  342. };
  343. struct nfs_diropok {
  344. struct nfs_fh * fh;
  345. struct nfs_fattr * fattr;
  346. };
  347. struct nfs_readlinkargs {
  348. struct nfs_fh * fh;
  349. unsigned int pgbase;
  350. unsigned int pglen;
  351. struct page ** pages;
  352. };
  353. struct nfs3_sattrargs {
  354. struct nfs_fh * fh;
  355. struct iattr * sattr;
  356. unsigned int guard;
  357. struct timespec guardtime;
  358. };
  359. struct nfs3_diropargs {
  360. struct nfs_fh * fh;
  361. const char * name;
  362. unsigned int len;
  363. };
  364. struct nfs3_accessargs {
  365. struct nfs_fh * fh;
  366. __u32 access;
  367. };
  368. struct nfs3_createargs {
  369. struct nfs_fh * fh;
  370. const char * name;
  371. unsigned int len;
  372. struct iattr * sattr;
  373. enum nfs3_createmode createmode;
  374. __u32 verifier[2];
  375. };
  376. struct nfs3_mkdirargs {
  377. struct nfs_fh * fh;
  378. const char * name;
  379. unsigned int len;
  380. struct iattr * sattr;
  381. };
  382. struct nfs3_symlinkargs {
  383. struct nfs_fh * fromfh;
  384. const char * fromname;
  385. unsigned int fromlen;
  386. const char * topath;
  387. unsigned int tolen;
  388. struct iattr * sattr;
  389. };
  390. struct nfs3_mknodargs {
  391. struct nfs_fh * fh;
  392. const char * name;
  393. unsigned int len;
  394. enum nfs3_ftype type;
  395. struct iattr * sattr;
  396. dev_t rdev;
  397. };
  398. struct nfs3_renameargs {
  399. struct nfs_fh * fromfh;
  400. const char * fromname;
  401. unsigned int fromlen;
  402. struct nfs_fh * tofh;
  403. const char * toname;
  404. unsigned int tolen;
  405. };
  406. struct nfs3_linkargs {
  407. struct nfs_fh * fromfh;
  408. struct nfs_fh * tofh;
  409. const char * toname;
  410. unsigned int tolen;
  411. };
  412. struct nfs3_readdirargs {
  413. struct nfs_fh * fh;
  414. __u64 cookie;
  415. __u32 verf[2];
  416. int plus;
  417. unsigned int count;
  418. struct page ** pages;
  419. };
  420. struct nfs3_diropres {
  421. struct nfs_fattr * dir_attr;
  422. struct nfs_fh * fh;
  423. struct nfs_fattr * fattr;
  424. };
  425. struct nfs3_accessres {
  426. struct nfs_fattr * fattr;
  427. __u32 access;
  428. };
  429. struct nfs3_readlinkargs {
  430. struct nfs_fh * fh;
  431. unsigned int pgbase;
  432. unsigned int pglen;
  433. struct page ** pages;
  434. };
  435. struct nfs3_renameres {
  436. struct nfs_fattr * fromattr;
  437. struct nfs_fattr * toattr;
  438. };
  439. struct nfs3_linkres {
  440. struct nfs_fattr * dir_attr;
  441. struct nfs_fattr * fattr;
  442. };
  443. struct nfs3_readdirres {
  444. struct nfs_fattr * dir_attr;
  445. __u32 * verf;
  446. int plus;
  447. };
  448. struct nfs3_getaclres {
  449. struct nfs_fattr * fattr;
  450. int mask;
  451. unsigned int acl_access_count;
  452. unsigned int acl_default_count;
  453. struct posix_acl * acl_access;
  454. struct posix_acl * acl_default;
  455. };
  456. #ifdef CONFIG_NFS_V4
  457. typedef u64 clientid4;
  458. struct nfs4_accessargs {
  459. const struct nfs_fh * fh;
  460. u32 access;
  461. };
  462. struct nfs4_accessres {
  463. u32 supported;
  464. u32 access;
  465. };
  466. struct nfs4_create_arg {
  467. u32 ftype;
  468. union {
  469. struct qstr * symlink; /* NF4LNK */
  470. struct {
  471. u32 specdata1;
  472. u32 specdata2;
  473. } device; /* NF4BLK, NF4CHR */
  474. } u;
  475. const struct qstr * name;
  476. const struct nfs_server * server;
  477. const struct iattr * attrs;
  478. const struct nfs_fh * dir_fh;
  479. const u32 * bitmask;
  480. };
  481. struct nfs4_create_res {
  482. const struct nfs_server * server;
  483. struct nfs_fh * fh;
  484. struct nfs_fattr * fattr;
  485. struct nfs4_change_info dir_cinfo;
  486. struct nfs_fattr * dir_fattr;
  487. };
  488. struct nfs4_fsinfo_arg {
  489. const struct nfs_fh * fh;
  490. const u32 * bitmask;
  491. };
  492. struct nfs4_getattr_arg {
  493. const struct nfs_fh * fh;
  494. const u32 * bitmask;
  495. };
  496. struct nfs4_getattr_res {
  497. const struct nfs_server * server;
  498. struct nfs_fattr * fattr;
  499. };
  500. struct nfs4_link_arg {
  501. const struct nfs_fh * fh;
  502. const struct nfs_fh * dir_fh;
  503. const struct qstr * name;
  504. const u32 * bitmask;
  505. };
  506. struct nfs4_link_res {
  507. const struct nfs_server * server;
  508. struct nfs_fattr * fattr;
  509. struct nfs4_change_info cinfo;
  510. struct nfs_fattr * dir_attr;
  511. };
  512. struct nfs4_lookup_arg {
  513. const struct nfs_fh * dir_fh;
  514. const struct qstr * name;
  515. const u32 * bitmask;
  516. };
  517. struct nfs4_lookup_res {
  518. const struct nfs_server * server;
  519. struct nfs_fattr * fattr;
  520. struct nfs_fh * fh;
  521. };
  522. struct nfs4_lookup_root_arg {
  523. const u32 * bitmask;
  524. };
  525. struct nfs4_pathconf_arg {
  526. const struct nfs_fh * fh;
  527. const u32 * bitmask;
  528. };
  529. struct nfs4_readdir_arg {
  530. const struct nfs_fh * fh;
  531. u64 cookie;
  532. nfs4_verifier verifier;
  533. u32 count;
  534. struct page ** pages; /* zero-copy data */
  535. unsigned int pgbase; /* zero-copy data */
  536. const u32 * bitmask;
  537. };
  538. struct nfs4_readdir_res {
  539. nfs4_verifier verifier;
  540. unsigned int pgbase;
  541. };
  542. struct nfs4_readlink {
  543. const struct nfs_fh * fh;
  544. unsigned int pgbase;
  545. unsigned int pglen; /* zero-copy data */
  546. struct page ** pages; /* zero-copy data */
  547. };
  548. struct nfs4_remove_arg {
  549. const struct nfs_fh * fh;
  550. const struct qstr * name;
  551. const u32 * bitmask;
  552. };
  553. struct nfs4_remove_res {
  554. const struct nfs_server * server;
  555. struct nfs4_change_info cinfo;
  556. struct nfs_fattr * dir_attr;
  557. };
  558. struct nfs4_rename_arg {
  559. const struct nfs_fh * old_dir;
  560. const struct nfs_fh * new_dir;
  561. const struct qstr * old_name;
  562. const struct qstr * new_name;
  563. const u32 * bitmask;
  564. };
  565. struct nfs4_rename_res {
  566. const struct nfs_server * server;
  567. struct nfs4_change_info old_cinfo;
  568. struct nfs_fattr * old_fattr;
  569. struct nfs4_change_info new_cinfo;
  570. struct nfs_fattr * new_fattr;
  571. };
  572. struct nfs4_setclientid {
  573. const nfs4_verifier * sc_verifier; /* request */
  574. unsigned int sc_name_len;
  575. char sc_name[32]; /* request */
  576. u32 sc_prog; /* request */
  577. unsigned int sc_netid_len;
  578. char sc_netid[4]; /* request */
  579. unsigned int sc_uaddr_len;
  580. char sc_uaddr[24]; /* request */
  581. u32 sc_cb_ident; /* request */
  582. };
  583. struct nfs4_statfs_arg {
  584. const struct nfs_fh * fh;
  585. const u32 * bitmask;
  586. };
  587. struct nfs4_server_caps_res {
  588. u32 attr_bitmask[2];
  589. u32 acl_bitmask;
  590. u32 has_links;
  591. u32 has_symlinks;
  592. };
  593. struct nfs4_string {
  594. unsigned int len;
  595. char *data;
  596. };
  597. #define NFS4_PATHNAME_MAXCOMPONENTS 512
  598. struct nfs4_pathname {
  599. unsigned int ncomponents;
  600. struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
  601. };
  602. #define NFS4_FS_LOCATION_MAXSERVERS 10
  603. struct nfs4_fs_location {
  604. unsigned int nservers;
  605. struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
  606. struct nfs4_pathname rootpath;
  607. };
  608. #define NFS4_FS_LOCATIONS_MAXENTRIES 10
  609. struct nfs4_fs_locations {
  610. struct nfs_fattr fattr;
  611. const struct nfs_server *server;
  612. struct nfs4_pathname fs_path;
  613. int nlocations;
  614. struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
  615. };
  616. struct nfs4_fs_locations_arg {
  617. const struct nfs_fh *dir_fh;
  618. const struct qstr *name;
  619. struct page *page;
  620. const u32 *bitmask;
  621. };
  622. #endif /* CONFIG_NFS_V4 */
  623. struct nfs_page;
  624. #define NFS_PAGEVEC_SIZE (8U)
  625. struct nfs_read_data {
  626. int flags;
  627. struct rpc_task task;
  628. struct inode *inode;
  629. struct rpc_cred *cred;
  630. struct nfs_fattr fattr; /* fattr storage */
  631. struct list_head pages; /* Coalesced read requests */
  632. struct nfs_page *req; /* multi ops per nfs_page */
  633. struct page **pagevec;
  634. unsigned int npages; /* active pages in pagevec */
  635. struct nfs_readargs args;
  636. struct nfs_readres res;
  637. #ifdef CONFIG_NFS_V4
  638. unsigned long timestamp; /* For lease renewal */
  639. #endif
  640. struct page *page_array[NFS_PAGEVEC_SIZE];
  641. };
  642. struct nfs_write_data {
  643. int flags;
  644. struct rpc_task task;
  645. struct inode *inode;
  646. struct rpc_cred *cred;
  647. struct nfs_fattr fattr;
  648. struct nfs_writeverf verf;
  649. struct list_head pages; /* Coalesced requests we wish to flush */
  650. struct nfs_page *req; /* multi ops per nfs_page */
  651. struct page **pagevec;
  652. unsigned int npages; /* active pages in pagevec */
  653. struct nfs_writeargs args; /* argument struct */
  654. struct nfs_writeres res; /* result struct */
  655. #ifdef CONFIG_NFS_V4
  656. unsigned long timestamp; /* For lease renewal */
  657. #endif
  658. struct page *page_array[NFS_PAGEVEC_SIZE];
  659. };
  660. struct nfs_access_entry;
  661. /*
  662. * RPC procedure vector for NFSv2/NFSv3 demuxing
  663. */
  664. struct nfs_rpc_ops {
  665. int version; /* Protocol version */
  666. struct dentry_operations *dentry_ops;
  667. struct inode_operations *dir_inode_ops;
  668. struct inode_operations *file_inode_ops;
  669. int (*getroot) (struct nfs_server *, struct nfs_fh *,
  670. struct nfs_fsinfo *);
  671. int (*getattr) (struct nfs_server *, struct nfs_fh *,
  672. struct nfs_fattr *);
  673. int (*setattr) (struct dentry *, struct nfs_fattr *,
  674. struct iattr *);
  675. int (*lookup) (struct inode *, struct qstr *,
  676. struct nfs_fh *, struct nfs_fattr *);
  677. int (*access) (struct inode *, struct nfs_access_entry *);
  678. int (*readlink)(struct inode *, struct page *, unsigned int,
  679. unsigned int);
  680. int (*read) (struct nfs_read_data *);
  681. int (*write) (struct nfs_write_data *);
  682. int (*commit) (struct nfs_write_data *);
  683. int (*create) (struct inode *, struct dentry *,
  684. struct iattr *, int, struct nameidata *);
  685. int (*remove) (struct inode *, struct qstr *);
  686. int (*unlink_setup) (struct rpc_message *,
  687. struct dentry *, struct qstr *);
  688. int (*unlink_done) (struct dentry *, struct rpc_task *);
  689. int (*rename) (struct inode *, struct qstr *,
  690. struct inode *, struct qstr *);
  691. int (*link) (struct inode *, struct inode *, struct qstr *);
  692. int (*symlink) (struct inode *, struct qstr *, struct qstr *,
  693. struct iattr *, struct nfs_fh *,
  694. struct nfs_fattr *);
  695. int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
  696. int (*rmdir) (struct inode *, struct qstr *);
  697. int (*readdir) (struct dentry *, struct rpc_cred *,
  698. u64, struct page *, unsigned int, int);
  699. int (*mknod) (struct inode *, struct dentry *, struct iattr *,
  700. dev_t);
  701. int (*statfs) (struct nfs_server *, struct nfs_fh *,
  702. struct nfs_fsstat *);
  703. int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
  704. struct nfs_fsinfo *);
  705. int (*pathconf) (struct nfs_server *, struct nfs_fh *,
  706. struct nfs_pathconf *);
  707. u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus);
  708. void (*read_setup) (struct nfs_read_data *);
  709. int (*read_done) (struct rpc_task *, struct nfs_read_data *);
  710. void (*write_setup) (struct nfs_write_data *, int how);
  711. int (*write_done) (struct rpc_task *, struct nfs_write_data *);
  712. void (*commit_setup) (struct nfs_write_data *, int how);
  713. int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
  714. int (*file_open) (struct inode *, struct file *);
  715. int (*file_release) (struct inode *, struct file *);
  716. int (*lock)(struct file *, int, struct file_lock *);
  717. void (*clear_acl_cache)(struct inode *);
  718. };
  719. /*
  720. * NFS_CALL(getattr, inode, (fattr));
  721. * into
  722. * NFS_PROTO(inode)->getattr(fattr);
  723. */
  724. #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
  725. /*
  726. * Function vectors etc. for the NFS client
  727. */
  728. extern struct nfs_rpc_ops nfs_v2_clientops;
  729. extern struct nfs_rpc_ops nfs_v3_clientops;
  730. extern struct nfs_rpc_ops nfs_v4_clientops;
  731. extern struct rpc_version nfs_version2;
  732. extern struct rpc_version nfs_version3;
  733. extern struct rpc_version nfs_version4;
  734. extern struct rpc_version nfsacl_version3;
  735. extern struct rpc_program nfsacl_program;
  736. #endif