From owner-svn-src-all@freebsd.org Sun Oct 1 15:35:22 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94314E2798F; Sun, 1 Oct 2017 15:35:22 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E8EA64098; Sun, 1 Oct 2017 15:35:22 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v91FZLSa008007; Sun, 1 Oct 2017 15:35:21 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v91FZL54008003; Sun, 1 Oct 2017 15:35:21 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201710011535.v91FZL54008003@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sun, 1 Oct 2017 15:35:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324162 - in head: share/man/man4 sys/dev/mpr sys/dev/mps X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/mpr sys/dev/mps X-SVN-Commit-Revision: 324162 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Oct 2017 15:35:22 -0000 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@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; }