callback_xdr.c (27fd38c5226ed0f1712d071880fa8e739eb78650) callback_xdr.c (93b717fd81bf6b9a73c3702e9b079b4de8148b34)
1/*
2 * linux/fs/nfs/callback_xdr.c
3 *
4 * Copyright (C) 2004 Trond Myklebust
5 *
6 * NFSv4 callback encode/decode procedures
7 */
8#include <linux/kernel.h>

--- 132 unchanged lines hidden (view full) ---

141
142static __be32 decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
143{
144 __be32 *p;
145
146 p = read_buf(xdr, NFS4_STATEID_SIZE);
147 if (unlikely(p == NULL))
148 return htonl(NFS4ERR_RESOURCE);
1/*
2 * linux/fs/nfs/callback_xdr.c
3 *
4 * Copyright (C) 2004 Trond Myklebust
5 *
6 * NFSv4 callback encode/decode procedures
7 */
8#include <linux/kernel.h>

--- 132 unchanged lines hidden (view full) ---

141
142static __be32 decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
143{
144 __be32 *p;
145
146 p = read_buf(xdr, NFS4_STATEID_SIZE);
147 if (unlikely(p == NULL))
148 return htonl(NFS4ERR_RESOURCE);
149 memcpy(stateid, p, NFS4_STATEID_SIZE);
149 memcpy(stateid->data, p, NFS4_STATEID_SIZE);
150 return 0;
151}
152
150 return 0;
151}
152
153static __be32 decode_delegation_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
154{
155 stateid->type = NFS4_DELEGATION_STATEID_TYPE;
156 return decode_stateid(xdr, stateid);
157}
158
153static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound_hdr_arg *hdr)
154{
155 __be32 *p;
156 __be32 status;
157
158 status = decode_string(xdr, &hdr->taglen, &hdr->tag);
159 if (unlikely(status != 0))
160 return status;

--- 45 unchanged lines hidden (view full) ---

206 return status;
207}
208
209static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args)
210{
211 __be32 *p;
212 __be32 status;
213
159static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound_hdr_arg *hdr)
160{
161 __be32 *p;
162 __be32 status;
163
164 status = decode_string(xdr, &hdr->taglen, &hdr->tag);
165 if (unlikely(status != 0))
166 return status;

--- 45 unchanged lines hidden (view full) ---

212 return status;
213}
214
215static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args)
216{
217 __be32 *p;
218 __be32 status;
219
214 status = decode_stateid(xdr, &args->stateid);
220 status = decode_delegation_stateid(xdr, &args->stateid);
215 if (unlikely(status != 0))
216 goto out;
217 p = read_buf(xdr, 4);
218 if (unlikely(p == NULL)) {
219 status = htonl(NFS4ERR_RESOURCE);
220 goto out;
221 }
222 args->truncate = ntohl(*p);
223 status = decode_fh(xdr, &args->fh);
224out:
225 dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
226 return status;
227}
228
229#if defined(CONFIG_NFS_V4_1)
221 if (unlikely(status != 0))
222 goto out;
223 p = read_buf(xdr, 4);
224 if (unlikely(p == NULL)) {
225 status = htonl(NFS4ERR_RESOURCE);
226 goto out;
227 }
228 args->truncate = ntohl(*p);
229 status = decode_fh(xdr, &args->fh);
230out:
231 dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
232 return status;
233}
234
235#if defined(CONFIG_NFS_V4_1)
236static __be32 decode_layout_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
237{
238 stateid->type = NFS4_LAYOUT_STATEID_TYPE;
239 return decode_stateid(xdr, stateid);
240}
230
231static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
232 struct xdr_stream *xdr,
233 struct cb_layoutrecallargs *args)
234{
235 __be32 *p;
236 __be32 status = 0;
237 uint32_t iomode;

--- 20 unchanged lines hidden (view full) ---

258
259 p = read_buf(xdr, 2 * sizeof(uint64_t));
260 if (unlikely(p == NULL)) {
261 status = htonl(NFS4ERR_BADXDR);
262 goto out;
263 }
264 p = xdr_decode_hyper(p, &args->cbl_range.offset);
265 p = xdr_decode_hyper(p, &args->cbl_range.length);
241
242static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
243 struct xdr_stream *xdr,
244 struct cb_layoutrecallargs *args)
245{
246 __be32 *p;
247 __be32 status = 0;
248 uint32_t iomode;

--- 20 unchanged lines hidden (view full) ---

269
270 p = read_buf(xdr, 2 * sizeof(uint64_t));
271 if (unlikely(p == NULL)) {
272 status = htonl(NFS4ERR_BADXDR);
273 goto out;
274 }
275 p = xdr_decode_hyper(p, &args->cbl_range.offset);
276 p = xdr_decode_hyper(p, &args->cbl_range.length);
266 status = decode_stateid(xdr, &args->cbl_stateid);
277 status = decode_layout_stateid(xdr, &args->cbl_stateid);
267 if (unlikely(status != 0))
268 goto out;
269 } else if (args->cbl_recall_type == RETURN_FSID) {
270 p = read_buf(xdr, 2 * sizeof(uint64_t));
271 if (unlikely(p == NULL)) {
272 status = htonl(NFS4ERR_BADXDR);
273 goto out;
274 }

--- 758 unchanged lines hidden ---
278 if (unlikely(status != 0))
279 goto out;
280 } else if (args->cbl_recall_type == RETURN_FSID) {
281 p = read_buf(xdr, 2 * sizeof(uint64_t));
282 if (unlikely(p == NULL)) {
283 status = htonl(NFS4ERR_BADXDR);
284 goto out;
285 }

--- 758 unchanged lines hidden ---