Whamcloud - gitweb
LU-9859 libcfs: move cfs_expr_list_print to nidstrings.c 34/50834/3
authorMr NeilBrown <neilb@suse.de>
Tue, 24 Nov 2020 03:02:50 +0000 (14:02 +1100)
committerOleg Drokin <green@whamcloud.com>
Wed, 31 May 2023 19:14:26 +0000 (19:14 +0000)
cfs_expr_list_print() is only called from nidstrings.c
so move it there and make it static.

Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: Ie30aba19fd7935ba424c9212a81e7d0d91ad6f57
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50834
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/libcfs_string.h
libcfs/libcfs/libcfs_string.c
lnet/lnet/nidstrings.c

index bc2e03c..5d07a1b 100644 (file)
@@ -73,8 +73,6 @@ int cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res);
 int cfs_str2num_check(char *str, int nob, unsigned *num,
                      unsigned min, unsigned max);
 int cfs_expr_list_match(__u32 value, struct cfs_expr_list *expr_list);
-int cfs_expr_list_print(char *buffer, int count,
-                       struct cfs_expr_list *expr_list);
 int cfs_expr_list_values(struct cfs_expr_list *expr_list,
                         int max, __u32 **values);
 void cfs_expr_list_values_free(__u32 *values, int num);
index 4bbff41..ea49a1e 100644 (file)
@@ -313,73 +313,6 @@ failed:
 }
 
 /**
- * Print the range expression \a re into specified \a buffer.
- * If \a bracketed is true, expression does not need additional
- * brackets.
- *
- * \retval number of characters written
- */
-static int
-cfs_range_expr_print(char *buffer, int count, struct cfs_range_expr *expr,
-                    bool bracketed)
-{
-       int i;
-       char s[] = "[";
-       char e[] = "]";
-
-       if (bracketed)
-               s[0] = e[0] = '\0';
-
-       if (expr->re_lo == expr->re_hi)
-               i = scnprintf(buffer, count, "%u", expr->re_lo);
-       else if (expr->re_stride == 1)
-               i = scnprintf(buffer, count, "%s%u-%u%s",
-                             s, expr->re_lo, expr->re_hi, e);
-       else
-               i = scnprintf(buffer, count, "%s%u-%u/%u%s",
-                             s, expr->re_lo, expr->re_hi,
-                             expr->re_stride, e);
-       return i;
-}
-
-/**
- * Print a list of range expressions (\a expr_list) into specified \a buffer.
- * If the list contains several expressions, separate them with comma
- * and surround the list with brackets.
- *
- * \retval number of characters written
- */
-int
-cfs_expr_list_print(char *buffer, int count, struct cfs_expr_list *expr_list)
-{
-       struct cfs_range_expr *expr;
-       int i = 0, j = 0;
-       int numexprs = 0;
-
-       if (count <= 0)
-               return 0;
-
-       list_for_each_entry(expr, &expr_list->el_exprs, re_link)
-               numexprs++;
-
-       if (numexprs > 1)
-               i += scnprintf(buffer + i, count - i, "[");
-
-       list_for_each_entry(expr, &expr_list->el_exprs, re_link) {
-               if (j++ != 0)
-                       i += scnprintf(buffer + i, count - i, ",");
-               i += cfs_range_expr_print(buffer + i, count - i, expr,
-                                         numexprs > 1);
-       }
-
-       if (numexprs > 1)
-               i += scnprintf(buffer + i, count - i, "]");
-
-       return i;
-}
-EXPORT_SYMBOL(cfs_expr_list_print);
-
-/**
  * Matches value (\a value) against ranges expression list \a expr_list.
  *
  * \retval 1 if \a value matches
index 39c75b2..94224be 100644 (file)
@@ -591,6 +591,72 @@ out:
        return rc;
 }
 
+/**
+ * Print the range expression \a re into specified \a buffer.
+ * If \a bracketed is true, expression does not need additional
+ * brackets.
+ *
+ * \retval number of characters written
+ */
+static int
+cfs_range_expr_print(char *buffer, int count, struct cfs_range_expr *expr,
+                    bool bracketed)
+{
+       int i;
+       char s[] = "[";
+       char e[] = "]";
+
+       if (bracketed)
+               s[0] = e[0] = '\0';
+
+       if (expr->re_lo == expr->re_hi)
+               i = scnprintf(buffer, count, "%u", expr->re_lo);
+       else if (expr->re_stride == 1)
+               i = scnprintf(buffer, count, "%s%u-%u%s",
+                             s, expr->re_lo, expr->re_hi, e);
+       else
+               i = scnprintf(buffer, count, "%s%u-%u/%u%s",
+                             s, expr->re_lo, expr->re_hi,
+                             expr->re_stride, e);
+       return i;
+}
+
+/**
+ * Print a list of range expressions (\a expr_list) into specified \a buffer.
+ * If the list contains several expressions, separate them with comma
+ * and surround the list with brackets.
+ *
+ * \retval number of characters written
+ */
+static int
+cfs_expr_list_print(char *buffer, int count, struct cfs_expr_list *expr_list)
+{
+       struct cfs_range_expr *expr;
+       int i = 0, j = 0;
+       int numexprs = 0;
+
+       if (count <= 0)
+               return 0;
+
+       list_for_each_entry(expr, &expr_list->el_exprs, re_link)
+               numexprs++;
+
+       if (numexprs > 1)
+               i += scnprintf(buffer + i, count - i, "[");
+
+       list_for_each_entry(expr, &expr_list->el_exprs, re_link) {
+               if (j++ != 0)
+                       i += scnprintf(buffer + i, count - i, ",");
+               i += cfs_range_expr_print(buffer + i, count - i, expr,
+                                         numexprs > 1);
+       }
+
+       if (numexprs > 1)
+               i += scnprintf(buffer + i, count - i, "]");
+
+       return i;
+}
+
 static int
 libcfs_ip_addr_range_print(char *buffer, int count, struct list_head *list)
 {