nfs_xdr.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  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. /*
  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. __u32 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. const char * topath;
  321. unsigned int tolen;
  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. __u32 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. const char * topath;
  386. unsigned int tolen;
  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. __u32 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. __u32 * 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 qstr * symlink; /* NF4LNK */
  469. struct {
  470. u32 specdata1;
  471. u32 specdata2;
  472. } device; /* NF4BLK, NF4CHR */
  473. } u;
  474. const struct qstr * name;
  475. const struct nfs_server * server;
  476. const struct iattr * attrs;
  477. const struct nfs_fh * dir_fh;
  478. const u32 * bitmask;
  479. };
  480. struct nfs4_create_res {
  481. const struct nfs_server * server;
  482. struct nfs_fh * fh;
  483. struct nfs_fattr * fattr;
  484. struct nfs4_change_info dir_cinfo;
  485. struct nfs_fattr * dir_fattr;
  486. };
  487. struct nfs4_fsinfo_arg {
  488. const struct nfs_fh * fh;
  489. const u32 * bitmask;
  490. };
  491. struct nfs4_getattr_arg {
  492. const struct nfs_fh * fh;
  493. const u32 * bitmask;
  494. };
  495. struct nfs4_getattr_res {
  496. const struct nfs_server * server;
  497. struct nfs_fattr * fattr;
  498. };
  499. struct nfs4_link_arg {
  500. const struct nfs_fh * fh;
  501. const struct nfs_fh * dir_fh;
  502. const struct qstr * name;
  503. const u32 * bitmask;
  504. };
  505. struct nfs4_link_res {
  506. const struct nfs_server * server;
  507. struct nfs_fattr * fattr;
  508. struct nfs4_change_info cinfo;
  509. struct nfs_fattr * dir_attr;
  510. };
  511. struct nfs4_lookup_arg {
  512. const struct nfs_fh * dir_fh;
  513. const struct qstr * name;
  514. const u32 * bitmask;
  515. };
  516. struct nfs4_lookup_res {
  517. const struct nfs_server * server;
  518. struct nfs_fattr * fattr;
  519. struct nfs_fh * fh;
  520. };
  521. struct nfs4_lookup_root_arg {
  522. const u32 * bitmask;
  523. };
  524. struct nfs4_pathconf_arg {
  525. const struct nfs_fh * fh;
  526. const u32 * bitmask;
  527. };
  528. struct nfs4_readdir_arg {
  529. const struct nfs_fh * fh;
  530. u64 cookie;
  531. nfs4_verifier verifier;
  532. u32 count;
  533. struct page ** pages; /* zero-copy data */
  534. unsigned int pgbase; /* zero-copy data */
  535. const u32 * bitmask;
  536. };
  537. struct nfs4_readdir_res {
  538. nfs4_verifier verifier;
  539. unsigned int pgbase;
  540. };
  541. struct nfs4_readlink {
  542. const struct nfs_fh * fh;
  543. unsigned int pgbase;
  544. unsigned int pglen; /* zero-copy data */
  545. struct page ** pages; /* zero-copy data */
  546. };
  547. struct nfs4_remove_arg {
  548. const struct nfs_fh * fh;
  549. const struct qstr * name;
  550. const u32 * bitmask;
  551. };
  552. struct nfs4_remove_res {
  553. const struct nfs_server * server;
  554. struct nfs4_change_info cinfo;
  555. struct nfs_fattr * dir_attr;
  556. };
  557. struct nfs4_rename_arg {
  558. const struct nfs_fh * old_dir;
  559. const struct nfs_fh * new_dir;
  560. const struct qstr * old_name;
  561. const struct qstr * new_name;
  562. const u32 * bitmask;
  563. };
  564. struct nfs4_rename_res {
  565. const struct nfs_server * server;
  566. struct nfs4_change_info old_cinfo;
  567. struct nfs_fattr * old_fattr;
  568. struct nfs4_change_info new_cinfo;
  569. struct nfs_fattr * new_fattr;
  570. };
  571. struct nfs4_setclientid {
  572. const nfs4_verifier * sc_verifier; /* request */
  573. unsigned int sc_name_len;
  574. char sc_name[32]; /* request */
  575. u32 sc_prog; /* request */
  576. unsigned int sc_netid_len;
  577. char sc_netid[4]; /* request */
  578. unsigned int sc_uaddr_len;
  579. char sc_uaddr[24]; /* request */
  580. u32 sc_cb_ident; /* request */
  581. };
  582. struct nfs4_statfs_arg {
  583. const struct nfs_fh * fh;
  584. const u32 * bitmask;
  585. };
  586. struct nfs4_server_caps_res {
  587. u32 attr_bitmask[2];
  588. u32 acl_bitmask;
  589. u32 has_links;
  590. u32 has_symlinks;
  591. };
  592. struct nfs4_string {
  593. unsigned int len;
  594. char *data;
  595. };
  596. #define NFS4_PATHNAME_MAXCOMPONENTS 512
  597. struct nfs4_pathname {
  598. unsigned int ncomponents;
  599. struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
  600. };
  601. #define NFS4_FS_LOCATION_MAXSERVERS 10
  602. struct nfs4_fs_location {
  603. unsigned int nservers;
  604. struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
  605. struct nfs4_pathname rootpath;
  606. };
  607. #define NFS4_FS_LOCATIONS_MAXENTRIES 10
  608. struct nfs4_fs_locations {
  609. struct nfs_fattr fattr;
  610. const struct nfs_server *server;
  611. struct nfs4_pathname fs_path;
  612. int nlocations;
  613. struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
  614. };
  615. struct nfs4_fs_locations_arg {
  616. const struct nfs_fh *dir_fh;
  617. const struct qstr *name;
  618. struct page *page;
  619. const u32 *bitmask;
  620. };
  621. #endif /* CONFIG_NFS_V4 */
  622. struct nfs_page;
  623. #define NFS_PAGEVEC_SIZE (8U)
  624. struct nfs_read_data {
  625. int flags;
  626. struct rpc_task task;
  627. struct inode *inode;
  628. struct rpc_cred *cred;
  629. struct nfs_fattr fattr; /* fattr storage */
  630. struct list_head pages; /* Coalesced read requests */
  631. struct nfs_page *req; /* multi ops per nfs_page */
  632. struct page **pagevec;
  633. struct nfs_readargs args;
  634. struct nfs_readres res;
  635. #ifdef CONFIG_NFS_V4
  636. unsigned long timestamp; /* For lease renewal */
  637. #endif
  638. struct page *page_array[NFS_PAGEVEC_SIZE];
  639. };
  640. struct nfs_write_data {
  641. int flags;
  642. struct rpc_task task;
  643. struct inode *inode;
  644. struct rpc_cred *cred;
  645. struct nfs_fattr fattr;
  646. struct nfs_writeverf verf;
  647. struct list_head pages; /* Coalesced requests we wish to flush */
  648. struct nfs_page *req; /* multi ops per nfs_page */
  649. struct page **pagevec;
  650. struct nfs_writeargs args; /* argument struct */
  651. struct nfs_writeres res; /* result struct */
  652. #ifdef CONFIG_NFS_V4
  653. unsigned long timestamp; /* For lease renewal */
  654. #endif
  655. struct page *page_array[NFS_PAGEVEC_SIZE];
  656. };
  657. struct nfs_access_entry;
  658. /*
  659. * RPC procedure vector for NFSv2/NFSv3 demuxing
  660. */
  661. struct nfs_rpc_ops {
  662. int version; /* Protocol version */
  663. struct dentry_operations *dentry_ops;
  664. struct inode_operations *dir_inode_ops;
  665. struct inode_operations *file_inode_ops;
  666. int (*getroot) (struct nfs_server *, struct nfs_fh *,
  667. struct nfs_fsinfo *);
  668. int (*getattr) (struct nfs_server *, struct nfs_fh *,
  669. struct nfs_fattr *);
  670. int (*setattr) (struct dentry *, struct nfs_fattr *,
  671. struct iattr *);
  672. int (*lookup) (struct inode *, struct qstr *,
  673. struct nfs_fh *, struct nfs_fattr *);
  674. int (*access) (struct inode *, struct nfs_access_entry *);
  675. int (*readlink)(struct inode *, struct page *, unsigned int,
  676. unsigned int);
  677. int (*read) (struct nfs_read_data *);
  678. int (*write) (struct nfs_write_data *);
  679. int (*commit) (struct nfs_write_data *);
  680. int (*create) (struct inode *, struct dentry *,
  681. struct iattr *, int, struct nameidata *);
  682. int (*remove) (struct inode *, struct qstr *);
  683. int (*unlink_setup) (struct rpc_message *,
  684. struct dentry *, struct qstr *);
  685. int (*unlink_done) (struct dentry *, struct rpc_task *);
  686. int (*rename) (struct inode *, struct qstr *,
  687. struct inode *, struct qstr *);
  688. int (*link) (struct inode *, struct inode *, struct qstr *);
  689. int (*symlink) (struct inode *, struct qstr *, struct qstr *,
  690. struct iattr *, struct nfs_fh *,
  691. struct nfs_fattr *);
  692. int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
  693. int (*rmdir) (struct inode *, struct qstr *);
  694. int (*readdir) (struct dentry *, struct rpc_cred *,
  695. u64, struct page *, unsigned int, int);
  696. int (*mknod) (struct inode *, struct dentry *, struct iattr *,
  697. dev_t);
  698. int (*statfs) (struct nfs_server *, struct nfs_fh *,
  699. struct nfs_fsstat *);
  700. int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
  701. struct nfs_fsinfo *);
  702. int (*pathconf) (struct nfs_server *, struct nfs_fh *,
  703. struct nfs_pathconf *);
  704. u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus);
  705. void (*read_setup) (struct nfs_read_data *);
  706. int (*read_done) (struct rpc_task *, struct nfs_read_data *);
  707. void (*write_setup) (struct nfs_write_data *, int how);
  708. int (*write_done) (struct rpc_task *, struct nfs_write_data *);
  709. void (*commit_setup) (struct nfs_write_data *, int how);
  710. int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
  711. int (*file_open) (struct inode *, struct file *);
  712. int (*file_release) (struct inode *, struct file *);
  713. int (*lock)(struct file *, int, struct file_lock *);
  714. void (*clear_acl_cache)(struct inode *);
  715. };
  716. /*
  717. * NFS_CALL(getattr, inode, (fattr));
  718. * into
  719. * NFS_PROTO(inode)->getattr(fattr);
  720. */
  721. #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
  722. /*
  723. * Function vectors etc. for the NFS client
  724. */
  725. extern struct nfs_rpc_ops nfs_v2_clientops;
  726. extern struct nfs_rpc_ops nfs_v3_clientops;
  727. extern struct nfs_rpc_ops nfs_v4_clientops;
  728. extern struct rpc_version nfs_version2;
  729. extern struct rpc_version nfs_version3;
  730. extern struct rpc_version nfs_version4;
  731. extern struct rpc_version nfsacl_version3;
  732. extern struct rpc_program nfsacl_program;
  733. #endif