nfs_xdr.h 35 KB

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