nfs_xdr.h 34 KB

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