nfs_xdr.h 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232
  1. #ifndef _LINUX_NFS_XDR_H
  2. #define _LINUX_NFS_XDR_H
  3. #include <linux/nfsacl.h>
  4. #include <linux/nfs3.h>
  5. #include <linux/sunrpc/gss_api.h>
  6. /*
  7. * To change the maximum rsize and wsize supported by the NFS client, adjust
  8. * NFS_MAX_FILE_IO_SIZE. 64KB is a typical maximum, but some servers can
  9. * support a megabyte or more. The default is left at 4096 bytes, which is
  10. * reasonable for NFS over UDP.
  11. */
  12. #define NFS_MAX_FILE_IO_SIZE (1048576U)
  13. #define NFS_DEF_FILE_IO_SIZE (4096U)
  14. #define NFS_MIN_FILE_IO_SIZE (1024U)
  15. /* Forward declaration for NFS v3 */
  16. struct nfs4_secinfo_flavors;
  17. struct nfs_fsid {
  18. uint64_t major;
  19. uint64_t minor;
  20. };
  21. /*
  22. * Helper for checking equality between 2 fsids.
  23. */
  24. static inline int nfs_fsid_equal(const struct nfs_fsid *a, const struct nfs_fsid *b)
  25. {
  26. return a->major == b->major && a->minor == b->minor;
  27. }
  28. struct nfs_fattr {
  29. unsigned int valid; /* which fields are valid */
  30. umode_t mode;
  31. __u32 nlink;
  32. __u32 uid;
  33. __u32 gid;
  34. dev_t rdev;
  35. __u64 size;
  36. union {
  37. struct {
  38. __u32 blocksize;
  39. __u32 blocks;
  40. } nfs2;
  41. struct {
  42. __u64 used;
  43. } nfs3;
  44. } du;
  45. struct nfs_fsid fsid;
  46. __u64 fileid;
  47. __u64 mounted_on_fileid;
  48. struct timespec atime;
  49. struct timespec mtime;
  50. struct timespec ctime;
  51. __u64 change_attr; /* NFSv4 change attribute */
  52. __u64 pre_change_attr;/* pre-op NFSv4 change attribute */
  53. __u64 pre_size; /* pre_op_attr.size */
  54. struct timespec pre_mtime; /* pre_op_attr.mtime */
  55. struct timespec pre_ctime; /* pre_op_attr.ctime */
  56. unsigned long time_start;
  57. unsigned long gencount;
  58. };
  59. #define NFS_ATTR_FATTR_TYPE (1U << 0)
  60. #define NFS_ATTR_FATTR_MODE (1U << 1)
  61. #define NFS_ATTR_FATTR_NLINK (1U << 2)
  62. #define NFS_ATTR_FATTR_OWNER (1U << 3)
  63. #define NFS_ATTR_FATTR_GROUP (1U << 4)
  64. #define NFS_ATTR_FATTR_RDEV (1U << 5)
  65. #define NFS_ATTR_FATTR_SIZE (1U << 6)
  66. #define NFS_ATTR_FATTR_PRESIZE (1U << 7)
  67. #define NFS_ATTR_FATTR_BLOCKS_USED (1U << 8)
  68. #define NFS_ATTR_FATTR_SPACE_USED (1U << 9)
  69. #define NFS_ATTR_FATTR_FSID (1U << 10)
  70. #define NFS_ATTR_FATTR_FILEID (1U << 11)
  71. #define NFS_ATTR_FATTR_ATIME (1U << 12)
  72. #define NFS_ATTR_FATTR_MTIME (1U << 13)
  73. #define NFS_ATTR_FATTR_CTIME (1U << 14)
  74. #define NFS_ATTR_FATTR_PREMTIME (1U << 15)
  75. #define NFS_ATTR_FATTR_PRECTIME (1U << 16)
  76. #define NFS_ATTR_FATTR_CHANGE (1U << 17)
  77. #define NFS_ATTR_FATTR_PRECHANGE (1U << 18)
  78. #define NFS_ATTR_FATTR_V4_REFERRAL (1U << 19) /* NFSv4 referral */
  79. #define NFS_ATTR_FATTR_MOUNTPOINT (1U << 20) /* Treat as mountpoint */
  80. #define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 21)
  81. #define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
  82. | NFS_ATTR_FATTR_MODE \
  83. | NFS_ATTR_FATTR_NLINK \
  84. | NFS_ATTR_FATTR_OWNER \
  85. | NFS_ATTR_FATTR_GROUP \
  86. | NFS_ATTR_FATTR_RDEV \
  87. | NFS_ATTR_FATTR_SIZE \
  88. | NFS_ATTR_FATTR_FSID \
  89. | NFS_ATTR_FATTR_FILEID \
  90. | NFS_ATTR_FATTR_ATIME \
  91. | NFS_ATTR_FATTR_MTIME \
  92. | NFS_ATTR_FATTR_CTIME)
  93. #define NFS_ATTR_FATTR_V2 (NFS_ATTR_FATTR \
  94. | NFS_ATTR_FATTR_BLOCKS_USED)
  95. #define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
  96. | NFS_ATTR_FATTR_SPACE_USED)
  97. #define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
  98. | NFS_ATTR_FATTR_SPACE_USED \
  99. | NFS_ATTR_FATTR_CHANGE)
  100. /*
  101. * Info on the file system
  102. */
  103. struct nfs_fsinfo {
  104. struct nfs_fattr *fattr; /* Post-op attributes */
  105. __u32 rtmax; /* max. read transfer size */
  106. __u32 rtpref; /* pref. read transfer size */
  107. __u32 rtmult; /* reads should be multiple of this */
  108. __u32 wtmax; /* max. write transfer size */
  109. __u32 wtpref; /* pref. write transfer size */
  110. __u32 wtmult; /* writes should be multiple of this */
  111. __u32 dtpref; /* pref. readdir transfer size */
  112. __u64 maxfilesize;
  113. struct timespec time_delta; /* server time granularity */
  114. __u32 lease_time; /* in seconds */
  115. __u32 layouttype; /* supported pnfs layout driver */
  116. };
  117. struct nfs_fsstat {
  118. struct nfs_fattr *fattr; /* Post-op attributes */
  119. __u64 tbytes; /* total size in bytes */
  120. __u64 fbytes; /* # of free bytes */
  121. __u64 abytes; /* # of bytes available to user */
  122. __u64 tfiles; /* # of files */
  123. __u64 ffiles; /* # of free files */
  124. __u64 afiles; /* # of files available to user */
  125. };
  126. struct nfs2_fsstat {
  127. __u32 tsize; /* Server transfer size */
  128. __u32 bsize; /* Filesystem block size */
  129. __u32 blocks; /* No. of "bsize" blocks on filesystem */
  130. __u32 bfree; /* No. of free "bsize" blocks */
  131. __u32 bavail; /* No. of available "bsize" blocks */
  132. };
  133. struct nfs_pathconf {
  134. struct nfs_fattr *fattr; /* Post-op attributes */
  135. __u32 max_link; /* max # of hard links */
  136. __u32 max_namelen; /* max name length */
  137. };
  138. struct nfs4_change_info {
  139. u32 atomic;
  140. u64 before;
  141. u64 after;
  142. };
  143. struct nfs_seqid;
  144. /* nfs41 sessions channel attributes */
  145. struct nfs4_channel_attrs {
  146. u32 max_rqst_sz;
  147. u32 max_resp_sz;
  148. u32 max_resp_sz_cached;
  149. u32 max_ops;
  150. u32 max_reqs;
  151. };
  152. /* nfs41 sessions slot seqid */
  153. struct nfs4_slot {
  154. u32 seq_nr;
  155. };
  156. struct nfs4_sequence_args {
  157. struct nfs4_session *sa_session;
  158. u8 sa_slotid;
  159. u8 sa_cache_this;
  160. };
  161. struct nfs4_sequence_res {
  162. struct nfs4_session *sr_session;
  163. struct nfs4_slot *sr_slot; /* slot used to send request */
  164. int sr_status; /* sequence operation status */
  165. unsigned long sr_renewal_time;
  166. u32 sr_status_flags;
  167. };
  168. struct nfs4_get_lease_time_args {
  169. struct nfs4_sequence_args la_seq_args;
  170. };
  171. struct nfs4_get_lease_time_res {
  172. struct nfs_fsinfo *lr_fsinfo;
  173. struct nfs4_sequence_res lr_seq_res;
  174. };
  175. #define PNFS_LAYOUT_MAXSIZE 4096
  176. struct nfs4_layoutdriver_data {
  177. struct page **pages;
  178. __u32 pglen;
  179. __u32 len;
  180. };
  181. struct pnfs_layout_range {
  182. u32 iomode;
  183. u64 offset;
  184. u64 length;
  185. };
  186. struct nfs4_layoutget_args {
  187. __u32 type;
  188. struct pnfs_layout_range range;
  189. __u64 minlength;
  190. __u32 maxcount;
  191. struct inode *inode;
  192. struct nfs_open_context *ctx;
  193. struct nfs4_sequence_args seq_args;
  194. nfs4_stateid stateid;
  195. struct nfs4_layoutdriver_data layout;
  196. };
  197. struct nfs4_layoutget_res {
  198. __u32 return_on_close;
  199. struct pnfs_layout_range range;
  200. __u32 type;
  201. nfs4_stateid stateid;
  202. struct nfs4_sequence_res seq_res;
  203. struct nfs4_layoutdriver_data *layoutp;
  204. };
  205. struct nfs4_layoutget {
  206. struct nfs4_layoutget_args args;
  207. struct nfs4_layoutget_res res;
  208. struct pnfs_layout_segment **lsegpp;
  209. gfp_t gfp_flags;
  210. };
  211. struct nfs4_getdeviceinfo_args {
  212. struct pnfs_device *pdev;
  213. struct nfs4_sequence_args seq_args;
  214. };
  215. struct nfs4_getdeviceinfo_res {
  216. struct pnfs_device *pdev;
  217. struct nfs4_sequence_res seq_res;
  218. };
  219. struct nfs4_layoutcommit_args {
  220. nfs4_stateid stateid;
  221. __u64 lastbytewritten;
  222. struct inode *inode;
  223. const u32 *bitmask;
  224. struct nfs4_sequence_args seq_args;
  225. };
  226. struct nfs4_layoutcommit_res {
  227. struct nfs_fattr *fattr;
  228. const struct nfs_server *server;
  229. struct nfs4_sequence_res seq_res;
  230. };
  231. struct nfs4_layoutcommit_data {
  232. struct rpc_task task;
  233. struct nfs_fattr fattr;
  234. struct pnfs_layout_segment *lseg;
  235. struct rpc_cred *cred;
  236. struct nfs4_layoutcommit_args args;
  237. struct nfs4_layoutcommit_res res;
  238. };
  239. struct nfs4_layoutreturn_args {
  240. __u32 layout_type;
  241. struct inode *inode;
  242. nfs4_stateid stateid;
  243. struct nfs4_sequence_args seq_args;
  244. };
  245. struct nfs4_layoutreturn_res {
  246. struct nfs4_sequence_res seq_res;
  247. u32 lrs_present;
  248. nfs4_stateid stateid;
  249. };
  250. struct nfs4_layoutreturn {
  251. struct nfs4_layoutreturn_args args;
  252. struct nfs4_layoutreturn_res res;
  253. struct rpc_cred *cred;
  254. struct nfs_client *clp;
  255. int rpc_status;
  256. };
  257. /*
  258. * Arguments to the open call.
  259. */
  260. struct nfs_openargs {
  261. const struct nfs_fh * fh;
  262. struct nfs_seqid * seqid;
  263. int open_flags;
  264. fmode_t fmode;
  265. __u64 clientid;
  266. __u64 id;
  267. union {
  268. struct {
  269. struct iattr * attrs; /* UNCHECKED, GUARDED */
  270. nfs4_verifier verifier; /* EXCLUSIVE */
  271. };
  272. nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
  273. fmode_t delegation_type; /* CLAIM_PREVIOUS */
  274. } u;
  275. const struct qstr * name;
  276. const struct nfs_server *server; /* Needed for ID mapping */
  277. const u32 * bitmask;
  278. __u32 claim;
  279. struct nfs4_sequence_args seq_args;
  280. };
  281. struct nfs_openres {
  282. nfs4_stateid stateid;
  283. struct nfs_fh fh;
  284. struct nfs4_change_info cinfo;
  285. __u32 rflags;
  286. struct nfs_fattr * f_attr;
  287. struct nfs_fattr * dir_attr;
  288. struct nfs_seqid * seqid;
  289. const struct nfs_server *server;
  290. fmode_t delegation_type;
  291. nfs4_stateid delegation;
  292. __u32 do_recall;
  293. __u64 maxsize;
  294. __u32 attrset[NFS4_BITMAP_SIZE];
  295. struct nfs4_sequence_res seq_res;
  296. };
  297. /*
  298. * Arguments to the open_confirm call.
  299. */
  300. struct nfs_open_confirmargs {
  301. const struct nfs_fh * fh;
  302. nfs4_stateid * stateid;
  303. struct nfs_seqid * seqid;
  304. };
  305. struct nfs_open_confirmres {
  306. nfs4_stateid stateid;
  307. struct nfs_seqid * seqid;
  308. };
  309. /*
  310. * Arguments to the close call.
  311. */
  312. struct nfs_closeargs {
  313. struct nfs_fh * fh;
  314. nfs4_stateid * stateid;
  315. struct nfs_seqid * seqid;
  316. fmode_t fmode;
  317. const u32 * bitmask;
  318. struct nfs4_sequence_args seq_args;
  319. };
  320. struct nfs_closeres {
  321. nfs4_stateid stateid;
  322. struct nfs_fattr * fattr;
  323. struct nfs_seqid * seqid;
  324. const struct nfs_server *server;
  325. struct nfs4_sequence_res seq_res;
  326. };
  327. /*
  328. * * Arguments to the lock,lockt, and locku call.
  329. * */
  330. struct nfs_lowner {
  331. __u64 clientid;
  332. __u64 id;
  333. dev_t s_dev;
  334. };
  335. struct nfs_lock_args {
  336. struct nfs_fh * fh;
  337. struct file_lock * fl;
  338. struct nfs_seqid * lock_seqid;
  339. nfs4_stateid * lock_stateid;
  340. struct nfs_seqid * open_seqid;
  341. nfs4_stateid * open_stateid;
  342. struct nfs_lowner lock_owner;
  343. unsigned char block : 1;
  344. unsigned char reclaim : 1;
  345. unsigned char new_lock_owner : 1;
  346. struct nfs4_sequence_args seq_args;
  347. };
  348. struct nfs_lock_res {
  349. nfs4_stateid stateid;
  350. struct nfs_seqid * lock_seqid;
  351. struct nfs_seqid * open_seqid;
  352. struct nfs4_sequence_res seq_res;
  353. };
  354. struct nfs_locku_args {
  355. struct nfs_fh * fh;
  356. struct file_lock * fl;
  357. struct nfs_seqid * seqid;
  358. nfs4_stateid * stateid;
  359. struct nfs4_sequence_args seq_args;
  360. };
  361. struct nfs_locku_res {
  362. nfs4_stateid stateid;
  363. struct nfs_seqid * seqid;
  364. struct nfs4_sequence_res seq_res;
  365. };
  366. struct nfs_lockt_args {
  367. struct nfs_fh * fh;
  368. struct file_lock * fl;
  369. struct nfs_lowner lock_owner;
  370. struct nfs4_sequence_args seq_args;
  371. };
  372. struct nfs_lockt_res {
  373. struct file_lock * denied; /* LOCK, LOCKT failed */
  374. struct nfs4_sequence_res seq_res;
  375. };
  376. struct nfs_release_lockowner_args {
  377. struct nfs_lowner lock_owner;
  378. };
  379. struct nfs4_delegreturnargs {
  380. const struct nfs_fh *fhandle;
  381. const nfs4_stateid *stateid;
  382. const u32 * bitmask;
  383. struct nfs4_sequence_args seq_args;
  384. };
  385. struct nfs4_delegreturnres {
  386. struct nfs_fattr * fattr;
  387. const struct nfs_server *server;
  388. struct nfs4_sequence_res seq_res;
  389. };
  390. /*
  391. * Arguments to the read call.
  392. */
  393. struct nfs_readargs {
  394. struct nfs_fh * fh;
  395. struct nfs_open_context *context;
  396. struct nfs_lock_context *lock_context;
  397. __u64 offset;
  398. __u32 count;
  399. unsigned int pgbase;
  400. struct page ** pages;
  401. struct nfs4_sequence_args seq_args;
  402. };
  403. struct nfs_readres {
  404. struct nfs_fattr * fattr;
  405. __u32 count;
  406. int eof;
  407. struct nfs4_sequence_res seq_res;
  408. };
  409. /*
  410. * Arguments to the write call.
  411. */
  412. struct nfs_writeargs {
  413. struct nfs_fh * fh;
  414. struct nfs_open_context *context;
  415. struct nfs_lock_context *lock_context;
  416. __u64 offset;
  417. __u32 count;
  418. enum nfs3_stable_how stable;
  419. unsigned int pgbase;
  420. struct page ** pages;
  421. const u32 * bitmask;
  422. struct nfs4_sequence_args seq_args;
  423. };
  424. struct nfs_writeverf {
  425. enum nfs3_stable_how committed;
  426. __be32 verifier[2];
  427. };
  428. struct nfs_writeres {
  429. struct nfs_fattr * fattr;
  430. struct nfs_writeverf * verf;
  431. __u32 count;
  432. const struct nfs_server *server;
  433. struct nfs4_sequence_res seq_res;
  434. };
  435. /*
  436. * Common arguments to the unlink call
  437. */
  438. struct nfs_removeargs {
  439. const struct nfs_fh *fh;
  440. struct qstr name;
  441. const u32 * bitmask;
  442. struct nfs4_sequence_args seq_args;
  443. };
  444. struct nfs_removeres {
  445. const struct nfs_server *server;
  446. struct nfs_fattr *dir_attr;
  447. struct nfs4_change_info cinfo;
  448. struct nfs4_sequence_res seq_res;
  449. };
  450. /*
  451. * Common arguments to the rename call
  452. */
  453. struct nfs_renameargs {
  454. const struct nfs_fh *old_dir;
  455. const struct nfs_fh *new_dir;
  456. const struct qstr *old_name;
  457. const struct qstr *new_name;
  458. const u32 *bitmask;
  459. struct nfs4_sequence_args seq_args;
  460. };
  461. struct nfs_renameres {
  462. const struct nfs_server *server;
  463. struct nfs4_change_info old_cinfo;
  464. struct nfs_fattr *old_fattr;
  465. struct nfs4_change_info new_cinfo;
  466. struct nfs_fattr *new_fattr;
  467. struct nfs4_sequence_res seq_res;
  468. };
  469. /*
  470. * Argument struct for decode_entry function
  471. */
  472. struct nfs_entry {
  473. __u64 ino;
  474. __u64 cookie,
  475. prev_cookie;
  476. const char * name;
  477. unsigned int len;
  478. int eof;
  479. struct nfs_fh * fh;
  480. struct nfs_fattr * fattr;
  481. unsigned char d_type;
  482. struct nfs_server * server;
  483. };
  484. /*
  485. * The following types are for NFSv2 only.
  486. */
  487. struct nfs_sattrargs {
  488. struct nfs_fh * fh;
  489. struct iattr * sattr;
  490. };
  491. struct nfs_diropargs {
  492. struct nfs_fh * fh;
  493. const char * name;
  494. unsigned int len;
  495. };
  496. struct nfs_createargs {
  497. struct nfs_fh * fh;
  498. const char * name;
  499. unsigned int len;
  500. struct iattr * sattr;
  501. };
  502. struct nfs_setattrargs {
  503. struct nfs_fh * fh;
  504. nfs4_stateid stateid;
  505. struct iattr * iap;
  506. const struct nfs_server * server; /* Needed for name mapping */
  507. const u32 * bitmask;
  508. struct nfs4_sequence_args seq_args;
  509. };
  510. struct nfs_setaclargs {
  511. struct nfs_fh * fh;
  512. size_t acl_len;
  513. unsigned int acl_pgbase;
  514. struct page ** acl_pages;
  515. struct nfs4_sequence_args seq_args;
  516. };
  517. struct nfs_setaclres {
  518. struct nfs4_sequence_res seq_res;
  519. };
  520. struct nfs_getaclargs {
  521. struct nfs_fh * fh;
  522. size_t acl_len;
  523. unsigned int acl_pgbase;
  524. struct page ** acl_pages;
  525. struct nfs4_sequence_args seq_args;
  526. };
  527. struct nfs_getaclres {
  528. size_t acl_len;
  529. struct nfs4_sequence_res seq_res;
  530. };
  531. struct nfs_setattrres {
  532. struct nfs_fattr * fattr;
  533. const struct nfs_server * server;
  534. struct nfs4_sequence_res seq_res;
  535. };
  536. struct nfs_linkargs {
  537. struct nfs_fh * fromfh;
  538. struct nfs_fh * tofh;
  539. const char * toname;
  540. unsigned int tolen;
  541. };
  542. struct nfs_symlinkargs {
  543. struct nfs_fh * fromfh;
  544. const char * fromname;
  545. unsigned int fromlen;
  546. struct page ** pages;
  547. unsigned int pathlen;
  548. struct iattr * sattr;
  549. };
  550. struct nfs_readdirargs {
  551. struct nfs_fh * fh;
  552. __u32 cookie;
  553. unsigned int count;
  554. struct page ** pages;
  555. };
  556. struct nfs3_getaclargs {
  557. struct nfs_fh * fh;
  558. int mask;
  559. struct page ** pages;
  560. };
  561. struct nfs3_setaclargs {
  562. struct inode * inode;
  563. int mask;
  564. struct posix_acl * acl_access;
  565. struct posix_acl * acl_default;
  566. size_t len;
  567. unsigned int npages;
  568. struct page ** pages;
  569. };
  570. struct nfs_diropok {
  571. struct nfs_fh * fh;
  572. struct nfs_fattr * fattr;
  573. };
  574. struct nfs_readlinkargs {
  575. struct nfs_fh * fh;
  576. unsigned int pgbase;
  577. unsigned int pglen;
  578. struct page ** pages;
  579. };
  580. struct nfs3_sattrargs {
  581. struct nfs_fh * fh;
  582. struct iattr * sattr;
  583. unsigned int guard;
  584. struct timespec guardtime;
  585. };
  586. struct nfs3_diropargs {
  587. struct nfs_fh * fh;
  588. const char * name;
  589. unsigned int len;
  590. };
  591. struct nfs3_accessargs {
  592. struct nfs_fh * fh;
  593. __u32 access;
  594. };
  595. struct nfs3_createargs {
  596. struct nfs_fh * fh;
  597. const char * name;
  598. unsigned int len;
  599. struct iattr * sattr;
  600. enum nfs3_createmode createmode;
  601. __be32 verifier[2];
  602. };
  603. struct nfs3_mkdirargs {
  604. struct nfs_fh * fh;
  605. const char * name;
  606. unsigned int len;
  607. struct iattr * sattr;
  608. };
  609. struct nfs3_symlinkargs {
  610. struct nfs_fh * fromfh;
  611. const char * fromname;
  612. unsigned int fromlen;
  613. struct page ** pages;
  614. unsigned int pathlen;
  615. struct iattr * sattr;
  616. };
  617. struct nfs3_mknodargs {
  618. struct nfs_fh * fh;
  619. const char * name;
  620. unsigned int len;
  621. enum nfs3_ftype type;
  622. struct iattr * sattr;
  623. dev_t rdev;
  624. };
  625. struct nfs3_linkargs {
  626. struct nfs_fh * fromfh;
  627. struct nfs_fh * tofh;
  628. const char * toname;
  629. unsigned int tolen;
  630. };
  631. struct nfs3_readdirargs {
  632. struct nfs_fh * fh;
  633. __u64 cookie;
  634. __be32 verf[2];
  635. int plus;
  636. unsigned int count;
  637. struct page ** pages;
  638. };
  639. struct nfs3_diropres {
  640. struct nfs_fattr * dir_attr;
  641. struct nfs_fh * fh;
  642. struct nfs_fattr * fattr;
  643. };
  644. struct nfs3_accessres {
  645. struct nfs_fattr * fattr;
  646. __u32 access;
  647. };
  648. struct nfs3_readlinkargs {
  649. struct nfs_fh * fh;
  650. unsigned int pgbase;
  651. unsigned int pglen;
  652. struct page ** pages;
  653. };
  654. struct nfs3_linkres {
  655. struct nfs_fattr * dir_attr;
  656. struct nfs_fattr * fattr;
  657. };
  658. struct nfs3_readdirres {
  659. struct nfs_fattr * dir_attr;
  660. __be32 * verf;
  661. int plus;
  662. };
  663. struct nfs3_getaclres {
  664. struct nfs_fattr * fattr;
  665. int mask;
  666. unsigned int acl_access_count;
  667. unsigned int acl_default_count;
  668. struct posix_acl * acl_access;
  669. struct posix_acl * acl_default;
  670. };
  671. #ifdef CONFIG_NFS_V4
  672. typedef u64 clientid4;
  673. struct nfs4_accessargs {
  674. const struct nfs_fh * fh;
  675. const u32 * bitmask;
  676. u32 access;
  677. struct nfs4_sequence_args seq_args;
  678. };
  679. struct nfs4_accessres {
  680. const struct nfs_server * server;
  681. struct nfs_fattr * fattr;
  682. u32 supported;
  683. u32 access;
  684. struct nfs4_sequence_res seq_res;
  685. };
  686. struct nfs4_create_arg {
  687. u32 ftype;
  688. union {
  689. struct {
  690. struct page ** pages;
  691. unsigned int len;
  692. } symlink; /* NF4LNK */
  693. struct {
  694. u32 specdata1;
  695. u32 specdata2;
  696. } device; /* NF4BLK, NF4CHR */
  697. } u;
  698. const struct qstr * name;
  699. const struct nfs_server * server;
  700. const struct iattr * attrs;
  701. const struct nfs_fh * dir_fh;
  702. const u32 * bitmask;
  703. struct nfs4_sequence_args seq_args;
  704. };
  705. struct nfs4_create_res {
  706. const struct nfs_server * server;
  707. struct nfs_fh * fh;
  708. struct nfs_fattr * fattr;
  709. struct nfs4_change_info dir_cinfo;
  710. struct nfs_fattr * dir_fattr;
  711. struct nfs4_sequence_res seq_res;
  712. };
  713. struct nfs4_fsinfo_arg {
  714. const struct nfs_fh * fh;
  715. const u32 * bitmask;
  716. struct nfs4_sequence_args seq_args;
  717. };
  718. struct nfs4_fsinfo_res {
  719. struct nfs_fsinfo *fsinfo;
  720. struct nfs4_sequence_res seq_res;
  721. };
  722. struct nfs4_getattr_arg {
  723. const struct nfs_fh * fh;
  724. const u32 * bitmask;
  725. struct nfs4_sequence_args seq_args;
  726. };
  727. struct nfs4_getattr_res {
  728. const struct nfs_server * server;
  729. struct nfs_fattr * fattr;
  730. struct nfs4_sequence_res seq_res;
  731. };
  732. struct nfs4_link_arg {
  733. const struct nfs_fh * fh;
  734. const struct nfs_fh * dir_fh;
  735. const struct qstr * name;
  736. const u32 * bitmask;
  737. struct nfs4_sequence_args seq_args;
  738. };
  739. struct nfs4_link_res {
  740. const struct nfs_server * server;
  741. struct nfs_fattr * fattr;
  742. struct nfs4_change_info cinfo;
  743. struct nfs_fattr * dir_attr;
  744. struct nfs4_sequence_res seq_res;
  745. };
  746. struct nfs4_lookup_arg {
  747. const struct nfs_fh * dir_fh;
  748. const struct qstr * name;
  749. const u32 * bitmask;
  750. struct nfs4_sequence_args seq_args;
  751. };
  752. struct nfs4_lookup_res {
  753. const struct nfs_server * server;
  754. struct nfs_fattr * fattr;
  755. struct nfs_fh * fh;
  756. struct nfs4_sequence_res seq_res;
  757. };
  758. struct nfs4_lookup_root_arg {
  759. const u32 * bitmask;
  760. struct nfs4_sequence_args seq_args;
  761. };
  762. struct nfs4_pathconf_arg {
  763. const struct nfs_fh * fh;
  764. const u32 * bitmask;
  765. struct nfs4_sequence_args seq_args;
  766. };
  767. struct nfs4_pathconf_res {
  768. struct nfs_pathconf *pathconf;
  769. struct nfs4_sequence_res seq_res;
  770. };
  771. struct nfs4_readdir_arg {
  772. const struct nfs_fh * fh;
  773. u64 cookie;
  774. nfs4_verifier verifier;
  775. u32 count;
  776. struct page ** pages; /* zero-copy data */
  777. unsigned int pgbase; /* zero-copy data */
  778. const u32 * bitmask;
  779. int plus;
  780. struct nfs4_sequence_args seq_args;
  781. };
  782. struct nfs4_readdir_res {
  783. nfs4_verifier verifier;
  784. unsigned int pgbase;
  785. struct nfs4_sequence_res seq_res;
  786. };
  787. struct nfs4_readlink {
  788. const struct nfs_fh * fh;
  789. unsigned int pgbase;
  790. unsigned int pglen; /* zero-copy data */
  791. struct page ** pages; /* zero-copy data */
  792. struct nfs4_sequence_args seq_args;
  793. };
  794. struct nfs4_readlink_res {
  795. struct nfs4_sequence_res seq_res;
  796. };
  797. #define NFS4_SETCLIENTID_NAMELEN (127)
  798. struct nfs4_setclientid {
  799. const nfs4_verifier * sc_verifier;
  800. unsigned int sc_name_len;
  801. char sc_name[NFS4_SETCLIENTID_NAMELEN + 1];
  802. u32 sc_prog;
  803. unsigned int sc_netid_len;
  804. char sc_netid[RPCBIND_MAXNETIDLEN + 1];
  805. unsigned int sc_uaddr_len;
  806. char sc_uaddr[RPCBIND_MAXUADDRLEN + 1];
  807. u32 sc_cb_ident;
  808. };
  809. struct nfs4_setclientid_res {
  810. u64 clientid;
  811. nfs4_verifier confirm;
  812. };
  813. struct nfs4_statfs_arg {
  814. const struct nfs_fh * fh;
  815. const u32 * bitmask;
  816. struct nfs4_sequence_args seq_args;
  817. };
  818. struct nfs4_statfs_res {
  819. struct nfs_fsstat *fsstat;
  820. struct nfs4_sequence_res seq_res;
  821. };
  822. struct nfs4_server_caps_arg {
  823. struct nfs_fh *fhandle;
  824. struct nfs4_sequence_args seq_args;
  825. };
  826. struct nfs4_server_caps_res {
  827. u32 attr_bitmask[2];
  828. u32 acl_bitmask;
  829. u32 has_links;
  830. u32 has_symlinks;
  831. struct nfs4_sequence_res seq_res;
  832. };
  833. struct nfs4_string {
  834. unsigned int len;
  835. char *data;
  836. };
  837. #define NFS4_PATHNAME_MAXCOMPONENTS 512
  838. struct nfs4_pathname {
  839. unsigned int ncomponents;
  840. struct nfs4_string components[NFS4_PATHNAME_MAXCOMPONENTS];
  841. };
  842. #define NFS4_FS_LOCATION_MAXSERVERS 10
  843. struct nfs4_fs_location {
  844. unsigned int nservers;
  845. struct nfs4_string servers[NFS4_FS_LOCATION_MAXSERVERS];
  846. struct nfs4_pathname rootpath;
  847. };
  848. #define NFS4_FS_LOCATIONS_MAXENTRIES 10
  849. struct nfs4_fs_locations {
  850. struct nfs_fattr fattr;
  851. const struct nfs_server *server;
  852. struct nfs4_pathname fs_path;
  853. int nlocations;
  854. struct nfs4_fs_location locations[NFS4_FS_LOCATIONS_MAXENTRIES];
  855. };
  856. struct nfs4_fs_locations_arg {
  857. const struct nfs_fh *dir_fh;
  858. const struct qstr *name;
  859. struct page *page;
  860. const u32 *bitmask;
  861. struct nfs4_sequence_args seq_args;
  862. };
  863. struct nfs4_fs_locations_res {
  864. struct nfs4_fs_locations *fs_locations;
  865. struct nfs4_sequence_res seq_res;
  866. };
  867. struct nfs4_secinfo_oid {
  868. unsigned int len;
  869. char data[GSS_OID_MAX_LEN];
  870. };
  871. struct nfs4_secinfo_gss {
  872. struct nfs4_secinfo_oid sec_oid4;
  873. unsigned int qop4;
  874. unsigned int service;
  875. };
  876. struct nfs4_secinfo_flavor {
  877. unsigned int flavor;
  878. struct nfs4_secinfo_gss gss;
  879. };
  880. struct nfs4_secinfo_flavors {
  881. unsigned int num_flavors;
  882. struct nfs4_secinfo_flavor flavors[0];
  883. };
  884. struct nfs4_secinfo_arg {
  885. const struct nfs_fh *dir_fh;
  886. const struct qstr *name;
  887. struct nfs4_sequence_args seq_args;
  888. };
  889. struct nfs4_secinfo_res {
  890. struct nfs4_secinfo_flavors *flavors;
  891. struct nfs4_sequence_res seq_res;
  892. };
  893. #endif /* CONFIG_NFS_V4 */
  894. struct nfstime4 {
  895. u64 seconds;
  896. u32 nseconds;
  897. };
  898. #ifdef CONFIG_NFS_V4_1
  899. struct nfs_impl_id4 {
  900. u32 domain_len;
  901. char *domain;
  902. u32 name_len;
  903. char *name;
  904. struct nfstime4 date;
  905. };
  906. #define NFS4_EXCHANGE_ID_LEN (48)
  907. struct nfs41_exchange_id_args {
  908. struct nfs_client *client;
  909. nfs4_verifier *verifier;
  910. unsigned int id_len;
  911. char id[NFS4_EXCHANGE_ID_LEN];
  912. u32 flags;
  913. };
  914. struct server_owner {
  915. uint64_t minor_id;
  916. uint32_t major_id_sz;
  917. char major_id[NFS4_OPAQUE_LIMIT];
  918. };
  919. struct server_scope {
  920. uint32_t server_scope_sz;
  921. char server_scope[NFS4_OPAQUE_LIMIT];
  922. };
  923. struct nfs41_exchange_id_res {
  924. struct nfs_client *client;
  925. u32 flags;
  926. };
  927. struct nfs41_create_session_args {
  928. struct nfs_client *client;
  929. uint32_t flags;
  930. uint32_t cb_program;
  931. struct nfs4_channel_attrs fc_attrs; /* Fore Channel */
  932. struct nfs4_channel_attrs bc_attrs; /* Back Channel */
  933. };
  934. struct nfs41_create_session_res {
  935. struct nfs_client *client;
  936. };
  937. struct nfs41_reclaim_complete_args {
  938. /* In the future extend to include curr_fh for use with migration */
  939. unsigned char one_fs:1;
  940. struct nfs4_sequence_args seq_args;
  941. };
  942. struct nfs41_reclaim_complete_res {
  943. struct nfs4_sequence_res seq_res;
  944. };
  945. #endif /* CONFIG_NFS_V4_1 */
  946. struct nfs_page;
  947. #define NFS_PAGEVEC_SIZE (8U)
  948. struct nfs_read_data {
  949. int flags;
  950. struct rpc_task task;
  951. struct inode *inode;
  952. struct rpc_cred *cred;
  953. struct nfs_fattr fattr; /* fattr storage */
  954. struct list_head pages; /* Coalesced read requests */
  955. struct nfs_page *req; /* multi ops per nfs_page */
  956. struct page **pagevec;
  957. unsigned int npages; /* Max length of pagevec */
  958. struct nfs_readargs args;
  959. struct nfs_readres res;
  960. unsigned long timestamp; /* For lease renewal */
  961. struct pnfs_layout_segment *lseg;
  962. struct nfs_client *ds_clp; /* pNFS data server */
  963. const struct rpc_call_ops *mds_ops;
  964. int (*read_done_cb) (struct rpc_task *task, struct nfs_read_data *data);
  965. __u64 mds_offset;
  966. int pnfs_error;
  967. struct page *page_array[NFS_PAGEVEC_SIZE];
  968. };
  969. struct nfs_write_data {
  970. int flags;
  971. struct rpc_task task;
  972. struct inode *inode;
  973. struct rpc_cred *cred;
  974. struct nfs_fattr fattr;
  975. struct nfs_writeverf verf;
  976. struct list_head pages; /* Coalesced requests we wish to flush */
  977. struct nfs_page *req; /* multi ops per nfs_page */
  978. struct page **pagevec;
  979. unsigned int npages; /* Max length of pagevec */
  980. struct nfs_writeargs args; /* argument struct */
  981. struct nfs_writeres res; /* result struct */
  982. struct pnfs_layout_segment *lseg;
  983. struct nfs_client *ds_clp; /* pNFS data server */
  984. int ds_commit_index;
  985. const struct rpc_call_ops *mds_ops;
  986. int (*write_done_cb) (struct rpc_task *task, struct nfs_write_data *data);
  987. #ifdef CONFIG_NFS_V4
  988. unsigned long timestamp; /* For lease renewal */
  989. #endif
  990. __u64 mds_offset; /* Filelayout dense stripe */
  991. int pnfs_error;
  992. struct page *page_array[NFS_PAGEVEC_SIZE];
  993. };
  994. struct nfs_access_entry;
  995. struct nfs_client;
  996. struct rpc_timeout;
  997. /*
  998. * RPC procedure vector for NFSv2/NFSv3 demuxing
  999. */
  1000. struct nfs_rpc_ops {
  1001. u32 version; /* Protocol version */
  1002. const struct dentry_operations *dentry_ops;
  1003. const struct inode_operations *dir_inode_ops;
  1004. const struct inode_operations *file_inode_ops;
  1005. int (*getroot) (struct nfs_server *, struct nfs_fh *,
  1006. struct nfs_fsinfo *);
  1007. int (*lookupfh)(struct nfs_server *, struct nfs_fh *,
  1008. struct qstr *, struct nfs_fh *,
  1009. struct nfs_fattr *);
  1010. int (*getattr) (struct nfs_server *, struct nfs_fh *,
  1011. struct nfs_fattr *);
  1012. int (*setattr) (struct dentry *, struct nfs_fattr *,
  1013. struct iattr *);
  1014. int (*lookup) (struct rpc_clnt *clnt, struct inode *, struct qstr *,
  1015. struct nfs_fh *, struct nfs_fattr *);
  1016. int (*access) (struct inode *, struct nfs_access_entry *);
  1017. int (*readlink)(struct inode *, struct page *, unsigned int,
  1018. unsigned int);
  1019. int (*create) (struct inode *, struct dentry *,
  1020. struct iattr *, int, struct nfs_open_context *);
  1021. int (*remove) (struct inode *, struct qstr *);
  1022. void (*unlink_setup) (struct rpc_message *, struct inode *dir);
  1023. int (*unlink_done) (struct rpc_task *, struct inode *);
  1024. int (*rename) (struct inode *, struct qstr *,
  1025. struct inode *, struct qstr *);
  1026. void (*rename_setup) (struct rpc_message *msg, struct inode *dir);
  1027. int (*rename_done) (struct rpc_task *task, struct inode *old_dir, struct inode *new_dir);
  1028. int (*link) (struct inode *, struct inode *, struct qstr *);
  1029. int (*symlink) (struct inode *, struct dentry *, struct page *,
  1030. unsigned int, struct iattr *);
  1031. int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
  1032. int (*rmdir) (struct inode *, struct qstr *);
  1033. int (*readdir) (struct dentry *, struct rpc_cred *,
  1034. u64, struct page **, unsigned int, int);
  1035. int (*mknod) (struct inode *, struct dentry *, struct iattr *,
  1036. dev_t);
  1037. int (*statfs) (struct nfs_server *, struct nfs_fh *,
  1038. struct nfs_fsstat *);
  1039. int (*fsinfo) (struct nfs_server *, struct nfs_fh *,
  1040. struct nfs_fsinfo *);
  1041. int (*pathconf) (struct nfs_server *, struct nfs_fh *,
  1042. struct nfs_pathconf *);
  1043. int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
  1044. int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
  1045. void (*read_setup) (struct nfs_read_data *, struct rpc_message *);
  1046. int (*read_done) (struct rpc_task *, struct nfs_read_data *);
  1047. void (*write_setup) (struct nfs_write_data *, struct rpc_message *);
  1048. int (*write_done) (struct rpc_task *, struct nfs_write_data *);
  1049. void (*commit_setup) (struct nfs_write_data *, struct rpc_message *);
  1050. int (*commit_done) (struct rpc_task *, struct nfs_write_data *);
  1051. int (*lock)(struct file *, int, struct file_lock *);
  1052. int (*lock_check_bounds)(const struct file_lock *);
  1053. void (*clear_acl_cache)(struct inode *);
  1054. void (*close_context)(struct nfs_open_context *ctx, int);
  1055. struct inode * (*open_context) (struct inode *dir,
  1056. struct nfs_open_context *ctx,
  1057. int open_flags,
  1058. struct iattr *iattr);
  1059. int (*init_client) (struct nfs_client *, const struct rpc_timeout *,
  1060. const char *, rpc_authflavor_t, int);
  1061. int (*secinfo)(struct inode *, const struct qstr *, struct nfs4_secinfo_flavors *);
  1062. };
  1063. /*
  1064. * NFS_CALL(getattr, inode, (fattr));
  1065. * into
  1066. * NFS_PROTO(inode)->getattr(fattr);
  1067. */
  1068. #define NFS_CALL(op, inode, args) NFS_PROTO(inode)->op args
  1069. /*
  1070. * Function vectors etc. for the NFS client
  1071. */
  1072. extern const struct nfs_rpc_ops nfs_v2_clientops;
  1073. extern const struct nfs_rpc_ops nfs_v3_clientops;
  1074. extern const struct nfs_rpc_ops nfs_v4_clientops;
  1075. extern struct rpc_version nfs_version2;
  1076. extern struct rpc_version nfs_version3;
  1077. extern struct rpc_version nfs_version4;
  1078. extern struct rpc_version nfsacl_version3;
  1079. extern struct rpc_program nfsacl_program;
  1080. #endif