nfs3xdr.c 29 KB

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