Rename class_destroy to prevent namespace conflicts
PATCH 1/1 Rename class_destroy to prevent namespace conflicts
Stephen,
We keep hitting naming conflicts with class_destroy included via linux/device.h, as networking related headers are increasingly being used on in the core SELinux code. I've tried using external declarations previously to prevent e.g. skbuff.h being included, but it's not going to work in the general case. I suggest we simply rename the SELinux function to cls_destroy per the patch below.
Please review.
---
policydb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
security/selinux/ss/policydb.c +3 -3
@@ -468,7 +468,7 @@ static int common_destroy(void *key, voireturn 0 ; } -static int class_destroy (void *key,void *datum,void *p) +static int cls_destroy (void *key,void *datum,void *p) {struct class_datum *cladatum;struct constraint_node *constraint, *ctemp;
@@ -566,7 +566,7 @@ static int cat_destroy(void *key, void *static int (*destroy_f[SYM_NUM ]) (void *key,void *datum,void *datap) = { common_destroy, - class_destroy, + cls_destroy, role_destroy, type_destroy, user_destroy,
@@ -1124,7 +1124,7 @@ static int class_read(struct policydb *p out:return rc; bad: -class_destroy (key, cladatum,NULL ); +cls_destroy (key, cladatum,NULL ); goto out; }
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 10 lines · James Morris
Stephen,
We keep hitting naming conflicts with
class_destroyincluded vialinux/device.h, as networking related headers are increasingly being used on in the core SELinux code. I've tried using external declarations previously to prevent e.g.skbuff.hbeing included, but it's not going to work in the general case. I suggest we simply rename the SELinux function tocls_destroyper the patch below.Please review.
That's fine, although you might want to just add a qualifying prefix to those functions, like policydb_ or sel_ or whatever.
Quoted 39 lines
Signed-off-by James Morris <[email protected]>---
policydb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)security/selinux/ss/policydb.c +3
-3@@ -468,7 +468,7 @@ static int common_destroy(void *key, voireturn 0 ; } -static int class_destroy (void *key,void *datum,void *p) +static int cls_destroy (void *key,void *datum,void *p) {struct class_datum *cladatum;struct constraint_node *constraint, *ctemp;@@ -566,7 +566,7 @@ static int cat_destroy(void *key, void *static int (*destroy_f[SYM_NUM ]) (void *key,void *datum,void *datap) = { common_destroy, - class_destroy, + cls_destroy, role_destroy, type_destroy, user_destroy,@@ -1124,7 +1124,7 @@ static int class_read(struct policydb *p out:return rc; bad: -class_destroy (key, cladatum,NULL ); +cls_destroy (key, cladatum,NULL ); goto out; }
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 4 lines · Stephen Smalley
Quoted 1 line
Please review.
That's fine, although you might want to just add a qualifying prefix to those functions, like
policydb_orsel_or whatever.
Yep -- this seemed to be the least invasive, and adding a prefix just for class_destroy would be inconsistent.
- James
Signature · 7 lines
James Morris <[email protected]> -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Stephen Smalley
Acked-byQuoted 9 lines · James Morris
Quoted 4 lines · Stephen Smalley
Quoted 1 line
Please review.
That's fine, although you might want to just add a qualifying prefix to those functions, like
policydb_orsel_or whatever.Yep -- this seemed to be the least invasive, and adding a prefix just for
class_destroywould be inconsistent.
Ok,
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.