summaryrefslogtreecommitdiffstats
path: root/sys/security
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2004-07-28 07:01:33 +0000
committerkan <kan@FreeBSD.org>2004-07-28 07:01:33 +0000
commit155eb2ef69ae4d2ee341f850bf3086ef28a07bf4 (patch)
treeef056cab170377399258c31a22ff9ddb327398f8 /sys/security
parent3140931e1f4468fc877cdf58192a63cbb525fc7c (diff)
downloadFreeBSD-src-155eb2ef69ae4d2ee341f850bf3086ef28a07bf4.zip
FreeBSD-src-155eb2ef69ae4d2ee341f850bf3086ef28a07bf4.tar.gz
Introduce SLOT_SET macro and use it in place of casts as lvalues.
Diffstat (limited to 'sys/security')
-rw-r--r--sys/security/mac_biba/mac_biba.c7
-rw-r--r--sys/security/mac_lomac/mac_lomac.c14
-rw-r--r--sys/security/mac_mls/mac_mls.c7
3 files changed, 16 insertions, 12 deletions
diff --git a/sys/security/mac_biba/mac_biba.c b/sys/security/mac_biba/mac_biba.c
index f8a7321..85028e0 100644
--- a/sys/security/mac_biba/mac_biba.c
+++ b/sys/security/mac_biba/mac_biba.c
@@ -124,6 +124,7 @@ TUNABLE_INT("security.mac.biba.revocation_enabled", &revocation_enabled);
static int mac_biba_slot;
#define SLOT(l) ((struct mac_biba *)LABEL_TO_SLOT((l), mac_biba_slot).l_ptr)
+#define SLOT_SET(l, val) (LABEL_TO_SLOT((l), mac_biba_slot).l_ptr = (val))
static uma_zone_t zone_biba;
@@ -501,14 +502,14 @@ static void
mac_biba_init_label(struct label *label)
{
- SLOT(label) = biba_alloc(M_WAITOK);
+ SLOT_SET(label, biba_alloc(M_WAITOK));
}
static int
mac_biba_init_label_waitcheck(struct label *label, int flag)
{
- SLOT(label) = biba_alloc(flag);
+ SLOT_SET(label, biba_alloc(flag));
if (SLOT(label) == NULL)
return (ENOMEM);
@@ -520,7 +521,7 @@ mac_biba_destroy_label(struct label *label)
{
biba_free(SLOT(label));
- SLOT(label) = NULL;
+ SLOT_SET(label, NULL);
}
/*
diff --git a/sys/security/mac_lomac/mac_lomac.c b/sys/security/mac_lomac/mac_lomac.c
index 5e5d569..4dd1572 100644
--- a/sys/security/mac_lomac/mac_lomac.c
+++ b/sys/security/mac_lomac/mac_lomac.c
@@ -125,8 +125,10 @@ TUNABLE_INT("security.mac.lomac.revocation_enabled", &revocation_enabled);
static int mac_lomac_slot;
#define SLOT(l) ((struct mac_lomac *)LABEL_TO_SLOT((l), mac_lomac_slot).l_ptr)
+#define SLOT_SET(l, val) (LABEL_TO_SLOT((l), mac_lomac_slot).l_ptr = (val))
#define PSLOT(l) ((struct mac_lomac_proc *) \
LABEL_TO_SLOT((l), mac_lomac_slot).l_ptr)
+#define PSLOT_SET(l, val) (LABEL_TO_SLOT((l), mac_lomac_slot).l_ptr = (val))
MALLOC_DEFINE(M_MACLOMAC, "lomac label", "MAC/LOMAC labels");
@@ -612,14 +614,14 @@ static void
mac_lomac_init_label(struct label *label)
{
- SLOT(label) = lomac_alloc(M_WAITOK);
+ SLOT_SET(label, lomac_alloc(M_WAITOK));
}
static int
mac_lomac_init_label_waitcheck(struct label *label, int flag)
{
- SLOT(label) = lomac_alloc(flag);
+ SLOT_SET(label, lomac_alloc(flag));
if (SLOT(label) == NULL)
return (ENOMEM);
@@ -630,8 +632,8 @@ static void
mac_lomac_init_proc_label(struct label *label)
{
- PSLOT(label) = malloc(sizeof(struct mac_lomac_proc), M_MACLOMAC,
- M_ZERO | M_WAITOK);
+ PSLOT_SET(label, malloc(sizeof(struct mac_lomac_proc), M_MACLOMAC,
+ M_ZERO | M_WAITOK));
mtx_init(&PSLOT(label)->mtx, "MAC/Lomac proc lock", NULL, MTX_DEF);
}
@@ -640,7 +642,7 @@ mac_lomac_destroy_label(struct label *label)
{
lomac_free(SLOT(label));
- SLOT(label) = NULL;
+ SLOT_SET(label, NULL);
}
static void
@@ -649,7 +651,7 @@ mac_lomac_destroy_proc_label(struct label *label)
mtx_destroy(&PSLOT(label)->mtx);
FREE(PSLOT(label), M_MACLOMAC);
- PSLOT(label) = NULL;
+ PSLOT_SET(label, NULL);
}
static int
diff --git a/sys/security/mac_mls/mac_mls.c b/sys/security/mac_mls/mac_mls.c
index ee390c3..3c5a88b 100644
--- a/sys/security/mac_mls/mac_mls.c
+++ b/sys/security/mac_mls/mac_mls.c
@@ -113,6 +113,7 @@ SYSCTL_INT(_security_mac_mls, OID_AUTO, max_compartments, CTLFLAG_RD,
static int mac_mls_slot;
#define SLOT(l) ((struct mac_mls *)LABEL_TO_SLOT((l), mac_mls_slot).l_ptr)
+#define SLOT_SET(l, val) (LABEL_TO_SLOT((l), mac_mls_slot).l_ptr = (val))
static uma_zone_t zone_mls;
@@ -467,14 +468,14 @@ static void
mac_mls_init_label(struct label *label)
{
- SLOT(label) = mls_alloc(M_WAITOK);
+ SLOT_SET(label, mls_alloc(M_WAITOK));
}
static int
mac_mls_init_label_waitcheck(struct label *label, int flag)
{
- SLOT(label) = mls_alloc(flag);
+ SLOT_SET(label, mls_alloc(flag));
if (SLOT(label) == NULL)
return (ENOMEM);
@@ -486,7 +487,7 @@ mac_mls_destroy_label(struct label *label)
{
mls_free(SLOT(label));
- SLOT(label) = NULL;
+ SLOT_SET(label, NULL);
}
/*
OpenPOWER on IntegriCloud