]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
SELinux: turn mount options strings into defines
authorEric Paris <eparis@redhat.com>
Tue, 1 Apr 2008 17:24:09 +0000 (13:24 -0400)
committerJames Morris <jmorris@namei.org>
Fri, 18 Apr 2008 10:26:13 +0000 (20:26 +1000)
Convert the strings used for mount options into #defines rather than
retyping the string throughout the SELinux code.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: James Morris <jmorris@namei.org>
security/selinux/hooks.c
security/selinux/include/security.h

index 9d002f8484a3af190fb7afd7f07a1a887e56ee28..93c809a6e4fac5c1535650a2adb4d4811669c810 100644 (file)
@@ -321,10 +321,10 @@ enum {
 };
 
 static match_table_t tokens = {
-       {Opt_context, "context=%s"},
-       {Opt_fscontext, "fscontext=%s"},
-       {Opt_defcontext, "defcontext=%s"},
-       {Opt_rootcontext, "rootcontext=%s"},
+       {Opt_context, CONTEXT_STR "%s"},
+       {Opt_fscontext, FSCONTEXT_STR "%s"},
+       {Opt_defcontext, DEFCONTEXT_STR "%s"},
+       {Opt_rootcontext, ROOTCONTEXT_STR "%s"},
        {Opt_error, NULL},
 };
 
@@ -2287,10 +2287,10 @@ static inline int match_prefix(char *prefix, int plen, char *option, int olen)
 
 static inline int selinux_option(char *option, int len)
 {
-       return (match_prefix("context=", sizeof("context=")-1, option, len) ||
-               match_prefix("fscontext=", sizeof("fscontext=")-1, option, len) ||
-               match_prefix("defcontext=", sizeof("defcontext=")-1, option, len) ||
-               match_prefix("rootcontext=", sizeof("rootcontext=")-1, option, len));
+       return (match_prefix(CONTEXT_STR, sizeof(CONTEXT_STR)-1, option, len) ||
+               match_prefix(FSCONTEXT_STR, sizeof(FSCONTEXT_STR)-1, option, len) ||
+               match_prefix(DEFCONTEXT_STR, sizeof(DEFCONTEXT_STR)-1, option, len) ||
+               match_prefix(ROOTCONTEXT_STR, sizeof(ROOTCONTEXT_STR)-1, option, len));
 }
 
 static inline void take_option(char **to, char *from, int *first, int len)
index dd70aa084637d1b6387a69732f3ba682df9a4590..bc823ef70a12ce848e532840ce34b0187d4ea4f6 100644 (file)
 #define ROOTCONTEXT_MNT        0x04
 #define DEFCONTEXT_MNT 0x08
 
+#define CONTEXT_STR    "context="
+#define FSCONTEXT_STR  "fscontext="
+#define ROOTCONTEXT_STR        "rootcontext="
+#define DEFCONTEXT_STR "defcontext="
+
 struct netlbl_lsm_secattr;
 
 extern int selinux_enabled;