From ef72003b0385402b41f3704dc4683b594516e579 Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Thu, 28 Mar 2024 16:47:01 -0700 Subject: [PATCH] LU-8191 libcfs: convert functions to static, removed function 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 Change-Id: Ia580881efa806bde49d532e5b2d8f5097f2294e0 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54620 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- libcfs/libcfs/tracefile.c | 6 +++--- libcfs/libcfs/util/param.c | 1 + libcfs/libcfs/util/string.c | 9 --------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/libcfs/libcfs/tracefile.c b/libcfs/libcfs/tracefile.c index e7aad28..73d4693 100644 --- a/libcfs/libcfs/tracefile.c +++ b/libcfs/libcfs/tracefile.c @@ -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; diff --git a/libcfs/libcfs/util/param.c b/libcfs/libcfs/util/param.c index 18fe84d..a33cd52 100644 --- a/libcfs/libcfs/util/param.c +++ b/libcfs/libcfs/util/param.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include diff --git a/libcfs/libcfs/util/string.c b/libcfs/libcfs/util/string.c index ce96090..2c4bf05 100644 --- a/libcfs/libcfs/util/string.c +++ b/libcfs/libcfs/util/string.c @@ -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. * -- 1.8.3.1