Declare local functions as static
v2 cover Declare local functions as static
Declare functions as static since they are used only in a particular file.
Changes in v2-
Made commit log and subject clearer.
Shraddha Barke (4):
Staging: lustre: obdclass: llog_swab: Declare local functions as
static
Staging: lustre: obdclass: lprocfs_status: Declare typedefs as static
Staging: lustre: ptlrpc: pack_generic: Declare local functions as
static
Staging: lustre: ptlrcpc: sec: Declare local functions as static
drivers/staging/lustre/lustre/include/lprocfs_status.h | 5 ----- drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 5 ----- drivers/staging/lustre/lustre/include/lustre_sec.h | 7 ------- drivers/staging/lustre/lustre/obdclass/llog_swab.c | 6 ++---- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 11 +++++------ drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 5 ++--- drivers/staging/lustre/lustre/ptlrpc/sec.c | 10 ++++------ 7 files changed, 13 insertions(+), 36 deletions(-)
Signature · 1 line
2.1.4
PATCH v2 1/4 Staging: lustre: obdclass: llog_swab: Declare local functions as static
Declare functions lustre_swab_llog_id and lustre_swab_ll_fid as static since they are used only in this particular file. Also remove them from corresponding header files.
---
Changes in v2-
Made commit message and subject clearer.
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 2 -- drivers/staging/lustre/lustre/obdclass/llog_swab.c | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +0 -2
@@ -2116,7 +2116,6 @@ void lustre_swab_generic_32s(__u32 *val);/* This FULL lock is useful to take on unlink sort of operations */ #define MDS_INODELOCK_FULL ((1<<(MDS_INODELOCK_MAXSHIFT+1))-1) -void lustre_swab_ll_fid (struct ll_fid *fid);/* NOTE: until Lustre 1.8.7/2.1.1 the fid_ver() was packed into name[2], * but was moved into name[1] along with the OID to avoid consuming the
@@ -3349,7 +3348,6 @@ void lustre_swab_llogd_body(struct llogd_body *d);void lustre_swab_llog_hdr (struct llog_log_hdr *h);void lustre_swab_llogd_conn_body (struct llogd_conn_body *d);void lustre_swab_llog_rec (struct llog_rec_hdr *rec); -void lustre_swab_llog_id (struct llog_logid *lid);struct lustre_cfg ;void lustre_swab_lustre_cfg (struct lustre_cfg *lcfg);
drivers/staging/lustre/lustre/obdclass/llog_swab.c +2 -4
@@ -78,13 +78,12 @@ void lustre_swab_ost_id(struct ost_id *oid) }EXPORT_SYMBOL (lustre_swab_ost_id); -void lustre_swab_llog_id (struct llog_logid *log_id) +static void lustre_swab_llog_id (struct llog_logid *log_id) {__swab64s (&log_id->lgl_oi.oi.oi_id);__swab64s (&log_id->lgl_oi.oi.oi_seq);__swab32s (&log_id->lgl_ogen); } -EXPORT_SYMBOL (lustre_swab_llog_id);void lustre_swab_llogd_body (struct llogd_body *d) {
@@ -109,13 +108,12 @@ void lustre_swab_llogd_conn_body(struct llogd_conn_body *d) }EXPORT_SYMBOL (lustre_swab_llogd_conn_body); -void lustre_swab_ll_fid (struct ll_fid *fid) +static void lustre_swab_ll_fid (struct ll_fid *fid) {__swab64s (&fid->id);__swab32s (&fid->generation);__swab32s (&fid->f_type); } -EXPORT_SYMBOL (lustre_swab_ll_fid);void lustre_swab_lu_seq_range (struct lu_seq_range *range) {
Signature · 1 line
2.1.4
PATCH v2 2/4 Staging: lustre: obdclass: lprocfs_status: Declare typedefs as static
In reply to Shraddha BarkeDeclare typedefs lustre_attr_show and lustre_attr_store as static since they are used only in this particular file. Also remove them from corresponding header files.
---
Changes in v2-
Made commit message and subject clearer.
drivers/staging/lustre/lustre/include/lprocfs_status.h | 5 ----- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 11 +++++------ 2 files changed, 5 insertions(+), 11 deletions(-)
drivers/staging/lustre/lustre/include/lprocfs_status.h +0 -5
@@ -713,11 +713,6 @@ static struct lustre_attr lustre_attr_##name = __ATTR(name, mode, show, store)#define LUSTRE_RO_ATTR (name) LUSTRE_ATTR(name, 0444, name##_show, NULL)#define LUSTRE_RW_ATTR (name) LUSTRE_ATTR(name, 0644, name##_show, name##_store) -ssize_t lustre_attr_show (struct kobject *kobj,struct attribute *attr, -char *buf); -ssize_t lustre_attr_store (struct kobject *kobj,struct attribute *attr, -const char *buf,size_t len); -extern const struct sysfs_ops lustre_sysfs_ops;/* all quota proc functions */
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +5 -6
@@ -1467,23 +1467,22 @@ void lprocfs_oh_clear(struct obd_histogram *oh) }EXPORT_SYMBOL (lprocfs_oh_clear); -ssize_t lustre_attr_show (struct kobject *kobj, -struct attribute *attr,char *buf) +static ssize_t lustre_attr_show (struct kobject *kobj, +struct attribute *attr,char *buf) { struct lustre_attr *a = container_of(attr, struct lustre_attr, attr);return a->show ? a->show (kobj, attr, buf) :0 ; } -EXPORT_SYMBOL_GPL (lustre_attr_show); -ssize_t lustre_attr_store (struct kobject *kobj,struct attribute *attr, -const char *buf,size_t len) +static ssize_t lustre_attr_store (struct kobject *kobj,struct attribute *attr, +const char *buf,size_t len) { struct lustre_attr *a = container_of(attr, struct lustre_attr, attr);return a->store ? a->store (kobj, attr, buf, len) : len; } -EXPORT_SYMBOL_GPL (lustre_attr_store); +const struct sysfs_ops lustre_sysfs_ops = { .show = lustre_attr_show,
Signature · 1 line
2.1.4
Greg KH
maintainerRe: [Outreachy kernel] [PATCH v2 2/4] Staging: lustre: obdclass: lprocfs_status: Declare typedefs as static
Quoted 3 lines · Shraddha Barke
Declare typedefs
lustre_attr_showandlustre_attr_storeas static since they are used only in this particular file. Also remove them from corresponding header files.
"typedefs"? I see no typedef changes here :(
Re: [Outreachy kernel] [PATCH v2 2/4] Staging: lustre: obdclass: lprocfs_status: Declare typedefs as static
Quoted 6 lines · Greg KH
Quoted 3 lines · Shraddha Barke
Declare typedefs
lustre_attr_showandlustre_attr_storeas static since they are used only in this particular file. Also remove them from corresponding header files."typedefs"? I see no typedef changes here :(
Shoot, my bad :( I'll fix it up and resend.
Thanks,
Shraddha
Quoted 2 lines
PATCH v2 3/4 Staging: lustre: ptlrpc: pack_generic: Declare local functions as static
In reply to Shraddha BarkeDeclare functions lustre_swab_ldlm_lock_desc and dump_obdo as static since they are used only in this particular file. Also remove them from corresponding header files.
---
Changes in v2-
Made commit message and subject clearer.
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 3 --- drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 5 ++--- 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +0 -3
@@ -2785,8 +2785,6 @@ struct ldlm_lock_desc {ldlm_wire_policy_data_t l_policy_data; }; -void lustre_swab_ldlm_lock_desc (struct ldlm_lock_desc *l); -#define LDLM_LOCKREQ_HANDLES 2#define LDLM_ENQUEUE_CANCEL_OFF 1
@@ -3355,7 +3353,6 @@ void lustre_swab_lustre_cfg(struct lustre_cfg *lcfg);/* Functions for dumping PTLRPC fields */ void dump_rniobuf (struct niobuf_remote *rnb);void dump_ioo (struct obd_ioobj *nb); -void dump_obdo (struct obdo *oa);void dump_ost_body (struct ost_body *ob);void dump_rcs (__u32 *rc);
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +2 -3
@@ -1977,14 +1977,13 @@ void lustre_swab_ldlm_resource_desc(struct ldlm_resource_desc *r) }EXPORT_SYMBOL (lustre_swab_ldlm_resource_desc); -void lustre_swab_ldlm_lock_desc (struct ldlm_lock_desc *l) +static void lustre_swab_ldlm_lock_desc (struct ldlm_lock_desc *l) {lustre_swab_ldlm_resource_desc (&l->l_resource);__swab32s (&l->l_req_mode);__swab32s (&l->l_granted_mode);lustre_swab_ldlm_policy_data (&l->l_policy_data); } -EXPORT_SYMBOL (lustre_swab_ldlm_lock_desc);void lustre_swab_ldlm_request (struct ldlm_request *rq) {
@@ -2033,7 +2032,7 @@ void dump_rniobuf(struct niobuf_remote *nb) }EXPORT_SYMBOL (dump_rniobuf); -void dump_obdo (struct obdo *oa) +static void dump_obdo (struct obdo *oa) {__u32 valid = oa->o_valid;
Signature · 1 line
2.1.4
PATCH v2 4/4 Staging: lustre: ptlrcpc: sec: Declare local functions as static
In reply to Shraddha BarkeDeclare functions sptlrpc_secflags2str, sptlrpc_sec_get and sptlrpc_svc_install_rvs_ctx as static since they are used only in this particular file. Also remove them from corresponding header files.
---
Changes in v2-
Made commit message and subject clearer.
drivers/staging/lustre/lustre/include/lustre_sec.h | 7 ------- drivers/staging/lustre/lustre/ptlrpc/sec.c | 10 ++++------ 2 files changed, 4 insertions(+), 13 deletions(-)
drivers/staging/lustre/lustre/include/lustre_sec.h +0 -7
@@ -916,7 +916,6 @@ const char *sptlrpc_flavor2name_base(__u32 flvr);char *sptlrpc_flavor2name_bulk (struct sptlrpc_flavor *sf,char *buf,int bufsize);char *sptlrpc_flavor2name (struct sptlrpc_flavor *sf,char *buf,int bufsize); -char *sptlrpc_secflags2str (__u32 flags,char *buf,int bufsize);static inline struct ptlrpc_sec_policy *sptlrpc_policy_get (struct ptlrpc_sec_policy *policy)
@@ -979,7 +978,6 @@ int cli_ctx_is_eternal(struct ptlrpc_cli_ctx *ctx)/* * sec get/put */ -struct ptlrpc_sec *sptlrpc_sec_get (struct ptlrpc_sec *sec);void sptlrpc_sec_put (struct ptlrpc_sec *sec);/*
@@ -1058,11 +1056,6 @@ void sptlrpc_svc_ctx_decref(struct ptlrpc_request *req);int sptlrpc_target_export_check (struct obd_export *exp,struct ptlrpc_request *req); -/* -* reverse context -*/ -int sptlrpc_svc_install_rvs_ctx (struct obd_import *imp, -struct ptlrpc_svc_ctx *ctx);/* bulk security api */ void sptlrpc_enc_pool_put_pages (struct ptlrpc_bulk_desc *desc);
drivers/staging/lustre/lustre/ptlrpc/sec.c +4 -6
@@ -227,7 +227,7 @@ char *sptlrpc_flavor2name(struct sptlrpc_flavor *sf, char *buf, int bufsize) }EXPORT_SYMBOL (sptlrpc_flavor2name); -char *sptlrpc_secflags2str (__u32 flags,char *buf,int bufsize) +static char *sptlrpc_secflags2str (__u32 flags,char *buf,int bufsize) { buf[0 ] ='\0' ;
@@ -244,7 +244,6 @@ char *sptlrpc_secflags2str(__u32 flags, char *buf, int bufsize)return buf; } -EXPORT_SYMBOL (sptlrpc_secflags2str);/************************************************** * client context APIs *
@@ -1199,14 +1198,13 @@ static void sptlrpc_sec_kill(struct ptlrpc_sec *sec) } } -struct ptlrpc_sec *sptlrpc_sec_get (struct ptlrpc_sec *sec) +static struct ptlrpc_sec *sptlrpc_sec_get (struct ptlrpc_sec *sec) {if (sec)atomic_inc (&sec->ps_refcount);return sec; } -EXPORT_SYMBOL (sptlrpc_sec_get);void sptlrpc_sec_put (struct ptlrpc_sec *sec) {
@@ -1643,8 +1641,8 @@ void sptlrpc_cli_free_repbuf(struct ptlrpc_request *req) req->rq_repmsg =NULL ; } -int sptlrpc_svc_install_rvs_ctx (struct obd_import *imp, -struct ptlrpc_svc_ctx *ctx) +static int sptlrpc_svc_install_rvs_ctx (struct obd_import *imp, +struct ptlrpc_svc_ctx *ctx) {struct ptlrpc_sec_policy *policy = ctx->sc_policy;
Signature · 1 line
2.1.4