From f2b264f2049554d69c1cc6f0c0ebc5d3e196a068 Mon Sep 17 00:00:00 2001 From: komaln Date: Thu, 3 Jan 2008 09:21:16 +0000 Subject: [PATCH] b=14184 r=Nathan, Adilger to remove the use of LPROCFS_INIT_VARS and related macros --- lustre/cmm/cmm_device.c | 8 ++++++-- lustre/include/lprocfs_status.h | 15 --------------- lustre/include/obd_class.h | 10 ++++++++++ lustre/llite/llite_internal.h | 5 +++++ lustre/llite/llite_lib.c | 2 +- lustre/llite/lproc_llite.c | 10 +++++++--- lustre/lmv/lmv_internal.h | 8 ++++++++ lustre/lmv/lmv_obd.c | 4 ++-- lustre/lmv/lproc_lmv.c | 10 +++++++--- lustre/lov/lov_internal.h | 8 ++++++++ lustre/lov/lov_obd.c | 12 ++++++------ lustre/lov/lproc_lov.c | 13 +++++++++---- lustre/lvfs/lustre_quota_fmt.h | 6 ++++++ lustre/lvfs/quotafmt_test.c | 14 +++++++++----- lustre/mdc/lproc_mdc.c | 10 +++++++--- lustre/mdc/mdc_internal.h | 8 ++++++++ lustre/mdc/mdc_request.c | 12 ++++++------ lustre/mdd/mdd_device.c | 8 ++++++-- lustre/mds/handler.c | 12 ++++++------ lustre/mds/lproc_mds.c | 13 +++++++++++-- lustre/mds/mds_internal.h | 3 ++- lustre/mdt/mdt_handler.c | 6 +++--- lustre/mdt/mdt_internal.h | 1 + lustre/mdt/mdt_lproc.c | 6 +++++- lustre/mgs/lproc_mgs.c | 6 +++++- lustre/mgs/mgs_handler.c | 4 ++-- lustre/mgs/mgs_internal.h | 5 +++++ lustre/obdclass/llog_test.c | 19 +++++++++++-------- lustre/obdecho/echo.c | 4 ++-- lustre/obdecho/echo_client.c | 4 ++-- lustre/obdecho/lproc_echo.c | 10 +++++++--- lustre/obdfilter/filter.c | 6 +++--- lustre/obdfilter/filter_internal.h | 5 +++++ lustre/obdfilter/lproc_obdfilter.c | 10 +++++++--- lustre/osc/lproc_osc.c | 10 +++++++--- lustre/osc/osc_internal.h | 5 +++++ lustre/osc/osc_request.c | 12 ++++++------ lustre/osd/osd_handler.c | 9 +++++++-- lustre/ost/lproc_ost.c | 12 ++++++++---- lustre/ost/ost_handler.c | 4 ++-- lustre/ost/ost_internal.h | 9 +++++++++ lustre/quota/quota_internal.h | 16 ++++++++++++++++ lustre/quota/quotacheck_test.c | 25 +++++++++++++++---------- lustre/quota/quotactl_test.c | 25 +++++++++++++++---------- 44 files changed, 278 insertions(+), 126 deletions(-) diff --git a/lustre/cmm/cmm_device.c b/lustre/cmm/cmm_device.c index 38054f4c..b4e03d2 100644 --- a/lustre/cmm/cmm_device.c +++ b/lustre/cmm/cmm_device.c @@ -483,13 +483,17 @@ struct lprocfs_vars lprocfs_cmm_module_vars[] = { { 0 } }; -LPROCFS_INIT_VARS(cmm, lprocfs_cmm_module_vars, lprocfs_cmm_obd_vars); +static void lprocfs_cmm_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_cmm_module_vars; + lvars->obd_vars = lprocfs_cmm_obd_vars; +} static int __init cmm_mod_init(void) { struct lprocfs_static_vars lvars; - lprocfs_init_vars(cmm, &lvars); + lprocfs_cmm_init_vars(&lvars); return class_register_type(&cmm_obd_device_ops, NULL, lvars.module_vars, LUSTRE_CMM_NAME, &cmm_device_type); } diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 3444250..e2dd9c4 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -296,19 +296,6 @@ extern int lprocfs_exp_cleanup(struct obd_export *exp); extern int lprocfs_register_stats(cfs_proc_dir_entry_t *root, const char *name, struct lprocfs_stats *stats); -#define LPROCFS_INIT_VARS(name, vclass, vinstance) \ -void lprocfs_##name##_init_vars(struct lprocfs_static_vars *x) \ -{ \ - x->module_vars = vclass; \ - x->obd_vars = vinstance; \ -} \ - -#define lprocfs_init_vars(NAME, VAR) \ -do { \ - extern void lprocfs_##NAME##_init_vars(struct lprocfs_static_vars *); \ - lprocfs_##NAME##_init_vars(VAR); \ -} while (0) - /* lprocfs_status.c */ extern int lprocfs_add_vars(cfs_proc_dir_entry_t *root, struct lprocfs_vars *var, @@ -516,8 +503,6 @@ static inline int lprocfs_exp_cleanup(struct obd_export *exp) static inline cfs_proc_dir_entry_t * lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent, struct lprocfs_vars *list, void *data) { return NULL; } -#define LPROCFS_INIT_VARS(name, vclass, vinstance) -#define lprocfs_init_vars(...) do {} while (0) static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root, struct lprocfs_vars *var, void *data) { return 0; } diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 7f29480..b863841 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -102,6 +102,16 @@ int class_detach(struct obd_device *obd, struct lustre_cfg *lcfg); struct obd_device *class_incref(struct obd_device *obd); void class_decref(struct obd_device *obd); +/*obdecho*/ +#ifdef LPROCFS +extern void lprocfs_echo_init_vars(struct lprocfs_static_vars *lvars); +#else +static inline void lprocfs_echo_init_vars(struct lprocfs_static_vars *lvars) +{ + memset(lvars, 0, sizeof(*lvars)); +} +#endif + #define CFG_F_START 0x01 /* Set when we start updating from a log */ #define CFG_F_MARKER 0x02 /* We are within a maker */ #define CFG_F_SKIP 0x04 /* We should ignore this cfg command */ diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 6d0c8c0..6273f68 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -447,11 +447,16 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent, struct super_block *sb, char *osc, char *mdc); void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi); void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count); +void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars); #else static inline int lprocfs_register_mountpoint(struct proc_dir_entry *parent, struct super_block *sb, char *osc, char *mdc){return 0;} static inline void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi) {} static void ll_stats_ops_tally(struct ll_sb_info *sbi, int op, int count) {} +static void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars) +{ + memset(lvars, 0, sizeof(*lvars)); +} #endif diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 2f6fbab..06e3b79 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -2140,7 +2140,7 @@ int ll_process_config(struct lustre_cfg *lcfg) unsigned long x; int rc = 0; - lprocfs_init_vars(llite, &lvars); + lprocfs_llite_init_vars(&lvars); /* The instance name contains the sb: lustre-client-aacfe000 */ ptr = strrchr(lustre_cfg_string(lcfg, 0), '-'); diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 82b166d..9ed89be 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -454,7 +454,7 @@ static int ll_wr_track_gid(struct file *file, const char *buffer, return (ll_wr_track_id(buffer, count, data, STATS_TRACK_GID)); } -static struct lprocfs_vars lprocfs_obd_vars[] = { +static struct lprocfs_vars lprocfs_llite_obd_vars[] = { { "uuid", ll_rd_sb_uuid, 0, 0 }, //{ "mntpt_path", ll_rd_path, 0, 0 }, { "fstype", ll_rd_fstype, 0, 0 }, @@ -643,7 +643,7 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent, if (err) GOTO(out, err); - err = lprocfs_add_vars(sbi->ll_proc_root, lprocfs_obd_vars, sb); + err = lprocfs_add_vars(sbi->ll_proc_root, lprocfs_llite_obd_vars, sb); if (err) GOTO(out, err); @@ -1273,5 +1273,9 @@ static ssize_t ll_rw_offset_stats_seq_write(struct file *file, const char *buf, LPROC_SEQ_FOPS(ll_rw_offset_stats); -LPROCFS_INIT_VARS(llite, NULL, lprocfs_obd_vars) +void lprocfs_llite_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = NULL; + lvars->obd_vars = lprocfs_llite_obd_vars; +} #endif /* LPROCFS */ diff --git a/lustre/lmv/lmv_internal.h b/lustre/lmv/lmv_internal.h index 4e8c721..d4cce7f 100644 --- a/lustre/lmv/lmv_internal.h +++ b/lustre/lmv/lmv_internal.h @@ -223,6 +223,14 @@ static inline void lmv_update_body(struct mdt_body *body, } /* lproc_lmv.c */ +#ifdef LPROCFS +void lprocfs_lmv_init_vars(struct lprocfs_static_vars *lvars); +#else +static inline void lprocfs_lmv_init_vars(struct lprocfs_static_vars *lvars) +{ + memset(lvars, 0, sizeof(*lvars)); +} +#endif extern struct file_operations lmv_proc_target_fops; #endif diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 2ac04ca..9c6a4db 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -968,7 +968,7 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg) GOTO(out_free_datas, rc); } - lprocfs_init_vars(lmv, &lvars); + lprocfs_lmv_init_vars(&lvars); lprocfs_obd_setup(obd, lvars.obd_vars); #ifdef LPROCFS { @@ -2903,7 +2903,7 @@ int __init lmv_init(void) return -ENOMEM; } - lprocfs_init_vars(lmv, &lvars); + lprocfs_lmv_init_vars(&lvars); rc = class_register_type(&lmv_obd_ops, &lmv_md_ops, lvars.module_vars, LUSTRE_LMV_NAME, NULL); if (rc) diff --git a/lustre/lmv/lproc_lmv.c b/lustre/lmv/lproc_lmv.c index 0b33aa0..8b01727 100644 --- a/lustre/lmv/lproc_lmv.c +++ b/lustre/lmv/lproc_lmv.c @@ -124,7 +124,7 @@ static int lmv_target_seq_open(struct inode *inode, struct file *file) return 0; } -struct lprocfs_vars lprocfs_obd_vars[] = { +struct lprocfs_vars lprocfs_lmv_obd_vars[] = { { "numobd", lmv_rd_numobd, 0, 0 }, { "activeobd", lmv_rd_activeobd, 0, 0 }, { "uuid", lprocfs_rd_uuid, 0, 0 }, @@ -132,7 +132,7 @@ struct lprocfs_vars lprocfs_obd_vars[] = { { 0 } }; -static struct lprocfs_vars lprocfs_module_vars[] = { +static struct lprocfs_vars lprocfs_lmv_module_vars[] = { { "num_refs", lprocfs_rd_numrefs, 0, 0 }, { 0 } }; @@ -146,4 +146,8 @@ struct file_operations lmv_proc_target_fops = { }; #endif /* LPROCFS */ -LPROCFS_INIT_VARS(lmv, lprocfs_module_vars, lprocfs_obd_vars) +void lprocfs_lmv_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_lmv_module_vars; + lvars->obd_vars = lprocfs_lmv_obd_vars; +} diff --git a/lustre/lov/lov_internal.h b/lustre/lov/lov_internal.h index a6d981f..cfe3370 100644 --- a/lustre/lov/lov_internal.h +++ b/lustre/lov/lov_internal.h @@ -266,5 +266,13 @@ int lovea_destroy_object(struct lov_obd *lov, struct lov_stripe_md *lsm, struct obdo *oa, void *data); /* lproc_lov.c */ extern struct file_operations lov_proc_target_fops; +#ifdef LPROCFS +void lprocfs_lov_init_vars(struct lprocfs_static_vars *lvars); +#else +static inline void lprocfs_lov_init_vars(struct lprocfs_static_vars *lvars) +{ + memset(lvars, 0, sizeof(*lvars)); +} +#endif #endif diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 4edb6be..a3a4563 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -675,7 +675,7 @@ void lov_fix_desc(struct lov_desc *desc) static int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg) { - struct lprocfs_static_vars lvars; + struct lprocfs_static_vars lvars = { 0 }; struct lov_desc *desc; struct lov_obd *lov = &obd->u.lov; int count; @@ -732,7 +732,7 @@ static int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg) /* Default priority is toward free space balance */ lov->lov_qos.lq_prio_free = 232; - lprocfs_init_vars(lov, &lvars); + lprocfs_lov_init_vars(&lvars); lprocfs_obd_setup(obd, lvars.obd_vars); #ifdef LPROCFS { @@ -846,13 +846,13 @@ static int lov_process_config(struct obd_device *obd, obd_count len, void *buf) GOTO(out, rc); } case LCFG_PARAM: { - struct lprocfs_static_vars lvars; + struct lprocfs_static_vars lvars = { 0 }; struct lov_desc *desc = &(obd->u.lov.desc); if (!desc) GOTO(out, rc = -EINVAL); - lprocfs_init_vars(lov, &lvars); + lprocfs_lov_init_vars(&lvars); rc = class_process_proc_param(PARAM_LOV, lvars.obd_vars, lcfg, obd); @@ -2712,7 +2712,7 @@ cfs_mem_cache_t *lov_oinfo_slab; int __init lov_init(void) { - struct lprocfs_static_vars lvars; + struct lprocfs_static_vars lvars = { 0 }; int rc, rc2; ENTRY; @@ -2721,7 +2721,7 @@ int __init lov_init(void) 0, SLAB_HWCACHE_ALIGN); if (lov_oinfo_slab == NULL) return -ENOMEM; - lprocfs_init_vars(lov, &lvars); + lprocfs_lov_init_vars(&lvars); request_module("lquota"); quota_interface = PORTAL_SYMBOL_GET(lov_quota_interface); diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c index 0fa460b..0ecba0d 100644 --- a/lustre/lov/lproc_lov.c +++ b/lustre/lov/lproc_lov.c @@ -315,7 +315,7 @@ static int lov_target_seq_open(struct inode *inode, struct file *file) return 0; } -struct lprocfs_vars lprocfs_obd_vars[] = { +struct lprocfs_vars lprocfs_lov_obd_vars[] = { { "uuid", lprocfs_rd_uuid, 0, 0 }, { "stripesize", lov_rd_stripesize, lov_wr_stripesize, 0 }, { "stripeoffset", lov_rd_stripeoffset, lov_wr_stripeoffset, 0 }, @@ -336,11 +336,17 @@ struct lprocfs_vars lprocfs_obd_vars[] = { { 0 } }; -static struct lprocfs_vars lprocfs_module_vars[] = { +static struct lprocfs_vars lprocfs_lov_module_vars[] = { { "num_refs", lprocfs_rd_numrefs, 0, 0 }, { 0 } }; +void lprocfs_lov_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_lov_module_vars; + lvars->obd_vars = lprocfs_lov_obd_vars; +} + struct file_operations lov_proc_target_fops = { .owner = THIS_MODULE, .open = lov_target_seq_open, @@ -348,6 +354,5 @@ struct file_operations lov_proc_target_fops = { .llseek = seq_lseek, .release = lprocfs_seq_release, }; - -LPROCFS_INIT_VARS(lov, lprocfs_module_vars, lprocfs_obd_vars) #endif /* LPROCFS */ + diff --git a/lustre/lvfs/lustre_quota_fmt.h b/lustre/lvfs/lustre_quota_fmt.h index 28f5c15..eca2f31 100644 --- a/lustre/lvfs/lustre_quota_fmt.h +++ b/lustre/lvfs/lustre_quota_fmt.h @@ -74,6 +74,12 @@ struct lustre_disk_dqdbheader { __u32 dqdh_pad2; }; +#ifdef LPROCFS +void lprocfs_quotfmt_test_init_vars(struct lprocfs_static_vars *lvars); +#else +static void lprocfs_quotfmt_test_init_vars(struct lprocfs_static_vars *lvars) {} +#endif + #define LUSTRE_DQINFOOFF sizeof(struct lustre_disk_dqheader) /* Offset of info header in file */ #define LUSTRE_DQBLKSIZE_BITS 10 #define LUSTRE_DQBLKSIZE (1 << LUSTRE_DQBLKSIZE_BITS) /* Size of block with quota structures */ diff --git a/lustre/lvfs/quotafmt_test.c b/lustre/lvfs/quotafmt_test.c index 9c901fd..fc9f2d7 100644 --- a/lustre/lvfs/quotafmt_test.c +++ b/lustre/lvfs/quotafmt_test.c @@ -463,7 +463,7 @@ static int quotfmt_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg) if (rc) quotfmt_test_cleanup(obd); - lprocfs_init_vars(quotfmt_test, &lvars); + lprocfs_quotfmt_test_init_vars(&lvars); lprocfs_obd_setup(obd, lvars.obd_vars); RETURN(rc); @@ -476,16 +476,20 @@ static struct obd_ops quotfmt_obd_ops = { }; #ifdef LPROCFS -static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; -static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; +static struct lprocfs_vars lprocfs_quotfmt_test_obd_vars[] = { {0} }; +static struct lprocfs_vars lprocfs_quotfmt_test_module_vars[] = { {0} }; -LPROCFS_INIT_VARS(quotfmt_test, lprocfs_module_vars, lprocfs_obd_vars) +void lprocfs_quotfmt_test_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_quotfmt_test_module_vars; + lvars->obd_vars = lprocfs_quotfmt_test_obd_vars; +} #endif static int __init quotfmt_test_init(void) { struct lprocfs_static_vars lvars; - lprocfs_init_vars(quotfmt_test, &lvars); + lprocfs_quotfmt_test_init_vars(&lvars); return class_register_type("fmt_obd_ops, NULL, lvars.module_vars, "quotfmt_test", NULL); } diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c index d7b00dc..8ed8c92 100644 --- a/lustre/mdc/lproc_mdc.c +++ b/lustre/mdc/lproc_mdc.c @@ -64,7 +64,7 @@ static int mdc_wr_max_rpcs_in_flight(struct file *file, const char *buffer, return count; } -static struct lprocfs_vars lprocfs_obd_vars[] = { +static struct lprocfs_vars lprocfs_mdc_obd_vars[] = { { "uuid", lprocfs_rd_uuid, 0, 0 }, { "ping", 0, lprocfs_wr_ping, 0 }, { "connect_flags", lprocfs_rd_connect_flags, 0, 0 }, @@ -83,11 +83,15 @@ static struct lprocfs_vars lprocfs_obd_vars[] = { { 0 } }; -static struct lprocfs_vars lprocfs_module_vars[] = { +static struct lprocfs_vars lprocfs_mdc_module_vars[] = { { "num_refs", lprocfs_rd_numrefs, 0, 0 }, { 0 } }; -LPROCFS_INIT_VARS(mdc, lprocfs_module_vars, lprocfs_obd_vars) +void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_mdc_module_vars; + lvars->obd_vars = lprocfs_mdc_obd_vars; +} #endif /* LPROCFS */ diff --git a/lustre/mdc/mdc_internal.h b/lustre/mdc/mdc_internal.h index 65df5fc..595dfd4 100644 --- a/lustre/mdc/mdc_internal.h +++ b/lustre/mdc/mdc_internal.h @@ -27,6 +27,14 @@ #include +#ifdef LPROCFS +void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars); +#else +static inline void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars) +{ + memset(lvars, 0, sizeof(*lvars)); +} +#endif void mdc_pack_req_body(struct ptlrpc_request *req, int offset, __u64 valid, const struct lu_fid *fid, struct obd_capa *oc, int ea_size, int flags); diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index a3d569e..e9334f9 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -1501,7 +1501,7 @@ static int mdc_fid_delete(struct obd_export *exp, const struct lu_fid *fid) static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg) { struct client_obd *cli = &obd->u.cli; - struct lprocfs_static_vars lvars; + struct lprocfs_static_vars lvars = { 0 }; int rc; ENTRY; @@ -1525,7 +1525,7 @@ static int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg) rc = client_obd_setup(obd, cfg); if (rc) GOTO(err_close_lock, rc); - lprocfs_init_vars(mdc, &lvars); + lprocfs_mdc_init_vars(&lvars); lprocfs_obd_setup(obd, lvars.obd_vars); ptlrpc_lprocfs_register_obd(obd); @@ -1658,10 +1658,10 @@ static int mdc_llog_finish(struct obd_device *obd, int count) static int mdc_process_config(struct obd_device *obd, obd_count len, void *buf) { struct lustre_cfg *lcfg = buf; - struct lprocfs_static_vars lvars; + struct lprocfs_static_vars lvars = { 0 }; int rc = 0; - lprocfs_init_vars(mdc, &lvars); + lprocfs_mdc_init_vars(&lvars); rc = class_process_proc_param(PARAM_MDC, lvars.obd_vars, lcfg, obd); return(rc); @@ -1844,8 +1844,8 @@ extern quota_interface_t mdc_quota_interface; int __init mdc_init(void) { int rc; - struct lprocfs_static_vars lvars; - lprocfs_init_vars(mdc, &lvars); + struct lprocfs_static_vars lvars = { 0 }; + lprocfs_mdc_init_vars(&lvars); request_module("lquota"); quota_interface = PORTAL_SYMBOL_GET(mdc_quota_interface); diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index 480bb7b..da978d4 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -420,12 +420,16 @@ struct lprocfs_vars lprocfs_mdd_module_vars[] = { { 0 } }; -LPROCFS_INIT_VARS(mdd, lprocfs_mdd_module_vars, lprocfs_mdd_obd_vars); +static void lprocfs_mdd_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_mdd_module_vars; + lvars->obd_vars = lprocfs_mdd_obd_vars; +} static int __init mdd_mod_init(void) { struct lprocfs_static_vars lvars; - lprocfs_init_vars(mdd, &lvars); + lprocfs_mdd_init_vars(&lvars); return class_register_type(&mdd_obd_device_ops, NULL, lvars.module_vars, LUSTRE_MDD_NAME, &mdd_device_type); } diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 21ae791..4e16577 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -1986,7 +1986,7 @@ static int mds_setup(struct obd_device *obd, struct lustre_cfg* lcfg) } ldlm_register_intent(obd->obd_namespace, mds_intent_policy); - lprocfs_init_vars(mds, &lvars); + lprocfs_mds_init_vars(&lvars); if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0 && lprocfs_alloc_obd_stats(obd, LPROC_MDS_LAST) == 0) { /* Init private stats here */ @@ -2544,7 +2544,7 @@ static int mdt_setup(struct obd_device *obd, struct lustre_cfg *lcfg) int rc = 0; ENTRY; - lprocfs_init_vars(mdt, &lvars); + lprocfs_mdt_init_vars(&lvars); lprocfs_obd_setup(obd, lvars.obd_vars); sema_init(&mds->mds_health_sem, 1); @@ -2714,7 +2714,7 @@ static int mds_process_config(struct obd_device *obd, obd_count len, void *buf) struct lprocfs_static_vars lvars; int rc; - lprocfs_init_vars(mds, &lvars); + lprocfs_mds_init_vars(&lvars); rc = class_process_proc_param(PARAM_MDT, lvars.obd_vars, lcfg, obd); return(rc); @@ -2772,10 +2772,10 @@ static __attribute__((unused)) int __init mds_init(void) } init_obd_quota_ops(mds_quota_interface_ref, &mds_obd_ops); - lprocfs_init_vars(mds, &lvars); + lprocfs_mds_init_vars(&lvars); class_register_type(&mds_obd_ops, NULL, lvars.module_vars, LUSTRE_MDS_NAME, NULL); - lprocfs_init_vars(mdt, &lvars); + lprocfs_mds_init_vars(&lvars); mdt_obd_ops = mdt_obd_ops; //make compiler happy // class_register_type(&mdt_obd_ops, NULL, // lvars.module_vars, LUSTRE_MDT_NAME, NULL); @@ -2941,7 +2941,7 @@ static int __init mds_cmd_init(void) { struct lprocfs_static_vars lvars; - lprocfs_init_vars(mds, &lvars); + lprocfs_mds_init_vars(&lvars); class_register_type(&mds_cmd_obd_ops, NULL, lvars.module_vars, LUSTRE_MDS_NAME, NULL); diff --git a/lustre/mds/lproc_mds.c b/lustre/mds/lproc_mds.c index f8c7f83..c535591 100644 --- a/lustre/mds/lproc_mds.c +++ b/lustre/mds/lproc_mds.c @@ -377,6 +377,15 @@ void mds_stats_counter_init(struct lprocfs_stats *stats) lprocfs_counter_init(stats, LPROC_MDS_SETXATTR, 0, "setxattr", "reqs"); } -LPROCFS_INIT_VARS(mds, lprocfs_mds_module_vars, lprocfs_mds_obd_vars); -LPROCFS_INIT_VARS(mdt, lprocfs_mdt_module_vars, lprocfs_mdt_obd_vars); +void lprocfs_mds_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_mds_module_vars; + lvars->obd_vars = lprocfs_mds_obd_vars; +} + +void lprocfs_mdt_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_mdt_module_vars; + lvars->obd_vars = lprocfs_mdt_obd_vars; +} #endif diff --git a/lustre/mds/mds_internal.h b/lustre/mds/mds_internal.h index 8193d5b..37601a4 100644 --- a/lustre/mds/mds_internal.h +++ b/lustre/mds/mds_internal.h @@ -270,5 +270,6 @@ enum { }; void mds_counter_incr(struct obd_export *exp, int opcode); void mds_stats_counter_init(struct lprocfs_stats *stats); - +void lprocfs_mds_init_vars(struct lprocfs_static_vars *lvars); +void lprocfs_mdt_init_vars(struct lprocfs_static_vars *lvars); #endif /* _MDS_INTERNAL_H */ diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 9ba14df..f4d0262 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -3825,7 +3825,7 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m, GOTO(err_free_site, rc); } - lprocfs_init_vars(mdt, &lvars); + lprocfs_mdt_init_vars(&lvars); rc = lprocfs_obd_setup(obd, lvars.obd_vars); if (rc) { CERROR("Can't init lprocfs, rc %d\n", rc); @@ -3986,7 +3986,7 @@ static int mdt_process_config(const struct lu_env *env, struct lprocfs_static_vars lvars; struct obd_device *obd = d->ld_obd; - lprocfs_init_vars(mdt, &lvars); + lprocfs_mdt_init_vars(&lvars); rc = class_process_proc_param(PARAM_MDT, lvars.obd_vars, cfg, obd); if (rc) /* others are passed further */ @@ -4590,7 +4590,7 @@ static int __init mdt_mod_init(void) int rc; mdt_num_threads = MDT_NUM_THREADS; - lprocfs_init_vars(mdt, &lvars); + lprocfs_mdt_init_vars(&lvars); rc = class_register_type(&mdt_obd_device_ops, NULL, lvars.module_vars, LUSTRE_MDT_NAME, &mdt_device_type); diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 1252e81..4ff1b1e 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -771,6 +771,7 @@ static inline struct lu_name *mdt_name_copy(struct lu_name *tlname, } /* lprocfs stuff */ +void lprocfs_mdt_init_vars(struct lprocfs_static_vars *lvars); int mdt_procfs_init(struct mdt_device *mdt, const char *name); int mdt_procfs_fini(struct mdt_device *mdt); diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c index ed46c91..e7565dd 100644 --- a/lustre/mdt/mdt_lproc.c +++ b/lustre/mdt/mdt_lproc.c @@ -758,4 +758,8 @@ static struct lprocfs_vars lprocfs_mdt_module_vars[] = { { 0 } }; -LPROCFS_INIT_VARS(mdt, lprocfs_mdt_module_vars, lprocfs_mdt_obd_vars); +void lprocfs_mdt_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_mdt_module_vars; + lvars->obd_vars = lprocfs_mdt_obd_vars; +} diff --git a/lustre/mgs/lproc_mgs.c b/lustre/mgs/lproc_mgs.c index 6ed7aab..598ad31 100644 --- a/lustre/mgs/lproc_mgs.c +++ b/lustre/mgs/lproc_mgs.c @@ -146,5 +146,9 @@ struct lprocfs_vars lprocfs_mgs_module_vars[] = { { 0 } }; -LPROCFS_INIT_VARS(mgs, lprocfs_mgs_module_vars, lprocfs_mgs_obd_vars); +void lprocfs_mgs_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_mgs_module_vars; + lvars->obd_vars = lprocfs_mgs_obd_vars; +} #endif diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index 338905e..786ea2a 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -193,7 +193,7 @@ static int mgs_setup(struct obd_device *obd, struct lustre_cfg *lcfg) GOTO(err_thread, rc); /* Setup proc */ - lprocfs_init_vars(mgs, &lvars); + lprocfs_mgs_init_vars(&lvars); if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0) { lproc_mgs_setup(obd); } @@ -730,7 +730,7 @@ static int __init mgs_init(void) { struct lprocfs_static_vars lvars; - lprocfs_init_vars(mgs, &lvars); + lprocfs_mgs_init_vars(&lvars); class_register_type(&mgs_obd_ops, NULL, lvars.module_vars, LUSTRE_MGS_NAME, NULL); diff --git a/lustre/mgs/mgs_internal.h b/lustre/mgs/mgs_internal.h index 9fd1250..69acba9 100644 --- a/lustre/mgs/mgs_internal.h +++ b/lustre/mgs/mgs_internal.h @@ -64,6 +64,7 @@ int mgs_fs_cleanup(struct obd_device *obddev); int lproc_mgs_setup(struct obd_device *dev); int lproc_mgs_add_live(struct obd_device *obd, struct fs_db *fsdb); int lproc_mgs_del_live(struct obd_device *obd, struct fs_db *fsdb); +void lprocfs_mgs_init_vars(struct lprocfs_static_vars *lvars); #else static inline int lproc_mgs_setup(struct obd_device *dev) {return 0;} @@ -71,6 +72,10 @@ static int lproc_mgs_add_live(struct obd_device *obd, struct fs_db *fsdb) {return 0;} static int lproc_mgs_del_live(struct obd_device *obd, struct fs_db *fsdb) {return 0;} +static void lprocfs_mgs_init_vars(struct lprocfs_static_vars *lvars) +{ + memset(lvars, 0, sizeof(*lvars)); +} #endif #endif /* _MGS_INTERNAL_H */ diff --git a/lustre/obdclass/llog_test.c b/lustre/obdclass/llog_test.c index a70eed2..5dfcd0c 100644 --- a/lustre/obdclass/llog_test.c +++ b/lustre/obdclass/llog_test.c @@ -617,6 +617,15 @@ static int llog_test_llog_finish(struct obd_device *obd, int count) rc = llog_cleanup(llog_get_context(obd, LLOG_TEST_ORIG_CTXT)); RETURN(rc); } +#ifdef LPROCFS +static struct lprocfs_vars lprocfs_llog_test_obd_vars[] = { {0} }; +static struct lprocfs_vars lprocfs_llog_test_module_vars[] = { {0} }; +static void lprocfs_llog_test_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_llog_test_module_vars; + lvars->obd_vars = lprocfs_llog_test_obd_vars; +} +#endif static int llog_test_cleanup(struct obd_device *obd) { @@ -663,7 +672,7 @@ static int llog_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg) if (rc) llog_test_cleanup(obd); - lprocfs_init_vars(llog_test, &lvars); + lprocfs_llog_test_init_vars(&lvars); lprocfs_obd_setup(obd, lvars.obd_vars); RETURN(rc); @@ -677,17 +686,11 @@ static struct obd_ops llog_obd_ops = { .o_llog_finish = llog_test_llog_finish, }; -#ifdef LPROCFS -static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; -static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; -LPROCFS_INIT_VARS(llog_test, lprocfs_module_vars, lprocfs_obd_vars) -#endif - static int __init llog_test_init(void) { struct lprocfs_static_vars lvars; - lprocfs_init_vars(llog_test, &lvars); + lprocfs_llog_test_init_vars(&lvars); return class_register_type(&llog_obd_ops, NULL, lvars.module_vars,"llog_test", NULL); } diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index 6ac884e..55828ec 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -479,7 +479,7 @@ static int echo_setup(struct obd_device *obd, struct lustre_cfg *lcfg) 0, NULL, &obd->u.echo.eo_nl_lock); LASSERT (rc == ELDLM_OK); - lprocfs_init_vars(echo, &lvars); + lprocfs_echo_init_vars(&lvars); if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0 && lprocfs_alloc_obd_stats(obd, LPROC_ECHO_LAST) == 0) { lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_READ_BYTES, @@ -584,7 +584,7 @@ static int __init obdecho_init(void) LASSERT(CFS_PAGE_SIZE % OBD_ECHO_BLOCK_SIZE == 0); - lprocfs_init_vars(echo, &lvars); + lprocfs_echo_init_vars(&lvars); rc = echo_persistent_pages_init (); if (rc != 0) diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index 00cd063..142aef3 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -1426,9 +1426,9 @@ static struct obd_ops echo_obd_ops = { int echo_client_init(void) { - struct lprocfs_static_vars lvars; + struct lprocfs_static_vars lvars = { 0 }; - lprocfs_init_vars(echo, &lvars); + lprocfs_echo_init_vars(&lvars); return class_register_type(&echo_obd_ops, NULL, lvars.module_vars, LUSTRE_ECHO_CLIENT_NAME, NULL); } diff --git a/lustre/obdecho/lproc_echo.c b/lustre/obdecho/lproc_echo.c index c816ca0..42ded58 100644 --- a/lustre/obdecho/lproc_echo.c +++ b/lustre/obdecho/lproc_echo.c @@ -28,15 +28,19 @@ #include #ifdef LPROCFS -static struct lprocfs_vars lprocfs_obd_vars[] = { +static struct lprocfs_vars lprocfs_echo_obd_vars[] = { { "uuid", lprocfs_rd_uuid, 0, 0 }, { 0 } }; -static struct lprocfs_vars lprocfs_module_vars[] = { +static struct lprocfs_vars lprocfs_echo_module_vars[] = { { "num_refs", lprocfs_rd_numrefs, 0, 0 }, { 0 } }; -LPROCFS_INIT_VARS(echo, lprocfs_module_vars, lprocfs_obd_vars) +void lprocfs_echo_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_echo_module_vars; + lvars->obd_vars = lprocfs_echo_obd_vars; +} #endif /* LPROCFS */ diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 0f90091..84947d6 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -2036,7 +2036,7 @@ static int filter_setup(struct obd_device *obd, struct lustre_cfg* lcfg) /* lprocfs must be setup before the filter so state can be safely added * to /proc incrementally as the filter is setup */ - lprocfs_init_vars(filter, &lvars); + lprocfs_filter_init_vars(&lvars); if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0 && lprocfs_alloc_obd_stats(obd, LPROC_FILTER_LAST) == 0) { /* Init obdfilter private stats here */ @@ -4011,7 +4011,7 @@ static int filter_process_config(struct obd_device *obd, obd_count len, struct lprocfs_static_vars lvars; int rc = 0; - lprocfs_init_vars(filter, &lvars); + lprocfs_filter_init_vars(&lvars); rc = class_process_proc_param(PARAM_OST, lvars.obd_vars, lcfg, obd); return rc; @@ -4061,7 +4061,7 @@ static int __init obdfilter_init(void) struct lprocfs_static_vars lvars; int rc; - lprocfs_init_vars(filter, &lvars); + lprocfs_filter_init_vars(&lvars); request_module("lquota"); OBD_ALLOC(obdfilter_created_scratchpad, diff --git a/lustre/obdfilter/filter_internal.h b/lustre/obdfilter/filter_internal.h index 444e0a6..a92d621 100644 --- a/lustre/obdfilter/filter_internal.h +++ b/lustre/obdfilter/filter_internal.h @@ -186,11 +186,16 @@ int filter_recov_log_mds_ost_cb(struct llog_handle *llh, void filter_tally(struct obd_export *exp, struct page **pages, int nr_pages, unsigned long *blocks, int blocks_per_page, int wr); int lproc_filter_attach_seqstat(struct obd_device *dev); +void lprocfs_filter_init_vars(struct lprocfs_static_vars *lvars); #else static inline void filter_tally(struct obd_export *exp, struct page **pages, int nr_pages, unsigned long *blocks, int blocks_per_page, int wr) {} static inline int lproc_filter_attach_seqstat(struct obd_device *dev) {} +static void lprocfs_filter_init_vars(struct lprocfs_static_vars *lvars) +{ + memset(lvars, 0, sizeof(*lvars)); +} #endif /* Quota stuff */ diff --git a/lustre/obdfilter/lproc_obdfilter.c b/lustre/obdfilter/lproc_obdfilter.c index f0984fa..2b7d846 100644 --- a/lustre/obdfilter/lproc_obdfilter.c +++ b/lustre/obdfilter/lproc_obdfilter.c @@ -231,7 +231,7 @@ static int lprocfs_filter_rd_capa_count(char *page, char **start, off_t off, capa_count[CAPA_SITE_SERVER]); } -static struct lprocfs_vars lprocfs_obd_vars[] = { +static struct lprocfs_vars lprocfs_filter_obd_vars[] = { { "uuid", lprocfs_rd_uuid, 0, 0 }, { "blocksize", lprocfs_rd_blksize, 0, 0 }, { "kbytestotal", lprocfs_rd_kbytestotal, 0, 0 }, @@ -270,7 +270,7 @@ static struct lprocfs_vars lprocfs_obd_vars[] = { { 0 } }; -static struct lprocfs_vars lprocfs_module_vars[] = { +static struct lprocfs_vars lprocfs_filter_module_vars[] = { { "num_refs", lprocfs_rd_numrefs, 0, 0 }, { 0 } }; @@ -454,5 +454,9 @@ static ssize_t filter_per_export_stats_seq_write(struct file *file, LPROC_SEQ_FOPS(filter_per_export_stats); -LPROCFS_INIT_VARS(filter, lprocfs_module_vars, lprocfs_obd_vars) +void lprocfs_filter_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_filter_module_vars; + lvars->obd_vars = lprocfs_filter_obd_vars; +} #endif /* LPROCFS */ diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index 6b9d8539..a011bdf 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -327,7 +327,7 @@ static int osc_wr_resend_count(struct file *file, const char *buffer, return count; } -static struct lprocfs_vars lprocfs_obd_vars[] = { +static struct lprocfs_vars lprocfs_osc_obd_vars[] = { { "uuid", lprocfs_rd_uuid, 0, 0 }, { "ping", 0, lprocfs_wr_ping, 0 }, { "connect_flags", lprocfs_rd_connect_flags, 0, 0 }, @@ -358,7 +358,7 @@ static struct lprocfs_vars lprocfs_obd_vars[] = { { 0 } }; -static struct lprocfs_vars lprocfs_module_vars[] = { +static struct lprocfs_vars lprocfs_osc_module_vars[] = { { "num_refs", lprocfs_rd_numrefs, 0, 0 }, { 0 } }; @@ -487,6 +487,10 @@ int lproc_osc_attach_seqstat(struct obd_device *dev) &osc_rpc_stats_fops, dev); } -LPROCFS_INIT_VARS(osc, lprocfs_module_vars, lprocfs_obd_vars) +void lprocfs_osc_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_osc_module_vars; + lvars->obd_vars = lprocfs_osc_obd_vars; +} #endif /* LPROCFS */ diff --git a/lustre/osc/osc_internal.h b/lustre/osc/osc_internal.h index 334afa8..e81d54f 100644 --- a/lustre/osc/osc_internal.h +++ b/lustre/osc/osc_internal.h @@ -64,8 +64,13 @@ void osc_wake_cache_waiters(struct client_obd *cli); #ifdef LPROCFS int lproc_osc_attach_seqstat(struct obd_device *dev); +void lprocfs_osc_init_vars(struct lprocfs_static_vars *lvars); #else static inline int lproc_osc_attach_seqstat(struct obd_device *dev) {return 0;} +static inline void lprocfs_osc_init_vars(struct lprocfs_static_vars *lvars) +{ + memset(lvars, 0, sizeof(*lvars)); +} #endif static inline int osc_recoverable_error(int rc) diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 177002b..87e3867 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -3661,10 +3661,10 @@ int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) if (rc) { ptlrpcd_decref(); } else { - struct lprocfs_static_vars lvars; + struct lprocfs_static_vars lvars = { 0 }; struct client_obd *cli = &obd->u.cli; - lprocfs_init_vars(osc, &lvars); + lprocfs_osc_init_vars(&lvars); if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0) { lproc_osc_attach_seqstat(obd); ptlrpc_lprocfs_register_obd(obd); @@ -3754,10 +3754,10 @@ int osc_cleanup(struct obd_device *obd) static int osc_process_config(struct obd_device *obd, obd_count len, void *buf) { struct lustre_cfg *lcfg = buf; - struct lprocfs_static_vars lvars; + struct lprocfs_static_vars lvars = { 0 }; int rc = 0; - lprocfs_init_vars(osc, &lvars); + lprocfs_osc_init_vars(&lvars); rc = class_process_proc_param(PARAM_OSC, lvars.obd_vars, lcfg, obd); return(rc); @@ -3810,11 +3810,11 @@ struct obd_ops osc_obd_ops = { }; int __init osc_init(void) { - struct lprocfs_static_vars lvars; + struct lprocfs_static_vars lvars = { 0 }; int rc; ENTRY; - lprocfs_init_vars(osc, &lvars); + lprocfs_osc_init_vars(&lvars); request_module("lquota"); quota_interface = PORTAL_SYMBOL_GET(osc_quota_interface); diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index 85f3e06..06afd56 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -2601,13 +2601,18 @@ static struct obd_ops osd_obd_device_ops = { .o_owner = THIS_MODULE }; -LPROCFS_INIT_VARS(osd, lprocfs_osd_module_vars, lprocfs_osd_obd_vars); +static void lprocfs_osd_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_osd_module_vars; + lvars->obd_vars = lprocfs_osd_obd_vars; +} + static int __init osd_mod_init(void) { struct lprocfs_static_vars lvars; - lprocfs_init_vars(osd, &lvars); + lprocfs_osd_init_vars(&lvars); return class_register_type(&osd_obd_device_ops, NULL, lvars.module_vars, LUSTRE_OSD_NAME, &osd_device_type); } diff --git a/lustre/ost/lproc_ost.c b/lustre/ost/lproc_ost.c index 38f9518..e07405a9 100644 --- a/lustre/ost/lproc_ost.c +++ b/lustre/ost/lproc_ost.c @@ -30,16 +30,22 @@ #include "ost_internal.h" #ifdef LPROCFS -static struct lprocfs_vars lprocfs_obd_vars[] = { +static struct lprocfs_vars lprocfs_ost_obd_vars[] = { { "uuid", lprocfs_rd_uuid, 0, 0 }, { 0 } }; -static struct lprocfs_vars lprocfs_module_vars[] = { +static struct lprocfs_vars lprocfs_ost_module_vars[] = { { "num_refs", lprocfs_rd_numrefs, 0, 0 }, { 0 } }; +void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_ost_module_vars; + lvars->obd_vars = lprocfs_ost_obd_vars; +} + void ost_print_req(void *seq_file, struct ptlrpc_request *req) { @@ -73,6 +79,4 @@ ost_print_req(void *seq_file, struct ptlrpc_request *req) LBUG(); } } - -LPROCFS_INIT_VARS(ost, lprocfs_module_vars, lprocfs_obd_vars) #endif /* LPROCFS */ diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 3dcc729..2bc96b3 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -1782,7 +1782,7 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg) if (rc < 0) RETURN(rc); - lprocfs_init_vars(ost, &lvars); + lprocfs_ost_init_vars(&lvars); lprocfs_obd_setup(obd, lvars.obd_vars); sema_init(&ost->ost_health_sem, 1); @@ -1961,7 +1961,7 @@ static int __init ost_init(void) int rc; ENTRY; - lprocfs_init_vars(ost, &lvars); + lprocfs_ost_init_vars(&lvars); rc = class_register_type(&ost_obd_ops, NULL, lvars.module_vars, LUSTRE_OSS_NAME, NULL); diff --git a/lustre/ost/ost_internal.h b/lustre/ost/ost_internal.h index 82a40b9..64df2d2 100644 --- a/lustre/ost/ost_internal.h +++ b/lustre/ost/ost_internal.h @@ -43,4 +43,13 @@ struct ost_thread_local_cache *ost_tls(struct ptlrpc_request *r); /* Quota stuff */ extern quota_interface_t *quota_interface; +#ifdef LPROCFS +void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars); +#else +static void lprocfs_ost_init_vars(struct lprocfs_static_vars *lvars) +{ + memset(lvars, 0, sizeof(*lvars)); +} +#endif + #endif /* OST_INTERNAL_H */ diff --git a/lustre/quota/quota_internal.h b/lustre/quota/quota_internal.h index fcfee55..18f398b 100644 --- a/lustre/quota/quota_internal.h +++ b/lustre/quota/quota_internal.h @@ -97,4 +97,20 @@ int client_quota_check(struct obd_export *exp, struct obd_quotactl *oqctl); int lov_quota_check(struct obd_export *exp, struct obd_quotactl *oqctl); int client_quota_poll_check(struct obd_export *exp, struct if_quotacheck *qchk); +#ifdef LPROCFS +void lprocfs_quotactl_test_init_vars(struct lprocfs_static_vars *lvars); +void lprocfs_quotacheck_test_init_vars(struct lprocfs_static_vars *lvars); +#else +static inline void lprocfs_quotactl_test_init_vars + (struct lprocfs_static_vars *lvars) +{ + memset(lvars, 0, sizeof(*lvars)); +} +static inline void lprocfs_quotacheck_test_init_vars + (struct lprocfs_static_vars *lvars) +{ + memset(lvars, 0, sizeof(*lvars)); +} +#endif + #endif diff --git a/lustre/quota/quotacheck_test.c b/lustre/quota/quotacheck_test.c index e42a167..ff9963d 100644 --- a/lustre/quota/quotacheck_test.c +++ b/lustre/quota/quotacheck_test.c @@ -148,6 +148,17 @@ static int quotacheck_run_tests(struct obd_device *obd, struct obd_device *tgt) return rc; } +#ifdef LPROCFS +static struct lprocfs_vars lprocfs_quotacheck_test_obd_vars[] = { {0} }; +static struct lprocfs_vars lprocfs_quotacheck_test_module_vars[] = { {0} }; + +void lprocfs_quotacheck_test_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_quotacheck_test_module_vars; + lvars->obd_vars = lprocfs_quotacheck_test_obd_vars; +} +#endif + static int quotacheck_test_cleanup(struct obd_device *obd) { lprocfs_obd_cleanup(obd); @@ -156,7 +167,7 @@ static int quotacheck_test_cleanup(struct obd_device *obd) static int quotacheck_test_setup(struct obd_device *obd, struct lustre_cfg* lcfg) { - struct lprocfs_static_vars lvars; + struct lprocfs_static_vars lvars = { 0 }; struct obd_device *tgt; int rc; ENTRY; @@ -177,7 +188,7 @@ static int quotacheck_test_setup(struct obd_device *obd, struct lustre_cfg* lcfg if (rc) quotacheck_test_cleanup(obd); - lprocfs_init_vars(quotacheck_test, &lvars); + lprocfs_quotacheck_test_init_vars(&lvars); lprocfs_obd_setup(obd, lvars.obd_vars); RETURN(rc); @@ -189,17 +200,11 @@ static struct obd_ops quotacheck_obd_ops = { .o_cleanup = quotacheck_test_cleanup, }; -#ifdef LPROCFS -static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; -static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; -LPROCFS_INIT_VARS(quotacheck_test, lprocfs_module_vars, lprocfs_obd_vars) -#endif - static int __init quotacheck_test_init(void) { - struct lprocfs_static_vars lvars; + struct lprocfs_static_vars lvars = { 0 }; - lprocfs_init_vars(quotacheck_test, &lvars); + lprocfs_init_quotacheck_test_vars(&lvars); return class_register_type("acheck_obd_ops, NULL, lvars.module_vars, "quotacheck_test", NULL); } diff --git a/lustre/quota/quotactl_test.c b/lustre/quota/quotactl_test.c index cffb646..7a50deb 100644 --- a/lustre/quota/quotactl_test.c +++ b/lustre/quota/quotactl_test.c @@ -288,6 +288,17 @@ static int quotactl_run_tests(struct obd_device *obd, struct obd_device *tgt) return rc; } +#ifdef LPROCFS +static struct lprocfs_vars lprocfs_quotactl_test_obd_vars[] = { {0} }; +static struct lprocfs_vars lprocfs_quotactl_test_module_vars[] = { {0} }; + +void lprocfs_quotactl_test_init_vars(struct lprocfs_static_vars *lvars) +{ + lvars->module_vars = lprocfs_quotactl_test_module_vars; + lvars->obd_vars = lprocfs_quotactl_test_obd_vars; +} +#endif + static int quotactl_test_cleanup(struct obd_device *obd) { lprocfs_obd_cleanup(obd); @@ -296,7 +307,7 @@ static int quotactl_test_cleanup(struct obd_device *obd) static int quotactl_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg) { - struct lprocfs_static_vars lvars; + struct lprocfs_static_vars lvars = { 0 }; struct obd_device *tgt; int rc; ENTRY; @@ -313,7 +324,7 @@ static int quotactl_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg) RETURN(-EINVAL); } - lprocfs_init_vars(quotactl_test, &lvars); + lprocfs_quotactl_test_init_vars(&lvars); lprocfs_obd_setup(obd, lvars.obd_vars); rc = quotactl_run_tests(obd, tgt); @@ -329,17 +340,11 @@ static struct obd_ops quotactl_obd_ops = { .o_cleanup = quotactl_test_cleanup, }; -#ifdef LPROCFS -static struct lprocfs_vars lprocfs_obd_vars[] = { {0} }; -static struct lprocfs_vars lprocfs_module_vars[] = { {0} }; -LPROCFS_INIT_VARS(quotactl_test, lprocfs_module_vars, lprocfs_obd_vars) -#endif - static int __init quotactl_test_init(void) { - struct lprocfs_static_vars lvars; + struct lprocfs_static_vars lvars = { 0 }; - lprocfs_init_vars(quotactl_test, &lvars); + lprocfs_init_quotactl_test_vars(&lvars); return class_register_type("actl_obd_ops, NULL, lvars.module_vars, "quotactl_test", NULL); } -- 1.8.3.1