Message ID | 1494514306-4167-2-git-send-email-siddhesh@sourceware.org |
---|---|
State | New |
Headers | show |
On 11/05/2017 11:51, Siddhesh Poyarekar wrote: > Enhance dl-tunables.list to allow specifying a default value for a > tunable that it would be initialized to. > > * scripts/gen-tunables.awk: Recognize 'default' keyword in > dl-tunables.list. LGTM, thanks. > --- > scripts/gen-tunables.awk | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/scripts/gen-tunables.awk b/scripts/gen-tunables.awk > index defb3e7..b10b00e 100644 > --- a/scripts/gen-tunables.awk > +++ b/scripts/gen-tunables.awk > @@ -113,6 +113,14 @@ $1 == "}" { > exit 1 > } > } > + else if (attr == "default") { > + 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) > + } > + } > } > > END { > @@ -146,9 +154,9 @@ END { > 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}, {.numval = 0}, NULL, TUNABLE_SECLEVEL_%s, %s},\n", > + 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], > - security_level[t][n][m], env_alias[t][n][m]); > + default_val[t][n][m], security_level[t][n][m], env_alias[t][n][m]); > } > } > } >
On 15/05/2017 18:12, Adhemerval Zanella wrote: > > > On 11/05/2017 11:51, Siddhesh Poyarekar wrote: >> Enhance dl-tunables.list to allow specifying a default value for a >> tunable that it would be initialized to. >> >> * scripts/gen-tunables.awk: Recognize 'default' keyword in >> dl-tunables.list. > > LGTM, thanks. I just noted you should update the README.tunables with the new allowed attribute. > >> --- >> scripts/gen-tunables.awk | 12 ++++++++++-- >> 1 file changed, 10 insertions(+), 2 deletions(-) >> >> diff --git a/scripts/gen-tunables.awk b/scripts/gen-tunables.awk >> index defb3e7..b10b00e 100644 >> --- a/scripts/gen-tunables.awk >> +++ b/scripts/gen-tunables.awk >> @@ -113,6 +113,14 @@ $1 == "}" { >> exit 1 >> } >> } >> + else if (attr == "default") { >> + 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) >> + } >> + } >> } >> >> END { >> @@ -146,9 +154,9 @@ END { >> 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}, {.numval = 0}, NULL, TUNABLE_SECLEVEL_%s, %s},\n", >> + 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], >> - security_level[t][n][m], env_alias[t][n][m]); >> + default_val[t][n][m], security_level[t][n][m], env_alias[t][n][m]); >> } >> } >> } >>
diff --git a/scripts/gen-tunables.awk b/scripts/gen-tunables.awk index defb3e7..b10b00e 100644 --- a/scripts/gen-tunables.awk +++ b/scripts/gen-tunables.awk @@ -113,6 +113,14 @@ $1 == "}" { exit 1 } } + else if (attr == "default") { + 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) + } + } } END { @@ -146,9 +154,9 @@ END { 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}, {.numval = 0}, NULL, TUNABLE_SECLEVEL_%s, %s},\n", + 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], - security_level[t][n][m], env_alias[t][n][m]); + default_val[t][n][m], security_level[t][n][m], env_alias[t][n][m]); } } }