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 (2):
Staging: lustre: obdclass: lu_object: Declare local functions as
static
Staging: lustre: obdclass: lprocfs_status: Declare local functions as
static
drivers/staging/lustre/lustre/include/lprocfs_status.h | 5 ----- drivers/staging/lustre/lustre/include/lu_object.h | 5 ----- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 10 ++++------ drivers/staging/lustre/lustre/obdclass/lu_object.c | 11 +++++------ 4 files changed, 9 insertions(+), 22 deletions(-)
Signature · 1 line
2.1.4
PATCH 1/2 Staging: lustre: obdclass: lu_object: Declare local functions as static
Declare lu_dev_add_linkage and lu_object_find as static since they are used only in this particular file. Also remove the corresponding declarations from header file.
--- drivers/staging/lustre/lustre/include/lu_object.h | 5 ----- drivers/staging/lustre/lustre/obdclass/lu_object.c | 11 +++++------ 2 files changed, 5 insertions(+), 11 deletions(-)
drivers/staging/lustre/lustre/include/lu_object.h +0 -5
@@ -671,8 +671,6 @@ void lu_object_fini (struct lu_object *o);void lu_object_add_top (struct lu_object_header *h,struct lu_object *o);void lu_object_add (struct lu_object *before,struct lu_object *o); -void lu_dev_add_linkage (struct lu_site *s,struct lu_device *d); -/** * Helpers to initialize and finalize device types. */
@@ -715,9 +713,6 @@ int lu_site_purge(const struct lu_env *env, struct lu_site *s, int nr);void lu_site_print (const struct lu_env *env,struct lu_site *s,void *cookie,lu_printer_t printer); -struct lu_object *lu_object_find (const struct lu_env *env, -struct lu_device *dev,const struct lu_fid *f, -const struct lu_object_conf *conf); struct lu_object *lu_object_find_at(const struct lu_env *env, struct lu_device *dev, const struct lu_fid *f,
drivers/staging/lustre/lustre/obdclass/lu_object.c +5 -6
@@ -572,13 +572,13 @@ static struct lu_object *htable_lookup(struct lu_site *s,* return it. Otherwise, create new object, insert it into cache and return * it. In any case, additional reference is acquired on the returned object. */ -struct lu_object *lu_object_find (const struct lu_env *env, -struct lu_device *dev,const struct lu_fid *f, -const struct lu_object_conf *conf) +static struct lu_object *lu_object_find (const struct lu_env *env, +struct lu_device *dev, +const struct lu_fid *f, +const struct lu_object_conf *conf) {return lu_object_find_at (env, dev->ld_site->ls_top_dev, f, conf); } -EXPORT_SYMBOL (lu_object_find); static struct lu_object *lu_object_new(const struct lu_env *env, struct lu_device *dev,
@@ -925,14 +925,13 @@ cfs_hash_ops_t lu_site_hash_ops = { .hs_put_locked = lu_obj_hop_put_locked, }; -void lu_dev_add_linkage (struct lu_site *s,struct lu_device *d) +static void lu_dev_add_linkage (struct lu_site *s,struct lu_device *d) {spin_lock (&s->ls_ld_lock);if (list_empty (&d->ld_linkage))list_add (&d->ld_linkage, &s->ls_ld_linkage);spin_unlock (&s->ls_ld_lock); } -EXPORT_SYMBOL (lu_dev_add_linkage);/** * Initialize site \a s, with \a d as the top level device.
Signature · 1 line
2.1.4
PATCH 2/2 Staging: lustre: obdclass: lprocfs_status: Declare local functions as static
In reply to Shraddha BarkeDeclare 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.
--- drivers/staging/lustre/lustre/include/lprocfs_status.h | 5 ----- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 10 ++++------ 2 files changed, 4 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 +4 -6
@@ -1467,23 +1467,21 @@ 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