nfs_xdr.h 27 KB

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