nfs_xdr.h 37 KB

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