Skip to content

Commit 16c6636

Browse files
chuckleverJ. Bruce Fields
authored andcommitted
SUNRPC: Replace the "__be32 *p" parameter to .pc_decode
The passed-in value of the "__be32 *p" parameter is now unused in every server-side XDR decoder, and can be removed. Note also that there is a line in each decoder that sets up a local pointer to a struct xdr_stream. Passing that pointer from the dispatcher instead saves one line per decoder function. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
1 parent 5b747a5 commit 16c6636

File tree

16 files changed

+112
-149
lines changed

16 files changed

+112
-149
lines changed

fs/lockd/svc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,11 +780,10 @@ module_exit(exit_nlm);
780780
static int nlmsvc_dispatch(struct svc_rqst *rqstp, __be32 *statp)
781781
{
782782
const struct svc_procedure *procp = rqstp->rq_procinfo;
783-
struct kvec *argv = rqstp->rq_arg.head;
784783
struct kvec *resv = rqstp->rq_res.head;
785784

786785
svcxdr_init_decode(rqstp);
787-
if (!procp->pc_decode(rqstp, argv->iov_base))
786+
if (!procp->pc_decode(rqstp, &rqstp->rq_arg_stream))
788787
goto out_decode_err;
789788

790789
*statp = procp->pc_func(rqstp);

fs/lockd/xdr.c

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,14 @@ svcxdr_encode_testrply(struct xdr_stream *xdr, const struct nlm_res *resp)
146146
*/
147147

148148
int
149-
nlmsvc_decode_void(struct svc_rqst *rqstp, __be32 *p)
149+
nlmsvc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
150150
{
151151
return 1;
152152
}
153153

154154
int
155-
nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p)
155+
nlmsvc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
156156
{
157-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
158157
struct nlm_args *argp = rqstp->rq_argp;
159158
u32 exclusive;
160159

@@ -171,9 +170,8 @@ nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p)
171170
}
172171

173172
int
174-
nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p)
173+
nlmsvc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
175174
{
176-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
177175
struct nlm_args *argp = rqstp->rq_argp;
178176
u32 exclusive;
179177

@@ -197,9 +195,8 @@ nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p)
197195
}
198196

199197
int
200-
nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p)
198+
nlmsvc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
201199
{
202-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
203200
struct nlm_args *argp = rqstp->rq_argp;
204201
u32 exclusive;
205202

@@ -218,9 +215,8 @@ nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p)
218215
}
219216

220217
int
221-
nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p)
218+
nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
222219
{
223-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
224220
struct nlm_args *argp = rqstp->rq_argp;
225221

226222
if (!svcxdr_decode_cookie(xdr, &argp->cookie))
@@ -233,9 +229,8 @@ nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p)
233229
}
234230

235231
int
236-
nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p)
232+
nlmsvc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
237233
{
238-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
239234
struct nlm_res *resp = rqstp->rq_argp;
240235

241236
if (!svcxdr_decode_cookie(xdr, &resp->cookie))
@@ -247,10 +242,10 @@ nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p)
247242
}
248243

249244
int
250-
nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p)
245+
nlmsvc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr)
251246
{
252-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
253247
struct nlm_reboot *argp = rqstp->rq_argp;
248+
__be32 *p;
254249
u32 len;
255250

256251
if (xdr_stream_decode_u32(xdr, &len) < 0)
@@ -273,9 +268,8 @@ nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p)
273268
}
274269

275270
int
276-
nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
271+
nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
277272
{
278-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
279273
struct nlm_args *argp = rqstp->rq_argp;
280274
struct nlm_lock *lock = &argp->lock;
281275

@@ -301,9 +295,8 @@ nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
301295
}
302296

303297
int
304-
nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p)
298+
nlmsvc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
305299
{
306-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
307300
struct nlm_args *argp = rqstp->rq_argp;
308301
struct nlm_lock *lock = &argp->lock;
309302

fs/lockd/xdr4.c

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,14 @@ svcxdr_encode_testrply(struct xdr_stream *xdr, const struct nlm_res *resp)
145145
*/
146146

147147
int
148-
nlm4svc_decode_void(struct svc_rqst *rqstp, __be32 *p)
148+
nlm4svc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr)
149149
{
150150
return 1;
151151
}
152152

