nfs_xdr.h 26 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130
  1. #ifndef _LINUX_NFS_XDR_H
  2. #define _LINUX_NFS_XDR_H
  3. #include <linux/nfsacl.h>
  4. #include <linux/nfs3.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 nfs_fsid {
  15. uint64_t major;
  16. uint64_t minor;
  17. };
  18. /*
  19. * Helper for checking equality between 2 fsids.
  20. */
  21. static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
  22. {
  23. return a->major == b->major && a->minor == b->minor;
  24. }
  25. struct nfs_fattr {
  26. unsigned int valid; /* which fields are valid */
  27. umode_t mode;
  28. __u32 nlink;
  29. __u32 uid;
  30. __u32 gid;
  31. dev_t rdev;
  32. __u64 size;
  33. union {
  34. struct {
  35. __u32 blocksize;
  36. __u32 blocks;
  37. } nfs2;
  38. struct {
  39. __u64 used;
  40. } nfs3;
  41. } du;
  42. struct nfs_fsid fsid;
  43. __u64 fileid;
  44. struct timespec atime;
  45. struct timespec mtime;
  46. struct timespec ctime;
  47. __u64 change_attr; /* NFSv4 change attribute */
  48. __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
  49. __u64 pre_size; /* pre_op_attr.size */
  50. struct timespec pre_mtime; /* pre_op_attr.mtime */
  51. struct timespec pre_ctime; /* pre_op_attr.ctime */
  52. unsigned long time_start;
  53. unsigned long gencount;
  54. };
  55. #define NFS_ATTR_FATTR_TYPE (1U << 0)
  56. #define NFS_ATTR_FATTR_MODE (1U << 1)
  57. #define NFS_ATTR_FATTR_NLINK (1U << 2)
  58. #define NFS_ATTR_FATTR_OWNER (1U << 3)
  59. #define NFS_ATTR_FATTR_GROUP (1U << 4)
  60. #define NFS_ATTR_FATTR_RDEV (1U << 5)
  61. #define NFS_ATTR_FATTR_SIZE (1U << 6)
  62. #define NFS_ATTR_FATTR_PRESIZE (1U << 7)
  63. #define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
  64. #define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
  65. #define NFS_ATTR_FATTR_FSID (1U << 10)
  66. #define NFS_ATTR_FATTR_FILEID (1U << 11)
  67. #define NFS_ATTR_FATTR_ATIME (1U << 12)
  68. #define NFS_ATTR_FATTR_MTIME (1U << 13)
  69. #define NFS_ATTR_FATTR_CTIME (1U << 14)
  70. #define NFS_ATTR_FATTR_PREMTIME (1U << 15)
  71. #define NFS_ATTR_FATTR_PRECTIME (1U << 16)
  72. #define NFS_ATTR_FATTR_CHANGE (1U << 17)
  73. #define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
  74. #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
  75. #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
  76. | NFS_ATTR_FATTR_MODE \
  77. | NFS_ATTR_FATTR_NLINK \
  78. | NFS_ATTR_FATTR_OWNER \
  79. | NFS_ATTR_FATTR_GROUP \
  80. | NFS_ATTR_FATTR_RDEV \
  81. | NFS_ATTR_FATTR_SIZE \
  82. | NFS_ATTR_FATTR_FSID \
  83. | NFS_ATTR_FATTR_FILEID \
  84. | NFS_ATTR_FATTR_ATIME \
  85. | NFS_ATTR_FATTR_MTIME \
  86. | NFS_ATTR_FATTR_CTIME)
  87. #define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
  88. | NFS_ATTR_FATTR_BLOCKS_USED)
  89. #define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
  90. | NFS_ATTR_FATTR_SPACE_USED)
  91. #define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
  92. | NFS_ATTR_FATTR_SPACE_USED \
  93. | NFS_ATTR_FATTR_CHANGE)
  94. /*
  95. * Info on the file system
  96. */
  97. struct nfs_fsinfo {
  98. struct nfs_fattr *fattr; /* Post-op attributes */
  99. __u32 rtmax; /* max. read transfer size */
  100. __u32 rtpref; /* pref. read transfer size */
  101. __u32 rtmult; /* reads should be multiple of this */
  102. __u32 wtmax; /* max. write transfer size */
  103. __u32 wtpref; /* pref. write transfer size */
  104. __u32 wtmult; /* writes should be multiple of this */
  105. __u32 dtpref; /* pref. readdir transfer size */
  106. __u64 maxfilesize;
  107. struct timespec time_delta; /* server time granularity */
  108. __u32 lease_time; /* in seconds */
  109. __u32 layouttype; /* supported pnfs layout driver */
  110. };
  111. struct nfs_fsstat {
  112. struct nfs_fattr *fattr; /* Post-op attributes */
  113. __u64 tbytes; /* total size in bytes */
  114. __u64 fbytes; /* # of free bytes */
  115. __u64 abytes; /* # of bytes available to user */
  116. __u64 tfiles; /* # of files */
  117. __u64 ffiles; /* # of free files */
  118. __u64 afiles; /* # of files available to user */
  119. };
  120. struct nfs2_fsstat {
  121. __u32 tsize; /* Server transfer size */
  122. __u32 bsize; /* Filesystem block size */
  123. __u32 blocks; /* No. of "bsize" blocks on filesystem */
  124. __u32 bfree; /* No. of free "bsize" blocks */
  125. __u32 bavail; /* No. of available "bsize" blocks */
  126. };
  127. struct nfs_pathconf {
  128. struct nfs_fattr *fattr; /* Post-op attributes */
  129. __u32 max_link; /* max # of hard links */
  130. __u32 max_namelen; /* max name length */
  131. };
  132. struct nfs4_change_info {
  133. u32 atomic;
  134. u64 before;
  135. u64 after;
  136. };
  137. struct nfs_seqid;
  138. /* nfs41 sessions channel attributes */
  139. struct nfs4_channel_attrs {
  140. u32 headerpadsz;
  141. u32 max_rqst_sz;
  142. u32 max_resp_sz;
  143. u32 max_resp_sz_cached;
  144. u32 max_ops;
  145. u32 max_reqs;
  146. };
  147. /* nfs41 sessions slot seqid */
  148. struct nfs4_slot {
  149. u32 seq_nr;
  150. };
  151. struct nfs4_sequence_args {
  152. struct nfs4_session *sa_session;
  153. u8 sa_slotid;
  154. u8 sa_cache_this;
  155. };
  156. struct nfs4_sequence_res {
  157. struct nfs4_session *sr_session;
  158. struct nfs4_slot *sr_slot; /* slot used to send request */
  159. int sr_status; /* sequence operation status */
  160. unsigned long sr_renewal_time;
  161. u32 sr_status_flags;
  162. };
  163. struct nfs4_get_lease_time_args {
  164. struct nfs4_sequence_args la_seq_args;
  165. };
  166. struct nfs4_get_lease_time_res {
  167. struct nfs_fsinfo *lr_fsinfo;
  168. struct nfs4_sequence_res lr_seq_res;
  169. };
  170. #define PNFS_LAYOUT_MAXSIZE 4096
  171. struct nfs4_layoutdriver_data {
  172. __u32 len;
  173. void *buf;
  174. };
  175. struct pnfs_layout_range {
  176. u32 iomode;
  177. u64 offset;
  178. u64 length;
  179. };
  180. struct nfs4_layoutget_args {
  181. __u32 type;
  182. struct pnfs_layout_range range;
  183. __u64 minlength;
  184. __u32 maxcount;
  185. struct inode *inode;
  186. struct nfs_open_context *ctx;
  187. struct nfs4_sequence_args seq_args;
  188. };
  189. struct nfs4_layoutget_res {
  190. __u32 return_on_close;
  191. struct pnfs_layout_range range;
  192. __u32 type;
  193. nfs4_stateid stateid;
  194. struct nfs4_layoutdriver_data layout;
  195. struct nfs4_sequence_res seq_res;
  196. };
  197. struct nfs4_layoutget {
  198. struct nfs4_layoutget_args args;
  199. struct nfs4_layoutget_res res;
  200. struct pnfs_layout_segment **lsegpp;
  201. int status;
  202. };
  203. struct nfs4_getdeviceinfo_args {
  204. struct pnfs_device *pdev;
  205. struct nfs4_sequence_args seq_args;
  206. };
  207. struct nfs4_getdeviceinfo_res {
  208. struct pnfs_device *pdev;
  209. struct nfs4_sequence_res seq_res;
  210. };
  211. /*
  212. * Arguments to the open call.
  213. */
  214. struct nfs_openargs {
  215. const struct nfs_fh * fh;
  216. struct nfs_seqid * seqid;
  217. int open_flags;
  218. fmode_t fmode;
  219. __u64 clientid;
  220. __u64 id;
  221. union {
  222. struct {
  223. struct iattr * attrs; /* UNCHECKED, GUARDED */
  224. nfs4_verifier verifier; /* EXCLUSIVE */
  225. };
  226. nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
  227. fmode_t delegation_type; /* CLAIM_PREVIOUS */
  228. } u;
  229. const struct qstr * name;
  230. const struct nfs_server *server; /* Needed for ID mapping */
  231. const u32 * bitmask;
  232. __u32 claim;
  233. struct nfs4_sequence_args seq_args;
  234. };
  235. struct nfs_openres {
  236. nfs4_stateid stateid;
  237. struct nfs_fh fh;
  238. struct nfs4_change_info cinfo;
  239. __u32 rflags;
  240. struct nfs_fattr * f_attr;
  241. struct nfs_fattr * dir_attr;
  242. struct nfs_seqid * seqid;
  243. const struct nfs_server *server;
  244. fmode_t delegation_type;
  245. nfs4_stateid delegation;
  246. __u32 do_recall;
  247. __u64 maxsize;
  248. __u32 attrset[NFS4_BITMAP_SIZE];
  249. struct nfs4_sequence_res seq_res;
  250. };
  251. /*
  252. * Arguments to the open_confirm call.
  253. */
  254. struct nfs_open_confirmargs {
  255. const struct nfs_fh * fh;
  256. nfs4_stateid * stateid;
  257. struct nfs_seqid * seqid;
  258. };
  259. struct nfs_open_confirmres {
  260. nfs4_stateid stateid;
  261. struct nfs_seqid * seqid;
  262. };
  263. /*
  264. * Arguments to the close call.
  265. */
  266. struct nfs_closeargs {
  267. struct nfs_fh * fh;
  268. nfs4_stateid * stateid;
  269. struct nfs_seqid * seqid;
  270. fmode_t fmode;
  271. const u32 * bitmask;
  272. struct nfs4_sequence_args seq_args;
  273. };
  274. struct nfs_closeres {
  275. nfs4_stateid stateid;
  276. struct nfs_fattr * fattr;
  277. struct nfs_seqid * seqid;
  278. const struct nfs_server *server;
  279. struct nfs4_sequence_res seq_res;
  280. };
  281. /*
  282. * * Arguments to the lock,lockt, and locku call.
  283. * */
  284. struct nfs_lowner {
  285. __u64 clientid;
  286. __u64 id;
  287. };
  288. struct nfs_lock_args {
  289. struct nfs_fh * fh;
  290. struct file_lock * fl;
  291. struct nfs_seqid * lock_seqid;
  292. nfs4_stateid * lock_stateid;
  293. struct nfs_seqid * open_seqid;
  294. nfs4_stateid * open_stateid;
  295. struct nfs_lowner lock_owner;
  296. unsigned char block : 1;
  297. unsigned char reclaim : 1;
  298. unsigned char new_lock_owner : 1;
  299. struct nfs4_sequence_args seq_args;
  300. };
  301. struct nfs_lock_res {
  302. nfs4_stateid stateid;
  303. struct nfs_seqid * lock_seqid;
  304. struct nfs_seqid * open_seqid;
  305. struct nfs4_sequence_res seq_res;
  306. };
  307. struct nfs_locku_args {
  308. struct nfs_fh * fh;
  309. struct file_lock * fl;
  310. struct nfs_seqid * seqid;
  311. nfs4_stateid * stateid;
  312. struct nfs4_sequence_args seq_args;
  313. };
  314. struct nfs_locku_res {
  315. nfs4_stateid stateid;
  316. struct nfs_seqid * seqid;
  317. struct nfs4_sequence_res seq_res;
  318. };
  319. struct nfs_lockt_args {
  320. struct nfs_fh * fh;
  321. struct file_lock * fl;
  322. struct nfs_lowner lock_owner;
  323. struct nfs4_sequence_args seq_args;
  324. };
  325. struct nfs_lockt_res {
  326. struct file_lock * denied; /* LOCK, LOCKT failed */
  327. struct nfs4_sequence_res seq_res;
  328. };
  329. struct nfs_release_lockowner_args {
  330. struct nfs_lowner lock_owner;
  331. };
  332. struct nfs4_delegreturnargs {
  333. const struct nfs_fh *fhandle;
  334. const nfs4_stateid *stateid;
  335. const u32 * bitmask;
  336. struct nfs4_sequence_args seq_args;
  337. };
  338. struct nfs4_delegreturnres {
  339. struct nfs_fattr * fattr;
  340. const struct nfs_server *server;
  341. struct nfs4_sequence_res seq_res;
  342. };
  343. /*
  344. * Arguments to the read call.
  345. */
  346. struct nfs_readargs {
  347. struct nfs_fh * fh;
  348. struct nfs_open_context *context;
  349. struct nfs_lock_context *lock_context;
  350. __u64 offset;
  351. __u32 count;
  352. unsigned int pgbase;
  353. struct page ** pages;
  354. struct nfs4_sequence_args seq_args;
  355. };
  356. struct nfs_readres {
  357. struct nfs_fattr * fattr;
  358. __u32 count;
  359. int eof;
  360. struct nfs4_sequence_res seq_res;
  361. };
  362. /*
  363. * Arguments to the write call.
  364. */
  365. struct nfs_writeargs {
  366. struct nfs_fh * fh;
  367. struct nfs_open_context *context;
  368. struct nfs_lock_context *lock_context;
  369. __u64 offset;
  370. __u32 count;
  371. enum nfs3_stable_how stable;
  372. unsigned int pgbase;
  373. struct page ** pages;
  374. const u32 * bitmask;
  375. struct nfs4_sequence_args seq_args;
  376. };
  377. struct nfs_writeverf {
  378. enum nfs3_stable_how committed;
  379. __be32 verifier[2];
  380. };
  381. struct nfs_writeres {
  382. struct nfs_fattr * fattr;
  383. struct nfs_writeverf * verf;
  384. __u32 count;
  385. const struct nfs_server *server;
  386. struct nfs4_sequence_res seq_res;
  387. };
  388. /*
  389. * Common arguments to the unlink call
  390. */
  391. struct nfs_removeargs {
  392. const struct nfs_fh *fh;
  393. struct qstr name;
  394. const u32 * bitmask;
  395. struct nfs4_sequence_args seq_args;
  396. };
  397. struct nfs_removeres {
  398. const struct nfs_server *server;
  399. struct nfs_fattr *dir_attr;
  400. struct nfs4_change_info cinfo;
  401. struct nfs4_sequence_res seq_res;
  402. };
  403. /*
  404. * Common arguments to the rename call
  405. */
  406. struct nfs_renameargs {
  407. const struct nfs_fh *old_dir;
  408. const struct nfs_fh *new_dir;
  409. const struct qstr *old_name;
  410. const struct qstr *new_name;
  411. const u32 *bitmask;
  412. struct nfs4_sequence_args seq_args;
  413. };
  414. struct nfs_renameres {
  415. const struct nfs_server *server;
  416. struct nfs4_change_info old_cinfo;
  417. struct nfs_fattr *old_fattr;
  418. struct nfs4_change_info new_cinfo;
  419. struct nfs_fattr *new_fattr;
  420. struct nfs4_sequence_res seq_res;
  421. };
  422. /*
  423. * Argument struct for decode_entry function
  424. */
  425. struct nfs_entry {
  426. __u64 ino;
  427. __u64 cookie,
  428. prev_cookie;
  429. const char * name;
  430. unsigned int len;
  431. int eof;
  432. struct nfs_fh * fh;
  433. struct nfs_fattr * fattr;
  434. unsigned char d_type;
  435. struct nfs_server * server;
  436. };
  437. /*
  438. * The following types are for NFSv2 only.
  439. */
  440. struct nfs_sattrargs {
  441. struct nfs_fh * fh;
  442. struct iattr * sattr;
  443. };
  444. struct nfs_diropargs {
  445. struct nfs_fh * fh;
  446. const char * name;
  447. unsigned int len;
  448. };
  449. struct nfs_createargs {
  450. struct nfs_fh * fh;
  451. const char * name;
  452. unsigned int len;
  453. struct iattr * sattr;
  454. };
  455. struct nfs_setattrargs {
  456. struct nfs_fh * fh;
  457. nfs4_stateid stateid;
  458. struct iattr * iap;
  459. const struct nfs_server * server; /* Needed for name mapping */
  460. const u32 * bitmask;
  461. struct nfs4_sequence_args seq_args;
  462. };
  463. struct nfs_setaclargs {
  464. struct nfs_fh * fh;
  465. size_t acl_len;
  466. unsigned int acl_pgbase;
  467. struct page ** acl_pages;
  468. struct nfs4_sequence_args seq_args;
  469. };
  470. struct nfs_setaclres {
  471. struct nfs4_sequence_res seq_res;
  472. };
  473. struct nfs_getaclargs {
  474. struct nfs_fh * fh;
  475. size_t acl_len;
  476. unsigned int acl_pgbase;
  477. struct page ** acl_pages;
  478. struct nfs4_sequence_args seq_args;
  479. };
  480. struct nfs_getaclres {
  481. size_t acl_len;
  482. struct nfs4_sequence_res seq_res;
  483. };
  484. struct nfs_setattrres {
  485. struct nfs_fattr * fattr;
  486. const struct nfs_server * server;
  487. struct nfs4_sequence_res seq_res;
  488. };
  489. struct nfs_linkargs {
  490. struct nfs_fh * fromfh;
  491. struct nfs_fh * tofh;
  492. const char * toname;
  493. unsigned int tolen;
  494. };
  495. struct nfs_symlinkargs {
  496. struct nfs_fh * fromfh;
  497. const char * fromname;
  498. unsigned int fromlen;
  499. struct page ** pages;
  500. unsigned int pathlen;
  501. struct iattr * sattr;
  502. };
  503. struct nfs_readdirargs {
  504. struct nfs_fh * fh;
  505. __u32 cookie;
  506. unsigned int count;
  507. struct page ** pages;
  508. };
  509. struct nfs3_getaclargs {
  510. struct nfs_fh * fh;
  511. int mask;
  512. struct page ** pages;
  513. };
  514. struct nfs3_setaclargs {
  515. struct inode * inode;
  516. int mask;
  517. struct posix_acl * acl_access;
  518. struct posix_acl * acl_default;
  519. size_t len;
  520. unsigned int npages;
  521. struct page ** pages;
  522. };
  523. struct nfs_diropok {
  524. struct nfs_fh * fh;
  525. struct nfs_fattr * fattr;
  526. };
  527. struct nfs_readlinkargs {
  528. struct nfs_fh * fh;
  529. unsigned int pgbase;
  530. unsigned int pglen;
  531. struct page ** pages;
  532. };
  533. struct nfs3_sattrargs {
  534. struct nfs_fh * fh;
  535. struct iattr * sattr;
  536. unsigned int guard;
  537. struct timespec guardtime;
  538. };
  539. struct nfs3_diropargs {
  540. struct nfs_fh * fh;
  541. const char * name;
  542. unsigned int len;
  543. };
  544. struct nfs3_accessargs {
  545. struct nfs_fh * fh;
  546. __u32 access;
  547. };
  548. struct nfs3_createargs {
  549. struct nfs_fh * fh;
  550. const char * name;
  551. unsigned int len;
  552. struct iattr * sattr;
  553. enum nfs3_createmode createmode;
  554. __be32 verifier[2];
  555. };
  556. struct nfs3_mkdirargs {
  557. struct nfs_fh * fh;
  558. const char * name;
  559. unsigned int len;
  560. struct iattr * sattr;
  561. };
  562. struct nfs3_symlinkargs {
  563. struct nfs_fh * fromfh;
  564. const char * fromname;
  565. unsigned int fromlen;
  566. struct page ** pages;
  567. unsigned int pathlen;
  568. struct iattr * sattr;
  569. };
  570. struct nfs3_mknodargs {
  571. struct nfs_fh * fh;
  572. const char * name;
  573. unsigned int len;
  574. enum nfs3_ftype type;
  575. struct iattr * sattr;
  576. dev_t rdev;
  577. };
  578. struct nfs3_linkargs {
  579. struct nfs_fh * fromfh;
  580. struct nfs_fh * tofh;
  581. const char * toname;
  582. unsigned int tolen;
  583. };
  584. struct nfs3_readdirargs {
  585. struct nfs_fh * fh;
  586. __u64 cookie;
  587. __be32 verf[2];
  588. int plus;
  589. unsigned int count;
  590. struct page ** pages;
  591. };
  592. struct nfs3_diropres {
  593. struct nfs_fattr * dir_attr;
  594. struct nfs_fh * fh;
  595. struct nfs_fattr * fattr;
  596. };
  597. struct nfs3_accessres {
  598. struct nfs_fattr * fattr;
  599. __u32 access;
  600. };
  601. struct nfs3_readlinkargs {
  602. struct nfs_fh * fh;
  603. unsigned int pgbase;
  604. unsigned int pglen;
  605. struct page ** pages;
  606. };
  607. struct nfs3_linkres {
  608. struct nfs_fattr * dir_attr;
  609. struct nfs_fattr * fattr;
  610. };
  611. struct nfs3_readdirres {
  612. struct nfs_fattr * dir_attr;
  613. __be32 * verf;
  614. int plus;
  615. };
  616. struct nfs3_getaclres {
  617. struct nfs_fattr * fattr;
  618. int mask;
  619. unsigned int acl_access_count;
  620. unsigned int acl_default_count;
  621. struct posix_acl * acl_access;
  622. struct posix_acl * acl_default;
  623. };
  624. #ifdef CONFIG_NFS_V4
  625. typedef u64 clientid4;
  626. struct nfs4_accessargs {
  627. const struct nfs_fh * fh;
  628. const u32 * bitmask;
  629. u32 access;
  630. struct nfs4_sequence_args seq_args;
  631. };
  632. struct nfs4_accessres {
  633. const struct nfs_server * server;
  634. struct nfs_fattr * fattr;
  635. u32 supported;
  636. u32 access;
  637. struct nfs4_sequence_res seq_res;
  638. };
  639. struct nfs4_create_arg {
  640. u32 ftype;
  641. union {
  642. struct {
  643. struct page ** pages;
  644. unsigned int len;
  645. } symlink; /* NF4LNK */
  646. struct {
  647. u32 specdata1;
  648. u32 specdata2;
  649. } device; /* NF4BLK, NF4CHR */
  650. } u;
  651. const struct qstr * name;
  652. const struct nfs_server * server;
  653. const struct iattr * attrs;
  654. const struct nfs_fh * dir_fh;
  655. const u32 * bitmask;
  656. struct nfs4_sequence_args seq_args;
  657. };
  658. struct nfs4_create_res {
  659. const struct nfs_server * server;
  660. struct nfs_fh * fh;
  661. struct nfs_fattr * fattr;
  662. struct nfs4_change_info dir_cinfo;
  663. struct nfs_fattr * dir_fattr;
  664. struct nfs4_sequence_res seq_res;
  665. };
  666. struct nfs4_fsinfo_arg {
  667. const struct nfs_fh * fh;
  668. const u32 * bitmask;
  669. struct nfs4_sequence_args seq_args;
  670. };
  671. struct nfs4_fsinfo_res {
  672. struct nfs_fsinfo *fsinfo;
  673. struct nfs4_sequence_res seq_res;
  674. };
  675. struct nfs4_getattr_arg {
  676. const struct nfs_fh * fh;
  677. const u32 * bitmask;
  678. struct nfs4_sequence_args seq_args;
  679. };
  680. struct nfs4_getattr_res {
  681. const struct nfs_server * server;
  682. struct nfs_fattr * fattr;
  683. struct nfs4_sequence_res seq_res;
  684. };
  685. struct nfs4_link_arg {
  686. const struct nfs_fh * fh;
  687. const struct nfs_fh * dir_fh;
  688. const struct qstr * name;
  689. const u32 * bitmask;
  690. struct nfs4_sequence_args seq_args;
  691. };
  692. struct nfs4_link_res {
  693. const struct nfs_server * server;
  694. struct nfs_fattr * fattr;
  695. struct nfs4_change_info cinfo;
  696. struct nfs_fattr * dir_attr;
  697. struct nfs4_sequence_res seq_res;
  698. };
  699. struct nfs4_lookup_arg {
  700. const struct nfs_fh * dir_fh;
  701. const struct qstr * name;
  702. const u32 * bitmask;
  703. struct nfs4_sequence_args seq_args;
  704. };
  705. struct nfs4_lookup_res {
  706. const struct nfs_server * server;
  707. struct nfs_fattr * fattr;
  708. struct nfs_fh * fh;
  709. struct nfs4_sequence_res seq_res;
  710. };
  711. struct nfs4_lookup_root_arg {
  712. const u32 * bitmask;
  713. struct nfs4_sequence_args seq_args;
  714. };
  715. struct nfs4_pathconf_arg {
  716. const struct nfs_fh * fh;
  717. const u32 * bitmask;
  718. struct nfs4_sequence_args seq_args;
  719. };
  720. struct nfs4_pathconf_res {
  721. struct nfs_pathconf *pathconf;
  722. struct nfs4_sequence_res seq_res;
  723. };
  724. struct nfs4_readdir_arg {
  725. const struct nfs_fh * fh;
  726. u64 cookie;
  727. nfs4_verifier verifier;
  728. u32 count;
  729. struct page ** pages; /* zero-copy data */
  730. unsigned int pgbase; /* zero-copy data */
  731. const u32 * bitmask;
  732. int plus;
  733. struct nfs4_sequence_args seq_args;
  734. };
  735. struct nfs4_readdir_res {
  736. nfs4_verifier verifier;
  737. unsigned int pgbase;
  738. struct nfs4_sequence_res seq_res;
  739. };
  740. struct nfs4_readlink {
  741. const struct nfs_fh * fh;
  742. unsigned int pgbase;
  743. unsigned int pglen; /* zero-copy data */
  744. struct page ** pages; /* zero-copy data */
  745. struct nfs4_sequence_args seq_args;
  746. };
  747. struct nfs4_readlink_res {
  748. struct nfs4_sequence_res seq_res;
  749. };
  750. #define NFS4_SETCLIENTID_NAMELEN (127)
  751. struct nfs4_setclientid {
  752. const nfs4_verifier * sc_verifier;
  753. unsigned int sc_name_len;
  754. char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
  755. u32 sc_prog;
  756. unsigned int sc_netid_len;
  757. char sc_netid[RPCBIND_MAXNETIDLEN + 1];
  758. unsigned int sc_uaddr_len;
  759. char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
  760. u32 sc_cb_ident;
  761. };
  762. struct nfs4_setclientid_res {
  763. u64 clientid;
  764. nfs4_verifier confirm;
  765. };
  766. struct nfs4_statfs_arg {
  767. const struct nfs_fh * fh;
  768. const u32 * bitmask;
  769. struct nfs4_sequence_args seq_args;
  770. };
  771. struct nfs4_statfs_res {
  772. struct nfs_fsstat *fsstat;
  773. struct nfs4_sequence_res seq_res;
  774. };
  775. struct nfs4_server_caps_arg {
  776. struct nfs_fh *fhandle;
  777. struct nfs4_sequence_args seq_args;
  778. };
  779. struct nfs4_server_caps_res {
  780. u32 attr_bitmask[2];
  781. u32 acl_bitmask;
  782. u32 has_links;
  783. u32 has_symlinks;
  784. struct nfs4_sequence_res seq_res;
  785. };
  786. struct nfs4_string {
  787. unsigned int len;
  788. char *data;
  789. };
  790. #define NFS4_PATHNAME_MAXCOMPONENTS 512
  791. struct nfs4_pathname {
  792. unsigned int ncomponents;
  793. struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
  794. };
  795. #define NFS4_FS_LOCATION_MAXSERVERS 10
  796. struct nfs4_fs_location {
  797. unsigned int nservers;
  798. struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
  799. struct nfs4_pathname rootpath;
  800. };
  801. #define NFS4_FS_LOCATIONS_MAXENTRIES 10
  802. struct nfs4_fs_locations {
  803. struct nfs_fattr fattr;
  804. const struct nfs_server *server;
  805. struct nfs4_pathname fs_path;
  806. int nlocations;
  807. struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
  808. };
  809. struct nfs4_fs_locations_arg {
  810. const struct nfs_fh *dir_fh;
  811. const struct qstr *name;
  812. struct page *page;
  813. const u32 *bitmask;
  814. struct nfs4_sequence_args seq_args;
  815. };
  816. struct nfs4_fs_locations_res {
  817. struct nfs4_fs_locations *fs_locations;
  818. struct nfs4_sequence_res seq_res;
  819. };
  820. #endif /* CONFIG_NFS_V4 */
  821. struct nfstime4 {
  822. u64 seconds;
  823. u32 nseconds;
  824. };
  825. #ifdef CONFIG_NFS_V4_1
  826. struct nfs_impl_id4 {
  827. u32 domain_len;
  828. char *domain;
  829. u32 name_len;
  830. char *name;
  831. struct nfstime4 date;
  832. };
  833. #define NFS4_EXCHANGE_ID_LEN (48)
  834. struct nfs41_exchange_id_args {
  835. struct nfs_client *client;
  836. nfs4_verifier *verifier;
  837. unsigned int id_len;
  838. char id[NFS4_EXCHANGE_ID_LEN];
  839. u32 flags;
  840. };
  841. struct server_owner {
  842. uint64_t minor_id;
  843. uint32_t major_id_sz;
  844. char major_id[NFS4_OPAQUE_LIMIT];
  845. };
  846. struct server_scope {
  847. uint32_t server_scope_sz;
  848. char server_scope[NFS4_OPAQUE_LIMIT];
  849. };
  850. struct nfs41_exchange_id_res {
  851. struct nfs_client *client;
  852. u32 flags;
  853. };
  854. struct nfs41_create_session_args {
  855. struct nfs_client *client;
  856. uint32_t flags;
  857. uint32_t cb_program;
  858. struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
  859. struct nfs4_channel_attrs bc_attrs; /* Back Channel */
  860. };
  861. struct nfs41_create_session_res {
  862. struct nfs_client *client;
  863. };
  864. struct nfs41_reclaim_complete_args {
  865. /* In the future extend to include curr_fh for use with migration */
  866. unsigned char one_fs:1;
  867. struct nfs4_sequence_args seq_args;
  868. };
  869. struct nfs41_reclaim_complete_res {
  870. struct nfs4_sequence_res seq_res;
  871. };
  872. #endif /* CONFIG_NFS_V4_1 */
  873. struct nfs_page;
  874. #define NFS_PAGEVEC_SIZE (8U)
  875. struct nfs_read_data {
  876. int flags;
  877. struct rpc_task task;
  878. struct inode *inode;
  879. struct rpc_cred *cred;
  880. struct nfs_fattr fattr; /* fattr storage */
  881. struct list_head pages; /* Coalesced read requests */
  882. struct nfs_page *req; /* multi ops per nfs_page */
  883. struct page **pagevec;
  884. unsigned int npages; /* Max length of pagevec */
  885. struct nfs_readargs args;
  886. struct nfs_readres res;
  887. #ifdef CONFIG_NFS_V4
  888. unsigned long timestamp; /* For lease renewal */
  889. #endif
  890. struct page *page_array[NFS_PAGEVEC_SIZE];
  891. };
  892. struct nfs_write_data {
  893. int flags;
  894. struct rpc_task task;
  895. struct inode *inode;
  896. struct rpc_cred *cred;
  897. struct nfs_fattr fattr;
  898. struct nfs_writeverf verf;
  899. struct list_head pages; /* Coalesced requests we wish to flush */
  900. struct nfs_page *req; /* multi ops per nfs_page */
  901. struct page **pagevec;
  902. unsigned int npages; /* Max length of pagevec */
  903. struct nfs_writeargs args; /* argument struct */
  904. struct nfs_writeres res; /* result struct */
  905. #ifdef CONFIG_NFS_V4
  906. unsigned long timestamp; /* For lease renewal */
  907. #endif
  908. struct page *page_array[NFS_PAGEVEC_SIZE];
  909. };
  910. struct nfs_access_entry;
  911. /*
  912. * RPC procedure vector for NFSv2/NFSv3 demuxing
  913. */
  914. struct nfs_rpc_ops {
  915. u32 version; /* Protocol version */
  916. const struct dentry_operations *dentry_ops;
  917. const struct inode_operations *dir_inode_ops;
  918. const struct inode_operations *file_inode_ops;
  919. int (*getroot) (struct nfs_server *, struct nfs_fh *,
  920. struct nfs_fsinfo *);
  921. int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
  922. struct qstr *, struct nfs_fh *,
  923. struct nfs_fattr *);
  924. int (*getattr) (struct nfs_server *, struct nfs_fh *,
  925. struct nfs_fattr *);
  926. int (*setattr) (struct dentry *, struct nfs_fattr *,
  927. struct iattr *);
  928. int (*lookup) (struct inode *, struct qstr *,
  929. struct nfs_fh *, struct nfs_fattr *);
  930. int (*access) (struct inode *, struct nfs_access_entry *);
  931. int (*readlink)(struct inode *, struct page *, unsigned int,
  932. unsigned int);
  933. int (*create) (struct inode *, struct dentry *,
  934. struct iattr *, int, struct nfs_open_context *);
  935. int (*remove) (struct inode *, struct qstr *);
  936. void (*unlink_setup) (struct rpc_message *, struct inode *dir);
  937. int (*unlink_done) (struct rpc_task *, struct inode *);
  938. int (*rename) (struct inode *, struct qstr *,
  939. struct inode *, struct qstr *);
  940. void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
  941. int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
  942. int (*link) (struct inode *, struct inode *, struct qstr *);
  943. int (*symlink) (struct inode *, struct dentry *, struct page *,
  944. unsigned int, struct iattr *);
  945. int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
  946. int (*rmdir) (struct inode *, struct qstr *);
  947. int (*readdir) (struct dentry *, struct rpc_cred *,
  948. u64, struct page **, unsigned int, int);
  949. int (*mknod) (struct inode *, struct dentry *, struct iattr *,
  950. dev_t);
  951. int (*statfs) (struct nfs_server *, struct nfs_fh *,
  952. struct nfs_fsstat *);
  953. int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
  954. struct nfs_fsinfo *);
  955. int (*pathconf) (struct nfs_server *, struct nfs_fh *,
  956. struct nfs_pathconf *);
  957. int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
  958. int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
  959. void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
  960. int (*read_done) (struct rpc_task *, struct nfs_read_data *);
  961. void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
  962. int (*write_done) (struct rpc_task *, struct nfs_write_data *);
  963. void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
  964. int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
  965. int (*lock)(struct file *, int, struct file_lock *);
  966. int (*lock_check_bounds)(const struct file_lock *);
  967. void (*clear_acl_cache)(struct inode *);
  968. void (*close_context)(struct nfs_open_context *ctx, int);
  969. struct inode * (*open_context) (struct inode *dir,
  970. struct nfs_open_context *ctx,
  971. int open_flags,
  972. struct iattr *iattr);
  973. };
  974. /*
  975. * NFS_CALL(getattr, inode, (fattr));
  976. * into
  977. * NFS_PROTO(inode)->getattr(fattr);
  978. */
  979. #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
  980. /*
  981. * Function vectors etc. for the NFS client
  982. */
  983. extern const struct nfs_rpc_ops nfs_v2_clientops;
  984. extern const struct nfs_rpc_ops nfs_v3_clientops;
  985. extern const struct nfs_rpc_ops nfs_v4_clientops;
  986. extern struct rpc_version nfs_version2;
  987. extern struct rpc_version nfs_version3;
  988. extern struct rpc_version nfs_version4;
  989. extern struct rpc_version nfsacl_version3;
  990. extern struct rpc_program nfsacl_program;
  991. #endif