Skip to contentSkip to conversation

Namespacing of security/selinux

PATCH In review Thomas Liu 1 participant 1 message Jul 6, 2009 SELinux security module

lore
Share & tools
lore

Thomas Liu

author
#0 lore raw

PATCH 2/4 Namespacing of security/selinux

Namespacing of most files in security/selinux/ss, not including most of the functions in policydb.h nor things with the mls_ prefix.

---
 security/selinux/ss/avtab.c       |   92 ++++++++++----------
 security/selinux/ss/avtab.h       |   50 +++++-----
 security/selinux/ss/conditional.c |  110 ++++++++++++------------
 security/selinux/ss/conditional.h |   40 ++++----
 security/selinux/ss/constraint.h  |   12 ++--
 security/selinux/ss/context.h     |   20 ++--
 security/selinux/ss/ebitmap.c     |   58 ++++++------
 security/selinux/ss/ebitmap.h     |   46 +++++-----
 security/selinux/ss/hashtab.c     |   26 +++---
 security/selinux/ss/hashtab.h     |   28 +++---
 security/selinux/ss/mls.c         |   50 +++++-----
 security/selinux/ss/mls_types.h   |    6 +-
 security/selinux/ss/policydb.c    |  174 ++++++++++++++++++------------------
 security/selinux/ss/policydb.h    |   28 +++---
 security/selinux/ss/services.c    |  122 +++++++++++++-------------
 security/selinux/ss/symtab.c      |    6 +-
 security/selinux/ss/symtab.h      |    2 +-
 17 files changed, 435 insertions(+), 435 deletions(-)
security/selinux/ss/avtab.c +46 -46
index 1215b8e..eb9c7c0 100644
@@ -14,7 +14,7 @@
  *	the Free Software Foundation, version 2.
  *
  * Updated: Yuichi Nakamura <[email protected]>
- *	Tuned number of hash slots for avtab to reduce memory usage
+ *	Tuned number of hash slots for selinux_avtab to reduce memory usage
  */
 
 #include <linux/kernel.h>
@@ -25,18 +25,18 @@
 
 static struct kmem_cache *avtab_node_cachep;
 
-static inline int avtab_hash(struct avtab_key *keyp, u16 mask)
+static inline int avtab_hash(struct selinux_avtab_key *keyp, u16 mask)
 {
 	return ((keyp->target_class + (keyp->target_type << 2) +
 		 (keyp->source_type << 9)) & mask);
 }
 
-static struct avtab_node*
-avtab_insert_node(struct avtab *h, int hvalue,
-		  struct avtab_node *prev, struct avtab_node *cur,
-		  struct avtab_key *key, struct avtab_datum *datum)
+static struct selinux_avtab_node*
+selinux_avtab_insert_node(struct selinux_avtab *h, int hvalue,
+		  struct selinux_avtab_node *prev, struct selinux_avtab_node *cur,
+		  struct selinux_avtab_key *key, struct selinux_avtab_datum *datum)
 {
-	struct avtab_node *newnode;
+	struct selinux_avtab_node *newnode;
 	newnode = kmem_cache_zalloc(avtab_node_cachep, GFP_KERNEL);
 	if (newnode == NULL)
 		return NULL;
@@ -54,10 +54,10 @@ avtab_insert_node(struct avtab *h, int hvalue,
 	return newnode;
 }
 
-static int avtab_insert(struct avtab *h, struct avtab_key *key, struct avtab_datum *datum)
+static int avtab_insert(struct selinux_avtab *h, struct selinux_avtab_key *key, struct selinux_avtab_datum *datum)
 {
 	int hvalue;
-	struct avtab_node *prev, *cur, *newnode;
+	struct selinux_avtab_node *prev, *cur, *newnode;
 	u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD);
 
 	if (!h || !h->htable)
@@ -83,7 +83,7 @@ static int avtab_insert(struct avtab *h, struct avtab_key *key, struct avtab_dat
 			break;
 	}
 
-	newnode = avtab_insert_node(h, hvalue, prev, cur, key, datum);
+	newnode = selinux_avtab_insert_node(h, hvalue, prev, cur, key, datum);
 	if (!newnode)
 		return -ENOMEM;
 
@@ -94,11 +94,11 @@ static int avtab_insert(struct avtab *h, struct avtab_key *key, struct avtab_dat
  * key/specified mask into the table, as needed by the conditional avtab.
  * It also returns a pointer to the node inserted.
  */
-struct avtab_node *
-avtab_insert_nonunique(struct avtab *h, struct avtab_key *key, struct avtab_datum *datum)
+struct selinux_avtab_node *
+selinux_avtab_insert_nonunique(struct selinux_avtab *h, struct selinux_avtab_key *key, struct selinux_avtab_datum *datum)
 {
 	int hvalue;
-	struct avtab_node *prev, *cur;
+	struct selinux_avtab_node *prev, *cur;
 	u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD);
 
 	if (!h || !h->htable)
@@ -122,13 +122,13 @@ avtab_insert_nonunique(struct avtab *h, struct avtab_key *key, struct avtab_datu
 		    key->target_class < cur->key.target_class)
 			break;
 	}
-	return avtab_insert_node(h, hvalue, prev, cur, key, datum);
+	return selinux_avtab_insert_node(h, hvalue, prev, cur, key, datum);
 }
 
