Skip to content

Commit 026fec7

Browse files
author
Christoph Hellwig
committed
sunrpc: properly type pc_decode callbacks
Drop the argp argument as it can trivially be derived from the rqstp argument. With that all functions now have the same prototype, and we can remove the unsafe casting to kxdrproc_t. Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 8537488 commit 026fec7

File tree

21 files changed

+237
-209
lines changed

21 files changed

+237
-209
lines changed

fs/lockd/svc4proc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ struct nlm_void { int dummy; };
496496

497497
#define PROC(name, xargt, xrest, argt, rest, respsize) \
498498
{ .pc_func = nlm4svc_proc_##name, \
499-
.pc_decode = (kxdrproc_t) nlm4svc_decode_##xargt, \
499+
.pc_decode = nlm4svc_decode_##xargt, \
500500
.pc_encode = (kxdrproc_t) nlm4svc_encode_##xrest, \
501501
.pc_release = NULL, \
502502
.pc_argsize = sizeof(struct nlm_##argt), \

fs/lockd/svcproc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ struct nlm_void { int dummy; };
538538

539539
#define PROC(name, xargt, xrest, argt, rest, respsize) \
540540
{ .pc_func = nlmsvc_proc_##name, \
541-
.pc_decode = (kxdrproc_t) nlmsvc_decode_##xargt, \
541+
.pc_decode = nlmsvc_decode_##xargt, \
542542
.pc_encode = (kxdrproc_t) nlmsvc_encode_##xrest, \
543543
.pc_release = NULL, \
544544
.pc_argsize = sizeof(struct nlm_##argt), \

fs/lockd/xdr.c

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,9 @@ nlm_encode_testres(__be32 *p, struct nlm_res *resp)
182182
* First, the server side XDR functions
183183
*/
184184
int
185-
nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
185+
nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p)
186186
{
187+
struct nlm_args *argp = rqstp->rq_argp;
187188
u32 exclusive;
188189

189190
if (!(p = nlm_decode_cookie(p, &argp->cookie)))
@@ -207,8 +208,9 @@ nlmsvc_encode_testres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
207208
}
208209

209210
int
210-
nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
211+
nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p)
211212
{
213+
struct nlm_args *argp = rqstp->rq_argp;
212214
u32 exclusive;
213215

214216
if (!(p = nlm_decode_cookie(p, &argp->cookie)))
@@ -227,8 +229,9 @@ nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
227229
}
228230

229231
int
230-
nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
232+
nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p)
231233
{
234+
struct nlm_args *argp = rqstp->rq_argp;
232235
u32 exclusive;
233236

234237
if (!(p = nlm_decode_cookie(p, &argp->cookie)))
@@ -243,8 +246,10 @@ nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
243246
}
244247

245248
int
246-
nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
249+
nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p)
247250
{
251+
struct nlm_args *argp = rqstp->rq_argp;
252+
248253
if (!(p = nlm_decode_cookie(p, &argp->cookie))
249254
|| !(p = nlm_decode_lock(p, &argp->lock)))
250255
return 0;
@@ -253,8 +258,9 @@ nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
253258
}
254259

255260
int
256-
nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
261+
nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
257262
{
263+
struct nlm_args *argp = rqstp->rq_argp;
258264
struct nlm_lock *lock = &argp->lock;
259265

260266
memset(lock, 0, sizeof(*lock));
@@ -293,8 +299,9 @@ nlmsvc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
293299
}
294300

295301
int
296-
nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp)
302+
nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p)
297303
{
304+
struct nlm_args *argp = rqstp->rq_argp;
298305
struct nlm_lock *lock = &argp->lock;
299306

300307
if (!(p = xdr_decode_string_inplace(p, &lock->caller,
@@ -305,8 +312,10 @@ nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp)
305312
}
306313

307314
int
308-
nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp)
315+
nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p)
309316
{
317+
struct nlm_reboot *argp = rqstp->rq_argp;
318+
310319
if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
311320
return 0;
312321
argp->state = ntohl(*p++);
@@ -316,16 +325,18 @@ nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp)
316325
}
317326

