nfs_xdr.h 35 KB

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