Whamcloud - gitweb
LU-8191 libcfs: convert functions to static, removed function 28/51428/2
authorTimothy Day <timday@amazon.com>
Fri, 23 Jun 2023 20:31:30 +0000 (20:31 +0000)
committerOleg Drokin <green@whamcloud.com>
Mon, 16 Oct 2023 05:47:56 +0000 (05:47 +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.

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: Ia580881efa806bde49d532e5b2d8f5097f2294e0
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51428
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/libcfs/tracefile.c
libcfs/libcfs/util/nidstrings.c
libcfs/libcfs/util/param.c
libcfs/libcfs/util/string.c

index e45cf82..acb8389 100644 (file)
@@ -77,7 +77,7 @@ static DECLARE_RWSEM(cfs_tracefile_sem);
  * 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);
@@ -92,7 +92,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);
@@ -117,7 +117,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 e9fab1c..c9e31a4 100644 (file)
@@ -1202,7 +1202,7 @@ libcfs_net_str_len(const char *str)
        return 0;
 }
 
-int
+static int
 parse_net_range(char *str, __u32 len, struct list_head *net_num,
                __u32 *net_type)
 {
@@ -1262,7 +1262,7 @@ parse_net_range(char *str, __u32 len, struct list_head *net_num,
                                net_num);
 }
 
-int
+static int
 parse_address(struct cfs_lstr *src, const __u32 net_type,
              struct list_head *addr)
 {
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 f957db6..205f3c3 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.
  *