Whamcloud - gitweb
LU-14929 gss: detect libkeyutils dependency
[fs/lustre-release.git] / libcfs / libcfs / libcfs_string.c
index 1ba1c24..5549417 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * String manipulation functions.
  *
 #include <libcfs/libcfs.h>
 #include <libcfs/libcfs_string.h>
 
-char *cfs_strrstr(const char *haystack, const char *needle)
-{
-       char *ptr;
-
-       if (unlikely(haystack == NULL || needle == NULL))
-               return NULL;
-
-       if (strlen(needle) == 1)
-               return strrchr(haystack, needle[0]);
-
-       ptr = strstr(haystack, needle);
-       if (ptr != NULL) {
-               while (1) {
-                       char *tmp;
-
-                       tmp = strstr(&ptr[1], needle);
-                       if (tmp == NULL)
-                               return ptr;
-
-                       ptr = tmp;
-               }
-       }
-
-       return NULL;
-}
-EXPORT_SYMBOL(cfs_strrstr);
-
 /* Convert a text string to a bitmask */
 int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
                 int *oldmask, int minmask, int allmask)
@@ -76,14 +48,14 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
        int newmask = minmask, i, len, found = 0;
 
        ENTRY;
-       /* <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;
@@ -100,7 +72,8 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),
 
                /* find token length */
                for (len = 0; str[len] != 0 && !isspace(str[len]) &&
-                    str[len] != '+' && str[len] != '-'; len++);
+                       str[len] != '+' && str[len] != '-' && str[len] != ',';
+                    len++);
 
                /* match token */
                found = 0;