Add headers and mark functions static
cover Add headers and mark functions static
This patch set fixes sparse warnings of the following type:
warning: symbol * was not declared. Should it be static?
Header files were included for functions that have existing prototypes. Functions that were internal to a file have been marked static.
Darshana Padmadas (6):
Staging: lustre: Make obd_proc_version_seq_show static
Staging: lustre: Add header that declares function
lprocfs_lmv_init_vars
Staging: lustre: Include header for functions defined in lov_object.c
Staging: lustre: Include header file that declares
lprocfs_mdc_init_vars
Staging: lustre: Mark internal functions as static
Staging: lustre: Mark internal functions static in llog_cat.c
drivers/staging/lustre/lustre/lmv/lproc_lmv.c | 1 + drivers/staging/lustre/lustre/lov/lov_object.c | 1 + drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 1 + drivers/staging/lustre/lustre/mgc/mgc_request.c | 6 +++--- drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 2 +- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 4 ++-- 6 files changed, 9 insertions(+), 6 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/6 Staging: lustre: Make obd_proc_version_seq_show static
The function obd_proc_version_seq_show is only used in this file, so make it static.
This eliminates the following sparse warning:
warning: symbol 'obd_proc_version_seq_show' was not declared. Should it be static?
--- drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +1 -1
@@ -217,7 +217,7 @@ struct miscdevice obd_psdev = {#if defined (CONFIG_PROC_FS ) -int obd_proc_version_seq_show (struct seq_file *m,void *v) +static int obd_proc_version_seq_show (struct seq_file *m,void *v) {seq_printf (m,"lustre: %s\nkernel: %s\nbuild: %s\n" ,LUSTRE_VERSION_STRING ,"patchless_client" ,BUILD_VERSION );
Signature · 1 line
1.9.1
PATCH 2/6 Staging: lustre: Add header that declares function lprocfs_lmv_init_vars
In reply to Darshana PadmadasThis patch includes the header file lmv_internal.h that declares the function lprocfs_lmv_init_vars defined in lproc_lmv.c.
This eliminates the sparse warning:
warning: symbol 'lprocfs_lmv_init_vars' was not declared. Should it be static?
--- drivers/staging/lustre/lustre/lmv/lproc_lmv.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/lustre/lustre/lmv/lproc_lmv.c +1 -0
@@ -40,6 +40,7 @@#include <linux/statfs.h> #include "../include/lprocfs_status.h" #include "../include/obd_class.h" +#include "lmv_internal.h" static int lmv_numobd_seq_show (struct seq_file *m,void *v) {
Signature · 1 line
1.9.1
PATCH 3/6 Staging: lustre: Include header for functions prototypes
In reply to Darshana PadmadasThis patch includes the header lustre/include/lclient.h that declares the functions lov_lsm_put and lov_read_and_clear_async_rc defined in lov_object.c.
This eliminates warnings reported by sparse:
warning: symbol was not declared. Should it be static?
--- drivers/staging/lustre/lustre/lov/lov_object.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/lustre/lustre/lov/lov_object.c +1 -0
@@ -42,6 +42,7 @@#define DEBUG_SUBSYSTEM S_LOV#include "lov_cl_internal.h" +#include "../include/lclient.h" /** \addtogroup lov * @{
Signature · 1 line
1.9.1
PATCH 4/6 Staging: lustre: Include header file that declares lprocfs_mdc_init_vars
In reply to Darshana PadmadasThis patch includes the header file mdc_internal.h that declares the function lprocfs_mdc_init_vars.
This also eliminates the sparse warning:
warning: symbol 'lprocfs_mdc_init_vars' was not declared. Should it be static?
--- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/lustre/lustre/mdc/lproc_mdc.c +1 -0
@@ -38,6 +38,7 @@#include <linux/vfs.h> #include "../include/obd_class.h" #include "../include/lprocfs_status.h" +#include "mdc_internal.h" static int mdc_max_rpcs_in_flight_seq_show (struct seq_file *m,void *v) {
Signature · 1 line
1.9.1
PATCH 5/6 Staging: lustre: Mark internal functions as static
In reply to Darshana PadmadasThis patch makes functions mgc_logname2resid, mgc_set_info_async and mgc_init static as these are only used internally.
This also eliminates sparse warnings of the type:
warning: symbol * was not declared. Should it be static?
--- drivers/staging/lustre/lustre/mgc/mgc_request.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/mgc/mgc_request.c +3 -3
@@ -95,7 +95,7 @@ int mgc_fsname2resid(char *fsname, struct ldlm_res_id *res_id, int type) }EXPORT_SYMBOL (mgc_fsname2resid); -int mgc_logname2resid (char *logname,struct ldlm_res_id *res_id,int type) +static int mgc_logname2resid (char *logname,struct ldlm_res_id *res_id,int type) {char *name_end;int len;
@@ -948,7 +948,7 @@ static int mgc_target_register(struct obd_export *exp,return rc; } -int mgc_set_info_async (const struct lu_env *env,struct obd_export *exp, +static int mgc_set_info_async (const struct lu_env *env,struct obd_export *exp,u32 keylen,void *key,u32 vallen,void *val,struct ptlrpc_request_set *set) {
@@ -1724,7 +1724,7 @@ struct obd_ops mgc_obd_ops = { .o_process_config = mgc_process_config, }; -int __init mgc_init (void ) +static int __init mgc_init (void ) {return class_register_type (&mgc_obd_ops,NULL ,NULL ,LUSTRE_MGC_NAME ,NULL );
Signature · 1 line
1.9.1
PATCH 6/6 Staging: lustre: Mark internal functions static in llog_cat.c
In reply to Darshana PadmadasThis patch marks functions llog_cat_set_first_idx and cat_cancel_cb static as these are used only within this file.
This eliminates the following sparse warning:
warning: symbol * was not declared. Should it be static?
--- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/obdclass/llog_cat.c +2 -2
@@ -692,7 +692,7 @@ int llog_cat_reverse_process(const struct lu_env *env, }EXPORT_SYMBOL (llog_cat_reverse_process); -int llog_cat_set_first_idx (struct llog_handle *cathandle,int index) +static int llog_cat_set_first_idx (struct llog_handle *cathandle,int index) {struct llog_log_hdr *llh = cathandle->lgh_hdr;int i, bitmap_size, idx;
@@ -751,7 +751,7 @@ int llog_cat_cleanup(const struct lu_env *env, struct llog_handle *cathandle,return rc; } -int cat_cancel_cb (const struct lu_env *env,struct llog_handle *cathandle, +static int cat_cancel_cb (const struct lu_env *env,struct llog_handle *cathandle,struct llog_rec_hdr *rec,void *data) {struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
Signature · 1 line
1.9.1
Re: [Outreachy kernel] [PATCH 6/6] Staging: lustre: Mark internal functions static in llog_cat.c
Quoted 25 lines · Darshana Padmadas
This patch marks functions
llog_cat_set_first_idxandcat_cancel_cbstatic as these are used only within this file.This eliminates the following sparse warning:
warning: symbol * was not declared. Should it be static?Signed-off-by Darshana Padmadas <[email protected]>--- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/lustre/lustre/obdclass/llog_cat.c +1
-1@@ -692,7 +692,7 @@ int llog_cat_reverse_process(const struct lu_env *env, }EXPORT_SYMBOL (llog_cat_reverse_process); -int llog_cat_set_first_idx (struct llog_handle *cathandle,int index) +static int llog_cat_set_first_idx (struct llog_handle *cathandle,int index) {struct llog_log_hdr *llh = cathandle->lgh_hdr;int i, bitmap_size, idx;
drivers/staging/lustre/lustre/obdclass/llog_cat.c int llog_cat_cleanup(const struct lu_env *env, struct llog_handle *cathandle, · line 754
Quoted 5 lines
drivers/staging/lustre/lustre/obdclass/llog_cat.c +1
-1@@ -751,7 +751,7 @@ int llog_cat_cleanup(const struct lu_env *env, struct llog_handle *cathandle,return rc; } -int cat_cancel_cb(const struct lu_env *env, struct llog_handle *cathandle, +static int cat_cancel_cb(const struct lu_env *env, struct llog_handle *cathandle,
If this is going to be static, it should not be exported, so you can get rid of the EXPORT_SYMBOL for this function as well.
julia
Quoted 13 lines
drivers/staging/lustre/lustre/obdclass/llog_cat.c +0
-1struct llog_rec_hdr *rec, void *data) { struct llog_logid_rec *lir = (struct llog_logid_rec *)rec; --1.9.1
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1427564637-10305-7-git-send-email-darshanapadmadas%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
PATCH v2 6/6 Staging: lustre: Mark internal functions static in llog_cat.c
In reply to Darshana PadmadasThis patch marks functions llog_cat_set_first_idx and cat_cancel_cb static as these are used only within this file. Also since cat_cancel_cb is made static do not export it.
This eliminates the following sparse warning:
warning: symbol * was not declared. Should it be static?
---
Changes in v2:
- Removed EXPORT_SYMBOL for static function cat_cancel_cb.
- Reflected above change in commit message.
drivers/staging/lustre/lustre/obdclass/llog_cat.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/obdclass/llog_cat.c +2 -3
@@ -692,7 +692,7 @@ int llog_cat_reverse_process(const struct lu_env *env, }EXPORT_SYMBOL (llog_cat_reverse_process); -int llog_cat_set_first_idx (struct llog_handle *cathandle,int index) +static int llog_cat_set_first_idx (struct llog_handle *cathandle,int index) {struct llog_log_hdr *llh = cathandle->lgh_hdr;int i, bitmap_size, idx;
@@ -751,7 +751,7 @@ int llog_cat_cleanup(const struct lu_env *env, struct llog_handle *cathandle,return rc; } -int cat_cancel_cb (const struct lu_env *env,struct llog_handle *cathandle, +static int cat_cancel_cb (const struct lu_env *env,struct llog_handle *cathandle,struct llog_rec_hdr *rec,void *data) {struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
@@ -795,7 +795,6 @@ int cat_cancel_cb(const struct lu_env *env, struct llog_handle *cathandle,return rc; } -EXPORT_SYMBOL (cat_cancel_cb);/* helper to initialize catalog llog and process it to cancel */ int llog_cat_init_and_process(const struct lu_env *env,
Signature · 1 line
1.9.1