- /* <str> must be a list of debug tokens or numbers separated by
- * whitespace and optionally an operator ('+' or '-'). If an operator
- * appears first in <str>, '*mask' is used as the starting point
- * (relative), otherwise 0 is used (absolute). An operator applies to
- * all following tokens up to the next operator. */
-
- matched = 0;
- while (*str != 0) {
- while (isspace(*str)) /* skip whitespace */
- str++;
-
- if (*str == 0)
- break;
-
- if (*str == '+' || *str == '-') {
- op = *str++;
-
- /* op on first token == relative */
- if (!matched)
- m = *mask;
-
- while (isspace(*str)) /* skip whitespace */
- str++;
-
- if (*str == 0) /* trailing op */
- return -EINVAL;
- }
-
- /* find token length */
- for (n = 0; str[n] != 0 && !isspace(str[n]); n++);
-
- /* match token */
- if (libcfs_debug_token2mask(&t, str, n, is_subsys) != 0)
- return -EINVAL;
-
- matched = 1;
- if (op == '-')
- m &= ~t;
- else
- m |= t;
-
- str += n;
- }
-
- if (!matched)
- return -EINVAL;
-
- *mask = m;
- return 0;
+ return libcfs_str2mask(str, fn, mask, is_subsys ? 0 : D_CANTMASK,
+ 0xffffffff);