nfs_xdr.h 34 KB

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