318327
int
319-
nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
328+
nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p)
320329
{
330+
struct nlm_res *resp = rqstp->rq_argp;
331+
321332
if (!(p = nlm_decode_cookie(p, &resp->cookie)))
322333
return 0;
323334
resp->status = *p++;
324335
return xdr_argsize_check(rqstp, p);
325336
}
326337

327338
int
328-
nlmsvc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
339+
nlmsvc_decode_void(struct svc_rqst *rqstp, __be32 *p)
329340
{
330341
return xdr_argsize_check(rqstp, p);
331342
}

fs/lockd/xdr4.c

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,9 @@ nlm4_encode_testres(__be32 *p, struct nlm_res *resp)
179179
* First, the server side XDR functions
180180
*/
181181
int
182-
nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
182+
nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p)
183183
{
184+
struct nlm_args *argp = rqstp->rq_argp;
184185
u32 exclusive;
185186

186187
if (!(p = nlm4_decode_cookie(p, &argp->cookie)))
@@ -204,8 +205,9 @@ nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
204205
}
205206

206207
int
207-
nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
208+
nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p)
208209
{
210+
struct nlm_args *argp = rqstp->rq_argp;
209211
u32 exclusive;
210212

211213
if (!(p = nlm4_decode_cookie(p, &argp->cookie)))
@@ -224,8 +226,9 @@ nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
224226
}
225227

226228
int
227-
nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
229+
nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p)
228230
{
231+
struct nlm_args *argp = rqstp->rq_argp;
229232
u32 exclusive;
230233

231234
if (!(p = nlm4_decode_cookie(p, &argp->cookie)))
@@ -240,8 +243,10 @@ nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
240243
}
241244

242245
int
243-
nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
246+
nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p)
244247
{
248+
struct nlm_args *argp = rqstp->rq_argp;
249+
245250
if (!(p = nlm4_decode_cookie(p, &argp->cookie))
246251
|| !(p = nlm4_decode_lock(p, &argp->lock)))
247252
return 0;
@@ -250,8 +255,9 @@ nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
250255
}
251256

252257
int
253-
nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
258+
nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p)
254259
{
260+
struct nlm_args *argp = rqstp->rq_argp;
255261
struct nlm_lock *lock = &argp->lock;
256262

257263
memset(lock, 0, sizeof(*lock));
@@ -290,8 +296,9 @@ nlm4svc_encode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
290296
}
291297

292298
int
293-
nlm4svc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp)
299+
nlm4svc_decode_notify(struct svc_rqst *rqstp, __be32 *p)
294300
{
301+
struct nlm_args *argp = rqstp->rq_argp;
295302
struct nlm_lock *lock = &argp->lock;
296303

297304
if (!(p = xdr_decode_string_inplace(p, &lock->caller,
@@ -302,8 +309,10 @@ nlm4svc_decode_notify(struct svc_rqst *rqstp, __be32 *p, struct nlm_args *argp)
302309
}
303310

304311
int
305-
nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp)
312+
nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p)
306313
{
314+
struct nlm_reboot *argp = rqstp->rq_argp;
315+
307316
if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
308317
return 0;
309318
argp->state = ntohl(*p++);
@@ -313,16 +322,18 @@ nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp
313322
}
314323

315324
int
316-
nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
325+
nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p)
317326
{
327+
struct nlm_res *resp = rqstp->rq_argp;
328+
318329
if (!(p = nlm4_decode_cookie(p, &resp->cookie)))
319330
return 0;
320331
resp->status = *p++;
321332
return xdr_argsize_check(rqstp, p);
322333
}
323334

324335
int
325-
nlm4svc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
336+
nlm4svc_decode_void(struct svc_rqst *rqstp, __be32 *p)
326337
{
327338
return xdr_argsize_check(rqstp, p);
328339
}

fs/nfs/callback_xdr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static __be32 nfs4_callback_null(struct svc_rqst *rqstp)
5858
return htonl(NFS4_OK);
5959
}
6060

