nfs_xdr.h 30 KB

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