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