From 1c88b0e64cef5ec6e363f47c11cd77bb9d0dd7f6 Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Thu, 28 Mar 2024 00:39:48 -0700 Subject: [PATCH] LU-8191 ptlrpc: convert functions to static Static analysis shows that a number of functions could be made static. This patch declares several functions in ptlrpc static. Lustre-change: https://review.whamcloud.com/51353 Lustre-commit: 41d94aa9c9c01fa88ae152625d5ffd97256bab73 Test-Parameters: trivial Signed-off-by: Timothy Day Change-Id: If0d92f7f4e625c146833f360806ae80b8914cc20 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/54601 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/ptlrpc/events.c | 2 +- lustre/ptlrpc/gss/gss_krb5_mech.c | 5 ++--- lustre/ptlrpc/gss/gss_null_mech.c | 1 + lustre/ptlrpc/gss/gss_sk_mech.c | 4 ++-- lustre/ptlrpc/gss/lproc_gss.c | 19 +++++++++++-------- lustre/ptlrpc/layout.c | 2 +- lustre/ptlrpc/nodemap_storage.c | 8 ++++---- lustre/ptlrpc/pack_generic.c | 9 +++++---- 8 files changed, 27 insertions(+), 23 deletions(-) diff --git a/lustre/ptlrpc/events.c b/lustre/ptlrpc/events.c index 1b7cb38..7f5db2b 100644 --- a/lustre/ptlrpc/events.c +++ b/lustre/ptlrpc/events.c @@ -611,7 +611,7 @@ lnet_pid_t ptl_get_pid(void) return LNET_PID_LUSTRE; } -int ptlrpc_ni_init(void) +static int ptlrpc_ni_init(void) { int rc; lnet_pid_t pid; diff --git a/lustre/ptlrpc/gss/gss_krb5_mech.c b/lustre/ptlrpc/gss/gss_krb5_mech.c index f2994e7..943bf13 100644 --- a/lustre/ptlrpc/gss/gss_krb5_mech.c +++ b/lustre/ptlrpc/gss/gss_krb5_mech.c @@ -1524,9 +1524,8 @@ __u32 gss_unwrap_bulk_kerberos(struct gss_ctx *gctx, return GSS_S_COMPLETE; } -int gss_display_kerberos(struct gss_ctx *ctx, - char *buf, - int bufsize) +static int gss_display_kerberos(struct gss_ctx *ctx, + char *buf, int bufsize) { struct krb5_ctx *kctx = ctx->internal_ctx_id; int written; diff --git a/lustre/ptlrpc/gss/gss_null_mech.c b/lustre/ptlrpc/gss/gss_null_mech.c index 142438a..9758b1a 100644 --- a/lustre/ptlrpc/gss/gss_null_mech.c +++ b/lustre/ptlrpc/gss/gss_null_mech.c @@ -145,6 +145,7 @@ void gss_delete_sec_context_null(void *internal_context) OBD_FREE_PTR(null_context); } +static int gss_display_null(struct gss_ctx *gss_context, char *buf, int bufsize) { return snprintf(buf, bufsize, "null"); diff --git a/lustre/ptlrpc/gss/gss_sk_mech.c b/lustre/ptlrpc/gss/gss_sk_mech.c index 9406370..8540146 100644 --- a/lustre/ptlrpc/gss/gss_sk_mech.c +++ b/lustre/ptlrpc/gss/gss_sk_mech.c @@ -118,7 +118,7 @@ static int sk_verify_header(struct sk_hdr *skh) return GSS_S_COMPLETE; } -void sk_construct_rfc3686_iv(__u8 *iv, __u32 nonce, __u64 partial_iv) +static void sk_construct_rfc3686_iv(__u8 *iv, __u32 nonce, __u64 partial_iv) { __u32 ctr = cpu_to_be32(1); @@ -884,7 +884,7 @@ void gss_delete_sec_context_sk(void *internal_context) sk_delete_context(sk_context); } -int gss_display_sk(struct gss_ctx *gss_context, char *buf, int bufsize) +static int gss_display_sk(struct gss_ctx *gss_context, char *buf, int bufsize) { return snprintf(buf, bufsize, "sk"); } diff --git a/lustre/ptlrpc/gss/lproc_gss.c b/lustre/ptlrpc/gss/lproc_gss.c index 0fbd032..245838a 100644 --- a/lustre/ptlrpc/gss/lproc_gss.c +++ b/lustre/ptlrpc/gss/lproc_gss.c @@ -133,15 +133,18 @@ static const struct file_operations gss_proc_secinit = { .write = gss_proc_write_secinit, }; -int sptlrpc_krb5_allow_old_client_csum_seq_show(struct seq_file *m, void *data) +static int +sptlrpc_krb5_allow_old_client_csum_seq_show(struct seq_file *m, + void *data) { seq_printf(m, "%u\n", krb5_allow_old_client_csum); return 0; } -ssize_t sptlrpc_krb5_allow_old_client_csum_seq_write(struct file *file, - const char __user *buffer, - size_t count, loff_t *off) +static ssize_t +sptlrpc_krb5_allow_old_client_csum_seq_write(struct file *file, + const char __user *buffer, + size_t count, loff_t *off) { bool val; int rc; @@ -156,15 +159,15 @@ ssize_t sptlrpc_krb5_allow_old_client_csum_seq_write(struct file *file, LPROC_SEQ_FOPS(sptlrpc_krb5_allow_old_client_csum); #ifdef HAVE_GSS_KEYRING -int sptlrpc_gss_check_upcall_ns_seq_show(struct seq_file *m, void *data) +static int sptlrpc_gss_check_upcall_ns_seq_show(struct seq_file *m, void *data) { seq_printf(m, "%u\n", gss_check_upcall_ns); return 0; } -ssize_t sptlrpc_gss_check_upcall_ns_seq_write(struct file *file, - const char __user *buffer, - size_t count, loff_t *off) +static ssize_t sptlrpc_gss_check_upcall_ns_seq_write(struct file *file, + const char __user *buffer, + size_t count, loff_t *off) { bool val; int rc; diff --git a/lustre/ptlrpc/layout.c b/lustre/ptlrpc/layout.c index 1b91546..4acffe9 100644 --- a/lustre/ptlrpc/layout.c +++ b/lustre/ptlrpc/layout.c @@ -2210,7 +2210,7 @@ static void *__req_capsule_get(struct req_capsule *pill, /** * Dump a request and/or reply */ -void __req_capsule_dump(struct req_capsule *pill, enum req_location loc) +static void __req_capsule_dump(struct req_capsule *pill, enum req_location loc) { const struct req_format *fmt; const struct req_msg_field *field; diff --git a/lustre/ptlrpc/nodemap_storage.c b/lustre/ptlrpc/nodemap_storage.c index 3ec0c84..ebfe049 100644 --- a/lustre/ptlrpc/nodemap_storage.c +++ b/lustre/ptlrpc/nodemap_storage.c @@ -1108,9 +1108,10 @@ out: /** * Step through active config and write to disk. */ -struct dt_object *nodemap_save_config_cache(const struct lu_env *env, - struct dt_device *dev, - struct local_oid_storage *los) +static struct dt_object * +nodemap_save_config_cache(const struct lu_env *env, + struct dt_device *dev, + struct local_oid_storage *los) { struct dt_object *o; struct lu_nodemap *nodemap; @@ -1579,7 +1580,6 @@ out: return rc; } - int nodemap_index_read(struct lu_env *env, struct nm_config_file *ncf, struct idx_info *ii, diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index c6b41b1..ce83b76 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -2771,7 +2771,7 @@ void dump_rniobuf(struct niobuf_remote *nb) nb->rnb_offset, nb->rnb_len, nb->rnb_flags); } -void dump_obdo(struct obdo *oa) +static void dump_obdo(struct obdo *oa) { u64 valid = oa->o_valid; @@ -2961,7 +2961,7 @@ void lustre_swab_hsm_user_item(struct hsm_user_item *hui) lustre_swab_hsm_extent(&hui->hui_extent); } -void lustre_swab_lu_extent(struct lu_extent *le) +static void lustre_swab_lu_extent(struct lu_extent *le) { __swab64s(&le->e_start); __swab64s(&le->e_end); @@ -3048,7 +3048,8 @@ int lustre_swab_object_update_request(struct object_update_request *our, return size; } -void lustre_swab_object_update_result(struct object_update_result *our) +static void +lustre_swab_object_update_result_no_len(struct object_update_result *our) { __swab32s(&our->our_rc); __swab16s(&our->our_datalen); @@ -3075,7 +3076,7 @@ int lustre_swab_object_update_reply(struct object_update_reply *our, __u32 len) ourp = object_update_result_get(our, i, NULL); if (ourp == NULL) return -EPROTO; - lustre_swab_object_update_result(ourp); + lustre_swab_object_update_result_no_len(ourp); } return size; -- 1.8.3.1