61-
static int nfs4_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
61+
static int nfs4_decode_void(struct svc_rqst *rqstp, __be32 *p)
6262
{
6363
return xdr_argsize_check(rqstp, p);
6464
}
@@ -998,7 +998,7 @@ static struct callback_op callback_ops[] = {
998998
static struct svc_procedure nfs4_callback_procedures1[] = {
999999
[CB_NULL] = {
10001000
.pc_func = nfs4_callback_null,
1001-
.pc_decode = (kxdrproc_t)nfs4_decode_void,
1001+
.pc_decode = nfs4_decode_void,
10021002
.pc_encode = (kxdrproc_t)nfs4_encode_void,
10031003
.pc_xdrressize = 1,
10041004
},

fs/nfsd/nfs2acl.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,10 @@ static __be32 nfsacld_proc_access(struct svc_rqst *rqstp)
182182
/*
183183
* XDR decode functions
184184
*/
185-
static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
186-
struct nfsd3_getaclargs *argp)
185+
static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p)
187186
{
187+
struct nfsd3_getaclargs *argp = rqstp->rq_argp;
188+
188189
p = nfs2svc_decode_fh(p, &argp->fh);
189190
if (!p)
190191
return 0;
@@ -194,9 +195,9 @@ static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
194195
}
195196

196197

197-
static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
198-
struct nfsd3_setaclargs *argp)
198+
static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p)
199199
{
200+
struct nfsd3_setaclargs *argp = rqstp->rq_argp;
200201
struct kvec *head = rqstp->rq_arg.head;
201202
unsigned int base;
202203
int n;
@@ -220,18 +221,20 @@ static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
220221
return (n > 0);
221222
}
222223

223-
static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p,
224-
struct nfsd_fhandle *argp)
224+
static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p)
225225
{
226+
struct nfsd_fhandle *argp = rqstp->rq_argp;
227+
226228
p = nfs2svc_decode_fh(p, &argp->fh);
227229
if (!p)
228230
return 0;
229231
return xdr_argsize_check(rqstp, p);
230232
}
231233

232-
static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p,
233-
struct nfsd3_accessargs *argp)
234+
static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p)
234235
{
236+
struct nfsd3_accessargs *argp = rqstp->rq_argp;
237+
235238
p = nfs2svc_decode_fh(p, &argp->fh);
236239
if (!p)
237240
return 0;
@@ -351,7 +354,7 @@ struct nfsd3_voidargs { int dummy; };
351354
#define PROC(name, argt, rest, relt, cache, respsize) \
352355
{ \
353356
.pc_func = nfsacld_proc_##name, \
354-
.pc_decode = (kxdrproc_t) nfsaclsvc_decode_##argt##args, \
357+
.pc_decode = nfsaclsvc_decode_##argt##args, \
355358
.pc_encode = (kxdrproc_t) nfsaclsvc_encode_##rest##res, \
356359
.pc_release = nfsaclsvc_release_##relt, \
357360
.pc_argsize = sizeof(struct nfsd3_##argt##args), \

fs/nfsd/nfs3acl.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,10 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst *rqstp)
124124
/*
125125
* XDR decode functions
126126
*/
127-
static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
128-
struct nfsd3_getaclargs *args)
127+
static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p)
129128
{
129+
struct nfsd3_getaclargs *args = rqstp->rq_argp;
130+
130131
p = nfs3svc_decode_fh(p, &args->fh);
131132
if (!p)
132133
return 0;
@@ -136,9 +137,9 @@ static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p,
136137
}
137138

138139

139-
static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
140-
struct nfsd3_setaclargs *args)
140+
static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p)
141141
{
142+
struct nfsd3_setaclargs *args = rqstp->rq_argp;
142143
struct kvec *head = rqstp->rq_arg.head;
143144
unsigned int base;
144145
int n;
@@ -241,7 +242,7 @@ struct nfsd3_voidargs { int dummy; };
241242
#define PROC(name, argt, rest, relt, cache, respsize) \
242243
{ \
243244
.pc_func = nfsd3_proc_##name, \
244-
.pc_decode = (kxdrproc_t) nfs3svc_decode_##argt##args, \
245+
.pc_decode = nfs3svc_decode_##argt##args, \
245246
.pc_encode = (kxdrproc_t) nfs3svc_encode_##rest##res, \
246247
.pc_release = nfs3svc_release_##relt, \
247248
.pc_argsize = sizeof(struct nfsd3_##argt##args), \

0 commit comments

Comments
 (0)