nfs_xdr.h 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599
  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. struct nfs4_string {
  15. unsigned int len;
  16. char *data;
  17. };
  18. struct nfs_fsid {
  19. uint64_t major;
  20. uint64_t minor;
  21. };
  22. /*
  23. * Helper for checking equality between 2 fsids.
  24. */
  25. static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
  26. {
  27. return a->major == b->major && a->minor == b->minor;
  28. }
  29. struct nfs4_threshold {
  30. __u32 bm;
  31. __u32 l_type;
  32. __u64 rd_sz;
  33. __u64 wr_sz;
  34. __u64 rd_io_sz;
  35. __u64 wr_io_sz;
  36. };
  37. struct nfs_fattr {
  38. unsigned int valid; /* which fields are valid */
  39. umode_t mode;
  40. __u32 nlink;
  41. kuid_t uid;
  42. kgid_t gid;
  43. dev_t rdev;
  44. __u64 size;
  45. union {
  46. struct {
  47. __u32 blocksize;
  48. __u32 blocks;
  49. } nfs2;
  50. struct {
  51. __u64 used;
  52. } nfs3;
  53. } du;
  54. struct nfs_fsid fsid;
  55. __u64 fileid;
  56. __u64 mounted_on_fileid;
  57. struct timespec atime;
  58. struct timespec mtime;
  59. struct timespec ctime;
  60. __u64 change_attr; /* NFSv4 change attribute */
  61. __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
  62. __u64 pre_size; /* pre_op_attr.size */
  63. struct timespec pre_mtime; /* pre_op_attr.mtime */
  64. struct timespec pre_ctime; /* pre_op_attr.ctime */
  65. unsigned long time_start;
  66. unsigned long gencount;
  67. struct nfs4_string *owner_name;
  68. struct nfs4_string *group_name;
  69. struct nfs4_threshold *mdsthreshold; /* pNFS threshold hints */
  70. };
  71. #define NFS_ATTR_FATTR_TYPE (1U << 0)
  72. #define NFS_ATTR_FATTR_MODE (1U << 1)
  73. #define NFS_ATTR_FATTR_NLINK (1U << 2)
  74. #define NFS_ATTR_FATTR_OWNER (1U << 3)
  75. #define NFS_ATTR_FATTR_GROUP (1U << 4)
  76. #define NFS_ATTR_FATTR_RDEV (1U << 5)
  77. #define NFS_ATTR_FATTR_SIZE (1U << 6)
  78. #define NFS_ATTR_FATTR_PRESIZE (1U << 7)
  79. #define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
  80. #define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
  81. #define NFS_ATTR_FATTR_FSID (1U << 10)
  82. #define NFS_ATTR_FATTR_FILEID (1U << 11)
  83. #define NFS_ATTR_FATTR_ATIME (1U << 12)
  84. #define NFS_ATTR_FATTR_MTIME (1U << 13)
  85. #define NFS_ATTR_FATTR_CTIME (1U << 14)
  86. #define NFS_ATTR_FATTR_PREMTIME (1U << 15)
  87. #define NFS_ATTR_FATTR_PRECTIME (1U << 16)
  88. #define NFS_ATTR_FATTR_CHANGE (1U << 17)
  89. #define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
  90. #define NFS_ATTR_FATTR_V4_LOCATIONS (1U << 19)
  91. #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 20)
  92. #define NFS_ATTR_FATTR_MOUNTPOINT (1U << 21)
  93. #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22)
  94. #define NFS_ATTR_FATTR_OWNER_NAME (1U << 23)
  95. #define NFS_ATTR_FATTR_GROUP_NAME (1U << 24)
  96. #define NFS_ATTR_FATTR_V4_SECURITY_LABEL (1U << 25)
  97. #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
  98. | NFS_ATTR_FATTR_MODE \
  99. | NFS_ATTR_FATTR_NLINK \
  100. | NFS_ATTR_FATTR_OWNER \
  101. | NFS_ATTR_FATTR_GROUP \
  102. | NFS_ATTR_FATTR_RDEV \
  103. | NFS_ATTR_FATTR_SIZE \
  104. | NFS_ATTR_FATTR_FSID \
  105. | NFS_ATTR_FATTR_FILEID \
  106. | NFS_ATTR_FATTR_ATIME \
  107. | NFS_ATTR_FATTR_MTIME \
  108. | NFS_ATTR_FATTR_CTIME \
  109. | NFS_ATTR_FATTR_CHANGE)
  110. #define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
  111. | NFS_ATTR_FATTR_BLOCKS_USED)
  112. #define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
  113. | NFS_ATTR_FATTR_SPACE_USED)
  114. #define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
  115. | NFS_ATTR_FATTR_SPACE_USED \
  116. | NFS_ATTR_FATTR_V4_SECURITY_LABEL)
  117. /*
  118. * Info on the file system
  119. */
  120. struct nfs_fsinfo {
  121. struct nfs_fattr *fattr; /* Post-op attributes */
  122. __u32 rtmax; /* max. read transfer size */
  123. __u32 rtpref; /* pref. read transfer size */
  124. __u32 rtmult; /* reads should be multiple of this */
  125. __u32 wtmax; /* max. write transfer size */
  126. __u32 wtpref; /* pref. write transfer size */
  127. __u32 wtmult; /* writes should be multiple of this */
  128. __u32 dtpref; /* pref. readdir transfer size */
  129. __u64 maxfilesize;
  130. struct timespec time_delta; /* server time granularity */
  131. __u32 lease_time; /* in seconds */
  132. __u32 layouttype; /* supported pnfs layout driver */
  133. __u32 blksize; /* preferred pnfs io block size */
  134. __u32 clone_blksize; /* granularity of a CLONE operation */
  135. };
  136. struct nfs_fsstat {
  137. struct nfs_fattr *fattr; /* Post-op attributes */
  138. __u64 tbytes; /* total size in bytes */
  139. __u64 fbytes; /* # of free bytes */
  140. __u64 abytes; /* # of bytes available to user */
  141. __u64 tfiles; /* # of files */
  142. __u64 ffiles; /* # of free files */
  143. __u64 afiles; /* # of files available to user */
  144. };
  145. struct nfs2_fsstat {
  146. __u32 tsize; /* Server transfer size */
  147. __u32 bsize; /* Filesystem block size */
  148. __u32 blocks; /* No. of "bsize" blocks on filesystem */
  149. __u32 bfree; /* No. of free "bsize" blocks */
  150. __u32 bavail; /* No. of available "bsize" blocks */
  151. };
  152. struct nfs_pathconf {
  153. struct nfs_fattr *fattr; /* Post-op attributes */
  154. __u32 max_link; /* max # of hard links */
  155. __u32 max_namelen; /* max name length */
  156. };
  157. struct nfs4_change_info {
  158. u32 atomic;
  159. u64 before;
  160. u64 after;
  161. };
  162. struct nfs_seqid;
  163. /* nfs41 sessions channel attributes */
  164. struct nfs4_channel_attrs {
  165. u32 max_rqst_sz;
  166. u32 max_resp_sz;
  167. u32 max_resp_sz_cached;
  168. u32 max_ops;
  169. u32 max_reqs;
  170. };
  171. struct nfs4_slot;
  172. struct nfs4_sequence_args {
  173. struct nfs4_slot *sa_slot;
  174. u8 sa_cache_this : 1,
  175. sa_privileged : 1;
  176. };
  177. struct nfs4_sequence_res {
  178. struct nfs4_slot *sr_slot; /* slot used to send request */
  179. unsigned long sr_timestamp;
  180. int sr_status; /* sequence operation status */
  181. u32 sr_status_flags;
  182. u32 sr_highest_slotid;
  183. u32 sr_target_highest_slotid;
  184. };
  185. struct nfs4_get_lease_time_args {
  186. struct nfs4_sequence_args la_seq_args;
  187. };
  188. struct nfs4_get_lease_time_res {
  189. struct nfs4_sequence_res lr_seq_res;
  190. struct nfs_fsinfo *lr_fsinfo;
  191. };
  192. #define PNFS_LAYOUT_MAXSIZE 4096
  193. struct nfs4_layoutdriver_data {
  194. struct page **pages;
  195. __u32 pglen;
  196. __u32 len;
  197. };
  198. struct pnfs_layout_range {
  199. u32 iomode;
  200. u64 offset;
  201. u64 length;
  202. };
  203. struct nfs4_layoutget_args {
  204. struct nfs4_sequence_args seq_args;
  205. __u32 type;
  206. struct pnfs_layout_range range;
  207. __u64 minlength;
  208. __u32 maxcount;
  209. struct inode *inode;
  210. struct nfs_open_context *ctx;
  211. nfs4_stateid stateid;
  212. unsigned long timestamp;
  213. struct nfs4_layoutdriver_data layout;
  214. };
  215. struct nfs4_layoutget_res {
  216. struct nfs4_sequence_res seq_res;
  217. __u32 return_on_close;
  218. struct pnfs_layout_range range;
  219. __u32 type;
  220. nfs4_stateid stateid;
  221. struct nfs4_layoutdriver_data *layoutp;
  222. };
  223. struct nfs4_layoutget {
  224. struct nfs4_layoutget_args args;
  225. struct nfs4_layoutget_res res;
  226. struct rpc_cred *cred;
  227. gfp_t gfp_flags;
  228. long timeout;
  229. };
  230. struct nfs4_getdeviceinfo_args {
  231. struct nfs4_sequence_args seq_args;
  232. struct pnfs_device *pdev;
  233. __u32 notify_types;
  234. };
  235. struct nfs4_getdeviceinfo_res {
  236. struct nfs4_sequence_res seq_res;
  237. struct pnfs_device *pdev;
  238. __u32 notification;
  239. };
  240. struct nfs4_layoutcommit_args {
  241. struct nfs4_sequence_args seq_args;
  242. nfs4_stateid stateid;
  243. __u64 lastbytewritten;
  244. struct inode *inode;
  245. const u32 *bitmask;
  246. size_t layoutupdate_len;
  247. struct page *layoutupdate_page;
  248. struct page **layoutupdate_pages;
  249. };
  250. struct nfs4_layoutcommit_res {
  251. struct nfs4_sequence_res seq_res;
  252. struct nfs_fattr *fattr;
  253. const struct nfs_server *server;
  254. int status;
  255. };
  256. struct nfs4_layoutcommit_data {
  257. struct rpc_task task;
  258. struct nfs_fattr fattr;
  259. struct list_head lseg_list;
  260. struct rpc_cred *cred;
  261. struct inode *inode;
  262. struct nfs4_layoutcommit_args args;
  263. struct nfs4_layoutcommit_res res;
  264. };
  265. struct nfs4_layoutreturn_args {
  266. struct nfs4_sequence_args seq_args;
  267. struct pnfs_layout_hdr *layout;
  268. struct inode *inode;
  269. struct pnfs_layout_range range;
  270. nfs4_stateid stateid;
  271. __u32 layout_type;
  272. };
  273. struct nfs4_layoutreturn_res {
  274. struct nfs4_sequence_res seq_res;
  275. u32 lrs_present;
  276. nfs4_stateid stateid;
  277. };
  278. struct nfs4_layoutreturn {
  279. struct nfs4_layoutreturn_args args;
  280. struct nfs4_layoutreturn_res res;
  281. struct rpc_cred *cred;
  282. struct nfs_client *clp;
  283. struct inode *inode;
  284. int rpc_status;
  285. };
  286. #define PNFS_LAYOUTSTATS_MAXSIZE 256
  287. struct nfs42_layoutstat_args;
  288. struct nfs42_layoutstat_devinfo;
  289. typedef void (*layoutstats_encode_t)(struct xdr_stream *,
  290. struct nfs42_layoutstat_args *,
  291. struct nfs42_layoutstat_devinfo *);
  292. /* Per file per deviceid layoutstats */
  293. struct nfs42_layoutstat_devinfo {
  294. struct nfs4_deviceid dev_id;
  295. __u64 offset;
  296. __u64 length;
  297. __u64 read_count;
  298. __u64 read_bytes;
  299. __u64 write_count;
  300. __u64 write_bytes;
  301. __u32 layout_type;
  302. layoutstats_encode_t layoutstats_encode;
  303. void *layout_private;
  304. };
  305. struct nfs42_layoutstat_args {
  306. struct nfs4_sequence_args seq_args;
  307. struct nfs_fh *fh;
  308. struct inode *inode;
  309. nfs4_stateid stateid;
  310. int num_dev;
  311. struct nfs42_layoutstat_devinfo *devinfo;
  312. };
  313. struct nfs42_layoutstat_res {
  314. struct nfs4_sequence_res seq_res;
  315. int num_dev;
  316. int rpc_status;
  317. };
  318. struct nfs42_layoutstat_data {
  319. struct inode *inode;
  320. struct nfs42_layoutstat_args args;
  321. struct nfs42_layoutstat_res res;
  322. };
  323. struct nfs42_clone_args {
  324. struct nfs4_sequence_args seq_args;
  325. struct nfs_fh *src_fh;
  326. struct nfs_fh *dst_fh;
  327. nfs4_stateid src_stateid;
  328. nfs4_stateid dst_stateid;
  329. __u64 src_offset;
  330. __u64 dst_offset;
  331. __u64 count;
  332. const u32 *dst_bitmask;
  333. };
  334. struct nfs42_clone_res {
  335. struct nfs4_sequence_res seq_res;
  336. unsigned int rpc_status;
  337. struct nfs_fattr *dst_fattr;
  338. const struct nfs_server *server;
  339. };
  340. struct stateowner_id {
  341. __u64 create_time;
  342. __u32 uniquifier;
  343. };
  344. /*
  345. * Arguments to the open call.
  346. */
  347. struct nfs_openargs {
  348. struct nfs4_sequence_args seq_args;
  349. const struct nfs_fh * fh;
  350. struct nfs_seqid * seqid;
  351. int open_flags;
  352. fmode_t fmode;
  353. u32 share_access;
  354. u32 access;
  355. __u64 clientid;
  356. struct stateowner_id id;
  357. union {
  358. struct {
  359. struct iattr * attrs; /* UNCHECKED, GUARDED, EXCLUSIVE4_1 */
  360. nfs4_verifier verifier; /* EXCLUSIVE */
  361. };
  362. nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
  363. fmode_t delegation_type; /* CLAIM_PREVIOUS */
  364. } u;
  365. const struct qstr * name;
  366. const struct nfs_server *server; /* Needed for ID mapping */
  367. const u32 * bitmask;
  368. const u32 * open_bitmap;
  369. enum open_claim_type4 claim;
  370. enum createmode4 createmode;
  371. const struct nfs4_label *label;
  372. };
  373. struct nfs_openres {
  374. struct nfs4_sequence_res seq_res;
  375. nfs4_stateid stateid;
  376. struct nfs_fh fh;
  377. struct nfs4_change_info cinfo;
  378. __u32 rflags;
  379. struct nfs_fattr * f_attr;
  380. struct nfs4_label *f_label;
  381. struct nfs_seqid * seqid;
  382. const struct nfs_server *server;
  383. fmode_t delegation_type;
  384. nfs4_stateid delegation;
  385. unsigned long pagemod_limit;
  386. __u32 do_recall;
  387. __u32 attrset[NFS4_BITMAP_SIZE];
  388. struct nfs4_string *owner;
  389. struct nfs4_string *group_owner;
  390. __u32 access_request;
  391. __u32 access_supported;
  392. __u32 access_result;
  393. };
  394. /*
  395. * Arguments to the open_confirm call.
  396. */
  397. struct nfs_open_confirmargs {
  398. struct nfs4_sequence_args seq_args;
  399. const struct nfs_fh * fh;
  400. nfs4_stateid * stateid;
  401. struct nfs_seqid * seqid;
  402. };
  403. struct nfs_open_confirmres {
  404. struct nfs4_sequence_res seq_res;
  405. nfs4_stateid stateid;
  406. struct nfs_seqid * seqid;
  407. };
  408. /*
  409. * Arguments to the close call.
  410. */
  411. struct nfs_closeargs {
  412. struct nfs4_sequence_args seq_args;
  413. struct nfs_fh * fh;
  414. nfs4_stateid stateid;
  415. struct nfs_seqid * seqid;
  416. fmode_t fmode;
  417. u32 share_access;
  418. const u32 * bitmask;
  419. };
  420. struct nfs_closeres {
  421. struct nfs4_sequence_res seq_res;
  422. nfs4_stateid stateid;
  423. struct nfs_fattr * fattr;
  424. struct nfs_seqid * seqid;
  425. const struct nfs_server *server;
  426. };
  427. /*
  428. * * Arguments to the lock,lockt, and locku call.
  429. * */
  430. struct nfs_lowner {
  431. __u64 clientid;
  432. __u64 id;
  433. dev_t s_dev;
  434. };
  435. struct nfs_lock_args {
  436. struct nfs4_sequence_args seq_args;
  437. struct nfs_fh * fh;
  438. struct file_lock * fl;
  439. struct nfs_seqid * lock_seqid;
  440. nfs4_stateid lock_stateid;
  441. struct nfs_seqid * open_seqid;
  442. nfs4_stateid open_stateid;
  443. struct nfs_lowner lock_owner;
  444. unsigned char block : 1;
  445. unsigned char reclaim : 1;
  446. unsigned char new_lock : 1;
  447. unsigned char new_lock_owner : 1;
  448. };
  449. struct nfs_lock_res {
  450. struct nfs4_sequence_res seq_res;
  451. nfs4_stateid stateid;
  452. struct nfs_seqid * lock_seqid;
  453. struct nfs_seqid * open_seqid;
  454. };
  455. struct nfs_locku_args {
  456. struct nfs4_sequence_args seq_args;
  457. struct nfs_fh * fh;
  458. struct file_lock * fl;
  459. struct nfs_seqid * seqid;
  460. nfs4_stateid stateid;
  461. };
  462. struct nfs_locku_res {
  463. struct nfs4_sequence_res seq_res;
  464. nfs4_stateid stateid;
  465. struct nfs_seqid * seqid;
  466. };
  467. struct nfs_lockt_args {
  468. struct nfs4_sequence_args seq_args;
  469. struct nfs_fh * fh;
  470. struct file_lock * fl;
  471. struct nfs_lowner lock_owner;
  472. };
  473. struct nfs_lockt_res {
  474. struct nfs4_sequence_res seq_res;
  475. struct file_lock * denied; /* LOCK, LOCKT failed */
  476. };
  477. struct nfs_release_lockowner_args {
  478. struct nfs4_sequence_args seq_args;
  479. struct nfs_lowner lock_owner;
  480. };
  481. struct nfs_release_lockowner_res {
  482. struct nfs4_sequence_res seq_res;
  483. };
  484. struct nfs4_delegreturnargs {
  485. struct nfs4_sequence_args seq_args;
  486. const struct nfs_fh *fhandle;
  487. const nfs4_stateid *stateid;
  488. const u32 * bitmask;
  489. };
  490. struct nfs4_delegreturnres {
  491. struct nfs4_sequence_res seq_res;
  492. struct nfs_fattr * fattr;
  493. struct nfs_server *server;
  494. };
  495. /*
  496. * Arguments to the write call.
  497. */
  498. struct nfs_write_verifier {
  499. char data[8];
  500. };
  501. struct nfs_writeverf {
  502. struct nfs_write_verifier verifier;
  503. enum nfs3_stable_how committed;
  504. };
  505. /*
  506. * Arguments shared by the read and write call.
  507. */
  508. struct nfs_pgio_args {
  509. struct nfs4_sequence_args seq_args;
  510. struct nfs_fh * fh;
  511. struct nfs_open_context *context;
  512. struct nfs_lock_context *lock_context;
  513. nfs4_stateid stateid;
  514. __u64 offset;
  515. __u32 count;
  516. unsigned int pgbase;
  517. struct page ** pages;
  518. const u32 * bitmask; /* used by write */
  519. enum nfs3_stable_how stable; /* used by write */
  520. };
  521. struct nfs_pgio_res {
  522. struct nfs4_sequence_res seq_res;
  523. struct nfs_fattr * fattr;
  524. __u32 count;
  525. __u32 op_status;
  526. int eof; /* used by read */
  527. struct nfs_writeverf * verf; /* used by write */
  528. const struct nfs_server *server; /* used by write */
  529. };
  530. /*
  531. * Arguments to the commit call.
  532. */
  533. struct nfs_commitargs {
  534. struct nfs4_sequence_args seq_args;
  535. struct nfs_fh *fh;
  536. __u64 offset;
  537. __u32 count;
  538. const u32 *bitmask;
  539. };
  540. struct nfs_commitres {
  541. struct nfs4_sequence_res seq_res;
  542. __u32 op_status;
  543. struct nfs_fattr *fattr;
  544. struct nfs_writeverf *verf;
  545. const struct nfs_server *server;
  546. };
  547. /*
  548. * Common arguments to the unlink call
  549. */
  550. struct nfs_removeargs {
  551. struct nfs4_sequence_args seq_args;
  552. const struct nfs_fh *fh;
  553. struct qstr name;
  554. };
  555. struct nfs_removeres {
  556. struct nfs4_sequence_res seq_res;
  557. struct nfs_server *server;
  558. struct nfs_fattr *dir_attr;
  559. struct nfs4_change_info cinfo;
  560. };
  561. /*
  562. * Common arguments to the rename call
  563. */
  564. struct nfs_renameargs {
  565. struct nfs4_sequence_args seq_args;
  566. const struct nfs_fh *old_dir;
  567. const struct nfs_fh *new_dir;
  568. const struct qstr *old_name;
  569. const struct qstr *new_name;
  570. };
  571. struct nfs_renameres {
  572. struct nfs4_sequence_res seq_res;
  573. struct nfs_server *server;
  574. struct nfs4_change_info old_cinfo;
  575. struct nfs_fattr *old_fattr;
  576. struct nfs4_change_info new_cinfo;
  577. struct nfs_fattr *new_fattr;
  578. };
  579. /* parsed sec= options */
  580. #define NFS_AUTH_INFO_MAX_FLAVORS 12 /* see fs/nfs/super.c */
  581. struct nfs_auth_info {
  582. unsigned int flavor_len;
  583. rpc_authflavor_t flavors[NFS_AUTH_INFO_MAX_FLAVORS];
  584. };
  585. /*
  586. * Argument struct for decode_entry function
  587. */
  588. struct nfs_entry {
  589. __u64 ino;
  590. __u64 cookie,
  591. prev_cookie;
  592. const char * name;
  593. unsigned int len;
  594. int eof;
  595. struct nfs_fh * fh;
  596. struct nfs_fattr * fattr;
  597. struct nfs4_label *label;
  598. unsigned char d_type;
  599. struct nfs_server * server;
  600. };
  601. /*
  602. * The following types are for NFSv2 only.
  603. */
  604. struct nfs_sattrargs {
  605. struct nfs_fh * fh;
  606. struct iattr * sattr;
  607. };
  608. struct nfs_diropargs {
  609. struct nfs_fh * fh;
  610. const char * name;
  611. unsigned int len;
  612. };
  613. struct nfs_createargs {
  614. struct nfs_fh * fh;
  615. const char * name;
  616. unsigned int len;
  617. struct iattr * sattr;
  618. };
  619. struct nfs_setattrargs {
  620. struct nfs4_sequence_args seq_args;
  621. struct nfs_fh * fh;
  622. nfs4_stateid stateid;
  623. struct iattr * iap;
  624. const struct nfs_server * server; /* Needed for name mapping */
  625. const u32 * bitmask;
  626. const struct nfs4_label *label;
  627. };
  628. struct nfs_setaclargs {
  629. struct nfs4_sequence_args seq_args;
  630. struct nfs_fh * fh;
  631. size_t acl_len;
  632. struct page ** acl_pages;
  633. };
  634. struct nfs_setaclres {
  635. struct nfs4_sequence_res seq_res;
  636. };
  637. struct nfs_getaclargs {
  638. struct nfs4_sequence_args seq_args;
  639. struct nfs_fh * fh;
  640. size_t acl_len;
  641. struct page ** acl_pages;
  642. };
  643. /* getxattr ACL interface flags */
  644. #define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */
  645. struct nfs_getaclres {
  646. struct nfs4_sequence_res seq_res;
  647. size_t acl_len;
  648. size_t acl_data_offset;
  649. int acl_flags;
  650. struct page * acl_scratch;
  651. };
  652. struct nfs_setattrres {
  653. struct nfs4_sequence_res seq_res;
  654. struct nfs_fattr * fattr;
  655. struct nfs4_label *label;
  656. const struct nfs_server * server;
  657. };
  658. struct nfs_linkargs {
  659. struct nfs_fh * fromfh;
  660. struct nfs_fh * tofh;
  661. const char * toname;
  662. unsigned int tolen;
  663. };
  664. struct nfs_symlinkargs {
  665. struct nfs_fh * fromfh;
  666. const char * fromname;
  667. unsigned int fromlen;
  668. struct page ** pages;
  669. unsigned int pathlen;
  670. struct iattr * sattr;
  671. };
  672. struct nfs_readdirargs {
  673. struct nfs_fh * fh;
  674. __u32 cookie;
  675. unsigned int count;
  676. struct page ** pages;
  677. };
  678. struct nfs3_getaclargs {
  679. struct nfs_fh * fh;
  680. int mask;
  681. struct page ** pages;
  682. };
  683. struct nfs3_setaclargs {
  684. struct inode * inode;
  685. int mask;
  686. struct posix_acl * acl_access;
  687. struct posix_acl * acl_default;
  688. size_t len;
  689. unsigned int npages;
  690. struct page ** pages;
  691. };
  692. struct nfs_diropok {
  693. struct nfs_fh * fh;
  694. struct nfs_fattr * fattr;
  695. };
  696. struct nfs_readlinkargs {
  697. struct nfs_fh * fh;
  698. unsigned int pgbase;
  699. unsigned int pglen;
  700. struct page ** pages;
  701. };
  702. struct nfs3_sattrargs {
  703. struct nfs_fh * fh;
  704. struct iattr * sattr;
  705. unsigned int guard;
  706. struct timespec guardtime;
  707. };
  708. struct nfs3_diropargs {
  709. struct nfs_fh * fh;
  710. const char * name;
  711. unsigned int len;
  712. };
  713. struct nfs3_accessargs {
  714. struct nfs_fh * fh;
  715. __u32 access;
  716. };
  717. struct nfs3_createargs {
  718. struct nfs_fh * fh;
  719. const char * name;
  720. unsigned int len;
  721. struct iattr * sattr;
  722. enum nfs3_createmode createmode;
  723. __be32 verifier[2];
  724. };
  725. struct nfs3_mkdirargs {
  726. struct nfs_fh * fh;
  727. const char * name;
  728. unsigned int len;
  729. struct iattr * sattr;
  730. };
  731. struct nfs3_symlinkargs {
  732. struct nfs_fh * fromfh;
  733. const char * fromname;
  734. unsigned int fromlen;
  735. struct page ** pages;
  736. unsigned int pathlen;
  737. struct iattr * sattr;
  738. };
  739. struct nfs3_mknodargs {
  740. struct nfs_fh * fh;
  741. const char * name;
  742. unsigned int len;
  743. enum nfs3_ftype type;
  744. struct iattr * sattr;
  745. dev_t rdev;
  746. };
  747. struct nfs3_linkargs {
  748. struct nfs_fh * fromfh;
  749. struct nfs_fh * tofh;
  750. const char * toname;
  751. unsigned int tolen;
  752. };
  753. struct nfs3_readdirargs {
  754. struct nfs_fh * fh;
  755. __u64 cookie;
  756. __be32 verf[2];
  757. int plus;
  758. unsigned int count;
  759. struct page ** pages;
  760. };
  761. struct nfs3_diropres {
  762. struct nfs_fattr * dir_attr;
  763. struct nfs_fh * fh;
  764. struct nfs_fattr * fattr;
  765. };
  766. struct nfs3_accessres {
  767. struct nfs_fattr * fattr;
  768. __u32 access;
  769. };
  770. struct nfs3_readlinkargs {
  771. struct nfs_fh * fh;
  772. unsigned int pgbase;
  773. unsigned int pglen;
  774. struct page ** pages;
  775. };
  776. struct nfs3_linkres {
  777. struct nfs_fattr * dir_attr;
  778. struct nfs_fattr * fattr;
  779. };
  780. struct nfs3_readdirres {
  781. struct nfs_fattr * dir_attr;
  782. __be32 * verf;
  783. int plus;
  784. };
  785. struct nfs3_getaclres {
  786. struct nfs_fattr * fattr;
  787. int mask;
  788. unsigned int acl_access_count;
  789. unsigned int acl_default_count;
  790. struct posix_acl * acl_access;
  791. struct posix_acl * acl_default;
  792. };
  793. #if IS_ENABLED(CONFIG_NFS_V4)
  794. typedef u64 clientid4;
  795. struct nfs4_accessargs {
  796. struct nfs4_sequence_args seq_args;
  797. const struct nfs_fh * fh;
  798. const u32 * bitmask;
  799. u32 access;
  800. };
  801. struct nfs4_accessres {
  802. struct nfs4_sequence_res seq_res;
  803. const struct nfs_server * server;
  804. struct nfs_fattr * fattr;
  805. u32 supported;
  806. u32 access;
  807. };
  808. struct nfs4_create_arg {
  809. struct nfs4_sequence_args seq_args;
  810. u32 ftype;
  811. union {
  812. struct {
  813. struct page ** pages;
  814. unsigned int len;
  815. } symlink; /* NF4LNK */
  816. struct {
  817. u32 specdata1;
  818. u32 specdata2;
  819. } device; /* NF4BLK, NF4CHR */
  820. } u;
  821. const struct qstr * name;
  822. const struct nfs_server * server;
  823. const struct iattr * attrs;
  824. const struct nfs_fh * dir_fh;
  825. const u32 * bitmask;
  826. const struct nfs4_label *label;
  827. };
  828. struct nfs4_create_res {
  829. struct nfs4_sequence_res seq_res;
  830. const struct nfs_server * server;
  831. struct nfs_fh * fh;
  832. struct nfs_fattr * fattr;
  833. struct nfs4_label *label;
  834. struct nfs4_change_info dir_cinfo;
  835. };
  836. struct nfs4_fsinfo_arg {
  837. struct nfs4_sequence_args seq_args;
  838. const struct nfs_fh * fh;
  839. const u32 * bitmask;
  840. };
  841. struct nfs4_fsinfo_res {
  842. struct nfs4_sequence_res seq_res;
  843. struct nfs_fsinfo *fsinfo;
  844. };
  845. struct nfs4_getattr_arg {
  846. struct nfs4_sequence_args seq_args;
  847. const struct nfs_fh * fh;
  848. const u32 * bitmask;
  849. };
  850. struct nfs4_getattr_res {
  851. struct nfs4_sequence_res seq_res;
  852. const struct nfs_server * server;
  853. struct nfs_fattr * fattr;
  854. struct nfs4_label *label;
  855. };
  856. struct nfs4_link_arg {
  857. struct nfs4_sequence_args seq_args;
  858. const struct nfs_fh * fh;
  859. const struct nfs_fh * dir_fh;
  860. const struct qstr * name;
  861. const u32 * bitmask;
  862. };
  863. struct nfs4_link_res {
  864. struct nfs4_sequence_res seq_res;
  865. const struct nfs_server * server;
  866. struct nfs_fattr * fattr;
  867. struct nfs4_label *label;
  868. struct nfs4_change_info cinfo;
  869. struct nfs_fattr * dir_attr;
  870. };
  871. struct nfs4_lookup_arg {
  872. struct nfs4_sequence_args seq_args;
  873. const struct nfs_fh * dir_fh;
  874. const struct qstr * name;
  875. const u32 * bitmask;
  876. };
  877. struct nfs4_lookup_res {
  878. struct nfs4_sequence_res seq_res;
  879. const struct nfs_server * server;
  880. struct nfs_fattr * fattr;
  881. struct nfs_fh * fh;
  882. struct nfs4_label *label;
  883. };
  884. struct nfs4_lookup_root_arg {
  885. struct nfs4_sequence_args seq_args;
  886. const u32 * bitmask;
  887. };
  888. struct nfs4_pathconf_arg {
  889. struct nfs4_sequence_args seq_args;
  890. const struct nfs_fh * fh;
  891. const u32 * bitmask;
  892. };
  893. struct nfs4_pathconf_res {
  894. struct nfs4_sequence_res seq_res;
  895. struct nfs_pathconf *pathconf;
  896. };
  897. struct nfs4_readdir_arg {
  898. struct nfs4_sequence_args seq_args;
  899. const struct nfs_fh * fh;
  900. u64 cookie;
  901. nfs4_verifier verifier;
  902. u32 count;
  903. struct page ** pages; /* zero-copy data */
  904. unsigned int pgbase; /* zero-copy data */
  905. const u32 * bitmask;
  906. int plus;
  907. };
  908. struct nfs4_readdir_res {
  909. struct nfs4_sequence_res seq_res;
  910. nfs4_verifier verifier;
  911. unsigned int pgbase;
  912. };
  913. struct nfs4_readlink {
  914. struct nfs4_sequence_args seq_args;
  915. const struct nfs_fh * fh;
  916. unsigned int pgbase;
  917. unsigned int pglen; /* zero-copy data */
  918. struct page ** pages; /* zero-copy data */
  919. };
  920. struct nfs4_readlink_res {
  921. struct nfs4_sequence_res seq_res;
  922. };
  923. struct nfs4_setclientid {
  924. const nfs4_verifier * sc_verifier;
  925. u32 sc_prog;
  926. unsigned int sc_netid_len;
  927. char sc_netid[RPCBIND_MAXNETIDLEN + 1];
  928. unsigned int sc_uaddr_len;
  929. char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
  930. struct nfs_client *sc_clnt;
  931. struct rpc_cred *sc_cred;
  932. };
  933. struct nfs4_setclientid_res {
  934. u64 clientid;
  935. nfs4_verifier confirm;
  936. };
  937. struct nfs4_statfs_arg {
  938. struct nfs4_sequence_args seq_args;
  939. const struct nfs_fh * fh;
  940. const u32 * bitmask;
  941. };
  942. struct nfs4_statfs_res {
  943. struct nfs4_sequence_res seq_res;
  944. struct nfs_fsstat *fsstat;
  945. };
  946. struct nfs4_server_caps_arg {
  947. struct nfs4_sequence_args seq_args;
  948. struct nfs_fh *fhandle;
  949. const u32 * bitmask;
  950. };
  951. struct nfs4_server_caps_res {
  952. struct nfs4_sequence_res seq_res;
  953. u32 attr_bitmask[3];
  954. u32 exclcreat_bitmask[3];
  955. u32 acl_bitmask;
  956. u32 has_links;
  957. u32 has_symlinks;
  958. u32 fh_expire_type;
  959. };
  960. #define NFS4_PATHNAME_MAXCOMPONENTS 512
  961. struct nfs4_pathname {
  962. unsigned int ncomponents;
  963. struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
  964. };
  965. #define NFS4_FS_LOCATION_MAXSERVERS 10
  966. struct nfs4_fs_location {
  967. unsigned int nservers;
  968. struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
  969. struct nfs4_pathname rootpath;
  970. };
  971. #define NFS4_FS_LOCATIONS_MAXENTRIES 10
  972. struct nfs4_fs_locations {
  973. struct nfs_fattr fattr;
  974. const struct nfs_server *server;
  975. struct nfs4_pathname fs_path;
  976. int nlocations;
  977. struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
  978. };
  979. struct nfs4_fs_locations_arg {
  980. struct nfs4_sequence_args seq_args;
  981. const struct nfs_fh *dir_fh;
  982. const struct nfs_fh *fh;
  983. const struct qstr *name;
  984. struct page *page;
  985. const u32 *bitmask;
  986. clientid4 clientid;
  987. unsigned char migration:1, renew:1;
  988. };
  989. struct nfs4_fs_locations_res {
  990. struct nfs4_sequence_res seq_res;
  991. struct nfs4_fs_locations *fs_locations;
  992. unsigned char migration:1, renew:1;
  993. };
  994. struct nfs4_secinfo4 {
  995. u32 flavor;
  996. struct rpcsec_gss_info flavor_info;
  997. };
  998. struct nfs4_secinfo_flavors {
  999. unsigned int num_flavors;
  1000. struct nfs4_secinfo4 flavors[0];
  1001. };
  1002. struct nfs4_secinfo_arg {
  1003. struct nfs4_sequence_args seq_args;
  1004. const struct nfs_fh *dir_fh;
  1005. const struct qstr *name;
  1006. };
  1007. struct nfs4_secinfo_res {
  1008. struct nfs4_sequence_res seq_res;
  1009. struct nfs4_secinfo_flavors *flavors;
  1010. };
  1011. struct nfs4_fsid_present_arg {
  1012. struct nfs4_sequence_args seq_args;
  1013. const struct nfs_fh *fh;
  1014. clientid4 clientid;
  1015. unsigned char renew:1;
  1016. };
  1017. struct nfs4_fsid_present_res {
  1018. struct nfs4_sequence_res seq_res;
  1019. struct nfs_fh *fh;
  1020. unsigned char renew:1;
  1021. };
  1022. #endif /* CONFIG_NFS_V4 */
  1023. struct nfstime4 {
  1024. u64 seconds;
  1025. u32 nseconds;
  1026. };
  1027. #ifdef CONFIG_NFS_V4_1
  1028. struct pnfs_commit_bucket {
  1029. struct list_head written;
  1030. struct list_head committing;
  1031. struct pnfs_layout_segment *wlseg;
  1032. struct pnfs_layout_segment *clseg;
  1033. struct nfs_writeverf direct_verf;
  1034. };
  1035. struct pnfs_ds_commit_info {
  1036. int nwritten;
  1037. int ncommitting;
  1038. int nbuckets;
  1039. struct pnfs_commit_bucket *buckets;
  1040. };
  1041. #define NFS4_OP_MAP_NUM_LONGS \
  1042. DIV_ROUND_UP(LAST_NFS4_OP, 8 * sizeof(unsigned long))
  1043. #define NFS4_OP_MAP_NUM_WORDS \
  1044. (NFS4_OP_MAP_NUM_LONGS * sizeof(unsigned long) / sizeof(u32))
  1045. struct nfs4_op_map {
  1046. union {
  1047. unsigned long longs[NFS4_OP_MAP_NUM_LONGS];
  1048. u32 words[NFS4_OP_MAP_NUM_WORDS];
  1049. } u;
  1050. };
  1051. struct nfs41_state_protection {
  1052. u32 how;
  1053. struct nfs4_op_map enforce;
  1054. struct nfs4_op_map allow;
  1055. };
  1056. struct nfs41_exchange_id_args {
  1057. struct nfs_client *client;
  1058. nfs4_verifier *verifier;
  1059. u32 flags;
  1060. struct nfs41_state_protection state_protect;
  1061. };
  1062. struct nfs41_server_owner {
  1063. uint64_t minor_id;
  1064. uint32_t major_id_sz;
  1065. char major_id[NFS4_OPAQUE_LIMIT];
  1066. };
  1067. struct nfs41_server_scope {
  1068. uint32_t server_scope_sz;
  1069. char server_scope[NFS4_OPAQUE_LIMIT];
  1070. };
  1071. struct nfs41_impl_id {
  1072. char domain[NFS4_OPAQUE_LIMIT + 1];
  1073. char name[NFS4_OPAQUE_LIMIT + 1];
  1074. struct nfstime4 date;
  1075. };
  1076. struct nfs41_bind_conn_to_session_args {
  1077. struct nfs_client *client;
  1078. struct nfs4_sessionid sessionid;
  1079. u32 dir;
  1080. bool use_conn_in_rdma_mode;
  1081. };
  1082. struct nfs41_bind_conn_to_session_res {
  1083. struct nfs4_sessionid sessionid;
  1084. u32 dir;
  1085. bool use_conn_in_rdma_mode;
  1086. };
  1087. struct nfs41_exchange_id_res {
  1088. u64 clientid;
  1089. u32 seqid;
  1090. u32 flags;
  1091. struct nfs41_server_owner *server_owner;
  1092. struct nfs41_server_scope *server_scope;
  1093. struct nfs41_impl_id *impl_id;
  1094. struct nfs41_state_protection state_protect;
  1095. };
  1096. struct nfs41_create_session_args {
  1097. struct nfs_client *client;
  1098. u64 clientid;
  1099. uint32_t seqid;
  1100. uint32_t flags;
  1101. uint32_t cb_program;
  1102. struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
  1103. struct nfs4_channel_attrs bc_attrs; /* Back Channel */
  1104. };
  1105. struct nfs41_create_session_res {
  1106. struct nfs4_sessionid sessionid;
  1107. uint32_t seqid;
  1108. uint32_t flags;
  1109. struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
  1110. struct nfs4_channel_attrs bc_attrs; /* Back Channel */
  1111. };
  1112. struct nfs41_reclaim_complete_args {
  1113. struct nfs4_sequence_args seq_args;
  1114. /* In the future extend to include curr_fh for use with migration */
  1115. unsigned char one_fs:1;
  1116. };
  1117. struct nfs41_reclaim_complete_res {
  1118. struct nfs4_sequence_res seq_res;
  1119. };
  1120. #define SECINFO_STYLE_CURRENT_FH 0
  1121. #define SECINFO_STYLE_PARENT 1
  1122. struct nfs41_secinfo_no_name_args {
  1123. struct nfs4_sequence_args seq_args;
  1124. int style;
  1125. };
  1126. struct nfs41_test_stateid_args {
  1127. struct nfs4_sequence_args seq_args;
  1128. nfs4_stateid *stateid;
  1129. };
  1130. struct nfs41_test_stateid_res {
  1131. struct nfs4_sequence_res seq_res;
  1132. unsigned int status;
  1133. };
  1134. struct nfs41_free_stateid_args {
  1135. struct nfs4_sequence_args seq_args;
  1136. nfs4_stateid stateid;
  1137. };
  1138. struct nfs41_free_stateid_res {
  1139. struct nfs4_sequence_res seq_res;
  1140. unsigned int status;
  1141. };
  1142. static inline void
  1143. nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
  1144. {
  1145. kfree(cinfo->buckets);
  1146. }
  1147. #else
  1148. struct pnfs_ds_commit_info {
  1149. };
  1150. static inline void
  1151. nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo)
  1152. {
  1153. }
  1154. #endif /* CONFIG_NFS_V4_1 */
  1155. #ifdef CONFIG_NFS_V4_2
  1156. struct nfs42_falloc_args {
  1157. struct nfs4_sequence_args seq_args;
  1158. struct nfs_fh *falloc_fh;
  1159. nfs4_stateid falloc_stateid;
  1160. u64 falloc_offset;
  1161. u64 falloc_length;
  1162. const u32 *falloc_bitmask;
  1163. };
  1164. struct nfs42_falloc_res {
  1165. struct nfs4_sequence_res seq_res;
  1166. unsigned int status;
  1167. struct nfs_fattr *falloc_fattr;
  1168. const struct nfs_server *falloc_server;
  1169. };
  1170. struct nfs42_seek_args {
  1171. struct nfs4_sequence_args seq_args;
  1172. struct nfs_fh *sa_fh;
  1173. nfs4_stateid sa_stateid;
  1174. u64 sa_offset;
  1175. u32 sa_what;
  1176. };
  1177. struct nfs42_seek_res {
  1178. struct nfs4_sequence_res seq_res;
  1179. unsigned int status;
  1180. u32 sr_eof;
  1181. u64 sr_offset;
  1182. };
  1183. #endif
  1184. struct nfs_page;
  1185. #define NFS_PAGEVEC_SIZE (8U)
  1186. struct nfs_page_array {
  1187. struct page **pagevec;
  1188. unsigned int npages; /* Max length of pagevec */
  1189. struct page *page_array[NFS_PAGEVEC_SIZE];
  1190. };
  1191. /* used as flag bits in nfs_pgio_header */
  1192. enum {
  1193. NFS_IOHDR_ERROR = 0,
  1194. NFS_IOHDR_EOF,
  1195. NFS_IOHDR_REDO,
  1196. };
  1197. struct nfs_pgio_header {
  1198. struct inode *inode;
  1199. struct rpc_cred *cred;
  1200. struct list_head pages;
  1201. struct nfs_page *req;
  1202. struct nfs_writeverf verf; /* Used for writes */
  1203. struct pnfs_layout_segment *lseg;
  1204. loff_t io_start;
  1205. const struct rpc_call_ops *mds_ops;
  1206. void (*release) (struct nfs_pgio_header *hdr);
  1207. const struct nfs_pgio_completion_ops *completion_ops;
  1208. const struct nfs_rw_ops *rw_ops;
  1209. struct nfs_direct_req *dreq;
  1210. void *layout_private;
  1211. spinlock_t lock;
  1212. /* fields protected by lock */
  1213. int pnfs_error;
  1214. int error; /* merge with pnfs_error */
  1215. unsigned long good_bytes; /* boundary of good data */
  1216. unsigned long flags;
  1217. /*
  1218. * rpc data
  1219. */
  1220. struct rpc_task task;
  1221. struct nfs_fattr fattr;
  1222. struct nfs_pgio_args args; /* argument struct */
  1223. struct nfs_pgio_res res; /* result struct */
  1224. unsigned long timestamp; /* For lease renewal */
  1225. int (*pgio_done_cb)(struct rpc_task *, struct nfs_pgio_header *);
  1226. __u64 mds_offset; /* Filelayout dense stripe */
  1227. struct nfs_page_array page_array;
  1228. struct nfs_client *ds_clp; /* pNFS data server */
  1229. int ds_commit_idx; /* ds index if ds_clp is set */
  1230. int pgio_mirror_idx;/* mirror index in pgio layer */
  1231. };
  1232. struct nfs_mds_commit_info {
  1233. atomic_t rpcs_out;
  1234. unsigned long ncommit;
  1235. struct list_head list;
  1236. };
  1237. struct nfs_commit_data;
  1238. struct nfs_inode;
  1239. struct nfs_commit_completion_ops {
  1240. void (*error_cleanup) (struct nfs_inode *nfsi);
  1241. void (*completion) (struct nfs_commit_data *data);
  1242. };
  1243. struct nfs_commit_info {
  1244. spinlock_t *lock; /* inode->i_lock */
  1245. struct nfs_mds_commit_info *mds;
  1246. struct pnfs_ds_commit_info *ds;
  1247. struct nfs_direct_req *dreq; /* O_DIRECT request */
  1248. const struct nfs_commit_completion_ops *completion_ops;
  1249. };
  1250. struct nfs_commit_data {
  1251. struct rpc_task task;
  1252. struct inode *inode;
  1253. struct rpc_cred *cred;
  1254. struct nfs_fattr fattr;
  1255. struct nfs_writeverf verf;
  1256. struct list_head pages; /* Coalesced requests we wish to flush */
  1257. struct list_head list; /* lists of struct nfs_write_data */
  1258. struct nfs_direct_req *dreq; /* O_DIRECT request */
  1259. struct nfs_commitargs args; /* argument struct */
  1260. struct nfs_commitres res; /* result struct */
  1261. struct nfs_open_context *context;
  1262. struct pnfs_layout_segment *lseg;
  1263. struct nfs_client *ds_clp; /* pNFS data server */
  1264. int ds_commit_index;
  1265. loff_t lwb;
  1266. const struct rpc_call_ops *mds_ops;
  1267. const struct nfs_commit_completion_ops *completion_ops;
  1268. int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data);
  1269. };
  1270. struct nfs_pgio_completion_ops {
  1271. void (*error_cleanup)(struct list_head *head);
  1272. void (*init_hdr)(struct nfs_pgio_header *hdr);
  1273. void (*completion)(struct nfs_pgio_header *hdr);
  1274. };
  1275. struct nfs_unlinkdata {
  1276. struct hlist_node list;
  1277. struct nfs_removeargs args;
  1278. struct nfs_removeres res;
  1279. struct inode *dir;
  1280. struct rpc_cred *cred;
  1281. struct nfs_fattr dir_attr;
  1282. long timeout;
  1283. };
  1284. struct nfs_renamedata {
  1285. struct nfs_renameargs args;
  1286. struct nfs_renameres res;
  1287. struct rpc_cred *cred;
  1288. struct inode *old_dir;
  1289. struct dentry *old_dentry;
  1290. struct nfs_fattr old_fattr;
  1291. struct inode *new_dir;
  1292. struct dentry *new_dentry;
  1293. struct nfs_fattr new_fattr;
  1294. void (*complete)(struct rpc_task *, struct nfs_renamedata *);
  1295. long timeout;
  1296. };
  1297. struct nfs_access_entry;
  1298. struct nfs_client;
  1299. struct rpc_timeout;
  1300. struct nfs_subversion;
  1301. struct nfs_mount_info;
  1302. struct nfs_client_initdata;
  1303. struct nfs_pageio_descriptor;
  1304. /*
  1305. * RPC procedure vector for NFSv2/NFSv3 demuxing
  1306. */
  1307. struct nfs_rpc_ops {
  1308. u32 version; /* Protocol version */
  1309. const struct dentry_operations *dentry_ops;
  1310. const struct inode_operations *dir_inode_ops;
  1311. const struct inode_operations *file_inode_ops;
  1312. const struct file_operations *file_ops;
  1313. int (*getroot) (struct nfs_server *, struct nfs_fh *,
  1314. struct nfs_fsinfo *);
  1315. struct vfsmount *(*submount) (struct nfs_server *, struct dentry *,
  1316. struct nfs_fh *, struct nfs_fattr *);
  1317. struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *,
  1318. struct nfs_subversion *);
  1319. int (*getattr) (struct nfs_server *, struct nfs_fh *,
  1320. struct nfs_fattr *, struct nfs4_label *);
  1321. int (*setattr) (struct dentry *, struct nfs_fattr *,
  1322. struct iattr *);
  1323. int (*lookup) (struct inode *, struct qstr *,
  1324. struct nfs_fh *, struct nfs_fattr *,
  1325. struct nfs4_label *);
  1326. int (*access) (struct inode *, struct nfs_access_entry *);
  1327. int (*readlink)(struct inode *, struct page *, unsigned int,
  1328. unsigned int);
  1329. int (*create) (struct inode *, struct dentry *,
  1330. struct iattr *, int);
  1331. int (*remove) (struct inode *, struct qstr *);
  1332. void (*unlink_setup) (struct rpc_message *, struct inode *dir);
  1333. void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
  1334. int (*unlink_done) (struct rpc_task *, struct inode *);
  1335. void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
  1336. void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
  1337. int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
  1338. int (*link) (struct inode *, struct inode *, struct qstr *);
  1339. int (*symlink) (struct inode *, struct dentry *, struct page *,
  1340. unsigned int, struct iattr *);
  1341. int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
  1342. int (*rmdir) (struct inode *, struct qstr *);
  1343. int (*readdir) (struct dentry *, struct rpc_cred *,
  1344. u64, struct page **, unsigned int, int);
  1345. int (*mknod) (struct inode *, struct dentry *, struct iattr *,
  1346. dev_t);
  1347. int (*statfs) (struct nfs_server *, struct nfs_fh *,
  1348. struct nfs_fsstat *);
  1349. int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
  1350. struct nfs_fsinfo *);
  1351. int (*pathconf) (struct nfs_server *, struct nfs_fh *,
  1352. struct nfs_pathconf *);
  1353. int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
  1354. int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
  1355. int (*pgio_rpc_prepare)(struct rpc_task *,
  1356. struct nfs_pgio_header *);
  1357. void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *);
  1358. int (*read_done)(struct rpc_task *, struct nfs_pgio_header *);
  1359. void (*write_setup)(struct nfs_pgio_header *, struct rpc_message *);
  1360. int (*write_done)(struct rpc_task *, struct nfs_pgio_header *);
  1361. void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
  1362. void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
  1363. int (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
  1364. int (*lock)(struct file *, int, struct file_lock *);
  1365. int (*lock_check_bounds)(const struct file_lock *);
  1366. void (*clear_acl_cache)(struct inode *);
  1367. void (*close_context)(struct nfs_open_context *ctx, int);
  1368. struct inode * (*open_context) (struct inode *dir,
  1369. struct nfs_open_context *ctx,
  1370. int open_flags,
  1371. struct iattr *iattr,
  1372. int *);
  1373. int (*have_delegation)(struct inode *, fmode_t);
  1374. int (*return_delegation)(struct inode *);
  1375. struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *);
  1376. struct nfs_client *
  1377. (*init_client) (struct nfs_client *, const struct rpc_timeout *,
  1378. const char *);
  1379. void (*free_client) (struct nfs_client *);
  1380. struct nfs_server *(*create_server)(struct nfs_mount_info *, struct nfs_subversion *);
  1381. struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
  1382. struct nfs_fattr *, rpc_authflavor_t);
  1383. };
  1384. /*
  1385. * NFS_CALL(getattr, inode, (fattr));
  1386. * into
  1387. * NFS_PROTO(inode)->getattr(fattr);
  1388. */
  1389. #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
  1390. /*
  1391. * Function vectors etc. for the NFS client
  1392. */
  1393. extern const struct nfs_rpc_ops nfs_v2_clientops;
  1394. extern const struct nfs_rpc_ops nfs_v3_clientops;
  1395. extern const struct nfs_rpc_ops nfs_v4_clientops;
  1396. extern const struct rpc_version nfs_version2;
  1397. extern const struct rpc_version nfs_version3;
  1398. extern const struct rpc_version nfs_version4;
  1399. extern const struct rpc_version nfsacl_version3;
  1400. extern const struct rpc_program nfsacl_program;
  1401. #endif