nfs_xdr.h 35 KB

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