nfs_xdr.h 42 KB

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