about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/gen-tunables.awk68
1 files changed, 34 insertions, 34 deletions
diff --git a/scripts/gen-tunables.awk b/scripts/gen-tunables.awk
index 93e5aff0ef..ccdd0c6c71 100644
--- a/scripts/gen-tunables.awk
+++ b/scripts/gen-tunables.awk
@@ -39,20 +39,20 @@ $2 == "{" {
 $1 == "}" {
   if (tunable != "") {
     # Tunables definition ended, now fill in default attributes.
-    if (!types[top_ns][ns][tunable]) {
-      types[top_ns][ns][tunable] = "STRING"
+    if (!types[top_ns,ns,tunable]) {
+      types[top_ns,ns,tunable] = "STRING"
     }
-    if (!minvals[top_ns][ns][tunable]) {
-      minvals[top_ns][ns][tunable] = "0"
+    if (!minvals[top_ns,ns,tunable]) {
+      minvals[top_ns,ns,tunable] = "0"
     }
-    if (!maxvals[top_ns][ns][tunable]) {
-      maxvals[top_ns][ns][tunable] = "0"
+    if (!maxvals[top_ns,ns,tunable]) {
+      maxvals[top_ns,ns,tunable] = "0"
     }
-    if (!env_alias[top_ns][ns][tunable]) {
-      env_alias[top_ns][ns][tunable] = "NULL"
+    if (!env_alias[top_ns,ns,tunable]) {
+      env_alias[top_ns,ns,tunable] = "NULL"
     }
-    if (!security_level[top_ns][ns][tunable]) {
-      security_level[top_ns][ns][tunable] = "SXID_ERASE"
+    if (!security_level[top_ns,ns,tunable]) {
+      security_level[top_ns,ns,tunable] = "SXID_ERASE"
     }
 
     tunable = ""
@@ -81,7 +81,7 @@ $1 == "}" {
   if (tunable == "") {
     # We encountered a tunable without any attributes, so note it with a
     # default.
-    types[top_ns][ns][$1] = "STRING"
+    types[top_ns,ns,$1] = "STRING"
     next
   }
 
@@ -91,20 +91,20 @@ $1 == "}" {
   val = gensub(/^[ \t]+|[ \t]+$/, "", "g", arr[2])
 
   if (attr == "type") {
-    types[top_ns][ns][tunable] = val
+    types[top_ns,ns,tunable] = val
   }
   else if (attr == "minval") {
-    minvals[top_ns][ns][tunable] = val
+    minvals[top_ns,ns,tunable] = val
   }
   else if (attr == "maxval") {
-    maxvals[top_ns][ns][tunable] = val
+    maxvals[top_ns,ns,tunable] = val
   }
   else if (attr == "env_alias") {
-    env_alias[top_ns][ns][tunable] = sprintf("\"%s\"", val)
+    env_alias[top_ns,ns,tunable] = sprintf("\"%s\"", val)
   }
   else if (attr == "security_level") {
     if (val == "SXID_ERASE" || val == "SXID_IGNORE" || val == "NONE") {
-      security_level[top_ns][ns][tunable] = val
+      security_level[top_ns,ns,tunable] = val
     }
     else {
       printf("Line %d: Invalid value (%s) for security_level: %s, ", NR, val,
@@ -114,11 +114,11 @@ $1 == "}" {
     }
   }
   else if (attr == "default") {
-    if (types[top_ns][ns][tunable] == "STRING") {
-      default_val[top_ns][ns][tunable] = sprintf(".strval = \"%s\"", val);
+    if (types[top_ns,ns,tunable] == "STRING") {
+      default_val[top_ns,ns,tunable] = sprintf(".strval = \"%s\"", val);
     }
     else {
-      default_val[top_ns][ns][tunable] = sprintf(".numval = %s", val)
+      default_val[top_ns,ns,tunable] = sprintf(".numval = %s", val)
     }
   }
 }
@@ -139,27 +139,27 @@ END {
   # Now, the enum names
   print "\ntypedef enum"
   print "{"
-  for (t in types) {
-    for (n in types[t]) {
-      for (m in types[t][n]) {
-        printf ("  TUNABLE_ENUM_NAME(%s, %s, %s),\n", t, n, m);
-      }
-    }
+  for (tnm in types) {
+    split (tnm, indices, SUBSEP);
+    t = indices[1];
+    n = indices[2];
+    m = indices[3];
+    printf ("  TUNABLE_ENUM_NAME(%s, %s, %s),\n", t, n, m);
   }
   print "} tunable_id_t;\n"
 
   # Finally, the tunable list.
   print "\n#ifdef TUNABLES_INTERNAL"
   print "static tunable_t tunable_list[] attribute_relro = {"
-  for (t in types) {
-    for (n in types[t]) {
-      for (m in types[t][n]) {
-        printf ("  {TUNABLE_NAME_S(%s, %s, %s)", t, n, m)
-        printf (", {TUNABLE_TYPE_%s, %s, %s}, {%s}, NULL, TUNABLE_SECLEVEL_%s, %s},\n",
-		types[t][n][m], minvals[t][n][m], maxvals[t][n][m],
-		default_val[t][n][m], security_level[t][n][m], env_alias[t][n][m]);
-      }
-    }
+  for (tnm in types) {
+    split (tnm, indices, SUBSEP);
+    t = indices[1];
+    n = indices[2];
+    m = indices[3];
+    printf ("  {TUNABLE_NAME_S(%s, %s, %s)", t, n, m)
+    printf (", {TUNABLE_TYPE_%s, %s, %s}, {%s}, NULL, TUNABLE_SECLEVEL_%s, %s},\n",
+	    types[t,n,m], minvals[t,n,m], maxvals[t,n,m],
+	    default_val[t,n,m], security_level[t,n,m], env_alias[t,n,m]);
   }
   print "};"
   print "#endif"