nfs_xdr.h 29 KB

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