nfs_xdr.h 26 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135
  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 nfs_client *ds_clp; /* pNFS data server */
  891. const struct rpc_call_ops *mds_ops;
  892. struct page *page_array[NFS_PAGEVEC_SIZE];
  893. };
  894. struct nfs_write_data {
  895. int flags;
  896. struct rpc_task task;
  897. struct inode *inode;
  898. struct rpc_cred *cred;
  899. struct nfs_fattr fattr;
  900. struct nfs_writeverf verf;
  901. struct list_head pages; /* Coalesced requests we wish to flush */
  902. struct nfs_page *req; /* multi ops per nfs_page */
  903. struct page **pagevec;
  904. unsigned int npages; /* Max length of pagevec */
  905. struct nfs_writeargs args; /* argument struct */
  906. struct nfs_writeres res; /* result struct */
  907. #ifdef CONFIG_NFS_V4
  908. unsigned long timestamp; /* For lease renewal */
  909. #endif
  910. struct page *page_array[NFS_PAGEVEC_SIZE];
  911. };
  912. struct nfs_access_entry;
  913. struct nfs_client;
  914. /*
  915. * RPC procedure vector for NFSv2/NFSv3 demuxing
  916. */
  917. struct nfs_rpc_ops {
  918. u32 version; /* Protocol version */
  919. const struct dentry_operations *dentry_ops;
  920. const struct inode_operations *dir_inode_ops;
  921. const struct inode_operations *file_inode_ops;
  922. int (*getroot) (struct nfs_server *, struct nfs_fh *,
  923. struct nfs_fsinfo *);
  924. int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
  925. struct qstr *, struct nfs_fh *,
  926. struct nfs_fattr *);
  927. int (*getattr) (struct nfs_server *, struct nfs_fh *,
  928. struct nfs_fattr *);
  929. int (*setattr) (struct dentry *, struct nfs_fattr *,
  930. struct iattr *);
  931. int (*lookup) (struct inode *, struct qstr *,
  932. struct nfs_fh *, struct nfs_fattr *);
  933. int (*access) (struct inode *, struct nfs_access_entry *);
  934. int (*readlink)(struct inode *, struct page *, unsigned int,
  935. unsigned int);
  936. int (*create) (struct inode *, struct dentry *,
  937. struct iattr *, int, struct nfs_open_context *);
  938. int (*remove) (struct inode *, struct qstr *);
  939. void (*unlink_setup) (struct rpc_message *, struct inode *dir);
  940. int (*unlink_done) (struct rpc_task *, struct inode *);
  941. int (*rename) (struct inode *, struct qstr *,
  942. struct inode *, struct qstr *);
  943. void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
  944. int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
  945. int (*link) (struct inode *, struct inode *, struct qstr *);
  946. int (*symlink) (struct inode *, struct dentry *, struct page *,
  947. unsigned int, struct iattr *);
  948. int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
  949. int (*rmdir) (struct inode *, struct qstr *);
  950. int (*readdir) (struct dentry *, struct rpc_cred *,
  951. u64, struct page **, unsigned int, int);
  952. int (*mknod) (struct inode *, struct dentry *, struct iattr *,
  953. dev_t);
  954. int (*statfs) (struct nfs_server *, struct nfs_fh *,
  955. struct nfs_fsstat *);
  956. int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
  957. struct nfs_fsinfo *);
  958. int (*pathconf) (struct nfs_server *, struct nfs_fh *,
  959. struct nfs_pathconf *);
  960. int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
  961. int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
  962. void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
  963. int (*read_done) (struct rpc_task *, struct nfs_read_data *);
  964. void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
  965. int (*write_done) (struct rpc_task *, struct nfs_write_data *);
  966. void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
  967. int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
  968. int (*lock)(struct file *, int, struct file_lock *);
  969. int (*lock_check_bounds)(const struct file_lock *);
  970. void (*clear_acl_cache)(struct inode *);
  971. void (*close_context)(struct nfs_open_context *ctx, int);
  972. struct inode * (*open_context) (struct inode *dir,
  973. struct nfs_open_context *ctx,
  974. int open_flags,
  975. struct iattr *iattr);
  976. int (*init_client) (struct nfs_client *, const struct rpc_timeout *,
  977. const char *, rpc_authflavor_t, int);
  978. };
  979. /*
  980. * NFS_CALL(getattr, inode, (fattr));
  981. * into
  982. * NFS_PROTO(inode)->getattr(fattr);
  983. */
  984. #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
  985. /*
  986. * Function vectors etc. for the NFS client
  987. */
  988. extern const struct nfs_rpc_ops nfs_v2_clientops;
  989. extern const struct nfs_rpc_ops nfs_v3_clientops;
  990. extern const struct nfs_rpc_ops nfs_v4_clientops;
  991. extern struct rpc_version nfs_version2;
  992. extern struct rpc_version nfs_version3;
  993. extern struct rpc_version nfs_version4;
  994. extern struct rpc_version nfsacl_version3;
  995. extern struct rpc_program nfsacl_program;
  996. #endif