Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

NFSACL: Replace PROC() macro with open code

Clean up: Follow-up on ten-year-old commit b9081d90f5b9 ("NFS: kill
off complicated macro 'PROC'") by performing the same conversion in
the NFSACL code. To reduce the chance of error, I copied the original
C preprocessor output and then made some minor edits.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>

authored by

Chuck Lever and committed by
J. Bruce Fields
ba1df797 49d99608

+80 -43
+49 -23
fs/nfsd/nfs2acl.c
··· 347 347 fh_put(&resp->fh); 348 348 } 349 349 350 - #define nfsaclsvc_decode_voidargs NULL 351 - #define nfsaclsvc_release_void NULL 352 - #define nfsd3_fhandleargs nfsd_fhandle 353 - #define nfsd3_attrstatres nfsd_attrstat 354 - #define nfsd3_voidres nfsd3_voidargs 355 350 struct nfsd3_voidargs { int dummy; }; 356 - 357 - #define PROC(name, argt, rest, relt, cache, respsize) \ 358 - { \ 359 - .pc_func = nfsacld_proc_##name, \ 360 - .pc_decode = nfsaclsvc_decode_##argt##args, \ 361 - .pc_encode = nfsaclsvc_encode_##rest##res, \ 362 - .pc_release = nfsaclsvc_release_##relt, \ 363 - .pc_argsize = sizeof(struct nfsd3_##argt##args), \ 364 - .pc_ressize = sizeof(struct nfsd3_##rest##res), \ 365 - .pc_cachetype = cache, \ 366 - .pc_xdrressize = respsize, \ 367 - } 368 351 369 352 #define ST 1 /* status*/ 370 353 #define AT 21 /* attributes */ 371 354 #define pAT (1+AT) /* post attributes - conditional */ 372 355 #define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */ 373 356 374 - static const struct svc_procedure nfsd_acl_procedures2[] = { 375 - PROC(null, void, void, void, RC_NOCACHE, ST), 376 - PROC(getacl, getacl, getacl, getacl, RC_NOCACHE, ST+1+2*(1+ACL)), 377 - PROC(setacl, setacl, attrstat, attrstat, RC_NOCACHE, ST+AT), 378 - PROC(getattr, fhandle, attrstat, attrstat, RC_NOCACHE, ST+AT), 379 - PROC(access, access, access, access, RC_NOCACHE, ST+AT+1), 357 + static const struct svc_procedure nfsd_acl_procedures2[5] = { 358 + [ACLPROC2_NULL] = { 359 + .pc_func = nfsacld_proc_null, 360 + .pc_encode = nfsaclsvc_encode_voidres, 361 + .pc_argsize = sizeof(struct nfsd3_voidargs), 362 + .pc_ressize = sizeof(struct nfsd3_voidargs), 363 + .pc_cachetype = RC_NOCACHE, 364 + .pc_xdrressize = ST, 365 + }, 366 + [ACLPROC2_GETACL] = { 367 + .pc_func = nfsacld_proc_getacl, 368 + .pc_decode = nfsaclsvc_decode_getaclargs, 369 + .pc_encode = nfsaclsvc_encode_getaclres, 370 + .pc_release = nfsaclsvc_release_getacl, 371 + .pc_argsize = sizeof(struct nfsd3_getaclargs), 372 + .pc_ressize = sizeof(struct nfsd3_getaclres), 373 + .pc_cachetype = RC_NOCACHE, 374 + .pc_xdrressize = ST+1+2*(1+ACL), 375 + }, 376 + [ACLPROC2_SETACL] = { 377 + .pc_func = nfsacld_proc_setacl, 378 + .pc_decode = nfsaclsvc_decode_setaclargs, 379 + .pc_encode = nfsaclsvc_encode_attrstatres, 380 + .pc_release = nfsaclsvc_release_attrstat, 381 + .pc_argsize = sizeof(struct nfsd3_setaclargs), 382 + .pc_ressize = sizeof(struct nfsd_attrstat), 383 + .pc_cachetype = RC_NOCACHE, 384 + .pc_xdrressize = ST+AT, 385 + }, 386 + [ACLPROC2_GETATTR] = { 387 + .pc_func = nfsacld_proc_getattr, 388 + .pc_decode = nfsaclsvc_decode_fhandleargs, 389 + .pc_encode = nfsaclsvc_encode_attrstatres, 390 + .pc_release = nfsaclsvc_release_attrstat, 391 + .pc_argsize = sizeof(struct nfsd_fhandle), 392 + .pc_ressize = sizeof(struct nfsd_attrstat), 393 + .pc_cachetype = RC_NOCACHE, 394 + .pc_xdrressize = ST+AT, 395 + }, 396 + [ACLPROC2_ACCESS] = { 397 + .pc_func = nfsacld_proc_access, 398 + .pc_decode = nfsaclsvc_decode_accessargs, 399 + .pc_encode = nfsaclsvc_encode_accessres, 400 + .pc_release = nfsaclsvc_release_access, 401 + .pc_argsize = sizeof(struct nfsd3_accessargs), 402 + .pc_ressize = sizeof(struct nfsd3_accessres), 403 + .pc_cachetype = RC_NOCACHE, 404 + .pc_xdrressize = ST+AT+1, 405 + }, 380 406 }; 381 407 382 408 static unsigned int nfsd_acl_count2[ARRAY_SIZE(nfsd_acl_procedures2)];
+29 -20
fs/nfsd/nfs3acl.c
··· 235 235 posix_acl_release(resp->acl_default); 236 236 } 237 237 238 - #define nfs3svc_decode_voidargs NULL 239 - #define nfs3svc_release_void NULL 240 - #define nfsd3_setaclres nfsd3_attrstat 241 - #define nfsd3_voidres nfsd3_voidargs 242 238 struct nfsd3_voidargs { int dummy; }; 243 - 244 - #define PROC(name, argt, rest, relt, cache, respsize) \ 245 - { \ 246 - .pc_func = nfsd3_proc_##name, \ 247 - .pc_decode = nfs3svc_decode_##argt##args, \ 248 - .pc_encode = nfs3svc_encode_##rest##res, \ 249 - .pc_release = nfs3svc_release_##relt, \ 250 - .pc_argsize = sizeof(struct nfsd3_##argt##args), \ 251 - .pc_ressize = sizeof(struct nfsd3_##rest##res), \ 252 - .pc_cachetype = cache, \ 253 - .pc_xdrressize = respsize, \ 254 - } 255 239 256 240 #define ST 1 /* status*/ 257 241 #define AT 21 /* attributes */ 258 242 #define pAT (1+AT) /* post attributes - conditional */ 259 243 #define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */ 260 244 261 - static const struct svc_procedure nfsd_acl_procedures3[] = { 262 - PROC(null, void, void, void, RC_NOCACHE, ST), 263 - PROC(getacl, getacl, getacl, getacl, RC_NOCACHE, ST+1+2*(1+ACL)), 264 - PROC(setacl, setacl, setacl, fhandle, RC_NOCACHE, ST+pAT), 245 + static const struct svc_procedure nfsd_acl_procedures3[3] = { 246 + [ACLPROC3_NULL] = { 247 + .pc_func = nfsd3_proc_null, 248 + .pc_encode = nfs3svc_encode_voidres, 249 + .pc_argsize = sizeof(struct nfsd3_voidargs), 250 + .pc_ressize = sizeof(struct nfsd3_voidargs), 251 + .pc_cachetype = RC_NOCACHE, 252 + .pc_xdrressize = ST, 253 + }, 254 + [ACLPROC3_GETACL] = { 255 + .pc_func = nfsd3_proc_getacl, 256 + .pc_decode = nfs3svc_decode_getaclargs, 257 + .pc_encode = nfs3svc_encode_getaclres, 258 + .pc_release = nfs3svc_release_getacl, 259 + .pc_argsize = sizeof(struct nfsd3_getaclargs), 260 + .pc_ressize = sizeof(struct nfsd3_getaclres), 261 + .pc_cachetype = RC_NOCACHE, 262 + .pc_xdrressize = ST+1+2*(1+ACL), 263 + }, 264 + [ACLPROC3_SETACL] = { 265 + .pc_func = nfsd3_proc_setacl, 266 + .pc_decode = nfs3svc_decode_setaclargs, 267 + .pc_encode = nfs3svc_encode_setaclres, 268 + .pc_release = nfs3svc_release_fhandle, 269 + .pc_argsize = sizeof(struct nfsd3_setaclargs), 270 + .pc_ressize = sizeof(struct nfsd3_attrstat), 271 + .pc_cachetype = RC_NOCACHE, 272 + .pc_xdrressize = ST+pAT, 273 + }, 265 274 }; 266 275 267 276 static unsigned int nfsd_acl_count3[ARRAY_SIZE(nfsd_acl_procedures3)];
+2
include/uapi/linux/nfsacl.h
··· 9 9 10 10 #define NFS_ACL_PROGRAM 100227 11 11 12 + #define ACLPROC2_NULL 0 12 13 #define ACLPROC2_GETACL 1 13 14 #define ACLPROC2_SETACL 2 14 15 #define ACLPROC2_GETATTR 3 15 16 #define ACLPROC2_ACCESS 4 16 17 18 + #define ACLPROC3_NULL 0 17 19 #define ACLPROC3_GETACL 1 18 20 #define ACLPROC3_SETACL 2 19 21