summaryrefslogtreecommitdiffstats
path: root/sys/security/mac_lomac/mac_lomac.c
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/mac_lomac/mac_lomac.c
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/mac_lomac/mac_lomac.c')
-rw-r--r--sys/security/mac_lomac/mac_lomac.c14
1 files changed, 8 insertions, 6 deletions
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
OpenPOWER on IntegriCloud