staging: lustre: use strim instead of cfs_trimwhite.
authorNeilBrown <neilb@suse.com>
Mon, 18 Dec 2017 23:01:47 +0000 (10:01 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Jan 2018 15:03:44 +0000 (16:03 +0100)
Linux lib provides identical functionality to cfs_trimwhite,
so discard that code and use the standard.

Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/include/linux/libcfs/libcfs_string.h
drivers/staging/lustre/lnet/libcfs/libcfs_string.c
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c
drivers/staging/lustre/lnet/lnet/config.c
drivers/staging/lustre/lnet/lnet/router_proc.c

index 1191764c431a7bfc6a6588767e8c5431a2c0f35c..bb95eaf9f3d506148ea0d729ddb2db6cf91f8298 100644 (file)
@@ -73,7 +73,6 @@ struct cfs_expr_list {
        struct list_head        el_exprs;
 };
 
-char *cfs_trimwhite(char *str);
 int cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res);
 int cfs_str2num_check(char *str, int nob, unsigned int *num,
                      unsigned int min, unsigned int max);
index bcac5074bf80c13ba6a1b42d865fe58bfbba33f0..cb0533b36cc703ac375d60b6e3f514a810744ef2 100644 (file)
@@ -137,26 +137,6 @@ out:
 }
 EXPORT_SYMBOL(cfs_firststr);
 
-char *
-cfs_trimwhite(char *str)
-{
-       char *end;
-
-       while (isspace(*str))
-               str++;
-
-       end = str + strlen(str);
-       while (end > str) {
-               if (!isspace(end[-1]))
-                       break;
-               end--;
-       }
-
-       *end = 0;
-       return str;
-}
-EXPORT_SYMBOL(cfs_trimwhite);
-
 /**
  * Extracts tokens from strings.
  *
index 51823ce71773a20221c035642a1814232fc1af3b..ae306c9c3c7817bd4635ec6535cb232e605e34fc 100644 (file)
@@ -830,7 +830,7 @@ cfs_cpt_table_create_pattern(char *pattern)
        int c;
        int i;
 
-       str = cfs_trimwhite(pattern);
+       str = strim(pattern);
        if (*str == 'n' || *str == 'N') {
                pattern = str + 1;
                if (*pattern != '\0') {
@@ -882,7 +882,7 @@ cfs_cpt_table_create_pattern(char *pattern)
 
        high = node ? MAX_NUMNODES - 1 : nr_cpu_ids - 1;
 
-       for (str = cfs_trimwhite(pattern), c = 0;; c++) {
+       for (str = strim(pattern), c = 0;; c++) {
                struct cfs_range_expr *range;
                struct cfs_expr_list *el;
                char *bracket = strchr(str, '[');
@@ -917,7 +917,7 @@ cfs_cpt_table_create_pattern(char *pattern)
                        goto failed;
                }
 
-               str = cfs_trimwhite(str + n);
+               str = strim(str + n);
                if (str != bracket) {
                        CERROR("Invalid pattern %s\n", str);
                        goto failed;
@@ -957,7 +957,7 @@ cfs_cpt_table_create_pattern(char *pattern)
                        goto failed;
                }
 
-               str = cfs_trimwhite(bracket + 1);
+               str = strim(bracket + 1);
        }
 
        return cptab;
index 0cf0f4f994359512ce38e5664ac9d062b918fb1a..0ba2a39400091b1af21ba295b7a0f1e3d5fe80eb 100644 (file)
@@ -275,7 +275,7 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
 
                        if (comma)
                                *comma++ = 0;
-                       net = libcfs_str2net(cfs_trimwhite(str));
+                       net = libcfs_str2net(strim(str));
 
                        if (net == LNET_NIDNET(LNET_NID_ANY)) {
                                LCONSOLE_ERROR_MSG(0x113,
@@ -298,7 +298,7 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
                }
 
                *bracket = 0;
-               net = libcfs_str2net(cfs_trimwhite(str));
+               net = libcfs_str2net(strim(str));
                if (net == LNET_NIDNET(LNET_NID_ANY)) {
                        tmp = str;
                        goto failed_syntax;
@@ -328,7 +328,7 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
                        if (comma)
                                *comma++ = 0;
 
-                       iface = cfs_trimwhite(iface);
+                       iface = strim(iface);
                        if (!*iface) {
                                tmp = iface;
                                goto failed_syntax;
@@ -365,7 +365,7 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
                comma = strchr(bracket + 1, ',');
                if (comma) {
                        *comma = 0;
-                       str = cfs_trimwhite(str);
+                       str = strim(str);
                        if (*str) {
                                tmp = str;
                                goto failed_syntax;
@@ -374,7 +374,7 @@ lnet_parse_networks(struct list_head *nilist, char *networks)
                        continue;
                }
 
-               str = cfs_trimwhite(str);
+               str = strim(str);
                if (*str) {
                        tmp = str;
                        goto failed_syntax;
index d32d653edcb030c9032c8bb7e8589912bc82d79f..e863a5e0ab3876e7116f34a2cd0561c2aae87e75 100644 (file)
@@ -829,7 +829,7 @@ static int __proc_lnet_portal_rotor(void *data, int write,
        if (rc < 0)
                goto out;
 
-       tmp = cfs_trimwhite(buf);
+       tmp = strim(buf);
 
        rc = -EINVAL;
        lnet_res_lock(0);