xdr4.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764
  1. /*
  2. * Server-side types for NFSv4.
  3. *
  4. * Copyright (c) 2002 The Regents of the University of Michigan.
  5. * All rights reserved.
  6. *
  7. * Kendrick Smith <kmsmith@umich.edu>
  8. * Andy Adamson <andros@umich.edu>
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. *
  14. * 1. Redistributions of source code must retain the above copyright
  15. * notice, this list of conditions and the following disclaimer.
  16. * 2. Redistributions in binary form must reproduce the above copyright
  17. * notice, this list of conditions and the following disclaimer in the
  18. * documentation and/or other materials provided with the distribution.
  19. * 3. Neither the name of the University nor the names of its
  20. * contributors may be used to endorse or promote products derived
  21. * from this software without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  24. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  25. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  26. * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  27. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  28. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  29. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  30. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  31. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  32. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  33. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. */
  36. #ifndef _LINUX_NFSD_XDR4_H
  37. #define _LINUX_NFSD_XDR4_H
  38. #include "state.h"
  39. #include "nfsd.h"
  40. #define NFSD4_MAX_TAGLEN 128
  41. #define XDR_LEN(n) (((n) + 3) & ~3)
  42. #define CURRENT_STATE_ID_FLAG (1<<0)
  43. #define SAVED_STATE_ID_FLAG (1<<1)
  44. #define SET_STATE_ID(c, f) ((c)->sid_flags |= (f))
  45. #define HAS_STATE_ID(c, f) ((c)->sid_flags & (f))
  46. #define CLEAR_STATE_ID(c, f) ((c)->sid_flags &= ~(f))
  47. struct nfsd4_compound_state {
  48. struct svc_fh current_fh;
  49. struct svc_fh save_fh;
  50. struct nfs4_stateowner *replay_owner;
  51. struct nfs4_client *clp;
  52. /* For sessions DRC */
  53. struct nfsd4_session *session;
  54. struct nfsd4_slot *slot;
  55. int data_offset;
  56. bool spo_must_allowed;
  57. size_t iovlen;
  58. u32 minorversion;
  59. __be32 status;
  60. stateid_t current_stateid;
  61. stateid_t save_stateid;
  62. /* to indicate current and saved state id presents */
  63. u32 sid_flags;
  64. };
  65. static inline bool nfsd4_has_session(struct nfsd4_compound_state *cs)
  66. {
  67. return cs->slot != NULL;
  68. }
  69. struct nfsd4_change_info {
  70. u32 atomic;
  71. bool change_supported;
  72. u32 before_ctime_sec;
  73. u32 before_ctime_nsec;
  74. u64 before_change;
  75. u32 after_ctime_sec;
  76. u32 after_ctime_nsec;
  77. u64 after_change;
  78. };
  79. struct nfsd4_access {
  80. u32 ac_req_access; /* request */
  81. u32 ac_supported; /* response */
  82. u32 ac_resp_access; /* response */
  83. };
  84. struct nfsd4_close {
  85. u32 cl_seqid; /* request */
  86. stateid_t cl_stateid; /* request+response */
  87. };
  88. struct nfsd4_commit {
  89. u64 co_offset; /* request */
  90. u32 co_count; /* request */
  91. nfs4_verifier co_verf; /* response */
  92. };
  93. struct nfsd4_create {
  94. u32 cr_namelen; /* request */
  95. char * cr_name; /* request */
  96. u32 cr_type; /* request */
  97. union { /* request */
  98. struct {
  99. u32 datalen;
  100. char *data;
  101. } link; /* NF4LNK */
  102. struct {
  103. u32 specdata1;
  104. u32 specdata2;
  105. } dev; /* NF4BLK, NF4CHR */
  106. } u;
  107. u32 cr_bmval[3]; /* request */
  108. struct iattr cr_iattr; /* request */
  109. struct nfsd4_change_info cr_cinfo; /* response */
  110. struct nfs4_acl *cr_acl;
  111. struct xdr_netobj cr_label;
  112. };
  113. #define cr_datalen u.link.datalen
  114. #define cr_data u.link.data
  115. #define cr_specdata1 u.dev.specdata1
  116. #define cr_specdata2 u.dev.specdata2
  117. struct nfsd4_delegreturn {
  118. stateid_t dr_stateid;
  119. };
  120. struct nfsd4_getattr {
  121. u32 ga_bmval[3]; /* request */
  122. struct svc_fh *ga_fhp; /* response */
  123. };
  124. struct nfsd4_link {
  125. u32 li_namelen; /* request */
  126. char * li_name; /* request */
  127. struct nfsd4_change_info li_cinfo; /* response */
  128. };
  129. struct nfsd4_lock_denied {
  130. clientid_t ld_clientid;
  131. struct xdr_netobj ld_owner;
  132. u64 ld_start;
  133. u64 ld_length;
  134. u32 ld_type;
  135. };
  136. struct nfsd4_lock {
  137. /* request */
  138. u32 lk_type;
  139. u32 lk_reclaim; /* boolean */
  140. u64 lk_offset;
  141. u64 lk_length;
  142. u32 lk_is_new;
  143. union {
  144. struct {
  145. u32 open_seqid;
  146. stateid_t open_stateid;
  147. u32 lock_seqid;
  148. clientid_t clientid;
  149. struct xdr_netobj owner;
  150. } new;
  151. struct {
  152. stateid_t lock_stateid;
  153. u32 lock_seqid;
  154. } old;
  155. } v;
  156. /* response */
  157. union {
  158. struct {
  159. stateid_t stateid;
  160. } ok;
  161. struct nfsd4_lock_denied denied;
  162. } u;
  163. };
  164. #define lk_new_open_seqid v.new.open_seqid
  165. #define lk_new_open_stateid v.new.open_stateid
  166. #define lk_new_lock_seqid v.new.lock_seqid
  167. #define lk_new_clientid v.new.clientid
  168. #define lk_new_owner v.new.owner
  169. #define lk_old_lock_stateid v.old.lock_stateid
  170. #define lk_old_lock_seqid v.old.lock_seqid
  171. #define lk_resp_stateid u.ok.stateid
  172. #define lk_denied u.denied
  173. struct nfsd4_lockt {
  174. u32 lt_type;
  175. clientid_t lt_clientid;
  176. struct xdr_netobj lt_owner;
  177. u64 lt_offset;
  178. u64 lt_length;
  179. struct nfsd4_lock_denied lt_denied;
  180. };
  181. struct nfsd4_locku {
  182. u32 lu_type;
  183. u32 lu_seqid;
  184. stateid_t lu_stateid;
  185. u64 lu_offset;
  186. u64 lu_length;
  187. };
  188. struct nfsd4_lookup {
  189. u32 lo_len; /* request */
  190. char * lo_name; /* request */
  191. };
  192. struct nfsd4_putfh {
  193. u32 pf_fhlen; /* request */
  194. char *pf_fhval; /* request */
  195. };
  196. struct nfsd4_open {
  197. u32 op_claim_type; /* request */
  198. struct xdr_netobj op_fname; /* request - everything but CLAIM_PREV */
  199. u32 op_delegate_type; /* request - CLAIM_PREV only */
  200. stateid_t op_delegate_stateid; /* request - response */
  201. u32 op_why_no_deleg; /* response - DELEG_NONE_EXT only */
  202. u32 op_create; /* request */
  203. u32 op_createmode; /* request */
  204. u32 op_bmval[3]; /* request */
  205. struct iattr op_iattr; /* UNCHECKED4, GUARDED4, EXCLUSIVE4_1 */
  206. nfs4_verifier op_verf __attribute__((aligned(32)));
  207. /* EXCLUSIVE4 */
  208. clientid_t op_clientid; /* request */
  209. struct xdr_netobj op_owner; /* request */
  210. u32 op_seqid; /* request */
  211. u32 op_share_access; /* request */
  212. u32 op_share_deny; /* request */
  213. u32 op_deleg_want; /* request */
  214. stateid_t op_stateid; /* response */
  215. __be32 op_xdr_error; /* see nfsd4_open_omfg() */
  216. u32 op_recall; /* recall */
  217. struct nfsd4_change_info op_cinfo; /* response */
  218. u32 op_rflags; /* response */
  219. bool op_truncate; /* used during processing */
  220. bool op_created; /* used during processing */
  221. struct nfs4_openowner *op_openowner; /* used during processing */
  222. struct nfs4_file *op_file; /* used during processing */
  223. struct nfs4_ol_stateid *op_stp; /* used during processing */
  224. struct nfs4_clnt_odstate *op_odstate; /* used during processing */
  225. struct nfs4_acl *op_acl;
  226. struct xdr_netobj op_label;
  227. };
  228. struct nfsd4_open_confirm {
  229. stateid_t oc_req_stateid /* request */;
  230. u32 oc_seqid /* request */;
  231. stateid_t oc_resp_stateid /* response */;
  232. };
  233. struct nfsd4_open_downgrade {
  234. stateid_t od_stateid;
  235. u32 od_seqid;
  236. u32 od_share_access; /* request */
  237. u32 od_deleg_want; /* request */
  238. u32 od_share_deny; /* request */
  239. };
  240. struct nfsd4_read {
  241. stateid_t rd_stateid; /* request */
  242. u64 rd_offset; /* request */
  243. u32 rd_length; /* request */
  244. int rd_vlen;
  245. struct file *rd_filp;
  246. bool rd_tmp_file;
  247. struct svc_rqst *rd_rqstp; /* response */
  248. struct svc_fh * rd_fhp; /* response */
  249. };
  250. struct nfsd4_readdir {
  251. u64 rd_cookie; /* request */
  252. nfs4_verifier rd_verf; /* request */
  253. u32 rd_dircount; /* request */
  254. u32 rd_maxcount; /* request */
  255. u32 rd_bmval[3]; /* request */
  256. struct svc_rqst *rd_rqstp; /* response */
  257. struct svc_fh * rd_fhp; /* response */
  258. struct readdir_cd common;
  259. struct xdr_stream *xdr;
  260. int cookie_offset;
  261. };
  262. struct nfsd4_release_lockowner {
  263. clientid_t rl_clientid;
  264. struct xdr_netobj rl_owner;
  265. };
  266. struct nfsd4_readlink {
  267. struct svc_rqst *rl_rqstp; /* request */
  268. struct svc_fh * rl_fhp; /* request */
  269. };
  270. struct nfsd4_remove {
  271. u32 rm_namelen; /* request */
  272. char * rm_name; /* request */
  273. struct nfsd4_change_info rm_cinfo; /* response */
  274. };
  275. struct nfsd4_rename {
  276. u32 rn_snamelen; /* request */
  277. char * rn_sname; /* request */
  278. u32 rn_tnamelen; /* request */
  279. char * rn_tname; /* request */
  280. struct nfsd4_change_info rn_sinfo; /* response */
  281. struct nfsd4_change_info rn_tinfo; /* response */
  282. };
  283. struct nfsd4_secinfo {
  284. u32 si_namelen; /* request */
  285. char *si_name; /* request */
  286. struct svc_export *si_exp; /* response */
  287. };
  288. struct nfsd4_secinfo_no_name {
  289. u32 sin_style; /* request */
  290. struct svc_export *sin_exp; /* response */
  291. };
  292. struct nfsd4_setattr {
  293. stateid_t sa_stateid; /* request */
  294. u32 sa_bmval[3]; /* request */
  295. struct iattr sa_iattr; /* request */
  296. struct nfs4_acl *sa_acl;
  297. struct xdr_netobj sa_label;
  298. };
  299. struct nfsd4_setclientid {
  300. nfs4_verifier se_verf; /* request */
  301. struct xdr_netobj se_name;
  302. u32 se_callback_prog; /* request */
  303. u32 se_callback_netid_len; /* request */
  304. char * se_callback_netid_val; /* request */
  305. u32 se_callback_addr_len; /* request */
  306. char * se_callback_addr_val; /* request */
  307. u32 se_callback_ident; /* request */
  308. clientid_t se_clientid; /* response */
  309. nfs4_verifier se_confirm; /* response */
  310. };
  311. struct nfsd4_setclientid_confirm {
  312. clientid_t sc_clientid;
  313. nfs4_verifier sc_confirm;
  314. };
  315. struct nfsd4_saved_compoundargs {
  316. __be32 *p;
  317. __be32 *end;
  318. int pagelen;
  319. struct page **pagelist;
  320. };
  321. struct nfsd4_test_stateid_id {
  322. __be32 ts_id_status;
  323. stateid_t ts_id_stateid;
  324. struct list_head ts_id_list;
  325. };
  326. struct nfsd4_test_stateid {
  327. u32 ts_num_ids;
  328. struct list_head ts_stateid_list;
  329. };
  330. struct nfsd4_free_stateid {
  331. stateid_t fr_stateid; /* request */
  332. };
  333. /* also used for NVERIFY */
  334. struct nfsd4_verify {
  335. u32 ve_bmval[3]; /* request */
  336. u32 ve_attrlen; /* request */
  337. char * ve_attrval; /* request */
  338. };
  339. struct nfsd4_write {
  340. stateid_t wr_stateid; /* request */
  341. u64 wr_offset; /* request */
  342. u32 wr_stable_how; /* request */
  343. u32 wr_buflen; /* request */
  344. struct kvec wr_head;
  345. struct page ** wr_pagelist; /* request */
  346. u32 wr_bytes_written; /* response */
  347. u32 wr_how_written; /* response */
  348. nfs4_verifier wr_verifier; /* response */
  349. };
  350. struct nfsd4_exchange_id {
  351. nfs4_verifier verifier;
  352. struct xdr_netobj clname;
  353. u32 flags;
  354. clientid_t clientid;
  355. u32 seqid;
  356. int spa_how;
  357. u32 spo_must_enforce[3];
  358. u32 spo_must_allow[3];
  359. };
  360. struct nfsd4_sequence {
  361. struct nfs4_sessionid sessionid; /* request/response */
  362. u32 seqid; /* request/response */
  363. u32 slotid; /* request/response */
  364. u32 maxslots; /* request/response */
  365. u32 cachethis; /* request */
  366. #if 0
  367. u32 target_maxslots; /* response */
  368. #endif /* not yet */
  369. u32 status_flags; /* response */
  370. };
  371. struct nfsd4_destroy_session {
  372. struct nfs4_sessionid sessionid;
  373. };
  374. struct nfsd4_destroy_clientid {
  375. clientid_t clientid;
  376. };
  377. struct nfsd4_reclaim_complete {
  378. u32 rca_one_fs;
  379. };
  380. struct nfsd4_deviceid {
  381. u64 fsid_idx;
  382. u32 generation;
  383. u32 pad;
  384. };
  385. struct nfsd4_layout_seg {
  386. u32 iomode;
  387. u64 offset;
  388. u64 length;
  389. };
  390. struct nfsd4_getdeviceinfo {
  391. struct nfsd4_deviceid gd_devid; /* request */
  392. u32 gd_layout_type; /* request */
  393. u32 gd_maxcount; /* request */
  394. u32 gd_notify_types;/* request - response */
  395. void *gd_device; /* response */
  396. };
  397. struct nfsd4_layoutget {
  398. u64 lg_minlength; /* request */
  399. u32 lg_signal; /* request */
  400. u32 lg_layout_type; /* request */
  401. u32 lg_maxcount; /* request */
  402. stateid_t lg_sid; /* request/response */
  403. struct nfsd4_layout_seg lg_seg; /* request/response */
  404. void *lg_content; /* response */
  405. };
  406. struct nfsd4_layoutcommit {
  407. stateid_t lc_sid; /* request */
  408. struct nfsd4_layout_seg lc_seg; /* request */
  409. u32 lc_reclaim; /* request */
  410. u32 lc_newoffset; /* request */
  411. u64 lc_last_wr; /* request */
  412. struct timespec lc_mtime; /* request */
  413. u32 lc_layout_type; /* request */
  414. u32 lc_up_len; /* layout length */
  415. void *lc_up_layout; /* decoded by callback */
  416. u32 lc_size_chg; /* boolean for response */
  417. u64 lc_newsize; /* response */
  418. };
  419. struct nfsd4_layoutreturn {
  420. u32 lr_return_type; /* request */
  421. u32 lr_layout_type; /* request */
  422. struct nfsd4_layout_seg lr_seg; /* request */
  423. u32 lr_reclaim; /* request */
  424. u32 lrf_body_len; /* request */
  425. void *lrf_body; /* request */
  426. stateid_t lr_sid; /* request/response */
  427. u32 lrs_present; /* response */
  428. };
  429. struct nfsd4_fallocate {
  430. /* request */
  431. stateid_t falloc_stateid;
  432. loff_t falloc_offset;
  433. u64 falloc_length;
  434. };
  435. struct nfsd4_clone {
  436. /* request */
  437. stateid_t cl_src_stateid;
  438. stateid_t cl_dst_stateid;
  439. u64 cl_src_pos;
  440. u64 cl_dst_pos;
  441. u64 cl_count;
  442. };
  443. struct nfsd42_write_res {
  444. u64 wr_bytes_written;
  445. u32 wr_stable_how;
  446. nfs4_verifier wr_verifier;
  447. };
  448. struct nfsd4_copy {
  449. /* request */
  450. stateid_t cp_src_stateid;
  451. stateid_t cp_dst_stateid;
  452. u64 cp_src_pos;
  453. u64 cp_dst_pos;
  454. u64 cp_count;
  455. /* both */
  456. bool cp_consecutive;
  457. bool cp_synchronous;
  458. /* response */
  459. struct nfsd42_write_res cp_res;
  460. };
  461. struct nfsd4_seek {
  462. /* request */
  463. stateid_t seek_stateid;
  464. loff_t seek_offset;
  465. u32 seek_whence;
  466. /* response */
  467. u32 seek_eof;
  468. loff_t seek_pos;
  469. };
  470. struct nfsd4_op {
  471. int opnum;
  472. __be32 status;
  473. union {
  474. struct nfsd4_access access;
  475. struct nfsd4_close close;
  476. struct nfsd4_commit commit;
  477. struct nfsd4_create create;
  478. struct nfsd4_delegreturn delegreturn;
  479. struct nfsd4_getattr getattr;
  480. struct svc_fh * getfh;
  481. struct nfsd4_link link;
  482. struct nfsd4_lock lock;
  483. struct nfsd4_lockt lockt;
  484. struct nfsd4_locku locku;
  485. struct nfsd4_lookup lookup;
  486. struct nfsd4_verify nverify;
  487. struct nfsd4_open open;
  488. struct nfsd4_open_confirm open_confirm;
  489. struct nfsd4_open_downgrade open_downgrade;
  490. struct nfsd4_putfh putfh;
  491. struct nfsd4_read read;
  492. struct nfsd4_readdir readdir;
  493. struct nfsd4_readlink readlink;
  494. struct nfsd4_remove remove;
  495. struct nfsd4_rename rename;
  496. clientid_t renew;
  497. struct nfsd4_secinfo secinfo;
  498. struct nfsd4_setattr setattr;
  499. struct nfsd4_setclientid setclientid;
  500. struct nfsd4_setclientid_confirm setclientid_confirm;
  501. struct nfsd4_verify verify;
  502. struct nfsd4_write write;
  503. struct nfsd4_release_lockowner release_lockowner;
  504. /* NFSv4.1 */
  505. struct nfsd4_exchange_id exchange_id;
  506. struct nfsd4_backchannel_ctl backchannel_ctl;
  507. struct nfsd4_bind_conn_to_session bind_conn_to_session;
  508. struct nfsd4_create_session create_session;
  509. struct nfsd4_destroy_session destroy_session;
  510. struct nfsd4_sequence sequence;
  511. struct nfsd4_reclaim_complete reclaim_complete;
  512. struct nfsd4_test_stateid test_stateid;
  513. struct nfsd4_free_stateid free_stateid;
  514. struct nfsd4_getdeviceinfo getdeviceinfo;
  515. struct nfsd4_layoutget layoutget;
  516. struct nfsd4_layoutcommit layoutcommit;
  517. struct nfsd4_layoutreturn layoutreturn;
  518. /* NFSv4.2 */
  519. struct nfsd4_fallocate allocate;
  520. struct nfsd4_fallocate deallocate;
  521. struct nfsd4_clone clone;
  522. struct nfsd4_copy copy;
  523. struct nfsd4_seek seek;
  524. } u;
  525. struct nfs4_replay * replay;
  526. };
  527. bool nfsd4_cache_this_op(struct nfsd4_op *);
  528. /*
  529. * Memory needed just for the duration of processing one compound:
  530. */
  531. struct svcxdr_tmpbuf {
  532. struct svcxdr_tmpbuf *next;
  533. char buf[];
  534. };
  535. struct nfsd4_compoundargs {
  536. /* scratch variables for XDR decode */
  537. __be32 * p;
  538. __be32 * end;
  539. struct page ** pagelist;
  540. int pagelen;
  541. __be32 tmp[8];
  542. __be32 * tmpp;
  543. struct svcxdr_tmpbuf *to_free;
  544. struct svc_rqst *rqstp;
  545. u32 taglen;
  546. char * tag;
  547. u32 minorversion;
  548. u32 opcnt;
  549. struct nfsd4_op *ops;
  550. struct nfsd4_op iops[8];
  551. int cachetype;
  552. };
  553. struct nfsd4_compoundres {
  554. /* scratch variables for XDR encode */
  555. struct xdr_stream xdr;
  556. struct svc_rqst * rqstp;
  557. u32 taglen;
  558. char * tag;
  559. u32 opcnt;
  560. __be32 * tagp; /* tag, opcount encode location */
  561. struct nfsd4_compound_state cstate;
  562. };
  563. static inline bool nfsd4_is_solo_sequence(struct nfsd4_compoundres *resp)
  564. {
  565. struct nfsd4_compoundargs *args = resp->rqstp->rq_argp;
  566. return resp->opcnt == 1 && args->ops[0].opnum == OP_SEQUENCE;
  567. }
  568. static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp)
  569. {
  570. return !(resp->cstate.slot->sl_flags & NFSD4_SLOT_CACHETHIS)
  571. || nfsd4_is_solo_sequence(resp);
  572. }
  573. static inline bool nfsd4_last_compound_op(struct svc_rqst *rqstp)
  574. {
  575. struct nfsd4_compoundres *resp = rqstp->rq_resp;
  576. struct nfsd4_compoundargs *argp = rqstp->rq_argp;
  577. return argp->opcnt == resp->opcnt;
  578. }
  579. int nfsd4_max_reply(struct svc_rqst *rqstp, struct nfsd4_op *op);
  580. void warn_on_nonidempotent_op(struct nfsd4_op *op);
  581. #define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs)
  582. static inline void
  583. set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
  584. {
  585. BUG_ON(!fhp->fh_pre_saved);
  586. cinfo->atomic = (u32)fhp->fh_post_saved;
  587. cinfo->change_supported = IS_I_VERSION(d_inode(fhp->fh_dentry));
  588. cinfo->before_change = fhp->fh_pre_change;
  589. cinfo->after_change = fhp->fh_post_change;
  590. cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec;
  591. cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec;
  592. cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec;
  593. cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec;
  594. }
  595. bool nfsd4_mach_creds_match(struct nfs4_client *cl, struct svc_rqst *rqstp);
  596. int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
  597. int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *,
  598. struct nfsd4_compoundargs *);
  599. int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *,
  600. struct nfsd4_compoundres *);
  601. __be32 nfsd4_check_resp_size(struct nfsd4_compoundres *, u32);
  602. void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *);
  603. void nfsd4_encode_replay(struct xdr_stream *xdr, struct nfsd4_op *op);
  604. __be32 nfsd4_encode_fattr_to_buf(__be32 **p, int words,
  605. struct svc_fh *fhp, struct svc_export *exp,
  606. struct dentry *dentry,
  607. u32 *bmval, struct svc_rqst *, int ignore_crossmnt);
  608. extern __be32 nfsd4_setclientid(struct svc_rqst *rqstp,
  609. struct nfsd4_compound_state *,
  610. struct nfsd4_setclientid *setclid);
  611. extern __be32 nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
  612. struct nfsd4_compound_state *,
  613. struct nfsd4_setclientid_confirm *setclientid_confirm);
  614. extern __be32 nfsd4_exchange_id(struct svc_rqst *rqstp,
  615. struct nfsd4_compound_state *, struct nfsd4_exchange_id *);
  616. extern __be32 nfsd4_backchannel_ctl(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_backchannel_ctl *);
  617. extern __be32 nfsd4_bind_conn_to_session(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_bind_conn_to_session *);
  618. extern __be32 nfsd4_create_session(struct svc_rqst *,
  619. struct nfsd4_compound_state *,
  620. struct nfsd4_create_session *);
  621. extern __be32 nfsd4_sequence(struct svc_rqst *,
  622. struct nfsd4_compound_state *,
  623. struct nfsd4_sequence *);
  624. extern void nfsd4_sequence_done(struct nfsd4_compoundres *resp);
  625. extern __be32 nfsd4_destroy_session(struct svc_rqst *,
  626. struct nfsd4_compound_state *,
  627. struct nfsd4_destroy_session *);
  628. extern __be32 nfsd4_destroy_clientid(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_destroy_clientid *);
  629. __be32 nfsd4_reclaim_complete(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_reclaim_complete *);
  630. extern __be32 nfsd4_process_open1(struct nfsd4_compound_state *,
  631. struct nfsd4_open *open, struct nfsd_net *nn);
  632. extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp,
  633. struct svc_fh *current_fh, struct nfsd4_open *open);
  634. extern void nfsd4_cstate_clear_replay(struct nfsd4_compound_state *cstate);
  635. extern void nfsd4_cleanup_open_state(struct nfsd4_compound_state *cstate,
  636. struct nfsd4_open *open);
  637. extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp,
  638. struct nfsd4_compound_state *, struct nfsd4_open_confirm *oc);
  639. extern __be32 nfsd4_close(struct svc_rqst *rqstp,
  640. struct nfsd4_compound_state *,
  641. struct nfsd4_close *close);
  642. extern __be32 nfsd4_open_downgrade(struct svc_rqst *rqstp,
  643. struct nfsd4_compound_state *,
  644. struct nfsd4_open_downgrade *od);
  645. extern __be32 nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *,
  646. struct nfsd4_lock *lock);
  647. extern __be32 nfsd4_lockt(struct svc_rqst *rqstp,
  648. struct nfsd4_compound_state *,
  649. struct nfsd4_lockt *lockt);
  650. extern __be32 nfsd4_locku(struct svc_rqst *rqstp,
  651. struct nfsd4_compound_state *,
  652. struct nfsd4_locku *locku);
  653. extern __be32
  654. nfsd4_release_lockowner(struct svc_rqst *rqstp,
  655. struct nfsd4_compound_state *,
  656. struct nfsd4_release_lockowner *rlockowner);
  657. extern int nfsd4_release_compoundargs(void *rq, __be32 *p, void *resp);
  658. extern __be32 nfsd4_delegreturn(struct svc_rqst *rqstp,
  659. struct nfsd4_compound_state *, struct nfsd4_delegreturn *dr);
  660. extern __be32 nfsd4_renew(struct svc_rqst *rqstp,
  661. struct nfsd4_compound_state *, clientid_t *clid);
  662. extern __be32 nfsd4_test_stateid(struct svc_rqst *rqstp,
  663. struct nfsd4_compound_state *, struct nfsd4_test_stateid *test_stateid);
  664. extern __be32 nfsd4_free_stateid(struct svc_rqst *rqstp,
  665. struct nfsd4_compound_state *, struct nfsd4_free_stateid *free_stateid);
  666. extern void nfsd4_bump_seqid(struct nfsd4_compound_state *, __be32 nfserr);
  667. #endif
  668. /*
  669. * Local variables:
  670. * c-basic-offset: 8
  671. * End:
  672. */