nfs_xdr.h 42 KB

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