Whamcloud - gitweb
LU-8191 libcfs: convert functions to static, removed function
authorTimothy Day <timday@amazon.com>
Thu, 28 Mar 2024 23:47:01 +0000 (16:47 -0700)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 30 Mar 2024 07:24:33 +0000 (07:24 +0000)
Static analysis shows that a number of functions
could be made static. This patch declares several
functions in libcfs static.

Remove cfs_expr_list_values_free in string.c, since
it is not used.

A header was missing in param.c, causing a number of
functions to be missing declarations.

Lustre-change: https://review.whamcloud.com/51428
Lustre-commit: 067dfd8d2701572ebe7246726c14a6e72a78cb33

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: Ia580881efa806bde49d532e5b2d8f5097f2294e0
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54620
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
libcfs/libcfs/tracefile.c
libcfs/libcfs/util/param.c
libcfs/libcfs/util/string.c

index e7aad28..73d4693 100644 (file)
@@ -78,7 +78,7 @@ static void put_pages_on_tcd_daemon_list(struct page_collection *pc,
  * with other interrupt locks that might be happening. See LU-1311
  * for details.
  */
-int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int walking)
+static int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int walking)
        __acquires(&tcd->tcd_lock)
 {
        __LASSERT(tcd->tcd_type < CFS_TCD_TYPE_CNT);
@@ -93,7 +93,7 @@ int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int walking)
        return 1;
 }
 
-void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking)
+static void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking)
        __releases(&tcd->tcd_lock)
 {
        __LASSERT(tcd->tcd_type < CFS_TCD_TYPE_CNT);
@@ -118,7 +118,7 @@ void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking)
             (tcd = &(*cfs_trace_data[i])[cpu].tcd) &&                  \
             cfs_trace_lock_tcd(tcd, 1); cfs_trace_unlock_tcd(tcd, 1), i++)
 
-enum cfs_trace_buf_type cfs_trace_buf_idx_get(void)
+static enum cfs_trace_buf_type cfs_trace_buf_idx_get(void)
 {
        if (in_irq())
                return CFS_TCD_TYPE_IRQ;
index 18fe84d..a33cd52 100644 (file)
@@ -38,6 +38,7 @@
 #include <unistd.h>
 #include <linux/limits.h>
 #include <libcfs/util/string.h>
+#include <libcfs/util/param.h>
 #include <sys/vfs.h>
 #include <linux/magic.h>
 
index ce96090..2c4bf05 100644 (file)
@@ -334,15 +334,6 @@ cfs_expr_list_values(struct cfs_expr_list *expr_list, int max, __u32 **valpp)
        return count;
 }
 
-void
-cfs_expr_list_values_free(__u32 *values, int num)
-{
-       /* This array is allocated by LIBCFS_ALLOC(), so it shouldn't be freed
-        * by OBD_FREE() if it's called by module other than libcfs & LNet,
-        * otherwise we will see fake memory leak */
-       free(values);
-}
-
 /**
  * Frees cfs_range_expr structures of \a expr_list.
  *