-struct avtab_datum *avtab_search(struct avtab *h, struct avtab_key *key)
+struct selinux_avtab_datum *avtab_search(struct selinux_avtab *h, struct selinux_avtab_key *key)
 {
 	int hvalue;
-	struct avtab_node *cur;
+	struct selinux_avtab_node *cur;
 	u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD);
 
 	if (!h || !h->htable)
@@ -157,13 +157,13 @@ struct avtab_datum *avtab_search(struct avtab *h, struct avtab_key *key)
 }
 
 /* This search function returns a node pointer, and can be used in
- * conjunction with avtab_search_next_node()
+ * conjunction with selinux_avtab_search_next_node()
  */
-struct avtab_node*
-avtab_search_node(struct avtab *h, struct avtab_key *key)
+struct selinux_avtab_node*
+selinux_avtab_search_node(struct selinux_avtab *h, struct selinux_avtab_key *key)
 {
 	int hvalue;
-	struct avtab_node *cur;
+	struct selinux_avtab_node *cur;
 	u16 specified = key->specified & ~(AVTAB_ENABLED|AVTAB_ENABLED_OLD);
 
 	if (!h || !h->htable)
@@ -190,10 +190,10 @@ avtab_search_node(struct avtab *h, struct avtab_key *key)
 	return NULL;
 }
 
-struct avtab_node*
-avtab_search_node_next(struct avtab_node *node, int specified)
+struct selinux_avtab_node*
+selinux_avtab_search_node_next(struct selinux_avtab_node *node, int specified)
 {
-	struct avtab_node *cur;
+	struct selinux_avtab_node *cur;
 
 	if (!node)
 		return NULL;
@@ -219,10 +219,10 @@ avtab_search_node_next(struct avtab_node *node, int specified)
 	return NULL;
 }
 
-void avtab_destroy(struct avtab *h)
+void selinux_avtab_destroy(struct selinux_avtab *h)
 {
 	int i;
-	struct avtab_node *cur, *temp;
+	struct selinux_avtab_node *cur, *temp;
 
 	if (!h || !h->htable)
 		return;
@@ -242,14 +242,14 @@ void avtab_destroy(struct avtab *h)
 	h->mask = 0;
 }
 
-int avtab_init(struct avtab *h)
+int selinux_avtab_init(struct selinux_avtab *h)
 {
 	h->htable = NULL;
 	h->nel = 0;
 	return 0;
 }
 
