nfs_xdr.h 20 KB

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