nfs_xdr.h 37 KB

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