-int avtab_alloc(struct avtab *h, u32 nrules)
+int selinux_avtab_alloc(struct selinux_avtab *h, u32 nrules)
 {
 	u16 mask = 0;
 	u32 shift = 0;
@@ -278,16 +278,16 @@ int avtab_alloc(struct avtab *h, u32 nrules)
 	h->nel = 0;
 	h->nslot = nslot;
 	h->mask = mask;
-	printk(KERN_DEBUG "SELinux: %d avtab hash slots, %d rules.\n",
+	printk(KERN_DEBUG "SELinux: %d selinux_avtab hash slots, %d rules.\n",
 	       h->nslot, nrules);
 	return 0;
 }
 
-void avtab_hash_eval(struct avtab *h, char *tag)
+void selinux_avtab_hash_eval(struct selinux_avtab *h, char *tag)
 {
 	int i, chain_len, slots_used, max_chain_len;
 	unsigned long long chain2_len_sum;
-	struct avtab_node *cur;
+	struct selinux_avtab_node *cur;
 
 	slots_used = 0;
 	max_chain_len = 0;
@@ -323,22 +323,22 @@ static uint16_t spec_order[] = {
 	AVTAB_MEMBER
 };
 
-int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol,
-		    int (*insertf)(struct avtab *a, struct avtab_key *k,
-				   struct avtab_datum *d, void *p),
+int selinux_avtab_read_item(struct selinux_avtab *a, void *fp, struct policydb *pol,
+		    int (*insertf)(struct selinux_avtab *a, struct selinux_avtab_key *k,
+				   struct selinux_avtab_datum *d, void *p),
 		    void *p)
 {
 	__le16 buf16[4];
 	u16 enabled;
 	__le32 buf32[7];
 	u32 items, items2, val, vers = pol->policyvers;
-	struct avtab_key key;
-	struct avtab_datum datum;
+	struct selinux_avtab_key key;
+	struct selinux_avtab_datum datum;
 	int i, rc;
 	unsigned set;
 
-	memset(&key, 0, sizeof(struct avtab_key));
-	memset(&datum, 0, sizeof(struct avtab_datum));
+	memset(&key, 0, sizeof(struct selinux_avtab_key));
+	memset(&datum, 0, sizeof(struct selinux_avtab_datum));
 
 	if (vers < POLICYDB_VERSION_AVTAB) {
 		rc = next_entry(buf32, fp, sizeof(u32));
@@ -451,13 +451,13 @@ int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol,
 	return insertf(a, &key, &datum, p);
 }
 
-static int avtab_insertf(struct avtab *a, struct avtab_key *k,
-			 struct avtab_datum *d, void *p)
+static int avtab_insertf(struct selinux_avtab *a, struct selinux_avtab_key *k,
+			 struct selinux_avtab_datum *d, void *p)
 {
 	return avtab_insert(a, k, d);
 }
 
-int avtab_read(struct avtab *a, void *fp, struct policydb *pol)
+int selinux_avtab_read(struct selinux_avtab *a, void *fp, struct policydb *pol)
 {
 	int rc;
 	__le32 buf[1];
@@ -476,12 +476,12 @@ int avtab_read(struct avtab *a, void *fp, struct policydb *pol)
 		goto bad;
 	}
 
-	rc = avtab_alloc(a, nel);
+	rc = selinux_avtab_alloc(a, nel);
 	if (rc)
 		goto bad;
 
 	for (i = 0; i < nel; i++) {
-		rc = avtab_read_item(a, fp, pol, avtab_insertf, NULL);
+		rc = selinux_avtab_read_item(a, fp, pol, avtab_insertf, NULL);
 		if (rc) {
 			if (rc == -ENOMEM)
 				printk(KERN_ERR "SELinux: avtab: out of memory\n");
@@ -498,18 +498,18 @@ out:
 	return rc;
 
 bad:
-	avtab_destroy(a);
+	selinux_avtab_destroy(a);
 	goto out;
 }
 
-void avtab_cache_init(void)
+void selinux_avtab_cache_init(void)
 {
 	avtab_node_cachep = kmem_cache_create("avtab_node",
-					      sizeof(struct avtab_node),
+					      sizeof(struct selinux_avtab_node),
 					      0, SLAB_PANIC, NULL);
 }
 
-void avtab_cache_destroy(void)
+void selinux_avtab_cache_destroy(void)
 {
 	kmem_cache_destroy(avtab_node_cachep);
 }
security/selinux/ss/avtab.h +25 -25

84 lines not on this page · raw message

security/selinux/ss/conditional.c +55 -55

317 lines not on this page · raw message

security/selinux/ss/conditional.h +20 -20
index 53ddb01..163b49c 100644
@@ -20,7 +20,7 @@
  * A conditional expression is a list of operators and operands
  * in reverse polish notation.
  */
-struct cond_expr {
+struct selinux_cond_expr {
 #define COND_BOOL	1 /* plain bool */
 #define COND_NOT	2 /* !bool */
 #define COND_OR		3 /* bool || bool */
@@ -31,17 +31,17 @@ struct cond_expr {
 #define COND_LAST	COND_NEQ
 	__u32 expr_type;
 	__u32 bool;
-	struct cond_expr *next;
+	struct selinux_cond_expr *next;
 };
 
 /*
- * Each cond_node contains a list of rules to be enabled/disabled
+ * Each selinux_cond_node contains a list of rules to be enabled/disabled
  * depending on the current value of the conditional expression. This
  * struct is for that list.
  */
-struct cond_av_list {
-	struct avtab_node *node;
-	struct cond_av_list *next;
+struct selinux_cond_av_list {
+	struct selinux_avtab_node *node;
+	struct selinux_cond_av_list *next;
 };
 
 /*
@@ -51,27 +51,27 @@ struct cond_av_list {
  * expression (the true list corresponds to if and the false list corresponds
  * to else)..
  */
-struct cond_node {
+struct selinux_cond_node {
 	int cur_state;
-	struct cond_expr *expr;
-	struct cond_av_list *true_list;
-	struct cond_av_list *false_list;
-	struct cond_node *next;
+	struct selinux_cond_expr *expr;
+	struct selinux_cond_av_list *true_list;
+	struct selinux_cond_av_list *false_list;
+	struct selinux_cond_node *next;
 };
 
-int cond_policydb_init(struct policydb *p);
-void cond_policydb_destroy(struct policydb *p);
+int selinux_cond_policydb_init(struct policydb *p);
+void selinux_cond_policydb_destroy(struct policydb *p);
 
-int cond_init_bool_indexes(struct policydb *p);
-int cond_destroy_bool(void *key, void *datum, void *p);
+int selinux_cond_init_bool_indexes(struct policydb *p);
+int selinux_cond_destroy_bool(void *key, void *datum, void *p);
 
-int cond_index_bool(void *key, void *datum, void *datap);
+int selinux_cond_index_bool(void *key, void *datum, void *datap);
 
-int cond_read_bool(struct policydb *p, struct hashtab *h, void *fp);
-int cond_read_list(struct policydb *p, void *fp);
+int selinux_cond_read_bool(struct policydb *p, struct selinux_hashtab *h, void *fp);
+int selinux_cond_read_list(struct policydb *p, void *fp);
 
-void cond_compute_av(struct avtab *ctab, struct avtab_key *key, struct av_decision *avd);
+void selinux_cond_compute_av(struct selinux_avtab *ctab, struct selinux_avtab_key *key, struct av_decision *avd);
 
-int evaluate_cond_node(struct policydb *p, struct cond_node *node);
+int selinux_evaluate_cond_node(struct policydb *p, struct selinux_cond_node *node);
 
 #endif /* _CONDITIONAL_H_ */
security/selinux/ss/constraint.h +6 -6
index 149dda7..d07bd2a 100644
@@ -19,7 +19,7 @@
 
 #define CEXPR_MAXDEPTH 5
 
-struct constraint_expr {
+struct selinux_constraint_expr {
 #define CEXPR_NOT		1 /* not expr */
 #define CEXPR_AND		2 /* expr and expr */
 #define CEXPR_OR		3 /* expr or expr */
@@ -47,15 +47,15 @@ struct constraint_expr {
 #define CEXPR_INCOMP 5		/* incomp */
 	u32 op;			/* operator */
 
-	struct ebitmap names;	/* names */
+	struct selinux_ebitmap names;	/* names */
 
-	struct constraint_expr *next;   /* next expression */
+	struct selinux_constraint_expr *next;   /* next expression */
 };
 
-struct constraint_node {
+struct selinux_constraint_node {
 	u32 permissions;	/* constrained permissions */
-	struct constraint_expr *expr;	/* constraint on permissions */
-	struct constraint_node *next;	/* next constraint */
+	struct selinux_constraint_expr *expr;	/* constraint on permissions */
+	struct selinux_constraint_node *next;	/* next constraint */
 };
 
 #endif	/* _SS_CONSTRAINT_H_ */
security/selinux/ss/context.h +10 -10
index d9dd7a2..6e93020 100644
@@ -45,14 +45,14 @@ static inline int mls_context_cpy(struct context *dst, struct context *src)
 		return 0;
 
 	dst->range.level[0].sens = src->range.level[0].sens;
-	rc = ebitmap_cpy(&dst->range.level[0].cat, &src->range.level[0].cat);
+	rc = selinux_ebitmap_cpy(&dst->range.level[0].cat, &src->range.level[0].cat);
 	if (rc)
 		goto out;
 
 	dst->range.level[1].sens = src->range.level[1].sens;
-	rc = ebitmap_cpy(&dst->range.level[1].cat, &src->range.level[1].cat);
+	rc = selinux_ebitmap_cpy(&dst->range.level[1].cat, &src->range.level[1].cat);
 	if (rc)
-		ebitmap_destroy(&dst->range.level[0].cat);
+		selinux_ebitmap_destroy(&dst->range.level[0].cat);
 out:
 	return rc;
 }
@@ -68,14 +68,14 @@ static inline int mls_context_cpy_low(struct context *dst, struct context *src)
 		return 0;
 
 	dst->range.level[0].sens = src->range.level[0].sens;
-	rc = ebitmap_cpy(&dst->range.level[0].cat, &src->range.level[0].cat);
+	rc = selinux_ebitmap_cpy(&dst->range.level[0].cat, &src->range.level[0].cat);
 	if (rc)
 		goto out;
 
 	dst->range.level[1].sens = src->range.level[0].sens;
-	rc = ebitmap_cpy(&dst->range.level[1].cat, &src->range.level[0].cat);
+	rc = selinux_ebitmap_cpy(&dst->range.level[1].cat, &src->range.level[0].cat);
 	if (rc)
-		ebitmap_destroy(&dst->range.level[0].cat);
+		selinux_ebitmap_destroy(&dst->range.level[0].cat);
 out:
 	return rc;
 }
@@ -86,9 +86,9 @@ static inline int mls_context_cmp(struct context *c1, struct context *c2)
 		return 1;
 
 	return ((c1->range.level[0].sens == c2->range.level[0].sens) &&
-		ebitmap_cmp(&c1->range.level[0].cat, &c2->range.level[0].cat) &&
+		selinux_ebitmap_cmp(&c1->range.level[0].cat, &c2->range.level[0].cat) &&
 		(c1->range.level[1].sens == c2->range.level[1].sens) &&
-		ebitmap_cmp(&c1->range.level[1].cat, &c2->range.level[1].cat));
+		selinux_ebitmap_cmp(&c1->range.level[1].cat, &c2->range.level[1].cat));
 }
 
 static inline void mls_context_destroy(struct context *c)
@@ -96,8 +96,8 @@ static inline void mls_context_destroy(struct context *c)
 	if (!selinux_mls_enabled)
 		return;
 
-	ebitmap_destroy(&c->range.level[0].cat);
-	ebitmap_destroy(&c->range.level[1].cat);
+	selinux_ebitmap_destroy(&c->range.level[0].cat);
+	selinux_ebitmap_destroy(&c->range.level[1].cat);
 	mls_context_init(c);
 }
 
security/selinux/ss/ebitmap.c +29 -29

171 lines not on this page · raw message

security/selinux/ss/ebitmap.h +23 -23

105 lines not on this page · raw message

security/selinux/ss/hashtab.c +13 -13
index 933e735..bb3dad7 100644
@@ -8,11 +8,11 @@
 #include <linux/errno.h>
 #include "hashtab.h"
 
-struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const void *key),
-			       int (*keycmp)(struct hashtab *h, const void *key1, const void *key2),
+struct selinux_hashtab *selinux_hashtab_create(u32 (*hash_value)(struct selinux_hashtab *h, const void *key),
+			       int (*keycmp)(struct selinux_hashtab *h, const void *key1, const void *key2),
 			       u32 size)
 {
-	struct hashtab *p;
+	struct selinux_hashtab *p;
 	u32 i;
 
 	p = kzalloc(sizeof(*p), GFP_KERNEL);
@@ -35,10 +35,10 @@ struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const void *
 	return p;
 }
 
-int hashtab_insert(struct hashtab *h, void *key, void *datum)
+int selinux_hashtab_insert(struct selinux_hashtab *h, void *key, void *datum)
 {
 	u32 hvalue;
-	struct hashtab_node *prev, *cur, *newnode;
+	struct selinux_hashtab_node *prev, *cur, *newnode;
 
 	if (!h || h->nel == HASHTAB_MAX_NODES)
 		return -EINVAL;
@@ -71,10 +71,10 @@ int hashtab_insert(struct hashtab *h, void *key, void *datum)
 	return 0;
 }
 
-void *hashtab_search(struct hashtab *h, const void *key)
+void *selinux_hashtab_search(struct selinux_hashtab *h, const void *key)
 {
 	u32 hvalue;
-	struct hashtab_node *cur;
+	struct selinux_hashtab_node *cur;
 
 	if (!h)
 		return NULL;
@@ -90,10 +90,10 @@ void *hashtab_search(struct hashtab *h, const void *key)
 	return cur->datum;
 }
 
-void hashtab_destroy(struct hashtab *h)
+void selinux_hashtab_destroy(struct selinux_hashtab *h)
 {
 	u32 i;
-	struct hashtab_node *cur, *temp;
+	struct selinux_hashtab_node *cur, *temp;
 
 	if (!h)
 		return;
@@ -114,13 +114,13 @@ void hashtab_destroy(struct hashtab *h)
 	kfree(h);
 }
 
-int hashtab_map(struct hashtab *h,
+int selinux_hashtab_map(struct selinux_hashtab *h,
 		int (*apply)(void *k, void *d, void *args),
 		void *args)
 {
 	u32 i;
 	int ret;
-	struct hashtab_node *cur;
+	struct selinux_hashtab_node *cur;
 
 	if (!h)
 		return 0;
@@ -138,10 +138,10 @@ int hashtab_map(struct hashtab *h,
 }
 
 
-void hashtab_stat(struct hashtab *h, struct hashtab_info *info)
+void selinux_hashtab_stat(struct selinux_hashtab *h, struct selinux_hashtab_info *info)
 {
 	u32 i, chain_len, slots_used, max_chain_len;
-	struct hashtab_node *cur;
+	struct selinux_hashtab_node *cur;
 
 	slots_used = 0;
 	max_chain_len = 0;
security/selinux/ss/hashtab.h +14 -14
index 953872c..0a81e71 100644
@@ -12,23 +12,23 @@
 
 #define HASHTAB_MAX_NODES	0xffffffff
 
-struct hashtab_node {
+struct selinux_hashtab_node {
 	void *key;
 	void *datum;
-	struct hashtab_node *next;
+	struct selinux_hashtab_node *next;
 };
 
-struct hashtab {
-	struct hashtab_node **htable;	/* hash table */
+struct selinux_hashtab {
+	struct selinux_hashtab_node **htable;	/* hash table */
 	u32 size;			/* number of slots in hash table */
 	u32 nel;			/* number of elements in hash table */
-	u32 (*hash_value)(struct hashtab *h, const void *key);
+	u32 (*hash_value)(struct selinux_hashtab *h, const void *key);
 					/* hash function */
-	int (*keycmp)(struct hashtab *h, const void *key1, const void *key2);
+	int (*keycmp)(struct selinux_hashtab *h, const void *key1, const void *key2);
 					/* key comparison function */
 };
 
-struct hashtab_info {
+struct selinux_hashtab_info {
 	u32 slots_used;
 	u32 max_chain_len;
 };
@@ -39,8 +39,8 @@ struct hashtab_info {
  * Returns NULL if insufficent space is available or
  * the new hash table otherwise.
  */
-struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const void *key),
-			       int (*keycmp)(struct hashtab *h, const void *key1, const void *key2),
+struct selinux_hashtab *selinux_hashtab_create(u32 (*hash_value)(struct selinux_hashtab *h, const void *key),
+			       int (*keycmp)(struct selinux_hashtab *h, const void *key1, const void *key2),
 			       u32 size);
 
 /*
@@ -51,7 +51,7 @@ struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const void *
  * -EINVAL for general errors or
   0 otherwise.
  */
-int hashtab_insert(struct hashtab *h, void *k, void *d);
+int selinux_hashtab_insert(struct selinux_hashtab *h, void *k, void *d);
 
 /*
  * Searches for the entry with the specified key in the hash table.
@@ -59,12 +59,12 @@ int hashtab_insert(struct hashtab *h, void *k, void *d);
  * Returns NULL if no entry has the specified key or
  * the datum of the entry otherwise.
  */
-void *hashtab_search(struct hashtab *h, const void *k);
+void *selinux_hashtab_search(struct selinux_hashtab *h, const void *k);
 
 /*
  * Destroys the specified hash table.
  */
-void hashtab_destroy(struct hashtab *h);
+void selinux_hashtab_destroy(struct selinux_hashtab *h);
 
 /*
  * Applies the specified apply function to (key,datum,args)
@@ -77,11 +77,11 @@ void hashtab_destroy(struct hashtab *h);
  * iterating through the hash table and will propagate the error
  * return to its caller.
  */
-int hashtab_map(struct hashtab *h,
+int selinux_hashtab_map(struct selinux_hashtab *h,
 		int (*apply)(void *k, void *d, void *args),
 		void *args);
 
 /* Fill info with some hash table statistics */
-void hashtab_stat(struct hashtab *h, struct hashtab_info *info);
+void selinux_hashtab_stat(struct selinux_hashtab *h, struct selinux_hashtab_info *info);
 
 #endif	/* _SS_HASHTAB_H */
security/selinux/ss/mls.c +25 -25

166 lines not on this page · raw message

security/selinux/ss/mls_types.h +3 -3
index b6e943a..5d33694 100644
@@ -18,7 +18,7 @@
 
 struct mls_level {
 	u32 sens;		/* sensitivity */
-	struct ebitmap cat;	/* category set */
+	struct selinux_ebitmap cat;	/* category set */
 };
 
 struct mls_range {
@@ -31,7 +31,7 @@ static inline int mls_level_eq(struct mls_level *l1, struct mls_level *l2)
 		return 1;
 
 	return ((l1->sens == l2->sens) &&
-		ebitmap_cmp(&l1->cat, &l2->cat));
+		selinux_ebitmap_cmp(&l1->cat, &l2->cat));
 }
 
 static inline int mls_level_dom(struct mls_level *l1, struct mls_level *l2)
@@ -40,7 +40,7 @@ static inline int mls_level_dom(struct mls_level *l1, struct mls_level *l2)
 		return 1;
 
 	return ((l1->sens >= l2->sens) &&
-		ebitmap_contains(&l1->cat, &l2->cat));
+		selinux_ebitmap_contains(&l1->cat, &l2->cat));
 }
 
 #define mls_level_incomp(l1, l2) \
security/selinux/ss/policydb.c +87 -87

584 lines not on this page · raw message

security/selinux/ss/policydb.h +14 -14
index 55152d4..85716f0 100644
@@ -54,16 +54,16 @@ struct class_datum {
 	char *comkey;			/* common name */
 	struct common_datum *comdatum;	/* common datum */
 	struct symtab permissions;	/* class-specific permission symbol table */
-	struct constraint_node *constraints;	/* constraints on class permissions */
-	struct constraint_node *validatetrans;	/* special transition rules */
+	struct selinux_constraint_node *constraints;	/* constraints on class permissions */
+	struct selinux_constraint_node *validatetrans;	/* special transition rules */
 };
 
 /* Role attributes */
 struct role_datum {
 	u32 value;			/* internal role value */
 	u32 bounds;			/* boundary of role */
-	struct ebitmap dominates;	/* set of roles dominated by this role */
-	struct ebitmap types;		/* set of authorized types for role */
+	struct selinux_ebitmap dominates;	/* set of roles dominated by this role */
+	struct selinux_ebitmap types;		/* set of authorized types for role */
 };
 
 struct role_trans {
@@ -91,7 +91,7 @@ struct type_datum {
 struct user_datum {
 	u32 value;			/* internal user value */
 	u32 bounds;			/* bounds of user */
-	struct ebitmap roles;		/* set of authorized roles for user */
+	struct selinux_ebitmap roles;		/* set of authorized roles for user */
 	struct mls_range range;		/* MLS range (min - max) for user */
 	struct mls_level dfltlevel;	/* default login MLS level for user */
 };
@@ -118,12 +118,12 @@ struct range_trans {
 };
 
 /* Boolean data type */
-struct cond_bool_datum {
+struct selinux_cond_bool_datum {
 	__u32 value;		/* internal type value */
 	int state;
 };
 
-struct cond_node;
+struct selinux_cond_node;
 
 /*
  * The configuration data includes security contexts for
@@ -216,17 +216,17 @@ struct policydb {
 	struct type_datum **type_val_to_struct;
 
 	/* type enforcement access vectors and transitions */
-	struct avtab te_avtab;
+	struct selinux_avtab te_avtab;
 
 	/* role transitions */
 	struct role_trans *role_tr;
 
 	/* bools indexed by (value - 1) */
-	struct cond_bool_datum **bool_val_to_struct;
+	struct selinux_cond_bool_datum **bool_val_to_struct;
 	/* type enforcement conditional access vectors and transitions */
-	struct avtab te_cond_avtab;
+	struct selinux_avtab te_cond_avtab;
 	/* linked list indexing te_cond_avtab by conditional */
-	struct cond_node *cond_list;
+	struct selinux_cond_node *cond_list;
 
 	/* role allows */
 	struct role_allow *role_allow;
@@ -244,11 +244,11 @@ struct policydb {
 	struct range_trans *range_tr;
 
 	/* type -> attribute reverse mapping */
-	struct ebitmap *type_attr_map;
+	struct selinux_ebitmap *type_attr_map;
 
-	struct ebitmap policycaps;
+	struct selinux_ebitmap policycaps;
 
-	struct ebitmap permissive_map;
+	struct selinux_ebitmap permissive_map;
 
 	unsigned int policyvers;
 
security/selinux/ss/services.c +61 -61

399 lines not on this page · raw message

security/selinux/ss/symtab.c +3 -3
index 837658a..a55884e 100644
@@ -9,7 +9,7 @@
 #include <linux/errno.h>
 #include "symtab.h"
 
-static unsigned int symhash(struct hashtab *h, const void *key)
+static unsigned int symhash(struct selinux_hashtab *h, const void *key)
 {
 	const char *p, *keyp;
 	unsigned int size;
@@ -23,7 +23,7 @@ static unsigned int symhash(struct hashtab *h, const void *key)
 	return val & (h->size - 1);
 }
 
-static int symcmp(struct hashtab *h, const void *key1, const void *key2)
+static int symcmp(struct selinux_hashtab *h, const void *key1, const void *key2)
 {
 	const char *keyp1, *keyp2;
 
@@ -35,7 +35,7 @@ static int symcmp(struct hashtab *h, const void *key1, const void *key2)
 
 int symtab_init(struct symtab *s, unsigned int size)
 {
-	s->table = hashtab_create(symhash, symcmp, size);
+	s->table = selinux_hashtab_create(symhash, symcmp, size);
 	if (!s->table)
 		return -1;
 	s->nprim = 0;
security/selinux/ss/symtab.h +1 -1
index ca422b4..09bbf05 100644
@@ -12,7 +12,7 @@
 #include "hashtab.h"
 
 struct symtab {
-	struct hashtab *table;	/* hash table (keyed on a string) */
+	struct selinux_hashtab *table;	/* hash table (keyed on a string) */
 	u32 nprim;		/* number of primary names in table */
 };
 
Signature · 9 lines
1.6.2.5




--
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.