Skip to contentSkip to conversation

Rename class_destroy to prevent namespace conflicts

PATCH In review James Morris 2 participants 4 messages Nov 29, 2006 – Nov 30, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

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
index ba48961..cd79c63 100644
@@ -468,7 +468,7 @@ static int common_destroy(void *key, voi
 	return 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.

#1 lore raw
Quoted 10 lines · James Morris

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.

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

---

 policydb.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
security/selinux/ss/policydb.c +3 -3
index ba48961..cd79c63 100644
@@ -468,7 +468,7 @@ static int common_destroy(void *key, voi
 	return 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.
#2 lore raw
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_ or sel_ 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.
#3 lore raw
Quoted 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_ or sel_ or whatever.

Yep -- this seemed to be the least invasive, and adding a prefix just for class_destroy would 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.