Declare local functions as static
cover Declare local functions as static
Declare functions as static since they are used only in a particular file.
Shraddha Barke (5):
Staging: lustre: obdclass: llog_cat: Declare local functions as static
Staging: lustre: ptlrpc: pack_generic: Declare local functions as
static
Staging: lustre: ptlrpc: import: Declare deuuidify as static
Staging: lustre: ptlrpc: service: Declare local functions as static
Staging: lustre: obdclass: obdo: Declare iattr_from_obdo as static
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 8 -------- drivers/staging/lustre/lustre/include/lustre_log.h | 3 --- drivers/staging/lustre/lustre/include/lustre_net.h | 4 ---- drivers/staging/lustre/lustre/include/obd_class.h | 1 - drivers/staging/lustre/lustre/obdclass/llog_cat.c | 15 ++++++++------- drivers/staging/lustre/lustre/obdclass/llog_internal.h | 2 -- drivers/staging/lustre/lustre/obdclass/obdo.c | 3 +-- drivers/staging/lustre/lustre/ptlrpc/import.c | 3 ++- drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 12 ++++-------- drivers/staging/lustre/lustre/ptlrpc/service.c | 5 ++--- 10 files changed, 17 insertions(+), 39 deletions(-)
Signature · 1 line
2.1.4
PATCH 1/5 Staging: lustre: obdclass: llog_cat: Declare local functions as static
Declare llog_cat_id2handle and llog_cat_process_or_fork as static since they are used only in this particular file. Also remove the corresponding declarations from header files.
--- drivers/staging/lustre/lustre/include/lustre_log.h | 3 --- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 15 ++++++++------- drivers/staging/lustre/lustre/obdclass/llog_internal.h | 2 -- 3 files changed, 8 insertions(+), 12 deletions(-)
drivers/staging/lustre/lustre/include/lustre_log.h +0 -3
@@ -165,9 +165,6 @@ struct llog_process_cat_data {struct thandle ;int llog_cat_close (const struct lu_env *env,struct llog_handle *cathandle); -int llog_cat_process_or_fork (const struct lu_env *env, -struct llog_handle *cat_llh,llog_cb_t cb, -void *data,int startcat,int startidx,bool fork);int llog_cat_process (const struct lu_env *env,struct llog_handle *cat_llh,llog_cb_t cb,void *data,int startcat,int startidx);
drivers/staging/lustre/lustre/obdclass/llog_cat.c +8 -7
@@ -62,8 +62,10 @@* This takes extra reference on llog_handle via llog_handle_get() and require * this reference to be put by caller using llog_handle_put() */ -int llog_cat_id2handle (const struct lu_env *env,struct llog_handle *cathandle, -struct llog_handle **res,struct llog_logid *logid) +static int llog_cat_id2handle (const struct lu_env *env, +struct llog_handle *cathandle, +struct llog_handle **res, +struct llog_logid *logid) {struct llog_handle *loghandle;int rc =0 ;
@@ -189,10 +191,10 @@ static int llog_cat_process_cb(const struct lu_env *env,return rc; } -int llog_cat_process_or_fork (const struct lu_env *env, -struct llog_handle *cat_llh, -llog_cb_t cb,void *data,int startcat, -int startidx,bool fork) +static int llog_cat_process_or_fork (const struct lu_env *env, +struct llog_handle *cat_llh, +llog_cb_t cb,void *data,int startcat, +int startidx,bool fork) {struct llog_process_data d;struct llog_log_hdr *llh = cat_llh->lgh_hdr;
@@ -228,7 +230,6 @@ int llog_cat_process_or_fork(const struct lu_env *env,return rc; } -EXPORT_SYMBOL (llog_cat_process_or_fork);int llog_cat_process (const struct lu_env *env,struct llog_handle *cat_llh,llog_cb_t cb,void *data,int startcat,int startidx)
drivers/staging/lustre/lustre/obdclass/llog_internal.h +0 -2
@@ -66,8 +66,6 @@ void llog_info_fini(void);void llog_handle_get (struct llog_handle *loghandle);void llog_handle_put (struct llog_handle *loghandle); -int llog_cat_id2handle (const struct lu_env *env,struct llog_handle *cathandle, -struct llog_handle **res,struct llog_logid *logid);int class_config_dump_handler (const struct lu_env *env,struct llog_handle *handle,struct llog_rec_hdr *rec,void *data);
Signature · 1 line
2.1.4
PATCH 2/5 Staging: lustre: ptlrpc: pack_generic: Declare local functions as static
In reply to Shraddha BarkeDeclare lustre_swab_ldlm_resource_desc, lustre_swab_obdo, lustre_swab_ldlm_res_id, lustre_swab_ldlm_policy_data as static since they are used only in this particular file. Also remove the corresponding declarations from header file.
--- drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 8 -------- drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 12 ++++-------- 2 files changed, 4 insertions(+), 16 deletions(-)
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +0 -8
@@ -2680,8 +2680,6 @@ struct ldlm_res_id {#define PLDLMRES (res) (res)->lr_name.name[0], (res)->lr_name.name[1], \ (res)->lr_name.name[2], (res)->lr_name.name[3] -void lustre_swab_ldlm_res_id (struct ldlm_res_id *id); -static inline int ldlm_res_eq (const struct ldlm_res_id *res0,const struct ldlm_res_id *res1) {
@@ -2757,8 +2755,6 @@ typedef union {struct ldlm_inodebits l_inodebits; } ldlm_wire_policy_data_t; -void lustre_swab_ldlm_policy_data (ldlm_wire_policy_data_t *d); -union ldlm_gl_desc {struct ldlm_gl_lquota_desc lquota_desc; };
@@ -2777,8 +2773,6 @@ struct ldlm_resource_desc {struct ldlm_res_id lr_name; }; -void lustre_swab_ldlm_resource_desc (struct ldlm_resource_desc *r); -struct ldlm_lock_desc {struct ldlm_resource_desc l_resource;ldlm_mode_t l_req_mode;
@@ -3320,8 +3314,6 @@ static inline void lustre_get_wire_obdo(struct obd_connect_data *ocd, } } -void lustre_swab_obdo (struct obdo *o); -/* request structure for OST's */ struct ost_body {struct obdo oa;
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +4 -8
@@ -1501,7 +1501,7 @@ void lustre_swab_connect(struct obd_connect_data *ocd) CLASSERT(offsetof(typeof(*ocd), paddingF) != 0); } -void lustre_swab_obdo (struct obdo *o) +static void lustre_swab_obdo (struct obdo *o) {__swab64s (&o->o_valid);lustre_swab_ost_id (&o->o_oi);
@@ -1533,7 +1533,6 @@ void lustre_swab_obdo(struct obdo *o) CLASSERT(offsetof(typeof(*o), o_padding_6) != 0); } -EXPORT_SYMBOL (lustre_swab_obdo);void lustre_swab_obd_statfs (struct obd_statfs *os) {
@@ -1941,16 +1940,15 @@ void lustre_swab_lov_user_md_objects(struct lov_user_ost_data *lod, }EXPORT_SYMBOL (lustre_swab_lov_user_md_objects); -void lustre_swab_ldlm_res_id (struct ldlm_res_id *id) +static void lustre_swab_ldlm_res_id (struct ldlm_res_id *id) {int i;for (i =0 ; i <RES_NAME_SIZE ; i++)__swab64s (&id->name[i]); } -EXPORT_SYMBOL (lustre_swab_ldlm_res_id); -void lustre_swab_ldlm_policy_data (ldlm_wire_policy_data_t *d) +static void lustre_swab_ldlm_policy_data (ldlm_wire_policy_data_t *d) {/* the lock data is a union and the first two fields are always an * extent so it's ok to process an LDLM_EXTENT and LDLM_FLOCK lock
@@ -1961,7 +1959,6 @@ void lustre_swab_ldlm_policy_data(ldlm_wire_policy_data_t *d)__swab64s (&d->l_flock.lfw_owner);__swab32s (&d->l_flock.lfw_pid); } -EXPORT_SYMBOL (lustre_swab_ldlm_policy_data);void lustre_swab_ldlm_intent (struct ldlm_intent *i) {
@@ -1969,13 +1966,12 @@ void lustre_swab_ldlm_intent(struct ldlm_intent *i) }EXPORT_SYMBOL (lustre_swab_ldlm_intent); -void lustre_swab_ldlm_resource_desc (struct ldlm_resource_desc *r) +static void lustre_swab_ldlm_resource_desc (struct ldlm_resource_desc *r) {__swab32s (&r->lr_type); CLASSERT(offsetof(typeof(*r), lr_padding) != 0);lustre_swab_ldlm_res_id (&r->lr_name); } -EXPORT_SYMBOL (lustre_swab_ldlm_resource_desc);void lustre_swab_ldlm_lock_desc (struct ldlm_lock_desc *l) {
Signature · 1 line
2.1.4
PATCH 3/5 Staging: lustre: ptlrpc: import: Declare deuuidify as static
In reply to Shraddha BarkeDeclare function deuuidify as static since it is used only in this particular file.Also remove the corresponding declaration from header files.
--- drivers/staging/lustre/lustre/include/lustre_net.h | 2 -- drivers/staging/lustre/lustre/ptlrpc/import.c | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/include/lustre_net.h +0 -2
@@ -2523,8 +2523,6 @@ int ptlrpc_connect_import(struct obd_import *imp);int ptlrpc_init_import (struct obd_import *imp);int ptlrpc_disconnect_import (struct obd_import *imp,int noclose);int ptlrpc_import_recovery_state_machine (struct obd_import *imp); -void deuuidify (char *uuid,const char *prefix,char **uuid_start, -int *uuid_len);/* ptlrpc/pack_generic.c */ int ptlrpc_reconnect_import (struct obd_import *imp);
drivers/staging/lustre/lustre/ptlrpc/import.c +2 -1
@@ -128,7 +128,8 @@ int ptlrpc_init_import(struct obd_import *imp)EXPORT_SYMBOL (ptlrpc_init_import);#define UUID_STR "_UUID" -void deuuidify (char *uuid,const char *prefix,char **uuid_start,int *uuid_len) +static void deuuidify (char *uuid,const char *prefix,char **uuid_start, +int *uuid_len) { *uuid_start = !prefix ||strncmp (uuid, prefix,strlen (prefix)) ? uuid : uuid +strlen (prefix);
Signature · 1 line
2.1.4
PATCH 4/5 Staging: lustre: ptlrpc: service: Declare local functions as static
In reply to Shraddha BarkeDeclare ptlrpc_server_drop_request and ptlrpc_stop_all_threads as static since they are used only in this particular file.Also remove the corresponding declaration from header files.
--- drivers/staging/lustre/lustre/include/lustre_net.h | 2 -- drivers/staging/lustre/lustre/ptlrpc/service.c | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/staging/lustre/lustre/include/lustre_net.h +0 -2
@@ -2502,12 +2502,10 @@ struct ptlrpc_service *ptlrpc_register_service(struct ptlrpc_service_conf *conf, struct kset *parent, struct dentry *debugfs_entry); -void ptlrpc_stop_all_threads (struct ptlrpc_service *svc);int ptlrpc_start_threads (struct ptlrpc_service *svc);int ptlrpc_unregister_service (struct ptlrpc_service *service);int liblustre_check_services (void *arg); -void ptlrpc_server_drop_request (struct ptlrpc_request *req);int ptlrpc_hr_init (void );void ptlrpc_hr_fini (void );
drivers/staging/lustre/lustre/ptlrpc/service.c +2 -3
@@ -715,7 +715,7 @@ static void ptlrpc_server_free_request(struct ptlrpc_request *req)* drop a reference count of the request. if it reaches 0, we either * put it into history list, or free it immediately. */ -void ptlrpc_server_drop_request (struct ptlrpc_request *req) +static void ptlrpc_server_drop_request (struct ptlrpc_request *req) {struct ptlrpc_request_buffer_desc *rqbd = req->rq_rqbd;struct ptlrpc_service_part *svcpt = rqbd->rqbd_svcpt;
@@ -2327,7 +2327,7 @@ static void ptlrpc_svcpt_stop_threads(struct ptlrpc_service_part *svcpt)/** * Stops all threads of a particular service \a svc */ -void ptlrpc_stop_all_threads (struct ptlrpc_service *svc) +static void ptlrpc_stop_all_threads (struct ptlrpc_service *svc) {struct ptlrpc_service_part *svcpt;int i;
@@ -2337,7 +2337,6 @@ void ptlrpc_stop_all_threads(struct ptlrpc_service *svc)ptlrpc_svcpt_stop_threads (svcpt); } } -EXPORT_SYMBOL (ptlrpc_stop_all_threads);int ptlrpc_start_threads (struct ptlrpc_service *svc) {
Signature · 1 line
2.1.4
PATCH 5/5 Staging: lustre: obdclass: obdo: Declare iattr_from_obdo as static
In reply to Shraddha BarkeDeclare iattr_from_obdo as static since it is used only in this particular file.Also remove the corresponding declaration from header file.
--- drivers/staging/lustre/lustre/include/obd_class.h | 1 - drivers/staging/lustre/lustre/obdclass/obdo.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/staging/lustre/lustre/include/obd_class.h +0 -1
@@ -271,7 +271,6 @@ struct obdo;void obdo_refresh_inode (struct inode *dst,struct obdo *src,u32 valid);void obdo_to_ioobj (struct obdo *oa,struct obd_ioobj *ioobj); -void iattr_from_obdo (struct iattr *attr,struct obdo *oa,u32 valid);void md_from_obdo (struct md_op_data *op_data,struct obdo *oa,u32 valid);#define OBT (dev) (dev)->obd_type
drivers/staging/lustre/lustre/obdclass/obdo.c +1 -2
@@ -127,7 +127,7 @@ void obdo_to_ioobj(struct obdo *oa, struct obd_ioobj *ioobj) }EXPORT_SYMBOL (obdo_to_ioobj); -void iattr_from_obdo (struct iattr *attr,struct obdo *oa,u32 valid) +static void iattr_from_obdo (struct iattr *attr,struct obdo *oa,u32 valid) { valid &= oa->o_valid;
@@ -174,7 +174,6 @@ void iattr_from_obdo(struct iattr *attr, struct obdo *oa, u32 valid) attr->ia_valid |=ATTR_GID ; } } -EXPORT_SYMBOL (iattr_from_obdo);void md_from_obdo (struct md_op_data *op_data,struct obdo *oa,u32 valid) {
Signature · 1 line
2.1.4
Quoted 10 lines · On Thursday 08 October 2015 01:36:03 Shraddha Barke wrote:
Declare functions as static since they are used only in a particular file.
Shraddha Barke (5):
Staging: lustre: obdclass:llog_cat: Declare local functions as static
Staging: lustre: ptlrpc:pack_generic: Declare local functions as
static
Staging: lustre: ptlrpc: import: Declare deuuidify as static
Staging: lustre: ptlrpc: service: Declare local functions as static
Staging: lustre: obdclass: obdo: Declareiattr_from_obdoas static
All five patches