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