nfs3xdr.c 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204
  1. /*
  2. * linux/fs/nfs/nfs3xdr.c
  3. *
  4. * XDR functions to encode/decode NFSv3 RPC arguments and results.
  5. *
  6. * Copyright (C) 1996, 1997 Olaf Kirch
  7. */
  8. #include <linux/param.h>
  9. #include <linux/time.h>
  10. #include <linux/mm.h>
  11. #include <linux/errno.h>
  12. #include <linux/string.h>
  13. #include <linux/in.h>
  14. #include <linux/pagemap.h>
  15. #include <linux/proc_fs.h>
  16. #include <linux/kdev_t.h>
  17. #include <linux/sunrpc/clnt.h>
  18. #include <linux/nfs.h>
  19. #include <linux/nfs3.h>
  20. #include <linux/nfs_fs.h>
  21. #include <linux/nfsacl.h>
  22. #include "internal.h"
  23. #define NFSDBG_FACILITY NFSDBG_XDR
  24. /* Mapping from NFS error code to "errno" error code. */
  25. #define errno_NFSERR_IO EIO
  26. /*
  27. * Declare the space requirements for NFS arguments and replies as
  28. * number of 32bit-words
  29. */
  30. #define NFS3_fhandle_sz (1+16)
  31. #define NFS3_fh_sz (NFS3_fhandle_sz) /* shorthand */
  32. #define NFS3_sattr_sz (15)
  33. #define NFS3_filename_sz (1+(NFS3_MAXNAMLEN>>2))
  34. #define NFS3_path_sz (1+(NFS3_MAXPATHLEN>>2))
  35. #define NFS3_fattr_sz (21)
  36. #define NFS3_wcc_attr_sz (6)
  37. #define NFS3_pre_op_attr_sz (1+NFS3_wcc_attr_sz)
  38. #define NFS3_post_op_attr_sz (1+NFS3_fattr_sz)
  39. #define NFS3_wcc_data_sz (NFS3_pre_op_attr_sz+NFS3_post_op_attr_sz)
  40. #define NFS3_fsstat_sz
  41. #define NFS3_fsinfo_sz
  42. #define NFS3_pathconf_sz
  43. #define NFS3_entry_sz (NFS3_filename_sz+3)
  44. #define NFS3_sattrargs_sz (NFS3_fh_sz+NFS3_sattr_sz+3)
  45. #define NFS3_diropargs_sz (NFS3_fh_sz+NFS3_filename_sz)
  46. #define NFS3_removeargs_sz (NFS3_fh_sz+NFS3_filename_sz)
  47. #define NFS3_accessargs_sz (NFS3_fh_sz+1)
  48. #define NFS3_readlinkargs_sz (NFS3_fh_sz)
  49. #define NFS3_readargs_sz (NFS3_fh_sz+3)
  50. #define NFS3_writeargs_sz (NFS3_fh_sz+5)
  51. #define NFS3_createargs_sz (NFS3_diropargs_sz+NFS3_sattr_sz)
  52. #define NFS3_mkdirargs_sz (NFS3_diropargs_sz+NFS3_sattr_sz)
  53. #define NFS3_symlinkargs_sz (NFS3_diropargs_sz+1+NFS3_sattr_sz)
  54. #define NFS3_mknodargs_sz (NFS3_diropargs_sz+2+NFS3_sattr_sz)
  55. #define NFS3_renameargs_sz (NFS3_diropargs_sz+NFS3_diropargs_sz)
  56. #define NFS3_linkargs_sz (NFS3_fh_sz+NFS3_diropargs_sz)
  57. #define NFS3_readdirargs_sz (NFS3_fh_sz+2)
  58. #define NFS3_commitargs_sz (NFS3_fh_sz+3)
  59. #define NFS3_attrstat_sz (1+NFS3_fattr_sz)
  60. #define NFS3_wccstat_sz (1+NFS3_wcc_data_sz)
  61. #define NFS3_removeres_sz (NFS3_wccstat_sz)
  62. #define NFS3_lookupres_sz (1+NFS3_fh_sz+(2 * NFS3_post_op_attr_sz))
  63. #define NFS3_accessres_sz (1+NFS3_post_op_attr_sz+1)
  64. #define NFS3_readlinkres_sz (1+NFS3_post_op_attr_sz+1)
  65. #define NFS3_readres_sz (1+NFS3_post_op_attr_sz+3)
  66. #define NFS3_writeres_sz (1+NFS3_wcc_data_sz+4)
  67. #define NFS3_createres_sz (1+NFS3_fh_sz+NFS3_post_op_attr_sz+NFS3_wcc_data_sz)
  68. #define NFS3_renameres_sz (1+(2 * NFS3_wcc_data_sz))
  69. #define NFS3_linkres_sz (1+NFS3_post_op_attr_sz+NFS3_wcc_data_sz)
  70. #define NFS3_readdirres_sz (1+NFS3_post_op_attr_sz+2)
  71. #define NFS3_fsstatres_sz (1+NFS3_post_op_attr_sz+13)
  72. #define NFS3_fsinfores_sz (1+NFS3_post_op_attr_sz+12)
  73. #define NFS3_pathconfres_sz (1+NFS3_post_op_attr_sz+6)
  74. #define NFS3_commitres_sz (1+NFS3_wcc_data_sz+2)
  75. #define ACL3_getaclargs_sz (NFS3_fh_sz+1)
  76. #define ACL3_setaclargs_sz (NFS3_fh_sz+1+ \
  77. XDR_QUADLEN(NFS_ACL_INLINE_BUFSIZE))
  78. #define ACL3_getaclres_sz (1+NFS3_post_op_attr_sz+1+ \
  79. XDR_QUADLEN(NFS_ACL_INLINE_BUFSIZE))
  80. #define ACL3_setaclres_sz (1+NFS3_post_op_attr_sz)
  81. /*
  82. * Map file type to S_IFMT bits
  83. */
  84. static const umode_t nfs_type2fmt[] = {
  85. [NF3BAD] = 0,
  86. [NF3REG] = S_IFREG,
  87. [NF3DIR] = S_IFDIR,
  88. [NF3BLK] = S_IFBLK,
  89. [NF3CHR] = S_IFCHR,
  90. [NF3LNK] = S_IFLNK,
  91. [NF3SOCK] = S_IFSOCK,
  92. [NF3FIFO] = S_IFIFO,
  93. };
  94. /*
  95. * Common NFS XDR functions as inlines
  96. */
  97. static inline __be32 *
  98. xdr_encode_fhandle(__be32 *p, const struct nfs_fh *fh)
  99. {
  100. return xdr_encode_array(p, fh->data, fh->size);
  101. }
  102. static inline __be32 *
  103. xdr_decode_fhandle(__be32 *p, struct nfs_fh *fh)
  104. {
  105. if ((fh->size = ntohl(*p++)) <= NFS3_FHSIZE) {
  106. memcpy(fh->data, p, fh->size);
  107. return p + XDR_QUADLEN(fh->size);
  108. }
  109. return NULL;
  110. }
  111. /*
  112. * Encode/decode time.
  113. */
  114. static inline __be32 *
  115. xdr_encode_time3(__be32 *p, struct timespec *timep)
  116. {
  117. *p++ = htonl(timep->tv_sec);
  118. *p++ = htonl(timep->tv_nsec);
  119. return p;
  120. }
  121. static inline __be32 *
  122. xdr_decode_time3(__be32 *p, struct timespec *timep)
  123. {
  124. timep->tv_sec = ntohl(*p++);
  125. timep->tv_nsec = ntohl(*p++);
  126. return p;
  127. }
  128. static __be32 *
  129. xdr_decode_fattr(__be32 *p, struct nfs_fattr *fattr)
  130. {
  131. unsigned int type, major, minor;
  132. umode_t fmode;
  133. type = ntohl(*p++);
  134. if (type > NF3FIFO)
  135. type = NF3NON;
  136. fmode = nfs_type2fmt[type];
  137. fattr->mode = (ntohl(*p++) & ~S_IFMT) | fmode;
  138. fattr->nlink = ntohl(*p++);
  139. fattr->uid = ntohl(*p++);
  140. fattr->gid = ntohl(*p++);
  141. p = xdr_decode_hyper(p, &fattr->size);
  142. p = xdr_decode_hyper(p, &fattr->du.nfs3.used);
  143. /* Turn remote device info into Linux-specific dev_t */
  144. major = ntohl(*p++);
  145. minor = ntohl(*p++);
  146. fattr->rdev = MKDEV(major, minor);
  147. if (MAJOR(fattr->rdev) != major || MINOR(fattr->rdev) != minor)
  148. fattr->rdev = 0;
  149. p = xdr_decode_hyper(p, &fattr->fsid.major);
  150. fattr->fsid.minor = 0;
  151. p = xdr_decode_hyper(p, &fattr->fileid);
  152. p = xdr_decode_time3(p, &fattr->atime);
  153. p = xdr_decode_time3(p, &fattr->mtime);
  154. p = xdr_decode_time3(p, &fattr->ctime);
  155. /* Update the mode bits */
  156. fattr->valid |= NFS_ATTR_FATTR_V3;
  157. return p;
  158. }
  159. static inline __be32 *
  160. xdr_encode_sattr(__be32 *p, struct iattr *attr)
  161. {
  162. if (attr->ia_valid & ATTR_MODE) {
  163. *p++ = xdr_one;
  164. *p++ = htonl(attr->ia_mode & S_IALLUGO);
  165. } else {
  166. *p++ = xdr_zero;
  167. }
  168. if (attr->ia_valid & ATTR_UID) {
  169. *p++ = xdr_one;
  170. *p++ = htonl(attr->ia_uid);
  171. } else {
  172. *p++ = xdr_zero;
  173. }
  174. if (attr->ia_valid & ATTR_GID) {
  175. *p++ = xdr_one;
  176. *p++ = htonl(attr->ia_gid);
  177. } else {
  178. *p++ = xdr_zero;
  179. }
  180. if (attr->ia_valid & ATTR_SIZE) {
  181. *p++ = xdr_one;
  182. p = xdr_encode_hyper(p, (__u64) attr->ia_size);
  183. } else {
  184. *p++ = xdr_zero;
  185. }
  186. if (attr->ia_valid & ATTR_ATIME_SET) {
  187. *p++ = xdr_two;
  188. p = xdr_encode_time3(p, &attr->ia_atime);
  189. } else if (attr->ia_valid & ATTR_ATIME) {
  190. *p++ = xdr_one;
  191. } else {
  192. *p++ = xdr_zero;
  193. }
  194. if (attr->ia_valid & ATTR_MTIME_SET) {
  195. *p++ = xdr_two;
  196. p = xdr_encode_time3(p, &attr->ia_mtime);
  197. } else if (attr->ia_valid & ATTR_MTIME) {
  198. *p++ = xdr_one;
  199. } else {
  200. *p++ = xdr_zero;
  201. }
  202. return p;
  203. }
  204. static inline __be32 *
  205. xdr_decode_wcc_attr(__be32 *p, struct nfs_fattr *fattr)
  206. {
  207. p = xdr_decode_hyper(p, &fattr->pre_size);
  208. p = xdr_decode_time3(p, &fattr->pre_mtime);
  209. p = xdr_decode_time3(p, &fattr->pre_ctime);
  210. fattr->valid |= NFS_ATTR_FATTR_PRESIZE
  211. | NFS_ATTR_FATTR_PREMTIME
  212. | NFS_ATTR_FATTR_PRECTIME;
  213. return p;
  214. }
  215. static inline __be32 *
  216. xdr_decode_post_op_attr(__be32 *p, struct nfs_fattr *fattr)
  217. {
  218. if (*p++)
  219. p = xdr_decode_fattr(p, fattr);
  220. return p;
  221. }
  222. static inline __be32 *
  223. xdr_decode_pre_op_attr(__be32 *p, struct nfs_fattr *fattr)
  224. {
  225. if (*p++)
  226. return xdr_decode_wcc_attr(p, fattr);
  227. return p;
  228. }
  229. static inline __be32 *
  230. xdr_decode_wcc_data(__be32 *p, struct nfs_fattr *fattr)
  231. {
  232. p = xdr_decode_pre_op_attr(p, fattr);
  233. return xdr_decode_post_op_attr(p, fattr);
  234. }
  235. /*
  236. * NFS encode functions
  237. */
  238. /*
  239. * Encode file handle argument
  240. */
  241. static int
  242. nfs3_xdr_fhandle(struct rpc_rqst *req, __be32 *p, struct nfs_fh *fh)
  243. {
  244. p = xdr_encode_fhandle(p, fh);
  245. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  246. return 0;
  247. }
  248. /*
  249. * Encode SETATTR arguments
  250. */
  251. static int
  252. nfs3_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs3_sattrargs *args)
  253. {
  254. p = xdr_encode_fhandle(p, args->fh);
  255. p = xdr_encode_sattr(p, args->sattr);
  256. *p++ = htonl(args->guard);
  257. if (args->guard)
  258. p = xdr_encode_time3(p, &args->guardtime);
  259. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  260. return 0;
  261. }
  262. /*
  263. * Encode directory ops argument
  264. */
  265. static int
  266. nfs3_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs3_diropargs *args)
  267. {
  268. p = xdr_encode_fhandle(p, args->fh);
  269. p = xdr_encode_array(p, args->name, args->len);
  270. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  271. return 0;
  272. }
  273. /*
  274. * Encode REMOVE argument
  275. */
  276. static int
  277. nfs3_xdr_removeargs(struct rpc_rqst *req, __be32 *p, const struct nfs_removeargs *args)
  278. {
  279. p = xdr_encode_fhandle(p, args->fh);
  280. p = xdr_encode_array(p, args->name.name, args->name.len);
  281. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  282. return 0;
  283. }
  284. /*
  285. * Encode access() argument
  286. */
  287. static int
  288. nfs3_xdr_accessargs(struct rpc_rqst *req, __be32 *p, struct nfs3_accessargs *args)
  289. {
  290. p = xdr_encode_fhandle(p, args->fh);
  291. *p++ = htonl(args->access);
  292. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  293. return 0;
  294. }
  295. /*
  296. * Arguments to a READ call. Since we read data directly into the page
  297. * cache, we also set up the reply iovec here so that iov[1] points
  298. * exactly to the page we want to fetch.
  299. */
  300. static int
  301. nfs3_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args)
  302. {
  303. struct rpc_auth *auth = req->rq_cred->cr_auth;
  304. unsigned int replen;
  305. u32 count = args->count;
  306. p = xdr_encode_fhandle(p, args->fh);
  307. p = xdr_encode_hyper(p, args->offset);
  308. *p++ = htonl(count);
  309. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  310. /* Inline the page array */
  311. replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS3_readres_sz) << 2;
  312. xdr_inline_pages(&req->rq_rcv_buf, replen,
  313. args->pages, args->pgbase, count);
  314. req->rq_rcv_buf.flags |= XDRBUF_READ;
  315. return 0;
  316. }
  317. /*
  318. * Write arguments. Splice the buffer to be written into the iovec.
  319. */
  320. static int
  321. nfs3_xdr_writeargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
  322. {
  323. struct xdr_buf *sndbuf = &req->rq_snd_buf;
  324. u32 count = args->count;
  325. p = xdr_encode_fhandle(p, args->fh);
  326. p = xdr_encode_hyper(p, args->offset);
  327. *p++ = htonl(count);
  328. *p++ = htonl(args->stable);
  329. *p++ = htonl(count);
  330. sndbuf->len = xdr_adjust_iovec(sndbuf->head, p);
  331. /* Copy the page array */
  332. xdr_encode_pages(sndbuf, args->pages, args->pgbase, count);
  333. sndbuf->flags |= XDRBUF_WRITE;
  334. return 0;
  335. }
  336. /*
  337. * Encode CREATE arguments
  338. */
  339. static int
  340. nfs3_xdr_createargs(struct rpc_rqst *req, __be32 *p, struct nfs3_createargs *args)
  341. {
  342. p = xdr_encode_fhandle(p, args->fh);
  343. p = xdr_encode_array(p, args->name, args->len);
  344. *p++ = htonl(args->createmode);
  345. if (args->createmode == NFS3_CREATE_EXCLUSIVE) {
  346. *p++ = args->verifier[0];
  347. *p++ = args->verifier[1];
  348. } else
  349. p = xdr_encode_sattr(p, args->sattr);
  350. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  351. return 0;
  352. }
  353. /*
  354. * Encode MKDIR arguments
  355. */
  356. static int
  357. nfs3_xdr_mkdirargs(struct rpc_rqst *req, __be32 *p, struct nfs3_mkdirargs *args)
  358. {
  359. p = xdr_encode_fhandle(p, args->fh);
  360. p = xdr_encode_array(p, args->name, args->len);
  361. p = xdr_encode_sattr(p, args->sattr);
  362. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  363. return 0;
  364. }
  365. /*
  366. * Encode SYMLINK arguments
  367. */
  368. static int
  369. nfs3_xdr_symlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_symlinkargs *args)
  370. {
  371. p = xdr_encode_fhandle(p, args->fromfh);
  372. p = xdr_encode_array(p, args->fromname, args->fromlen);
  373. p = xdr_encode_sattr(p, args->sattr);
  374. *p++ = htonl(args->pathlen);
  375. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  376. /* Copy the page */
  377. xdr_encode_pages(&req->rq_snd_buf, args->pages, 0, args->pathlen);
  378. return 0;
  379. }
  380. /*
  381. * Encode MKNOD arguments
  382. */
  383. static int
  384. nfs3_xdr_mknodargs(struct rpc_rqst *req, __be32 *p, struct nfs3_mknodargs *args)
  385. {
  386. p = xdr_encode_fhandle(p, args->fh);
  387. p = xdr_encode_array(p, args->name, args->len);
  388. *p++ = htonl(args->type);
  389. p = xdr_encode_sattr(p, args->sattr);
  390. if (args->type == NF3CHR || args->type == NF3BLK) {
  391. *p++ = htonl(MAJOR(args->rdev));
  392. *p++ = htonl(MINOR(args->rdev));
  393. }
  394. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  395. return 0;
  396. }
  397. /*
  398. * Encode RENAME arguments
  399. */
  400. static int
  401. nfs3_xdr_renameargs(struct rpc_rqst *req, __be32 *p, struct nfs_renameargs *args)
  402. {
  403. p = xdr_encode_fhandle(p, args->old_dir);
  404. p = xdr_encode_array(p, args->old_name->name, args->old_name->len);
  405. p = xdr_encode_fhandle(p, args->new_dir);
  406. p = xdr_encode_array(p, args->new_name->name, args->new_name->len);
  407. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  408. return 0;
  409. }
  410. /*
  411. * Encode LINK arguments
  412. */
  413. static int
  414. nfs3_xdr_linkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_linkargs *args)
  415. {
  416. p = xdr_encode_fhandle(p, args->fromfh);
  417. p = xdr_encode_fhandle(p, args->tofh);
  418. p = xdr_encode_array(p, args->toname, args->tolen);
  419. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  420. return 0;
  421. }
  422. /*
  423. * Encode arguments to readdir call
  424. */
  425. static int
  426. nfs3_xdr_readdirargs(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirargs *args)
  427. {
  428. struct rpc_auth *auth = req->rq_cred->cr_auth;
  429. unsigned int replen;
  430. u32 count = args->count;
  431. p = xdr_encode_fhandle(p, args->fh);
  432. p = xdr_encode_hyper(p, args->cookie);
  433. *p++ = args->verf[0];
  434. *p++ = args->verf[1];
  435. if (args->plus) {
  436. /* readdirplus: need dircount + buffer size.
  437. * We just make sure we make dircount big enough */
  438. *p++ = htonl(count >> 3);
  439. }
  440. *p++ = htonl(count);
  441. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  442. /* Inline the page array */
  443. replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS3_readdirres_sz) << 2;
  444. xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages, 0, count);
  445. return 0;
  446. }
  447. /*
  448. * Decode the result of a readdir call.
  449. * We just check for syntactical correctness.
  450. */
  451. static int
  452. nfs3_xdr_readdirres(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirres *res)
  453. {
  454. struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
  455. struct kvec *iov = rcvbuf->head;
  456. struct page **page;
  457. size_t hdrlen;
  458. u32 len, recvd, pglen;
  459. int status, nr = 0;
  460. __be32 *entry, *end, *kaddr;
  461. status = ntohl(*p++);
  462. /* Decode post_op_attrs */
  463. p = xdr_decode_post_op_attr(p, res->dir_attr);
  464. if (status)
  465. return nfs_stat_to_errno(status);
  466. /* Decode verifier cookie */
  467. if (res->verf) {
  468. res->verf[0] = *p++;
  469. res->verf[1] = *p++;
  470. } else {
  471. p += 2;
  472. }
  473. hdrlen = (u8 *) p - (u8 *) iov->iov_base;
  474. if (iov->iov_len < hdrlen) {
  475. dprintk("NFS: READDIR reply header overflowed:"
  476. "length %Zu > %Zu\n", hdrlen, iov->iov_len);
  477. return -errno_NFSERR_IO;
  478. } else if (iov->iov_len != hdrlen) {
  479. dprintk("NFS: READDIR header is short. iovec will be shifted.\n");
  480. xdr_shift_buf(rcvbuf, iov->iov_len - hdrlen);
  481. }
  482. pglen = rcvbuf->page_len;
  483. recvd = rcvbuf->len - hdrlen;
  484. if (pglen > recvd)
  485. pglen = recvd;
  486. page = rcvbuf->pages;
  487. kaddr = p = kmap_atomic(*page, KM_USER0);
  488. end = (__be32 *)((char *)p + pglen);
  489. entry = p;
  490. /* Make sure the packet actually has a value_follows and EOF entry */
  491. if ((entry + 1) > end)
  492. goto short_pkt;
  493. for (; *p++; nr++) {
  494. if (p + 3 > end)
  495. goto short_pkt;
  496. p += 2; /* inode # */
  497. len = ntohl(*p++); /* string length */
  498. p += XDR_QUADLEN(len) + 2; /* name + cookie */
  499. if (len > NFS3_MAXNAMLEN) {
  500. dprintk("NFS: giant filename in readdir (len 0x%x)!\n",
  501. len);
  502. goto err_unmap;
  503. }
  504. if (res->plus) {
  505. /* post_op_attr */
  506. if (p + 2 > end)
  507. goto short_pkt;
  508. if (*p++) {
  509. p += 21;
  510. if (p + 1 > end)
  511. goto short_pkt;
  512. }
  513. /* post_op_fh3 */
  514. if (*p++) {
  515. if (p + 1 > end)
  516. goto short_pkt;
  517. len = ntohl(*p++);
  518. if (len > NFS3_FHSIZE) {
  519. dprintk("NFS: giant filehandle in "
  520. "readdir (len 0x%x)!\n", len);
  521. goto err_unmap;
  522. }
  523. p += XDR_QUADLEN(len);
  524. }
  525. }
  526. if (p + 2 > end)
  527. goto short_pkt;
  528. entry = p;
  529. }
  530. /*
  531. * Apparently some server sends responses that are a valid size, but
  532. * contain no entries, and have value_follows==0 and EOF==0. For
  533. * those, just set the EOF marker.
  534. */
  535. if (!nr && entry[1] == 0) {
  536. dprintk("NFS: readdir reply truncated!\n");
  537. entry[1] = 1;
  538. }
  539. out:
  540. kunmap_atomic(kaddr, KM_USER0);
  541. return nr;
  542. short_pkt:
  543. /*
  544. * When we get a short packet there are 2 possibilities. We can
  545. * return an error, or fix up the response to look like a valid
  546. * response and return what we have so far. If there are no
  547. * entries and the packet was short, then return -EIO. If there
  548. * are valid entries in the response, return them and pretend that
  549. * the call was successful, but incomplete. The caller can retry the
  550. * readdir starting at the last cookie.
  551. */
  552. entry[0] = entry[1] = 0;
  553. if (!nr)
  554. nr = -errno_NFSERR_IO;
  555. goto out;
  556. err_unmap:
  557. nr = -errno_NFSERR_IO;
  558. goto out;
  559. }
  560. __be32 *
  561. nfs3_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus)
  562. {
  563. struct nfs_entry old = *entry;
  564. if (!*p++) {
  565. if (!*p)
  566. return ERR_PTR(-EAGAIN);
  567. entry->eof = 1;
  568. return ERR_PTR(-EBADCOOKIE);
  569. }
  570. p = xdr_decode_hyper(p, &entry->ino);
  571. entry->len = ntohl(*p++);
  572. entry->name = (const char *) p;
  573. p += XDR_QUADLEN(entry->len);
  574. entry->prev_cookie = entry->cookie;
  575. p = xdr_decode_hyper(p, &entry->cookie);
  576. if (plus) {
  577. entry->fattr->valid = 0;
  578. p = xdr_decode_post_op_attr(p, entry->fattr);
  579. /* In fact, a post_op_fh3: */
  580. if (*p++) {
  581. p = xdr_decode_fhandle(p, entry->fh);
  582. /* Ugh -- server reply was truncated */
  583. if (p == NULL) {
  584. dprintk("NFS: FH truncated\n");
  585. *entry = old;
  586. return ERR_PTR(-EAGAIN);
  587. }
  588. } else
  589. memset((u8*)(entry->fh), 0, sizeof(*entry->fh));
  590. }
  591. entry->eof = !p[0] && p[1];
  592. return p;
  593. }
  594. /*
  595. * Encode COMMIT arguments
  596. */
  597. static int
  598. nfs3_xdr_commitargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args)
  599. {
  600. p = xdr_encode_fhandle(p, args->fh);
  601. p = xdr_encode_hyper(p, args->offset);
  602. *p++ = htonl(args->count);
  603. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  604. return 0;
  605. }
  606. #ifdef CONFIG_NFS_V3_ACL
  607. /*
  608. * Encode GETACL arguments
  609. */
  610. static int
  611. nfs3_xdr_getaclargs(struct rpc_rqst *req, __be32 *p,
  612. struct nfs3_getaclargs *args)
  613. {
  614. struct rpc_auth *auth = req->rq_cred->cr_auth;
  615. unsigned int replen;
  616. p = xdr_encode_fhandle(p, args->fh);
  617. *p++ = htonl(args->mask);
  618. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  619. if (args->mask & (NFS_ACL | NFS_DFACL)) {
  620. /* Inline the page array */
  621. replen = (RPC_REPHDRSIZE + auth->au_rslack +
  622. ACL3_getaclres_sz) << 2;
  623. xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages, 0,
  624. NFSACL_MAXPAGES << PAGE_SHIFT);
  625. }
  626. return 0;
  627. }
  628. /*
  629. * Encode SETACL arguments
  630. */
  631. static int
  632. nfs3_xdr_setaclargs(struct rpc_rqst *req, __be32 *p,
  633. struct nfs3_setaclargs *args)
  634. {
  635. struct xdr_buf *buf = &req->rq_snd_buf;
  636. unsigned int base;
  637. int err;
  638. p = xdr_encode_fhandle(p, NFS_FH(args->inode));
  639. *p++ = htonl(args->mask);
  640. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  641. base = req->rq_slen;
  642. if (args->npages != 0)
  643. xdr_encode_pages(buf, args->pages, 0, args->len);
  644. else
  645. req->rq_slen = xdr_adjust_iovec(req->rq_svec,
  646. p + XDR_QUADLEN(args->len));
  647. err = nfsacl_encode(buf, base, args->inode,
  648. (args->mask & NFS_ACL) ?
  649. args->acl_access : NULL, 1, 0);
  650. if (err > 0)
  651. err = nfsacl_encode(buf, base + err, args->inode,
  652. (args->mask & NFS_DFACL) ?
  653. args->acl_default : NULL, 1,
  654. NFS_ACL_DEFAULT);
  655. return (err > 0) ? 0 : err;
  656. }
  657. #endif /* CONFIG_NFS_V3_ACL */
  658. /*
  659. * NFS XDR decode functions
  660. */
  661. /*
  662. * Decode attrstat reply.
  663. */
  664. static int
  665. nfs3_xdr_attrstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
  666. {
  667. int status;
  668. if ((status = ntohl(*p++)))
  669. return nfs_stat_to_errno(status);
  670. xdr_decode_fattr(p, fattr);
  671. return 0;
  672. }
  673. /*
  674. * Decode status+wcc_data reply
  675. * SATTR, REMOVE, RMDIR
  676. */
  677. static int
  678. nfs3_xdr_wccstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
  679. {
  680. int status;
  681. if ((status = ntohl(*p++)))
  682. status = nfs_stat_to_errno(status);
  683. xdr_decode_wcc_data(p, fattr);
  684. return status;
  685. }
  686. static int
  687. nfs3_xdr_removeres(struct rpc_rqst *req, __be32 *p, struct nfs_removeres *res)
  688. {
  689. return nfs3_xdr_wccstat(req, p, res->dir_attr);
  690. }
  691. /*
  692. * Decode LOOKUP reply
  693. */
  694. static int
  695. nfs3_xdr_lookupres(struct rpc_rqst *req, __be32 *p, struct nfs3_diropres *res)
  696. {
  697. int status;
  698. if ((status = ntohl(*p++))) {
  699. status = nfs_stat_to_errno(status);
  700. } else {
  701. if (!(p = xdr_decode_fhandle(p, res->fh)))
  702. return -errno_NFSERR_IO;
  703. p = xdr_decode_post_op_attr(p, res->fattr);
  704. }
  705. xdr_decode_post_op_attr(p, res->dir_attr);
  706. return status;
  707. }
  708. /*
  709. * Decode ACCESS reply
  710. */
  711. static int
  712. nfs3_xdr_accessres(struct rpc_rqst *req, __be32 *p, struct nfs3_accessres *res)
  713. {
  714. int status = ntohl(*p++);
  715. p = xdr_decode_post_op_attr(p, res->fattr);
  716. if (status)
  717. return nfs_stat_to_errno(status);
  718. res->access = ntohl(*p++);
  719. return 0;
  720. }
  721. static int
  722. nfs3_xdr_readlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs3_readlinkargs *args)
  723. {
  724. struct rpc_auth *auth = req->rq_cred->cr_auth;
  725. unsigned int replen;
  726. p = xdr_encode_fhandle(p, args->fh);
  727. req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
  728. /* Inline the page array */
  729. replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS3_readlinkres_sz) << 2;
  730. xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages, args->pgbase, args->pglen);
  731. return 0;
  732. }
  733. /*
  734. * Decode READLINK reply
  735. */
  736. static int
  737. nfs3_xdr_readlinkres(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
  738. {
  739. struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
  740. struct kvec *iov = rcvbuf->head;
  741. size_t hdrlen;
  742. u32 len, recvd;
  743. int status;
  744. status = ntohl(*p++);
  745. p = xdr_decode_post_op_attr(p, fattr);
  746. if (status != 0)
  747. return nfs_stat_to_errno(status);
  748. /* Convert length of symlink */
  749. len = ntohl(*p++);
  750. if (len >= rcvbuf->page_len) {
  751. dprintk("nfs: server returned giant symlink!\n");
  752. return -ENAMETOOLONG;
  753. }
  754. hdrlen = (u8 *) p - (u8 *) iov->iov_base;
  755. if (iov->iov_len < hdrlen) {
  756. dprintk("NFS: READLINK reply header overflowed:"
  757. "length %Zu > %Zu\n", hdrlen, iov->iov_len);
  758. return -errno_NFSERR_IO;
  759. } else if (iov->iov_len != hdrlen) {
  760. dprintk("NFS: READLINK header is short. "
  761. "iovec will be shifted.\n");
  762. xdr_shift_buf(rcvbuf, iov->iov_len - hdrlen);
  763. }
  764. recvd = req->rq_rcv_buf.len - hdrlen;
  765. if (recvd < len) {
  766. dprintk("NFS: server cheating in readlink reply: "
  767. "count %u > recvd %u\n", len, recvd);
  768. return -EIO;
  769. }
  770. xdr_terminate_string(rcvbuf, len);
  771. return 0;
  772. }
  773. /*
  774. * Decode READ reply
  775. */
  776. static int
  777. nfs3_xdr_readres(struct rpc_rqst *req, __be32 *p, struct nfs_readres *res)
  778. {
  779. struct kvec *iov = req->rq_rcv_buf.head;
  780. size_t hdrlen;
  781. u32 count, ocount, recvd;
  782. int status;
  783. status = ntohl(*p++);
  784. p = xdr_decode_post_op_attr(p, res->fattr);
  785. if (status != 0)
  786. return nfs_stat_to_errno(status);
  787. /* Decode reply count and EOF flag. NFSv3 is somewhat redundant
  788. * in that it puts the count both in the res struct and in the
  789. * opaque data count. */
  790. count = ntohl(*p++);
  791. res->eof = ntohl(*p++);
  792. ocount = ntohl(*p++);
  793. if (ocount != count) {
  794. dprintk("NFS: READ count doesn't match RPC opaque count.\n");
  795. return -errno_NFSERR_IO;
  796. }
  797. hdrlen = (u8 *) p - (u8 *) iov->iov_base;
  798. if (iov->iov_len < hdrlen) {
  799. dprintk("NFS: READ reply header overflowed:"
  800. "length %Zu > %Zu\n", hdrlen, iov->iov_len);
  801. return -errno_NFSERR_IO;
  802. } else if (iov->iov_len != hdrlen) {
  803. dprintk("NFS: READ header is short. iovec will be shifted.\n");
  804. xdr_shift_buf(&req->rq_rcv_buf, iov->iov_len - hdrlen);
  805. }
  806. recvd = req->rq_rcv_buf.len - hdrlen;
  807. if (count > recvd) {
  808. dprintk("NFS: server cheating in read reply: "
  809. "count %u > recvd %u\n", count, recvd);
  810. count = recvd;
  811. res->eof = 0;
  812. }
  813. if (count < res->count)
  814. res->count = count;
  815. return count;
  816. }
  817. /*
  818. * Decode WRITE response
  819. */
  820. static int
  821. nfs3_xdr_writeres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res)
  822. {
  823. int status;
  824. status = ntohl(*p++);
  825. p = xdr_decode_wcc_data(p, res->fattr);
  826. if (status != 0)
  827. return nfs_stat_to_errno(status);
  828. res->count = ntohl(*p++);
  829. res->verf->committed = (enum nfs3_stable_how)ntohl(*p++);
  830. res->verf->verifier[0] = *p++;
  831. res->verf->verifier[1] = *p++;
  832. return res->count;
  833. }
  834. /*
  835. * Decode a CREATE response
  836. */
  837. static int
  838. nfs3_xdr_createres(struct rpc_rqst *req, __be32 *p, struct nfs3_diropres *res)
  839. {
  840. int status;
  841. status = ntohl(*p++);
  842. if (status == 0) {
  843. if (*p++) {
  844. if (!(p = xdr_decode_fhandle(p, res->fh)))
  845. return -errno_NFSERR_IO;
  846. p = xdr_decode_post_op_attr(p, res->fattr);
  847. } else {
  848. memset(res->fh, 0, sizeof(*res->fh));
  849. /* Do decode post_op_attr but set it to NULL */
  850. p = xdr_decode_post_op_attr(p, res->fattr);
  851. res->fattr->valid = 0;
  852. }
  853. } else {
  854. status = nfs_stat_to_errno(status);
  855. }
  856. p = xdr_decode_wcc_data(p, res->dir_attr);
  857. return status;
  858. }
  859. /*
  860. * Decode RENAME reply
  861. */
  862. static int
  863. nfs3_xdr_renameres(struct rpc_rqst *req, __be32 *p, struct nfs_renameres *res)
  864. {
  865. int status;
  866. if ((status = ntohl(*p++)) != 0)
  867. status = nfs_stat_to_errno(status);
  868. p = xdr_decode_wcc_data(p, res->old_fattr);
  869. p = xdr_decode_wcc_data(p, res->new_fattr);
  870. return status;
  871. }
  872. /*
  873. * Decode LINK reply
  874. */
  875. static int
  876. nfs3_xdr_linkres(struct rpc_rqst *req, __be32 *p, struct nfs3_linkres *res)
  877. {
  878. int status;
  879. if ((status = ntohl(*p++)) != 0)
  880. status = nfs_stat_to_errno(status);
  881. p = xdr_decode_post_op_attr(p, res->fattr);
  882. p = xdr_decode_wcc_data(p, res->dir_attr);
  883. return status;
  884. }
  885. /*
  886. * Decode FSSTAT reply
  887. */
  888. static int
  889. nfs3_xdr_fsstatres(struct rpc_rqst *req, __be32 *p, struct nfs_fsstat *res)
  890. {
  891. int status;
  892. status = ntohl(*p++);
  893. p = xdr_decode_post_op_attr(p, res->fattr);
  894. if (status != 0)
  895. return nfs_stat_to_errno(status);
  896. p = xdr_decode_hyper(p, &res->tbytes);
  897. p = xdr_decode_hyper(p, &res->fbytes);
  898. p = xdr_decode_hyper(p, &res->abytes);
  899. p = xdr_decode_hyper(p, &res->tfiles);
  900. p = xdr_decode_hyper(p, &res->ffiles);
  901. p = xdr_decode_hyper(p, &res->afiles);
  902. /* ignore invarsec */
  903. return 0;
  904. }
  905. /*
  906. * Decode FSINFO reply
  907. */
  908. static int
  909. nfs3_xdr_fsinfores(struct rpc_rqst *req, __be32 *p, struct nfs_fsinfo *res)
  910. {
  911. int status;
  912. status = ntohl(*p++);
  913. p = xdr_decode_post_op_attr(p, res->fattr);
  914. if (status != 0)
  915. return nfs_stat_to_errno(status);
  916. res->rtmax = ntohl(*p++);
  917. res->rtpref = ntohl(*p++);
  918. res->rtmult = ntohl(*p++);
  919. res->wtmax = ntohl(*p++);
  920. res->wtpref = ntohl(*p++);
  921. res->wtmult = ntohl(*p++);
  922. res->dtpref = ntohl(*p++);
  923. p = xdr_decode_hyper(p, &res->maxfilesize);
  924. /* ignore time_delta and properties */
  925. res->lease_time = 0;
  926. return 0;
  927. }
  928. /*
  929. * Decode PATHCONF reply
  930. */
  931. static int
  932. nfs3_xdr_pathconfres(struct rpc_rqst *req, __be32 *p, struct nfs_pathconf *res)
  933. {
  934. int status;
  935. status = ntohl(*p++);
  936. p = xdr_decode_post_op_attr(p, res->fattr);
  937. if (status != 0)
  938. return nfs_stat_to_errno(status);
  939. res->max_link = ntohl(*p++);
  940. res->max_namelen = ntohl(*p++);
  941. /* ignore remaining fields */
  942. return 0;
  943. }
  944. /*
  945. * Decode COMMIT reply
  946. */
  947. static int
  948. nfs3_xdr_commitres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res)
  949. {
  950. int status;
  951. status = ntohl(*p++);
  952. p = xdr_decode_wcc_data(p, res->fattr);
  953. if (status != 0)
  954. return nfs_stat_to_errno(status);
  955. res->verf->verifier[0] = *p++;
  956. res->verf->verifier[1] = *p++;
  957. return 0;
  958. }
  959. #ifdef CONFIG_NFS_V3_ACL
  960. /*
  961. * Decode GETACL reply
  962. */
  963. static int
  964. nfs3_xdr_getaclres(struct rpc_rqst *req, __be32 *p,
  965. struct nfs3_getaclres *res)
  966. {
  967. struct xdr_buf *buf = &req->rq_rcv_buf;
  968. int status = ntohl(*p++);
  969. struct posix_acl **acl;
  970. unsigned int *aclcnt;
  971. int err, base;
  972. if (status != 0)
  973. return nfs_stat_to_errno(status);
  974. p = xdr_decode_post_op_attr(p, res->fattr);
  975. res->mask = ntohl(*p++);
  976. if (res->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT))
  977. return -EINVAL;
  978. base = (char *)p - (char *)req->rq_rcv_buf.head->iov_base;
  979. acl = (res->mask & NFS_ACL) ? &res->acl_access : NULL;
  980. aclcnt = (res->mask & NFS_ACLCNT) ? &res->acl_access_count : NULL;
  981. err = nfsacl_decode(buf, base, aclcnt, acl);
  982. acl = (res->mask & NFS_DFACL) ? &res->acl_default : NULL;
  983. aclcnt = (res->mask & NFS_DFACLCNT) ? &res->acl_default_count : NULL;
  984. if (err > 0)
  985. err = nfsacl_decode(buf, base + err, aclcnt, acl);
  986. return (err > 0) ? 0 : err;
  987. }
  988. /*
  989. * Decode setacl reply.
  990. */
  991. static int
  992. nfs3_xdr_setaclres(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
  993. {
  994. int status = ntohl(*p++);
  995. if (status)
  996. return nfs_stat_to_errno(status);
  997. xdr_decode_post_op_attr(p, fattr);
  998. return 0;
  999. }
  1000. #endif /* CONFIG_NFS_V3_ACL */
  1001. #define PROC(proc, argtype, restype, timer) \
  1002. [NFS3PROC_##proc] = { \
  1003. .p_proc = NFS3PROC_##proc, \
  1004. .p_encode = (kxdrproc_t) nfs3_xdr_##argtype, \
  1005. .p_decode = (kxdrproc_t) nfs3_xdr_##restype, \
  1006. .p_arglen = NFS3_##argtype##_sz, \
  1007. .p_replen = NFS3_##restype##_sz, \
  1008. .p_timer = timer, \
  1009. .p_statidx = NFS3PROC_##proc, \
  1010. .p_name = #proc, \
  1011. }
  1012. struct rpc_procinfo nfs3_procedures[] = {
  1013. PROC(GETATTR, fhandle, attrstat, 1),
  1014. PROC(SETATTR, sattrargs, wccstat, 0),
  1015. PROC(LOOKUP, diropargs, lookupres, 2),
  1016. PROC(ACCESS, accessargs, accessres, 1),
  1017. PROC(READLINK, readlinkargs, readlinkres, 3),
  1018. PROC(READ, readargs, readres, 3),
  1019. PROC(WRITE, writeargs, writeres, 4),
  1020. PROC(CREATE, createargs, createres, 0),
  1021. PROC(MKDIR, mkdirargs, createres, 0),
  1022. PROC(SYMLINK, symlinkargs, createres, 0),
  1023. PROC(MKNOD, mknodargs, createres, 0),
  1024. PROC(REMOVE, removeargs, removeres, 0),
  1025. PROC(RMDIR, diropargs, wccstat, 0),
  1026. PROC(RENAME, renameargs, renameres, 0),
  1027. PROC(LINK, linkargs, linkres, 0),
  1028. PROC(READDIR, readdirargs, readdirres, 3),
  1029. PROC(READDIRPLUS, readdirargs, readdirres, 3),
  1030. PROC(FSSTAT, fhandle, fsstatres, 0),
  1031. PROC(FSINFO, fhandle, fsinfores, 0),
  1032. PROC(PATHCONF, fhandle, pathconfres, 0),
  1033. PROC(COMMIT, commitargs, commitres, 5),
  1034. };
  1035. struct rpc_version nfs_version3 = {
  1036. .number = 3,
  1037. .nrprocs = ARRAY_SIZE(nfs3_procedures),
  1038. .procs = nfs3_procedures
  1039. };
  1040. #ifdef CONFIG_NFS_V3_ACL
  1041. static struct rpc_procinfo nfs3_acl_procedures[] = {
  1042. [ACLPROC3_GETACL] = {
  1043. .p_proc = ACLPROC3_GETACL,
  1044. .p_encode = (kxdrproc_t) nfs3_xdr_getaclargs,
  1045. .p_decode = (kxdrproc_t) nfs3_xdr_getaclres,
  1046. .p_arglen = ACL3_getaclargs_sz,
  1047. .p_replen = ACL3_getaclres_sz,
  1048. .p_timer = 1,
  1049. .p_name = "GETACL",
  1050. },
  1051. [ACLPROC3_SETACL] = {
  1052. .p_proc = ACLPROC3_SETACL,
  1053. .p_encode = (kxdrproc_t) nfs3_xdr_setaclargs,
  1054. .p_decode = (kxdrproc_t) nfs3_xdr_setaclres,
  1055. .p_arglen = ACL3_setaclargs_sz,
  1056. .p_replen = ACL3_setaclres_sz,
  1057. .p_timer = 0,
  1058. .p_name = "SETACL",
  1059. },
  1060. };
  1061. struct rpc_version nfsacl_version3 = {
  1062. .number = 3,
  1063. .nrprocs = sizeof(nfs3_acl_procedures)/
  1064. sizeof(nfs3_acl_procedures[0]),
  1065. .procs = nfs3_acl_procedures,
  1066. };
  1067. #endif /* CONFIG_NFS_V3_ACL */