nfs_xdr.h 25 KB

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