nfs_xdr.h 39 KB

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