nfs_xdr.h 26 KB

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