nfs_xdr.h 28 KB

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