153153
int
154-
nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p)
154+
nlm4svc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
155155
{
156-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
157156
struct nlm_args *argp = rqstp->rq_argp;
158157
u32 exclusive;
159158

@@ -170,9 +169,8 @@ nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p)
170169
}
171170

172171
int
173-
nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p)
172+
nlm4svc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
174173
{
175-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
176174
struct nlm_args *argp = rqstp->rq_argp;
177175
u32 exclusive;
178176

@@ -196,9 +194,8 @@ nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p)
196194
}
197195

198196
int
199-
nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p)
197+
nlm4svc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
200198
{
201-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
202199
struct nlm_args *argp = rqstp->rq_argp;
203200
u32 exclusive;
204201

@@ -216,9 +213,8 @@ nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p)
216213
}
217214

218215
int
219-
nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p)
216+
nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
220217
{
221-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
222218
struct nlm_args *argp = rqstp->rq_argp;
223219

224220
if (!svcxdr_decode_cookie(xdr, &argp->cookie))
@@ -231,9 +227,8 @@ nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p)
231227
}
232228

233229
int
234-
nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p)
230+
nlm4svc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr)
235231
{
236-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
237232
struct nlm_res *resp = rqstp->rq_argp;
238233

239234
if (!svcxdr_decode_cookie(xdr, &resp->cookie))
@@ -245,10 +240,10 @@ nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p)
245240
}
246241

247242
int
248-
nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p)
243+
nlm4svc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr)
249244
{
250-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
251245
struct nlm_reboot *argp = rqstp->rq_argp;
246+
__be32 *p;
252247
u32 len;
253248

254249
if (xdr_stream_decode_u32(xdr, &len) < 0)
@@ -271,9 +266,8 @@ nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p)
271266
}
272267

273268
int
274-
nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
269+
nlm4svc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
275270
{
276-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
277271
struct nlm_args *argp = rqstp->rq_argp;
278272
struct nlm_lock *lock = &argp->lock;
279273

@@ -299,9 +293,8 @@ nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
299293
}
300294

301295
int
302-
nlm4svc_decode_notify(struct svc_rqst *rqstp, __be32 *p)
296+
nlm4svc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr)
303297
{
304-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
305298
struct nlm_args *argp = rqstp->rq_argp;
306299
struct nlm_lock *lock = &argp->lock;
307300

fs/nfsd/nfs2acl.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ static __be32 nfsacld_proc_access(struct svc_rqst *rqstp)
188188
* XDR decode functions
189189
*/
190190

191-
static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p)
191+
static int
192+
nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
192193
{
193-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
194194
struct nfsd3_getaclargs *argp = rqstp->rq_argp;
195195

196196
if (!svcxdr_decode_fhandle(xdr, &argp->fh))
@@ -201,9 +201,9 @@ static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p)
201201
return 1;
202202
}
203203

204-
static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p)
204+
static int
205+
nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
205206
{
206-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
207207
struct nfsd3_setaclargs *argp = rqstp->rq_argp;
208208

209209
if (!svcxdr_decode_fhandle(xdr, &argp->fh))
@@ -222,9 +222,9 @@ static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p)
222222
return 1;
223223
}
224224

225-
static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p)
225+
static int
226+
nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
226227
{
227-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
228228
struct nfsd3_accessargs *args = rqstp->rq_argp;
229229

230230
if (!svcxdr_decode_fhandle(xdr, &args->fh))

fs/nfsd/nfs3acl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst *rqstp)
127127
* XDR decode functions
128128
*/
129129

130-
static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p)
130+
static int
131+
nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
131132
{
132-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
133133
struct nfsd3_getaclargs *args = rqstp->rq_argp;
134134

135135
if (!svcxdr_decode_nfs_fh3(xdr, &args->fh))
@@ -140,9 +140,9 @@ static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p)
140140
return 1;
141141
}
142142

143-
static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p)
143+
static int
144+
nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
144145
{
145-
struct xdr_stream *xdr = &rqstp->rq_arg_stream;
146146
struct nfsd3_setaclargs *argp = rqstp->rq_argp;
147147

148148
if (!svcxdr_decode_nfs_fh3(xdr, &argp->fh))

0 commit comments

Comments
 (0)