Skip to contentSkip to conversation

libsepol: Move ebitmap_* functions from mcstrans to libsepol

PATCH New Steve Lawrence 1 participant 1 message Oct 18, 2011 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libsepol: Move ebitmap_* functions from mcstrans to libsepol

This patches moves some ebitmap functions (and, xor, not, etc.) from mcstrans into libsepol, where they really belong and could be used by other applications (e.g. CIL)

---
 libsepol/include/sepol/policydb/ebitmap.h |    6 ++
 libsepol/src/ebitmap.c                    |   76 ++++++++++++++++++++++++
 libsepol/src/private.h                    |    3 +
 policycoreutils/mcstrans/src/mcstrans.c   |   91 ++---------------------------
 4 files changed, 91 insertions(+), 85 deletions(-)
libsepol/include/sepol/policydb/ebitmap.h +6 -0
index 410c15c..214da95 100644
@@ -76,6 +76,12 @@ static inline int ebitmap_node_get_bit(ebitmap_node_t * n, unsigned int bit)
 extern int ebitmap_cmp(const ebitmap_t * e1, const ebitmap_t * e2);
 extern int ebitmap_or(ebitmap_t * dst, const ebitmap_t * e1, const ebitmap_t * e2);
 extern int ebitmap_union(ebitmap_t * dst, const ebitmap_t * e1);
+extern int ebitmap_and(ebitmap_t *dst, ebitmap_t *e1, ebitmap_t *e2);
+extern int ebitmap_xor(ebitmap_t *dst, ebitmap_t *e1, ebitmap_t *e2);
+extern int ebitmap_not(ebitmap_t *dst, ebitmap_t *e1, unsigned int maxbit);
+extern int ebitmap_andnot(ebitmap_t *dst, ebitmap_t *e1, ebitmap_t *e2, unsigned int maxbit);
+extern unsigned int ebitmap_cardinality(ebitmap_t *e1);
+extern int ebitmap_hamming_distance(ebitmap_t * e1, ebitmap_t * e2);
 extern int ebitmap_cpy(ebitmap_t * dst, const ebitmap_t * src);
 extern int ebitmap_contains(const ebitmap_t * e1, const ebitmap_t * e2);
 extern int ebitmap_get_bit(const ebitmap_t * e, unsigned int bit);
libsepol/src/ebitmap.c +76 -0

82 lines not on this page · raw message

libsepol/src/private.h +3 -0
index b2b247e..24a544d 100644
@@ -28,6 +28,9 @@
 #undef min
 #define min(a,b) (((a) < (b)) ? (a) : (b))
 
+#undef max
+#define max(a,b) ((a) >= (b) ? (a) : (b))
+
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
 
 /* Policy compatibility information. */
policycoreutils/mcstrans/src/mcstrans.c +6 -85

139 lines not on this page · raw message

Signature · 7 lines
1.7.4.4


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