nfs_xdr.h 38 KB

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