nfs_xdr.h 25 KB

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