Whamcloud - gitweb
LU-9859 libcfs: add "default" keyword for debug mask
[fs/lustre-release.git] / libcfs / libcfs / libcfs_string.c
index 7ba00df..a3ff59c 100644 (file)
@@ -41,7 +41,7 @@
 
 /* Convert a text string to a bitmask */
 int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
-                int *oldmask, int minmask, int allmask)
+                int *oldmask, int minmask, int allmask, int defmask)
 {
        const char *debugstr;
        char op = 0;
@@ -98,6 +98,15 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
                                newmask = allmask;
                        found = 1;
                }
+               if (!found && strcasecmp(str, "DEFAULT") == 0) {
+                       if (op == '-')
+                               newmask = (newmask & ~defmask) | minmask;
+                       else if (op == '+')
+                               newmask |= defmask;
+                       else
+                               newmask = defmask;
+                       found = 1;
+               }
                if (!found) {
                        CWARN("unknown mask '%.*s'.\n"
                              "mask usage: [+|-]<all|type> ...\n", len, str);