svn commit: r324162 - in head: share/man/man4 sys/dev/mpr sys/dev/mps
Scott Long
scottl at FreeBSD.org
Sun Oct 1 15:35:22 UTC 2017
Author: scottl
Date: Sun Oct 1 15:35:21 2017
New Revision: 324162
URL: https://svnweb.freebsd.org/changeset/base/324162
Log:
Improve the debug parsing to allow flags to be added and subtracted
from the existing set.
Submitted by: rea at freebsd.org
Modified:
head/share/man/man4/mpr.4
head/share/man/man4/mps.4
head/sys/dev/mpr/mpr.c
head/sys/dev/mps/mps.c
Modified: head/share/man/man4/mpr.4
==============================================================================
--- head/share/man/man4/mpr.4 Sun Oct 1 15:03:44 2017 (r324161)
+++ head/share/man/man4/mpr.4 Sun Oct 1 15:35:21 2017 (r324162)
@@ -354,6 +354,11 @@ All
variables can be named by either an integer value or a text string.
Multiple values can be specified together by either ORing the
integer values or by providing a comma-separated list of names.
+A text string prefixed by
+.Qq +
+adds the specified debug levels to the existing set, while the prefix
+.Qq -
+removes them from the existing set.
The current
.Va debug_level
status is reported in both formats for convenience.
Modified: head/share/man/man4/mps.4
==============================================================================
--- head/share/man/man4/mps.4 Sun Oct 1 15:03:44 2017 (r324161)
+++ head/share/man/man4/mps.4 Sun Oct 1 15:35:21 2017 (r324162)
@@ -330,6 +330,11 @@ All
variables can be named by either an integer value or a text string.
Multiple values can be specified together by either ORing the
integer values or by providing a comma-separated list of names.
+A text string prefixed by
+.Qq +
+adds the specified debug levels to the existing set, while the prefix
+.Qq -
+removes them from the existing set.
The current
.Va debug_level
status is reported in both formats for convenience.
Modified: head/sys/dev/mpr/mpr.c
==============================================================================
--- head/sys/dev/mpr/mpr.c Sun Oct 1 15:03:44 2017 (r324161)
+++ head/sys/dev/mpr/mpr.c Sun Oct 1 15:35:21 2017 (r324162)
@@ -1834,6 +1834,12 @@ static struct mpr_debug_string {
{"trace", MPR_TRACE}
};
+enum mpr_debug_level_combiner {
+ COMB_NONE,
+ COMB_ADD,
+ COMB_SUB
+};
+
static int
mpr_debug_sysctl(SYSCTL_HANDLER_ARGS)
{
@@ -1885,6 +1891,7 @@ static void
mpr_parse_debug(struct mpr_softc *sc, char *list)
{
struct mpr_debug_string *string;
+ enum mpr_debug_level_combiner op;
char *token, *endtoken;
size_t sz;
int flags, i;
@@ -1892,6 +1899,17 @@ mpr_parse_debug(struct mpr_softc *sc, char *list)
if (list == NULL || *list == '\0')
return;
+ if (*list == '+') {
+ op = COMB_ADD;
+ list++;
+ } else if (*list == '-') {
+ op = COMB_SUB;
+ list++;
+ } else
+ op = COMB_NONE;
+ if (*list == '\0')
+ return;
+
flags = 0;
sz = sizeof(mpr_debug_strings) / sizeof(mpr_debug_strings[0]);
while ((token = strsep(&list, ":,")) != NULL) {
@@ -1911,7 +1929,17 @@ mpr_parse_debug(struct mpr_softc *sc, char *list)
}
}
- sc->mpr_debug = flags;
+ switch (op) {
+ case COMB_NONE:
+ sc->mpr_debug = flags;
+ break;
+ case COMB_ADD:
+ sc->mpr_debug |= flags;
+ break;
+ case COMB_SUB:
+ sc->mpr_debug &= (~flags);
+ break;
+ }
return;
}
Modified: head/sys/dev/mps/mps.c
==============================================================================
--- head/sys/dev/mps/mps.c Sun Oct 1 15:03:44 2017 (r324161)
+++ head/sys/dev/mps/mps.c Sun Oct 1 15:35:21 2017 (r324162)
@@ -1696,6 +1696,12 @@ static struct mps_debug_string {
{"trace", MPS_TRACE}
};
+enum mps_debug_level_combiner {
+ COMB_NONE,
+ COMB_ADD,
+ COMB_SUB
+};
+
static int
mps_debug_sysctl(SYSCTL_HANDLER_ARGS)
{
@@ -1747,6 +1753,7 @@ static void
mps_parse_debug(struct mps_softc *sc, char *list)
{
struct mps_debug_string *string;
+ enum mps_debug_level_combiner op;
char *token, *endtoken;
size_t sz;
int flags, i;
@@ -1754,6 +1761,17 @@ mps_parse_debug(struct mps_softc *sc, char *list)
if (list == NULL || *list == '\0')
return;
+ if (*list == '+') {
+ op = COMB_ADD;
+ list++;
+ } else if (*list == '-') {
+ op = COMB_SUB;
+ list++;
+ } else
+ op = COMB_NONE;
+ if (*list == '\0')
+ return;
+
flags = 0;
sz = sizeof(mps_debug_strings) / sizeof(mps_debug_strings[0]);
while ((token = strsep(&list, ":,")) != NULL) {
@@ -1773,7 +1791,18 @@ mps_parse_debug(struct mps_softc *sc, char *list)
}
}
- sc->mps_debug = flags;
+ switch (op) {
+ case COMB_NONE:
+ sc->mps_debug = flags;
+ break;
+ case COMB_ADD:
+ sc->mps_debug |= flags;
+ break;
+ case COMB_SUB:
+ sc->mps_debug &= (~flags);
+ break;
+ }
+
return;
}
More information about the svn-src-all
mailing list