nfs_xdr.h 25 KB

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