nfs_xdr.h 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469
  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. /* Forward declaration for NFS v3 */
  15. struct nfs4_secinfo_flavors;
  16. struct nfs4_string {
  17. unsigned int len;
  18. char *data;
  19. };
  20. struct nfs_fsid {
  21. uint64_t major;
  22. uint64_t minor;
  23. };
  24. /*
  25. * Helper for checking equality between 2 fsids.
  26. */
  27. static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
  28. {
  29. return a->major == b->major && a->minor == b->minor;
  30. }
  31. struct nfs4_threshold {
  32. __u32 bm;
  33. __u32 l_type;
  34. __u64 rd_sz;
  35. __u64 wr_sz;
  36. __u64 rd_io_sz;
  37. __u64 wr_io_sz;
  38. };
  39. struct nfs_fattr {
  40. unsigned int valid; /* which fields are valid */
  41. umode_t mode;
  42. __u32 nlink;
  43. __u32 uid;
  44. __u32 gid;
  45. dev_t rdev;
  46. __u64 size;
  47. union {
  48. struct {
  49. __u32 blocksize;
  50. __u32 blocks;
  51. } nfs2;
  52. struct {
  53. __u64 used;
  54. } nfs3;
  55. } du;
  56. struct nfs_fsid fsid;
  57. __u64 fileid;
  58. __u64 mounted_on_fileid;
  59. struct timespec atime;
  60. struct timespec mtime;
  61. struct timespec ctime;
  62. __u64 change_attr; /* NFSv4 change attribute */
  63. __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
  64. __u64 pre_size; /* pre_op_attr.size */
  65. struct timespec pre_mtime; /* pre_op_attr.mtime */
  66. struct timespec pre_ctime; /* pre_op_attr.ctime */
  67. unsigned long time_start;
  68. unsigned long gencount;
  69. struct nfs4_string *owner_name;
  70. struct nfs4_string *group_name;
  71. struct nfs4_threshold *mdsthreshold; /* pNFS threshold hints */
  72. };
  73. #define NFS_ATTR_FATTR_TYPE (1U << 0)
  74. #define NFS_ATTR_FATTR_MODE (1U << 1)
  75. #define NFS_ATTR_FATTR_NLINK (1U << 2)
  76. #define NFS_ATTR_FATTR_OWNER (1U << 3)
  77. #define NFS_ATTR_FATTR_GROUP (1U << 4)
  78. #define NFS_ATTR_FATTR_RDEV (1U << 5)
  79. #define NFS_ATTR_FATTR_SIZE (1U << 6)
  80. #define NFS_ATTR_FATTR_PRESIZE (1U << 7)
  81. #define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
  82. #define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
  83. #define NFS_ATTR_FATTR_FSID (1U << 10)
  84. #define NFS_ATTR_FATTR_FILEID (1U << 11)
  85. #define NFS_ATTR_FATTR_ATIME (1U << 12)
  86. #define NFS_ATTR_FATTR_MTIME (1U << 13)
  87. #define NFS_ATTR_FATTR_CTIME (1U << 14)
  88. #define NFS_ATTR_FATTR_PREMTIME (1U << 15)
  89. #define NFS_ATTR_FATTR_PRECTIME (1U << 16)
  90. #define NFS_ATTR_FATTR_CHANGE (1U << 17)
  91. #define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
  92. #define NFS_ATTR_FATTR_V4_LOCATIONS (1U << 19)
  93. #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 20)
  94. #define NFS_ATTR_FATTR_MOUNTPOINT (1U << 21)
  95. #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22)
  96. #define NFS_ATTR_FATTR_OWNER_NAME (1U << 23)
  97. #define NFS_ATTR_FATTR_GROUP_NAME (1U << 24)
  98. #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
  99. | NFS_ATTR_FATTR_MODE \
  100. | NFS_ATTR_FATTR_NLINK \
  101. | NFS_ATTR_FATTR_OWNER \
  102. | NFS_ATTR_FATTR_GROUP \
  103. | NFS_ATTR_FATTR_RDEV \
  104. | NFS_ATTR_FATTR_SIZE \
  105. | NFS_ATTR_FATTR_FSID \
  106. | NFS_ATTR_FATTR_FILEID \
  107. | NFS_ATTR_FATTR_ATIME \
  108. | NFS_ATTR_FATTR_MTIME \
  109. | NFS_ATTR_FATTR_CTIME \
  110. | NFS_ATTR_FATTR_CHANGE)
  111. #define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
  112. | NFS_ATTR_FATTR_BLOCKS_USED)
  113. #define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
  114. | NFS_ATTR_FATTR_SPACE_USED)
  115. #define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
  116. | NFS_ATTR_FATTR_SPACE_USED)
  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. gfp_t gfp_flags;
  226. };
  227. struct nfs4_getdevicelist_args {
  228. struct nfs4_sequence_args seq_args;
  229. const struct nfs_fh *fh;
  230. u32 layoutclass;
  231. };
  232. struct nfs4_getdevicelist_res {
  233. struct nfs4_sequence_res seq_res;
  234. struct pnfs_devicelist *devlist;
  235. };
  236. struct nfs4_getdeviceinfo_args {
  237. struct nfs4_sequence_args seq_args;
  238. struct pnfs_device *pdev;
  239. };
  240. struct nfs4_getdeviceinfo_res {
  241. struct nfs4_sequence_res seq_res;
  242. struct pnfs_device *pdev;
  243. };
  244. struct nfs4_layoutcommit_args {
  245. struct nfs4_sequence_args seq_args;
  246. nfs4_stateid stateid;
  247. __u64 lastbytewritten;
  248. struct inode *inode;
  249. const u32 *bitmask;
  250. };
  251. struct nfs4_layoutcommit_res {
  252. struct nfs4_sequence_res seq_res;
  253. struct nfs_fattr *fattr;
  254. const struct nfs_server *server;
  255. int status;
  256. };
  257. struct nfs4_layoutcommit_data {
  258. struct rpc_task task;
  259. struct nfs_fattr fattr;
  260. struct list_head lseg_list;
  261. struct rpc_cred *cred;
  262. struct nfs4_layoutcommit_args args;
  263. struct nfs4_layoutcommit_res res;
  264. };
  265. struct nfs4_layoutreturn_args {
  266. struct nfs4_sequence_args seq_args;
  267. struct pnfs_layout_hdr *layout;
  268. struct inode *inode;
  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. int rpc_status;
  283. };
  284. struct stateowner_id {
  285. __u64 create_time;
  286. __u32 uniquifier;
  287. };
  288. /*
  289. * Arguments to the open call.
  290. */
  291. struct nfs_openargs {
  292. struct nfs4_sequence_args seq_args;
  293. const struct nfs_fh * fh;
  294. struct nfs_seqid * seqid;
  295. int open_flags;
  296. fmode_t fmode;
  297. u32 access;
  298. __u64 clientid;
  299. struct stateowner_id id;
  300. union {
  301. struct {
  302. struct iattr * attrs; /* UNCHECKED, GUARDED */
  303. nfs4_verifier verifier; /* EXCLUSIVE */
  304. };
  305. nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
  306. fmode_t delegation_type; /* CLAIM_PREVIOUS */
  307. } u;
  308. const struct qstr * name;
  309. const struct nfs_server *server; /* Needed for ID mapping */
  310. const u32 * bitmask;
  311. const u32 * open_bitmap;
  312. __u32 claim;
  313. };
  314. struct nfs_openres {
  315. struct nfs4_sequence_res seq_res;
  316. nfs4_stateid stateid;
  317. struct nfs_fh fh;
  318. struct nfs4_change_info cinfo;
  319. __u32 rflags;
  320. struct nfs_fattr * f_attr;
  321. struct nfs_seqid * seqid;
  322. const struct nfs_server *server;
  323. fmode_t delegation_type;
  324. nfs4_stateid delegation;
  325. __u32 do_recall;
  326. __u64 maxsize;
  327. __u32 attrset[NFS4_BITMAP_SIZE];
  328. struct nfs4_string *owner;
  329. struct nfs4_string *group_owner;
  330. __u32 access_request;
  331. __u32 access_supported;
  332. __u32 access_result;
  333. };
  334. /*
  335. * Arguments to the open_confirm call.
  336. */
  337. struct nfs_open_confirmargs {
  338. const struct nfs_fh * fh;
  339. nfs4_stateid * stateid;
  340. struct nfs_seqid * seqid;
  341. };
  342. struct nfs_open_confirmres {
  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 nfs_lowner lock_owner;
  415. };
  416. struct nfs4_delegreturnargs {
  417. struct nfs4_sequence_args seq_args;
  418. const struct nfs_fh *fhandle;
  419. const nfs4_stateid *stateid;
  420. const u32 * bitmask;
  421. };
  422. struct nfs4_delegreturnres {
  423. struct nfs4_sequence_res seq_res;
  424. struct nfs_fattr * fattr;
  425. const struct nfs_server *server;
  426. };
  427. /*
  428. * Arguments to the read call.
  429. */
  430. struct nfs_readargs {
  431. struct nfs4_sequence_args seq_args;
  432. struct nfs_fh * fh;
  433. struct nfs_open_context *context;
  434. struct nfs_lock_context *lock_context;
  435. __u64 offset;
  436. __u32 count;
  437. unsigned int pgbase;
  438. struct page ** pages;
  439. };
  440. struct nfs_readres {
  441. struct nfs4_sequence_res seq_res;
  442. struct nfs_fattr * fattr;
  443. __u32 count;
  444. int eof;
  445. };
  446. /*
  447. * Arguments to the write call.
  448. */
  449. struct nfs_writeargs {
  450. struct nfs4_sequence_args seq_args;
  451. struct nfs_fh * fh;
  452. struct nfs_open_context *context;
  453. struct nfs_lock_context *lock_context;
  454. __u64 offset;
  455. __u32 count;
  456. enum nfs3_stable_how stable;
  457. unsigned int pgbase;
  458. struct page ** pages;
  459. const u32 * bitmask;
  460. };
  461. struct nfs_write_verifier {
  462. char data[8];
  463. };
  464. struct nfs_writeverf {
  465. struct nfs_write_verifier verifier;
  466. enum nfs3_stable_how committed;
  467. };
  468. struct nfs_writeres {
  469. struct nfs4_sequence_res seq_res;
  470. struct nfs_fattr * fattr;
  471. struct nfs_writeverf * verf;
  472. __u32 count;
  473. const struct nfs_server *server;
  474. };
  475. /*
  476. * Arguments to the commit call.
  477. */
  478. struct nfs_commitargs {
  479. struct nfs4_sequence_args seq_args;
  480. struct nfs_fh *fh;
  481. __u64 offset;
  482. __u32 count;
  483. const u32 *bitmask;
  484. };
  485. struct nfs_commitres {
  486. struct nfs4_sequence_res seq_res;
  487. struct nfs_fattr *fattr;
  488. struct nfs_writeverf *verf;
  489. const struct nfs_server *server;
  490. };
  491. /*
  492. * Common arguments to the unlink call
  493. */
  494. struct nfs_removeargs {
  495. struct nfs4_sequence_args seq_args;
  496. const struct nfs_fh *fh;
  497. struct qstr name;
  498. };
  499. struct nfs_removeres {
  500. struct nfs4_sequence_res seq_res;
  501. const struct nfs_server *server;
  502. struct nfs_fattr *dir_attr;
  503. struct nfs4_change_info cinfo;
  504. };
  505. /*
  506. * Common arguments to the rename call
  507. */
  508. struct nfs_renameargs {
  509. struct nfs4_sequence_args seq_args;
  510. const struct nfs_fh *old_dir;
  511. const struct nfs_fh *new_dir;
  512. const struct qstr *old_name;
  513. const struct qstr *new_name;
  514. };
  515. struct nfs_renameres {
  516. struct nfs4_sequence_res seq_res;
  517. const struct nfs_server *server;
  518. struct nfs4_change_info old_cinfo;
  519. struct nfs_fattr *old_fattr;
  520. struct nfs4_change_info new_cinfo;
  521. struct nfs_fattr *new_fattr;
  522. };
  523. /*
  524. * Argument struct for decode_entry function
  525. */
  526. struct nfs_entry {
  527. __u64 ino;
  528. __u64 cookie,
  529. prev_cookie;
  530. const char * name;
  531. unsigned int len;
  532. int eof;
  533. struct nfs_fh * fh;
  534. struct nfs_fattr * fattr;
  535. unsigned char d_type;
  536. struct nfs_server * server;
  537. };
  538. /*
  539. * The following types are for NFSv2 only.
  540. */
  541. struct nfs_sattrargs {
  542. struct nfs_fh * fh;
  543. struct iattr * sattr;
  544. };
  545. struct nfs_diropargs {
  546. struct nfs_fh * fh;
  547. const char * name;
  548. unsigned int len;
  549. };
  550. struct nfs_createargs {
  551. struct nfs_fh * fh;
  552. const char * name;
  553. unsigned int len;
  554. struct iattr * sattr;
  555. };
  556. struct nfs_setattrargs {
  557. struct nfs4_sequence_args seq_args;
  558. struct nfs_fh * fh;
  559. nfs4_stateid stateid;
  560. struct iattr * iap;
  561. const struct nfs_server * server; /* Needed for name mapping */
  562. const u32 * bitmask;
  563. };
  564. struct nfs_setaclargs {
  565. struct nfs4_sequence_args seq_args;
  566. struct nfs_fh * fh;
  567. size_t acl_len;
  568. unsigned int acl_pgbase;
  569. struct page ** acl_pages;
  570. };
  571. struct nfs_setaclres {
  572. struct nfs4_sequence_res seq_res;
  573. };
  574. struct nfs_getaclargs {
  575. struct nfs4_sequence_args seq_args;
  576. struct nfs_fh * fh;
  577. size_t acl_len;
  578. unsigned int acl_pgbase;
  579. struct page ** acl_pages;
  580. };
  581. /* getxattr ACL interface flags */
  582. #define NFS4_ACL_TRUNC 0x0001 /* ACL was truncated */
  583. struct nfs_getaclres {
  584. struct nfs4_sequence_res seq_res;
  585. size_t acl_len;
  586. size_t acl_data_offset;
  587. int acl_flags;
  588. struct page * acl_scratch;
  589. };
  590. struct nfs_setattrres {
  591. struct nfs4_sequence_res seq_res;
  592. struct nfs_fattr * fattr;
  593. const struct nfs_server * server;
  594. };
  595. struct nfs_linkargs {
  596. struct nfs_fh * fromfh;
  597. struct nfs_fh * tofh;
  598. const char * toname;
  599. unsigned int tolen;
  600. };
  601. struct nfs_symlinkargs {
  602. struct nfs_fh * fromfh;
  603. const char * fromname;
  604. unsigned int fromlen;
  605. struct page ** pages;
  606. unsigned int pathlen;
  607. struct iattr * sattr;
  608. };
  609. struct nfs_readdirargs {
  610. struct nfs_fh * fh;
  611. __u32 cookie;
  612. unsigned int count;
  613. struct page ** pages;
  614. };
  615. struct nfs3_getaclargs {
  616. struct nfs_fh * fh;
  617. int mask;
  618. struct page ** pages;
  619. };
  620. struct nfs3_setaclargs {
  621. struct inode * inode;
  622. int mask;
  623. struct posix_acl * acl_access;
  624. struct posix_acl * acl_default;
  625. size_t len;
  626. unsigned int npages;
  627. struct page ** pages;
  628. };
  629. struct nfs_diropok {
  630. struct nfs_fh * fh;
  631. struct nfs_fattr * fattr;
  632. };
  633. struct nfs_readlinkargs {
  634. struct nfs_fh * fh;
  635. unsigned int pgbase;
  636. unsigned int pglen;
  637. struct page ** pages;
  638. };
  639. struct nfs3_sattrargs {
  640. struct nfs_fh * fh;
  641. struct iattr * sattr;
  642. unsigned int guard;
  643. struct timespec guardtime;
  644. };
  645. struct nfs3_diropargs {
  646. struct nfs_fh * fh;
  647. const char * name;
  648. unsigned int len;
  649. };
  650. struct nfs3_accessargs {
  651. struct nfs_fh * fh;
  652. __u32 access;
  653. };
  654. struct nfs3_createargs {
  655. struct nfs_fh * fh;
  656. const char * name;
  657. unsigned int len;
  658. struct iattr * sattr;
  659. enum nfs3_createmode createmode;
  660. __be32 verifier[2];
  661. };
  662. struct nfs3_mkdirargs {
  663. struct nfs_fh * fh;
  664. const char * name;
  665. unsigned int len;
  666. struct iattr * sattr;
  667. };
  668. struct nfs3_symlinkargs {
  669. struct nfs_fh * fromfh;
  670. const char * fromname;
  671. unsigned int fromlen;
  672. struct page ** pages;
  673. unsigned int pathlen;
  674. struct iattr * sattr;
  675. };
  676. struct nfs3_mknodargs {
  677. struct nfs_fh * fh;
  678. const char * name;
  679. unsigned int len;
  680. enum nfs3_ftype type;
  681. struct iattr * sattr;
  682. dev_t rdev;
  683. };
  684. struct nfs3_linkargs {
  685. struct nfs_fh * fromfh;
  686. struct nfs_fh * tofh;
  687. const char * toname;
  688. unsigned int tolen;
  689. };
  690. struct nfs3_readdirargs {
  691. struct nfs_fh * fh;
  692. __u64 cookie;
  693. __be32 verf[2];
  694. int plus;
  695. unsigned int count;
  696. struct page ** pages;
  697. };
  698. struct nfs3_diropres {
  699. struct nfs_fattr * dir_attr;
  700. struct nfs_fh * fh;
  701. struct nfs_fattr * fattr;
  702. };
  703. struct nfs3_accessres {
  704. struct nfs_fattr * fattr;
  705. __u32 access;
  706. };
  707. struct nfs3_readlinkargs {
  708. struct nfs_fh * fh;
  709. unsigned int pgbase;
  710. unsigned int pglen;
  711. struct page ** pages;
  712. };
  713. struct nfs3_linkres {
  714. struct nfs_fattr * dir_attr;
  715. struct nfs_fattr * fattr;
  716. };
  717. struct nfs3_readdirres {
  718. struct nfs_fattr * dir_attr;
  719. __be32 * verf;
  720. int plus;
  721. };
  722. struct nfs3_getaclres {
  723. struct nfs_fattr * fattr;
  724. int mask;
  725. unsigned int acl_access_count;
  726. unsigned int acl_default_count;
  727. struct posix_acl * acl_access;
  728. struct posix_acl * acl_default;
  729. };
  730. #if IS_ENABLED(CONFIG_NFS_V4)
  731. typedef u64 clientid4;
  732. struct nfs4_accessargs {
  733. struct nfs4_sequence_args seq_args;
  734. const struct nfs_fh * fh;
  735. const u32 * bitmask;
  736. u32 access;
  737. };
  738. struct nfs4_accessres {
  739. struct nfs4_sequence_res seq_res;
  740. const struct nfs_server * server;
  741. struct nfs_fattr * fattr;
  742. u32 supported;
  743. u32 access;
  744. };
  745. struct nfs4_create_arg {
  746. struct nfs4_sequence_args seq_args;
  747. u32 ftype;
  748. union {
  749. struct {
  750. struct page ** pages;
  751. unsigned int len;
  752. } symlink; /* NF4LNK */
  753. struct {
  754. u32 specdata1;
  755. u32 specdata2;
  756. } device; /* NF4BLK, NF4CHR */
  757. } u;
  758. const struct qstr * name;
  759. const struct nfs_server * server;
  760. const struct iattr * attrs;
  761. const struct nfs_fh * dir_fh;
  762. const u32 * bitmask;
  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_change_info dir_cinfo;
  770. };
  771. struct nfs4_fsinfo_arg {
  772. struct nfs4_sequence_args seq_args;
  773. const struct nfs_fh * fh;
  774. const u32 * bitmask;
  775. };
  776. struct nfs4_fsinfo_res {
  777. struct nfs4_sequence_res seq_res;
  778. struct nfs_fsinfo *fsinfo;
  779. };
  780. struct nfs4_getattr_arg {
  781. struct nfs4_sequence_args seq_args;
  782. const struct nfs_fh * fh;
  783. const u32 * bitmask;
  784. };
  785. struct nfs4_getattr_res {
  786. struct nfs4_sequence_res seq_res;
  787. const struct nfs_server * server;
  788. struct nfs_fattr * fattr;
  789. };
  790. struct nfs4_link_arg {
  791. struct nfs4_sequence_args seq_args;
  792. const struct nfs_fh * fh;
  793. const struct nfs_fh * dir_fh;
  794. const struct qstr * name;
  795. const u32 * bitmask;
  796. };
  797. struct nfs4_link_res {
  798. struct nfs4_sequence_res seq_res;
  799. const struct nfs_server * server;
  800. struct nfs_fattr * fattr;
  801. struct nfs4_change_info cinfo;
  802. struct nfs_fattr * dir_attr;
  803. };
  804. struct nfs4_lookup_arg {
  805. struct nfs4_sequence_args seq_args;
  806. const struct nfs_fh * dir_fh;
  807. const struct qstr * name;
  808. const u32 * bitmask;
  809. };
  810. struct nfs4_lookup_res {
  811. struct nfs4_sequence_res seq_res;
  812. const struct nfs_server * server;
  813. struct nfs_fattr * fattr;
  814. struct nfs_fh * fh;
  815. };
  816. struct nfs4_lookup_root_arg {
  817. struct nfs4_sequence_args seq_args;
  818. const u32 * bitmask;
  819. };
  820. struct nfs4_pathconf_arg {
  821. struct nfs4_sequence_args seq_args;
  822. const struct nfs_fh * fh;
  823. const u32 * bitmask;
  824. };
  825. struct nfs4_pathconf_res {
  826. struct nfs4_sequence_res seq_res;
  827. struct nfs_pathconf *pathconf;
  828. };
  829. struct nfs4_readdir_arg {
  830. struct nfs4_sequence_args seq_args;
  831. const struct nfs_fh * fh;
  832. u64 cookie;
  833. nfs4_verifier verifier;
  834. u32 count;
  835. struct page ** pages; /* zero-copy data */
  836. unsigned int pgbase; /* zero-copy data */
  837. const u32 * bitmask;
  838. int plus;
  839. };
  840. struct nfs4_readdir_res {
  841. struct nfs4_sequence_res seq_res;
  842. nfs4_verifier verifier;
  843. unsigned int pgbase;
  844. };
  845. struct nfs4_readlink {
  846. struct nfs4_sequence_args seq_args;
  847. const struct nfs_fh * fh;
  848. unsigned int pgbase;
  849. unsigned int pglen; /* zero-copy data */
  850. struct page ** pages; /* zero-copy data */
  851. };
  852. struct nfs4_readlink_res {
  853. struct nfs4_sequence_res seq_res;
  854. };
  855. #define NFS4_SETCLIENTID_NAMELEN (127)
  856. struct nfs4_setclientid {
  857. const nfs4_verifier * sc_verifier;
  858. unsigned int sc_name_len;
  859. char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
  860. u32 sc_prog;
  861. unsigned int sc_netid_len;
  862. char sc_netid[RPCBIND_MAXNETIDLEN + 1];
  863. unsigned int sc_uaddr_len;
  864. char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
  865. u32 sc_cb_ident;
  866. };
  867. struct nfs4_setclientid_res {
  868. u64 clientid;
  869. nfs4_verifier confirm;
  870. };
  871. struct nfs4_statfs_arg {
  872. struct nfs4_sequence_args seq_args;
  873. const struct nfs_fh * fh;
  874. const u32 * bitmask;
  875. };
  876. struct nfs4_statfs_res {
  877. struct nfs4_sequence_res seq_res;
  878. struct nfs_fsstat *fsstat;
  879. };
  880. struct nfs4_server_caps_arg {
  881. struct nfs4_sequence_args seq_args;
  882. struct nfs_fh *fhandle;
  883. };
  884. struct nfs4_server_caps_res {
  885. struct nfs4_sequence_res seq_res;
  886. u32 attr_bitmask[3];
  887. u32 acl_bitmask;
  888. u32 has_links;
  889. u32 has_symlinks;
  890. u32 fh_expire_type;
  891. };
  892. #define NFS4_PATHNAME_MAXCOMPONENTS 512
  893. struct nfs4_pathname {
  894. unsigned int ncomponents;
  895. struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
  896. };
  897. #define NFS4_FS_LOCATION_MAXSERVERS 10
  898. struct nfs4_fs_location {
  899. unsigned int nservers;
  900. struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
  901. struct nfs4_pathname rootpath;
  902. };
  903. #define NFS4_FS_LOCATIONS_MAXENTRIES 10
  904. struct nfs4_fs_locations {
  905. struct nfs_fattr fattr;
  906. const struct nfs_server *server;
  907. struct nfs4_pathname fs_path;
  908. int nlocations;
  909. struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
  910. };
  911. struct nfs4_fs_locations_arg {
  912. struct nfs4_sequence_args seq_args;
  913. const struct nfs_fh *dir_fh;
  914. const struct qstr *name;
  915. struct page *page;
  916. const u32 *bitmask;
  917. };
  918. struct nfs4_fs_locations_res {
  919. struct nfs4_sequence_res seq_res;
  920. struct nfs4_fs_locations *fs_locations;
  921. };
  922. struct nfs4_secinfo_oid {
  923. unsigned int len;
  924. char data[GSS_OID_MAX_LEN];
  925. };
  926. struct nfs4_secinfo_gss {
  927. struct nfs4_secinfo_oid sec_oid4;
  928. unsigned int qop4;
  929. unsigned int service;
  930. };
  931. struct nfs4_secinfo_flavor {
  932. unsigned int flavor;
  933. struct nfs4_secinfo_gss gss;
  934. };
  935. struct nfs4_secinfo_flavors {
  936. unsigned int num_flavors;
  937. struct nfs4_secinfo_flavor 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. #endif /* CONFIG_NFS_V4 */
  949. struct nfstime4 {
  950. u64 seconds;
  951. u32 nseconds;
  952. };
  953. #ifdef CONFIG_NFS_V4_1
  954. struct pnfs_commit_bucket {
  955. struct list_head written;
  956. struct list_head committing;
  957. struct pnfs_layout_segment *wlseg;
  958. struct pnfs_layout_segment *clseg;
  959. };
  960. struct pnfs_ds_commit_info {
  961. int nwritten;
  962. int ncommitting;
  963. int nbuckets;
  964. struct pnfs_commit_bucket *buckets;
  965. };
  966. #define NFS4_EXCHANGE_ID_LEN (48)
  967. struct nfs41_exchange_id_args {
  968. struct nfs_client *client;
  969. nfs4_verifier *verifier;
  970. unsigned int id_len;
  971. char id[NFS4_EXCHANGE_ID_LEN];
  972. u32 flags;
  973. };
  974. struct nfs41_server_owner {
  975. uint64_t minor_id;
  976. uint32_t major_id_sz;
  977. char major_id[NFS4_OPAQUE_LIMIT];
  978. };
  979. struct nfs41_server_scope {
  980. uint32_t server_scope_sz;
  981. char server_scope[NFS4_OPAQUE_LIMIT];
  982. };
  983. struct nfs41_impl_id {
  984. char domain[NFS4_OPAQUE_LIMIT + 1];
  985. char name[NFS4_OPAQUE_LIMIT + 1];
  986. struct nfstime4 date;
  987. };
  988. struct nfs41_bind_conn_to_session_res {
  989. struct nfs4_session *session;
  990. u32 dir;
  991. bool use_conn_in_rdma_mode;
  992. };
  993. struct nfs41_exchange_id_res {
  994. u64 clientid;
  995. u32 seqid;
  996. u32 flags;
  997. struct nfs41_server_owner *server_owner;
  998. struct nfs41_server_scope *server_scope;
  999. struct nfs41_impl_id *impl_id;
  1000. };
  1001. struct nfs41_create_session_args {
  1002. struct nfs_client *client;
  1003. uint32_t flags;
  1004. uint32_t cb_program;
  1005. struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
  1006. struct nfs4_channel_attrs bc_attrs; /* Back Channel */
  1007. };
  1008. struct nfs41_create_session_res {
  1009. struct nfs_client *client;
  1010. };
  1011. struct nfs41_reclaim_complete_args {
  1012. struct nfs4_sequence_args seq_args;
  1013. /* In the future extend to include curr_fh for use with migration */
  1014. unsigned char one_fs:1;
  1015. };
  1016. struct nfs41_reclaim_complete_res {
  1017. struct nfs4_sequence_res seq_res;
  1018. };
  1019. #define SECINFO_STYLE_CURRENT_FH 0
  1020. #define SECINFO_STYLE_PARENT 1
  1021. struct nfs41_secinfo_no_name_args {
  1022. struct nfs4_sequence_args seq_args;
  1023. int style;
  1024. };
  1025. struct nfs41_test_stateid_args {
  1026. struct nfs4_sequence_args seq_args;
  1027. nfs4_stateid *stateid;
  1028. };
  1029. struct nfs41_test_stateid_res {
  1030. struct nfs4_sequence_res seq_res;
  1031. unsigned int status;
  1032. };
  1033. struct nfs41_free_stateid_args {
  1034. struct nfs4_sequence_args seq_args;
  1035. nfs4_stateid *stateid;
  1036. };
  1037. struct nfs41_free_stateid_res {
  1038. struct nfs4_sequence_res seq_res;
  1039. unsigned int status;
  1040. };
  1041. #else
  1042. struct pnfs_ds_commit_info {
  1043. };
  1044. #endif /* CONFIG_NFS_V4_1 */
  1045. struct nfs_page;
  1046. #define NFS_PAGEVEC_SIZE (8U)
  1047. struct nfs_page_array {
  1048. struct page **pagevec;
  1049. unsigned int npages; /* Max length of pagevec */
  1050. struct page *page_array[NFS_PAGEVEC_SIZE];
  1051. };
  1052. struct nfs_read_data {
  1053. struct nfs_pgio_header *header;
  1054. struct list_head list;
  1055. struct rpc_task task;
  1056. struct nfs_fattr fattr; /* fattr storage */
  1057. struct nfs_readargs args;
  1058. struct nfs_readres res;
  1059. unsigned long timestamp; /* For lease renewal */
  1060. int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
  1061. __u64 mds_offset;
  1062. struct nfs_page_array pages;
  1063. struct nfs_client *ds_clp; /* pNFS data server */
  1064. };
  1065. /* used as flag bits in nfs_pgio_header */
  1066. enum {
  1067. NFS_IOHDR_ERROR = 0,
  1068. NFS_IOHDR_EOF,
  1069. NFS_IOHDR_REDO,
  1070. NFS_IOHDR_NEED_COMMIT,
  1071. NFS_IOHDR_NEED_RESCHED,
  1072. };
  1073. struct nfs_pgio_header {
  1074. struct inode *inode;
  1075. struct rpc_cred *cred;
  1076. struct list_head pages;
  1077. struct list_head rpc_list;
  1078. atomic_t refcnt;
  1079. struct nfs_page *req;
  1080. struct nfs_writeverf *verf;
  1081. struct pnfs_layout_segment *lseg;
  1082. loff_t io_start;
  1083. const struct rpc_call_ops *mds_ops;
  1084. void (*release) (struct nfs_pgio_header *hdr);
  1085. const struct nfs_pgio_completion_ops *completion_ops;
  1086. struct nfs_direct_req *dreq;
  1087. void *layout_private;
  1088. spinlock_t lock;
  1089. /* fields protected by lock */
  1090. int pnfs_error;
  1091. int error; /* merge with pnfs_error */
  1092. unsigned long good_bytes; /* boundary of good data */
  1093. unsigned long flags;
  1094. };
  1095. struct nfs_read_header {
  1096. struct nfs_pgio_header header;
  1097. struct nfs_read_data rpc_data;
  1098. };
  1099. struct nfs_write_data {
  1100. struct nfs_pgio_header *header;
  1101. struct list_head list;
  1102. struct rpc_task task;
  1103. struct nfs_fattr fattr;
  1104. struct nfs_writeverf verf;
  1105. struct nfs_writeargs args; /* argument struct */
  1106. struct nfs_writeres res; /* result struct */
  1107. unsigned long timestamp; /* For lease renewal */
  1108. int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
  1109. __u64 mds_offset; /* Filelayout dense stripe */
  1110. struct nfs_page_array pages;
  1111. struct nfs_client *ds_clp; /* pNFS data server */
  1112. };
  1113. struct nfs_write_header {
  1114. struct nfs_pgio_header header;
  1115. struct nfs_write_data rpc_data;
  1116. struct nfs_writeverf verf;
  1117. };
  1118. struct nfs_mds_commit_info {
  1119. atomic_t rpcs_out;
  1120. unsigned long ncommit;
  1121. struct list_head list;
  1122. };
  1123. struct nfs_commit_data;
  1124. struct nfs_inode;
  1125. struct nfs_commit_completion_ops {
  1126. void (*error_cleanup) (struct nfs_inode *nfsi);
  1127. void (*completion) (struct nfs_commit_data *data);
  1128. };
  1129. struct nfs_commit_info {
  1130. spinlock_t *lock;
  1131. struct nfs_mds_commit_info *mds;
  1132. struct pnfs_ds_commit_info *ds;
  1133. struct nfs_direct_req *dreq; /* O_DIRECT request */
  1134. const struct nfs_commit_completion_ops *completion_ops;
  1135. };
  1136. struct nfs_commit_data {
  1137. struct rpc_task task;
  1138. struct inode *inode;
  1139. struct rpc_cred *cred;
  1140. struct nfs_fattr fattr;
  1141. struct nfs_writeverf verf;
  1142. struct list_head pages; /* Coalesced requests we wish to flush */
  1143. struct list_head list; /* lists of struct nfs_write_data */
  1144. struct nfs_direct_req *dreq; /* O_DIRECT request */
  1145. struct nfs_commitargs args; /* argument struct */
  1146. struct nfs_commitres res; /* result struct */
  1147. struct nfs_open_context *context;
  1148. struct pnfs_layout_segment *lseg;
  1149. struct nfs_client *ds_clp; /* pNFS data server */
  1150. int ds_commit_index;
  1151. const struct rpc_call_ops *mds_ops;
  1152. const struct nfs_commit_completion_ops *completion_ops;
  1153. int (*commit_done_cb) (struct rpc_task *task, struct nfs_commit_data *data);
  1154. };
  1155. struct nfs_pgio_completion_ops {
  1156. void (*error_cleanup)(struct list_head *head);
  1157. void (*init_hdr)(struct nfs_pgio_header *hdr);
  1158. void (*completion)(struct nfs_pgio_header *hdr);
  1159. };
  1160. struct nfs_unlinkdata {
  1161. struct hlist_node list;
  1162. struct nfs_removeargs args;
  1163. struct nfs_removeres res;
  1164. struct inode *dir;
  1165. struct rpc_cred *cred;
  1166. struct nfs_fattr dir_attr;
  1167. };
  1168. struct nfs_renamedata {
  1169. struct nfs_renameargs args;
  1170. struct nfs_renameres res;
  1171. struct rpc_cred *cred;
  1172. struct inode *old_dir;
  1173. struct dentry *old_dentry;
  1174. struct nfs_fattr old_fattr;
  1175. struct inode *new_dir;
  1176. struct dentry *new_dentry;
  1177. struct nfs_fattr new_fattr;
  1178. };
  1179. struct nfs_access_entry;
  1180. struct nfs_client;
  1181. struct rpc_timeout;
  1182. struct nfs_subversion;
  1183. struct nfs_mount_info;
  1184. struct nfs_client_initdata;
  1185. struct nfs_pageio_descriptor;
  1186. /*
  1187. * RPC procedure vector for NFSv2/NFSv3 demuxing
  1188. */
  1189. struct nfs_rpc_ops {
  1190. u32 version; /* Protocol version */
  1191. const struct dentry_operations *dentry_ops;
  1192. const struct inode_operations *dir_inode_ops;
  1193. const struct inode_operations *file_inode_ops;
  1194. const struct file_operations *file_ops;
  1195. int (*getroot) (struct nfs_server *, struct nfs_fh *,
  1196. struct nfs_fsinfo *);
  1197. struct vfsmount *(*submount) (struct nfs_server *, struct dentry *,
  1198. struct nfs_fh *, struct nfs_fattr *);
  1199. struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *,
  1200. struct nfs_subversion *);
  1201. int (*getattr) (struct nfs_server *, struct nfs_fh *,
  1202. struct nfs_fattr *);
  1203. int (*setattr) (struct dentry *, struct nfs_fattr *,
  1204. struct iattr *);
  1205. int (*lookup) (struct inode *, struct qstr *,
  1206. struct nfs_fh *, struct nfs_fattr *);
  1207. int (*access) (struct inode *, struct nfs_access_entry *);
  1208. int (*readlink)(struct inode *, struct page *, unsigned int,
  1209. unsigned int);
  1210. int (*create) (struct inode *, struct dentry *,
  1211. struct iattr *, int);
  1212. int (*remove) (struct inode *, struct qstr *);
  1213. void (*unlink_setup) (struct rpc_message *, struct inode *dir);
  1214. void (*unlink_rpc_prepare) (struct rpc_task *, struct nfs_unlinkdata *);
  1215. int (*unlink_done) (struct rpc_task *, struct inode *);
  1216. int (*rename) (struct inode *, struct qstr *,
  1217. struct inode *, struct qstr *);
  1218. void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
  1219. void (*rename_rpc_prepare)(struct rpc_task *task, struct nfs_renamedata *);
  1220. int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
  1221. int (*link) (struct inode *, struct inode *, struct qstr *);
  1222. int (*symlink) (struct inode *, struct dentry *, struct page *,
  1223. unsigned int, struct iattr *);
  1224. int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
  1225. int (*rmdir) (struct inode *, struct qstr *);
  1226. int (*readdir) (struct dentry *, struct rpc_cred *,
  1227. u64, struct page **, unsigned int, int);
  1228. int (*mknod) (struct inode *, struct dentry *, struct iattr *,
  1229. dev_t);
  1230. int (*statfs) (struct nfs_server *, struct nfs_fh *,
  1231. struct nfs_fsstat *);
  1232. int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
  1233. struct nfs_fsinfo *);
  1234. int (*pathconf) (struct nfs_server *, struct nfs_fh *,
  1235. struct nfs_pathconf *);
  1236. int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
  1237. int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
  1238. void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
  1239. void (*read_pageio_init)(struct nfs_pageio_descriptor *, struct inode *,
  1240. const struct nfs_pgio_completion_ops *);
  1241. void (*read_rpc_prepare)(struct rpc_task *, struct nfs_read_data *);
  1242. int (*read_done) (struct rpc_task *, struct nfs_read_data *);
  1243. void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
  1244. void (*write_pageio_init)(struct nfs_pageio_descriptor *, struct inode *, int,
  1245. const struct nfs_pgio_completion_ops *);
  1246. void (*write_rpc_prepare)(struct rpc_task *, struct nfs_write_data *);
  1247. int (*write_done) (struct rpc_task *, struct nfs_write_data *);
  1248. void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
  1249. void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
  1250. int (*commit_done) (struct rpc_task *, struct nfs_commit_data *);
  1251. int (*lock)(struct file *, int, struct file_lock *);
  1252. int (*lock_check_bounds)(const struct file_lock *);
  1253. void (*clear_acl_cache)(struct inode *);
  1254. void (*close_context)(struct nfs_open_context *ctx, int);
  1255. struct inode * (*open_context) (struct inode *dir,
  1256. struct nfs_open_context *ctx,
  1257. int open_flags,
  1258. struct iattr *iattr);
  1259. int (*have_delegation)(struct inode *, fmode_t);
  1260. int (*return_delegation)(struct inode *);
  1261. struct nfs_client *(*alloc_client) (const struct nfs_client_initdata *);
  1262. struct nfs_client *
  1263. (*init_client) (struct nfs_client *, const struct rpc_timeout *,
  1264. const char *, rpc_authflavor_t);
  1265. void (*free_client) (struct nfs_client *);
  1266. struct nfs_server *(*create_server)(struct nfs_mount_info *, struct nfs_subversion *);
  1267. struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *,
  1268. struct nfs_fattr *, rpc_authflavor_t);
  1269. };
  1270. /*
  1271. * NFS_CALL(getattr, inode, (fattr));
  1272. * into
  1273. * NFS_PROTO(inode)->getattr(fattr);
  1274. */
  1275. #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
  1276. /*
  1277. * Function vectors etc. for the NFS client
  1278. */
  1279. extern const struct nfs_rpc_ops nfs_v2_clientops;
  1280. extern const struct nfs_rpc_ops nfs_v3_clientops;
  1281. extern const struct nfs_rpc_ops nfs_v4_clientops;
  1282. extern const struct rpc_version nfs_version2;
  1283. extern const struct rpc_version nfs_version3;
  1284. extern const struct rpc_version nfs_version4;
  1285. extern const struct rpc_version nfsacl_version3;
  1286. extern const struct rpc_program nfsacl_program;
  1287. #endif