nfs_xdr.h 26 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133
  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. nfs4_stateid stateid;
  189. };
  190. struct nfs4_layoutget_res {
  191. __u32 return_on_close;
  192. struct pnfs_layout_range range;
  193. __u32 type;
  194. nfs4_stateid stateid;
  195. struct nfs4_layoutdriver_data layout;
  196. struct nfs4_sequence_res seq_res;
  197. };
  198. struct nfs4_layoutget {
  199. struct nfs4_layoutget_args args;
  200. struct nfs4_layoutget_res res;
  201. struct pnfs_layout_segment **lsegpp;
  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. dev_t s_dev;
  288. };
  289. struct nfs_lock_args {
  290. struct nfs_fh * fh;
  291. struct file_lock * fl;
  292. struct nfs_seqid * lock_seqid;
  293. nfs4_stateid * lock_stateid;
  294. struct nfs_seqid * open_seqid;
  295. nfs4_stateid * open_stateid;
  296. struct nfs_lowner lock_owner;
  297. unsigned char block : 1;
  298. unsigned char reclaim : 1;
  299. unsigned char new_lock_owner : 1;
  300. struct nfs4_sequence_args seq_args;
  301. };
  302. struct nfs_lock_res {
  303. nfs4_stateid stateid;
  304. struct nfs_seqid * lock_seqid;
  305. struct nfs_seqid * open_seqid;
  306. struct nfs4_sequence_res seq_res;
  307. };
  308. struct nfs_locku_args {
  309. struct nfs_fh * fh;
  310. struct file_lock * fl;
  311. struct nfs_seqid * seqid;
  312. nfs4_stateid * stateid;
  313. struct nfs4_sequence_args seq_args;
  314. };
  315. struct nfs_locku_res {
  316. nfs4_stateid stateid;
  317. struct nfs_seqid * seqid;
  318. struct nfs4_sequence_res seq_res;
  319. };
  320. struct nfs_lockt_args {
  321. struct nfs_fh * fh;
  322. struct file_lock * fl;
  323. struct nfs_lowner lock_owner;
  324. struct nfs4_sequence_args seq_args;
  325. };
  326. struct nfs_lockt_res {
  327. struct file_lock * denied; /* LOCK, LOCKT failed */
  328. struct nfs4_sequence_res seq_res;
  329. };
  330. struct nfs_release_lockowner_args {
  331. struct nfs_lowner lock_owner;
  332. };
  333. struct nfs4_delegreturnargs {
  334. const struct nfs_fh *fhandle;
  335. const nfs4_stateid *stateid;
  336. const u32 * bitmask;
  337. struct nfs4_sequence_args seq_args;
  338. };
  339. struct nfs4_delegreturnres {
  340. struct nfs_fattr * fattr;
  341. const struct nfs_server *server;
  342. struct nfs4_sequence_res seq_res;
  343. };
  344. /*
  345. * Arguments to the read call.
  346. */
  347. struct nfs_readargs {
  348. struct nfs_fh * fh;
  349. struct nfs_open_context *context;
  350. struct nfs_lock_context *lock_context;
  351. __u64 offset;
  352. __u32 count;
  353. unsigned int pgbase;
  354. struct page ** pages;
  355. struct nfs4_sequence_args seq_args;
  356. };
  357. struct nfs_readres {
  358. struct nfs_fattr * fattr;
  359. __u32 count;
  360. int eof;
  361. struct nfs4_sequence_res seq_res;
  362. };
  363. /*
  364. * Arguments to the write call.
  365. */
  366. struct nfs_writeargs {
  367. struct nfs_fh * fh;
  368. struct nfs_open_context *context;
  369. struct nfs_lock_context *lock_context;
  370. __u64 offset;
  371. __u32 count;
  372. enum nfs3_stable_how stable;
  373. unsigned int pgbase;
  374. struct page ** pages;
  375. const u32 * bitmask;
  376. struct nfs4_sequence_args seq_args;
  377. };
  378. struct nfs_writeverf {
  379. enum nfs3_stable_how committed;
  380. __be32 verifier[2];
  381. };
  382. struct nfs_writeres {
  383. struct nfs_fattr * fattr;
  384. struct nfs_writeverf * verf;
  385. __u32 count;
  386. const struct nfs_server *server;
  387. struct nfs4_sequence_res seq_res;
  388. };
  389. /*
  390. * Common arguments to the unlink call
  391. */
  392. struct nfs_removeargs {
  393. const struct nfs_fh *fh;
  394. struct qstr name;
  395. const u32 * bitmask;
  396. struct nfs4_sequence_args seq_args;
  397. };
  398. struct nfs_removeres {
  399. const struct nfs_server *server;
  400. struct nfs_fattr *dir_attr;
  401. struct nfs4_change_info cinfo;
  402. struct nfs4_sequence_res seq_res;
  403. };
  404. /*
  405. * Common arguments to the rename call
  406. */
  407. struct nfs_renameargs {
  408. const struct nfs_fh *old_dir;
  409. const struct nfs_fh *new_dir;
  410. const struct qstr *old_name;
  411. const struct qstr *new_name;
  412. const u32 *bitmask;
  413. struct nfs4_sequence_args seq_args;
  414. };
  415. struct nfs_renameres {
  416. const struct nfs_server *server;
  417. struct nfs4_change_info old_cinfo;
  418. struct nfs_fattr *old_fattr;
  419. struct nfs4_change_info new_cinfo;
  420. struct nfs_fattr *new_fattr;
  421. struct nfs4_sequence_res seq_res;
  422. };
  423. /*
  424. * Argument struct for decode_entry function
  425. */
  426. struct nfs_entry {
  427. __u64 ino;
  428. __u64 cookie,
  429. prev_cookie;
  430. const char * name;
  431. unsigned int len;
  432. int eof;
  433. struct nfs_fh * fh;
  434. struct nfs_fattr * fattr;
  435. unsigned char d_type;
  436. struct nfs_server * server;
  437. };
  438. /*
  439. * The following types are for NFSv2 only.
  440. */
  441. struct nfs_sattrargs {
  442. struct nfs_fh * fh;
  443. struct iattr * sattr;
  444. };
  445. struct nfs_diropargs {
  446. struct nfs_fh * fh;
  447. const char * name;
  448. unsigned int len;
  449. };
  450. struct nfs_createargs {
  451. struct nfs_fh * fh;
  452. const char * name;
  453. unsigned int len;
  454. struct iattr * sattr;
  455. };
  456. struct nfs_setattrargs {
  457. struct nfs_fh * fh;
  458. nfs4_stateid stateid;
  459. struct iattr * iap;
  460. const struct nfs_server * server; /* Needed for name mapping */
  461. const u32 * bitmask;
  462. struct nfs4_sequence_args seq_args;
  463. };
  464. struct nfs_setaclargs {
  465. struct nfs_fh * fh;
  466. size_t acl_len;
  467. unsigned int acl_pgbase;
  468. struct page ** acl_pages;
  469. struct nfs4_sequence_args seq_args;
  470. };
  471. struct nfs_setaclres {
  472. struct nfs4_sequence_res seq_res;
  473. };
  474. struct nfs_getaclargs {
  475. struct nfs_fh * fh;
  476. size_t acl_len;
  477. unsigned int acl_pgbase;
  478. struct page ** acl_pages;
  479. struct nfs4_sequence_args seq_args;
  480. };
  481. struct nfs_getaclres {
  482. size_t acl_len;
  483. struct nfs4_sequence_res seq_res;
  484. };
  485. struct nfs_setattrres {
  486. struct nfs_fattr * fattr;
  487. const struct nfs_server * server;
  488. struct nfs4_sequence_res seq_res;
  489. };
  490. struct nfs_linkargs {
  491. struct nfs_fh * fromfh;
  492. struct nfs_fh * tofh;
  493. const char * toname;
  494. unsigned int tolen;
  495. };
  496. struct nfs_symlinkargs {
  497. struct nfs_fh * fromfh;
  498. const char * fromname;
  499. unsigned int fromlen;
  500. struct page ** pages;
  501. unsigned int pathlen;
  502. struct iattr * sattr;
  503. };
  504. struct nfs_readdirargs {
  505. struct nfs_fh * fh;
  506. __u32 cookie;
  507. unsigned int count;
  508. struct page ** pages;
  509. };
  510. struct nfs3_getaclargs {
  511. struct nfs_fh * fh;
  512. int mask;
  513. struct page ** pages;
  514. };
  515. struct nfs3_setaclargs {
  516. struct inode * inode;
  517. int mask;
  518. struct posix_acl * acl_access;
  519. struct posix_acl * acl_default;
  520. size_t len;
  521. unsigned int npages;
  522. struct page ** pages;
  523. };
  524. struct nfs_diropok {
  525. struct nfs_fh * fh;
  526. struct nfs_fattr * fattr;
  527. };
  528. struct nfs_readlinkargs {
  529. struct nfs_fh * fh;
  530. unsigned int pgbase;
  531. unsigned int pglen;
  532. struct page ** pages;
  533. };
  534. struct nfs3_sattrargs {
  535. struct nfs_fh * fh;
  536. struct iattr * sattr;
  537. unsigned int guard;
  538. struct timespec guardtime;
  539. };
  540. struct nfs3_diropargs {
  541. struct nfs_fh * fh;
  542. const char * name;
  543. unsigned int len;
  544. };
  545. struct nfs3_accessargs {
  546. struct nfs_fh * fh;
  547. __u32 access;
  548. };
  549. struct nfs3_createargs {
  550. struct nfs_fh * fh;
  551. const char * name;
  552. unsigned int len;
  553. struct iattr * sattr;
  554. enum nfs3_createmode createmode;
  555. __be32 verifier[2];
  556. };
  557. struct nfs3_mkdirargs {
  558. struct nfs_fh * fh;
  559. const char * name;
  560. unsigned int len;
  561. struct iattr * sattr;
  562. };
  563. struct nfs3_symlinkargs {
  564. struct nfs_fh * fromfh;
  565. const char * fromname;
  566. unsigned int fromlen;
  567. struct page ** pages;
  568. unsigned int pathlen;
  569. struct iattr * sattr;
  570. };
  571. struct nfs3_mknodargs {
  572. struct nfs_fh * fh;
  573. const char * name;
  574. unsigned int len;
  575. enum nfs3_ftype type;
  576. struct iattr * sattr;
  577. dev_t rdev;
  578. };
  579. struct nfs3_linkargs {
  580. struct nfs_fh * fromfh;
  581. struct nfs_fh * tofh;
  582. const char * toname;
  583. unsigned int tolen;
  584. };
  585. struct nfs3_readdirargs {
  586. struct nfs_fh * fh;
  587. __u64 cookie;
  588. __be32 verf[2];
  589. int plus;
  590. unsigned int count;
  591. struct page ** pages;
  592. };
  593. struct nfs3_diropres {
  594. struct nfs_fattr * dir_attr;
  595. struct nfs_fh * fh;
  596. struct nfs_fattr * fattr;
  597. };
  598. struct nfs3_accessres {
  599. struct nfs_fattr * fattr;
  600. __u32 access;
  601. };
  602. struct nfs3_readlinkargs {
  603. struct nfs_fh * fh;
  604. unsigned int pgbase;
  605. unsigned int pglen;
  606. struct page ** pages;
  607. };
  608. struct nfs3_linkres {
  609. struct nfs_fattr * dir_attr;
  610. struct nfs_fattr * fattr;
  611. };
  612. struct nfs3_readdirres {
  613. struct nfs_fattr * dir_attr;
  614. __be32 * verf;
  615. int plus;
  616. };
  617. struct nfs3_getaclres {
  618. struct nfs_fattr * fattr;
  619. int mask;
  620. unsigned int acl_access_count;
  621. unsigned int acl_default_count;
  622. struct posix_acl * acl_access;
  623. struct posix_acl * acl_default;
  624. };
  625. #ifdef CONFIG_NFS_V4
  626. typedef u64 clientid4;
  627. struct nfs4_accessargs {
  628. const struct nfs_fh * fh;
  629. const u32 * bitmask;
  630. u32 access;
  631. struct nfs4_sequence_args seq_args;
  632. };
  633. struct nfs4_accessres {
  634. const struct nfs_server * server;
  635. struct nfs_fattr * fattr;
  636. u32 supported;
  637. u32 access;
  638. struct nfs4_sequence_res seq_res;
  639. };
  640. struct nfs4_create_arg {
  641. u32 ftype;
  642. union {
  643. struct {
  644. struct page ** pages;
  645. unsigned int len;
  646. } symlink; /* NF4LNK */
  647. struct {
  648. u32 specdata1;
  649. u32 specdata2;
  650. } device; /* NF4BLK, NF4CHR */
  651. } u;
  652. const struct qstr * name;
  653. const struct nfs_server * server;
  654. const struct iattr * attrs;
  655. const struct nfs_fh * dir_fh;
  656. const u32 * bitmask;
  657. struct nfs4_sequence_args seq_args;
  658. };
  659. struct nfs4_create_res {
  660. const struct nfs_server * server;
  661. struct nfs_fh * fh;
  662. struct nfs_fattr * fattr;
  663. struct nfs4_change_info dir_cinfo;
  664. struct nfs_fattr * dir_fattr;
  665. struct nfs4_sequence_res seq_res;
  666. };
  667. struct nfs4_fsinfo_arg {
  668. const struct nfs_fh * fh;
  669. const u32 * bitmask;
  670. struct nfs4_sequence_args seq_args;
  671. };
  672. struct nfs4_fsinfo_res {
  673. struct nfs_fsinfo *fsinfo;
  674. struct nfs4_sequence_res seq_res;
  675. };
  676. struct nfs4_getattr_arg {
  677. const struct nfs_fh * fh;
  678. const u32 * bitmask;
  679. struct nfs4_sequence_args seq_args;
  680. };
  681. struct nfs4_getattr_res {
  682. const struct nfs_server * server;
  683. struct nfs_fattr * fattr;
  684. struct nfs4_sequence_res seq_res;
  685. };
  686. struct nfs4_link_arg {
  687. const struct nfs_fh * fh;
  688. const struct nfs_fh * dir_fh;
  689. const struct qstr * name;
  690. const u32 * bitmask;
  691. struct nfs4_sequence_args seq_args;
  692. };
  693. struct nfs4_link_res {
  694. const struct nfs_server * server;
  695. struct nfs_fattr * fattr;
  696. struct nfs4_change_info cinfo;
  697. struct nfs_fattr * dir_attr;
  698. struct nfs4_sequence_res seq_res;
  699. };
  700. struct nfs4_lookup_arg {
  701. const struct nfs_fh * dir_fh;
  702. const struct qstr * name;
  703. const u32 * bitmask;
  704. struct nfs4_sequence_args seq_args;
  705. };
  706. struct nfs4_lookup_res {
  707. const struct nfs_server * server;
  708. struct nfs_fattr * fattr;
  709. struct nfs_fh * fh;
  710. struct nfs4_sequence_res seq_res;
  711. };
  712. struct nfs4_lookup_root_arg {
  713. const u32 * bitmask;
  714. struct nfs4_sequence_args seq_args;
  715. };
  716. struct nfs4_pathconf_arg {
  717. const struct nfs_fh * fh;
  718. const u32 * bitmask;
  719. struct nfs4_sequence_args seq_args;
  720. };
  721. struct nfs4_pathconf_res {
  722. struct nfs_pathconf *pathconf;
  723. struct nfs4_sequence_res seq_res;
  724. };
  725. struct nfs4_readdir_arg {
  726. const struct nfs_fh * fh;
  727. u64 cookie;
  728. nfs4_verifier verifier;
  729. u32 count;
  730. struct page ** pages; /* zero-copy data */
  731. unsigned int pgbase; /* zero-copy data */
  732. const u32 * bitmask;
  733. int plus;
  734. struct nfs4_sequence_args seq_args;
  735. };
  736. struct nfs4_readdir_res {
  737. nfs4_verifier verifier;
  738. unsigned int pgbase;
  739. struct nfs4_sequence_res seq_res;
  740. };
  741. struct nfs4_readlink {
  742. const struct nfs_fh * fh;
  743. unsigned int pgbase;
  744. unsigned int pglen; /* zero-copy data */
  745. struct page ** pages; /* zero-copy data */
  746. struct nfs4_sequence_args seq_args;
  747. };
  748. struct nfs4_readlink_res {
  749. struct nfs4_sequence_res seq_res;
  750. };
  751. #define NFS4_SETCLIENTID_NAMELEN (127)
  752. struct nfs4_setclientid {
  753. const nfs4_verifier * sc_verifier;
  754. unsigned int sc_name_len;
  755. char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
  756. u32 sc_prog;
  757. unsigned int sc_netid_len;
  758. char sc_netid[RPCBIND_MAXNETIDLEN + 1];
  759. unsigned int sc_uaddr_len;
  760. char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
  761. u32 sc_cb_ident;
  762. };
  763. struct nfs4_setclientid_res {
  764. u64 clientid;
  765. nfs4_verifier confirm;
  766. };
  767. struct nfs4_statfs_arg {
  768. const struct nfs_fh * fh;
  769. const u32 * bitmask;
  770. struct nfs4_sequence_args seq_args;
  771. };
  772. struct nfs4_statfs_res {
  773. struct nfs_fsstat *fsstat;
  774. struct nfs4_sequence_res seq_res;
  775. };
  776. struct nfs4_server_caps_arg {
  777. struct nfs_fh *fhandle;
  778. struct nfs4_sequence_args seq_args;
  779. };
  780. struct nfs4_server_caps_res {
  781. u32 attr_bitmask[2];
  782. u32 acl_bitmask;
  783. u32 has_links;
  784. u32 has_symlinks;
  785. struct nfs4_sequence_res seq_res;
  786. };
  787. struct nfs4_string {
  788. unsigned int len;
  789. char *data;
  790. };
  791. #define NFS4_PATHNAME_MAXCOMPONENTS 512
  792. struct nfs4_pathname {
  793. unsigned int ncomponents;
  794. struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
  795. };
  796. #define NFS4_FS_LOCATION_MAXSERVERS 10
  797. struct nfs4_fs_location {
  798. unsigned int nservers;
  799. struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
  800. struct nfs4_pathname rootpath;
  801. };
  802. #define NFS4_FS_LOCATIONS_MAXENTRIES 10
  803. struct nfs4_fs_locations {
  804. struct nfs_fattr fattr;
  805. const struct nfs_server *server;
  806. struct nfs4_pathname fs_path;
  807. int nlocations;
  808. struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
  809. };
  810. struct nfs4_fs_locations_arg {
  811. const struct nfs_fh *dir_fh;
  812. const struct qstr *name;
  813. struct page *page;
  814. const u32 *bitmask;
  815. struct nfs4_sequence_args seq_args;
  816. };
  817. struct nfs4_fs_locations_res {
  818. struct nfs4_fs_locations *fs_locations;
  819. struct nfs4_sequence_res seq_res;
  820. };
  821. #endif /* CONFIG_NFS_V4 */
  822. struct nfstime4 {
  823. u64 seconds;
  824. u32 nseconds;
  825. };
  826. #ifdef CONFIG_NFS_V4_1
  827. struct nfs_impl_id4 {
  828. u32 domain_len;
  829. char *domain;
  830. u32 name_len;
  831. char *name;
  832. struct nfstime4 date;
  833. };
  834. #define NFS4_EXCHANGE_ID_LEN (48)
  835. struct nfs41_exchange_id_args {
  836. struct nfs_client *client;
  837. nfs4_verifier *verifier;
  838. unsigned int id_len;
  839. char id[NFS4_EXCHANGE_ID_LEN];
  840. u32 flags;
  841. };
  842. struct server_owner {
  843. uint64_t minor_id;
  844. uint32_t major_id_sz;
  845. char major_id[NFS4_OPAQUE_LIMIT];
  846. };
  847. struct server_scope {
  848. uint32_t server_scope_sz;
  849. char server_scope[NFS4_OPAQUE_LIMIT];
  850. };
  851. struct nfs41_exchange_id_res {
  852. struct nfs_client *client;
  853. u32 flags;
  854. };
  855. struct nfs41_create_session_args {
  856. struct nfs_client *client;
  857. uint32_t flags;
  858. uint32_t cb_program;
  859. struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
  860. struct nfs4_channel_attrs bc_attrs; /* Back Channel */
  861. };
  862. struct nfs41_create_session_res {
  863. struct nfs_client *client;
  864. };
  865. struct nfs41_reclaim_complete_args {
  866. /* In the future extend to include curr_fh for use with migration */
  867. unsigned char one_fs:1;
  868. struct nfs4_sequence_args seq_args;
  869. };
  870. struct nfs41_reclaim_complete_res {
  871. struct nfs4_sequence_res seq_res;
  872. };
  873. #endif /* CONFIG_NFS_V4_1 */
  874. struct nfs_page;
  875. #define NFS_PAGEVEC_SIZE (8U)
  876. struct nfs_read_data {
  877. int flags;
  878. struct rpc_task task;
  879. struct inode *inode;
  880. struct rpc_cred *cred;
  881. struct nfs_fattr fattr; /* fattr storage */
  882. struct list_head pages; /* Coalesced read requests */
  883. struct nfs_page *req; /* multi ops per nfs_page */
  884. struct page **pagevec;
  885. unsigned int npages; /* Max length of pagevec */
  886. struct nfs_readargs args;
  887. struct nfs_readres res;
  888. unsigned long timestamp; /* For lease renewal */
  889. struct pnfs_layout_segment *lseg;
  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. struct nfs_client;
  912. /*
  913. * RPC procedure vector for NFSv2/NFSv3 demuxing
  914. */
  915. struct nfs_rpc_ops {
  916. u32 version; /* Protocol version */
  917. const struct dentry_operations *dentry_ops;
  918. const struct inode_operations *dir_inode_ops;
  919. const struct inode_operations *file_inode_ops;
  920. int (*getroot) (struct nfs_server *, struct nfs_fh *,
  921. struct nfs_fsinfo *);
  922. int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
  923. struct qstr *, struct nfs_fh *,
  924. struct nfs_fattr *);
  925. int (*getattr) (struct nfs_server *, struct nfs_fh *,
  926. struct nfs_fattr *);
  927. int (*setattr) (struct dentry *, struct nfs_fattr *,
  928. struct iattr *);
  929. int (*lookup) (struct inode *, struct qstr *,
  930. struct nfs_fh *, struct nfs_fattr *);
  931. int (*access) (struct inode *, struct nfs_access_entry *);
  932. int (*readlink)(struct inode *, struct page *, unsigned int,
  933. unsigned int);
  934. int (*create) (struct inode *, struct dentry *,
  935. struct iattr *, int, struct nfs_open_context *);
  936. int (*remove) (struct inode *, struct qstr *);
  937. void (*unlink_setup) (struct rpc_message *, struct inode *dir);
  938. int (*unlink_done) (struct rpc_task *, struct inode *);
  939. int (*rename) (struct inode *, struct qstr *,
  940. struct inode *, struct qstr *);
  941. void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
  942. int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
  943. int (*link) (struct inode *, struct inode *, struct qstr *);
  944. int (*symlink) (struct inode *, struct dentry *, struct page *,
  945. unsigned int, struct iattr *);
  946. int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
  947. int (*rmdir) (struct inode *, struct qstr *);
  948. int (*readdir) (struct dentry *, struct rpc_cred *,
  949. u64, struct page **, unsigned int, int);
  950. int (*mknod) (struct inode *, struct dentry *, struct iattr *,
  951. dev_t);
  952. int (*statfs) (struct nfs_server *, struct nfs_fh *,
  953. struct nfs_fsstat *);
  954. int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
  955. struct nfs_fsinfo *);
  956. int (*pathconf) (struct nfs_server *, struct nfs_fh *,
  957. struct nfs_pathconf *);
  958. int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
  959. int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
  960. void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
  961. int (*read_done) (struct rpc_task *, struct nfs_read_data *);
  962. void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
  963. int (*write_done) (struct rpc_task *, struct nfs_write_data *);
  964. void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
  965. int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
  966. int (*lock)(struct file *, int, struct file_lock *);
  967. int (*lock_check_bounds)(const struct file_lock *);
  968. void (*clear_acl_cache)(struct inode *);
  969. void (*close_context)(struct nfs_open_context *ctx, int);
  970. struct inode * (*open_context) (struct inode *dir,
  971. struct nfs_open_context *ctx,
  972. int open_flags,
  973. struct iattr *iattr);
  974. int (*init_client) (struct nfs_client *, const struct rpc_timeout *,
  975. const char *, rpc_authflavor_t, int);
  976. };
  977. /*
  978. * NFS_CALL(getattr, inode, (fattr));
  979. * into
  980. * NFS_PROTO(inode)->getattr(fattr);
  981. */
  982. #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
  983. /*
  984. * Function vectors etc. for the NFS client
  985. */
  986. extern const struct nfs_rpc_ops nfs_v2_clientops;
  987. extern const struct nfs_rpc_ops nfs_v3_clientops;
  988. extern const struct nfs_rpc_ops nfs_v4_clientops;
  989. extern struct rpc_version nfs_version2;
  990. extern struct rpc_version nfs_version3;
  991. extern struct rpc_version nfs_version4;
  992. extern struct rpc_version nfsacl_version3;
  993. extern struct rpc_program nfsacl_program;
  994. #endif