nfs_xdr.h 25 KB

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