nfs_xdr.h 39 KB

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