nfs_xdr.h 38 KB

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