diff mbox series

[19/27] lnet: libcfs: allow comma-separated masks

Message ID 1623625897-17706-20-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: sync to 2.14.52 | expand

Commit Message

James Simmons June 13, 2021, 11:11 p.m. UTC
From: Andreas Dilger <adilger@whamcloud.com>

For debug and changelog mask names, allow a comma-separated list
of names to be given, so that the space-separated list does not
need to be quoted for use.

Fix a couple of test cases where the debug parameter is set and
printed overly verbosely during tests.

WC-bug-id: https://jira.whamcloud.com/browse/LU-13055
Lustre-commit: 6b6fde1026311a28 ("LU-13055 libcfs: allow comma-separated masks")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/43741
Reviewed-by: Emoly Liu <emoly@whamcloud.com>
Reviewed-by: Mike Pershin <mpershin@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 net/lnet/libcfs/libcfs_string.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/net/lnet/libcfs/libcfs_string.c b/net/lnet/libcfs/libcfs_string.c
index d2460f3..4259f8b8 100644
--- a/net/lnet/libcfs/libcfs_string.c
+++ b/net/lnet/libcfs/libcfs_string.c
@@ -52,14 +52,14 @@  int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
 	char op = '\0';
 	int newmask = minmask, i, len, found = 0;
 
-	/* <str> must be a list of tokens separated by whitespace
+	/* <str> must be a list of tokens separated by whitespace or comma,
 	 * and optionally an operator ('+' or '-').  If an operator
 	 * appears first in <str>, '*oldmask' is used as the starting point
 	 * (relative), otherwise minmask is used (absolute).  An operator
 	 * applies to all following tokens up to the next operator.
 	 */
 	while (*str != '\0') {
-		while (isspace(*str))
+		while (isspace(*str) || *str == ',')
 			str++;
 		if (*str == '\0')
 			break;
@@ -77,7 +77,7 @@  int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
 		/* find token length */
 		len = 0;
 		while (str[len] != '\0' && !isspace(str[len]) &&
-		       str[len] != '+' && str[len] != '-')
+		       str[len] != '+' && str[len] != '-' && str[len] != ',')
 			len++;
 
 		/* match token */