From b1e595c09e1b07a6840142b3ae015b8a5a8affeb Mon Sep 17 00:00:00 2001 From: Johann Lombardi Date: Fri, 5 Dec 2014 09:53:39 +0000 Subject: [PATCH] Revert "LU-5275 lprocfs: remove last of non seq data structs and functions." This reverts commit 0ad4f8a4227ed7dd93fec99d33c6bb25056473fc. This patch has broken the el6.6 build: include/linux/proc_fs.h:120: note: previous declaration of 'remove_proc_subtree' was here Change-Id: I62d9b032448d9eea5d089b69382c2ff5064c5d3d Reviewed-on: http://review.whamcloud.com/12953 Tested-by: Jenkins Reviewed-by: Johann Lombardi --- lustre/fid/fid_handler.c | 8 +- lustre/fid/fid_internal.h | 4 +- lustre/fid/fid_request.c | 13 +- lustre/fid/lproc_fid.c | 4 +- lustre/fld/fld_handler.c | 5 +- lustre/fld/fld_internal.h | 4 +- lustre/fld/fld_request.c | 13 +- lustre/fld/lproc_fld.c | 4 +- lustre/include/lprocfs_status.h | 82 +++++++-- lustre/include/obd.h | 2 +- lustre/include/obd_class.h | 4 +- lustre/ldlm/ldlm_internal.h | 4 +- lustre/ldlm/ldlm_pool.c | 5 +- lustre/ldlm/ldlm_resource.c | 21 ++- lustre/llite/llite_internal.h | 2 +- lustre/llite/lproc_llite.c | 16 +- lustre/llite/super25.c | 2 +- lustre/lmv/lmv_internal.h | 2 +- lustre/lmv/lmv_obd.c | 6 +- lustre/lmv/lproc_lmv.c | 2 +- lustre/lod/lod_dev.c | 4 +- lustre/lod/lproc_lod.c | 14 +- lustre/lov/lov_internal.h | 2 +- lustre/lov/lov_obd.c | 18 +- lustre/lov/lproc_lov.c | 2 +- lustre/mdc/lproc_mdc.c | 2 +- lustre/mdc/mdc_internal.h | 2 +- lustre/mdd/mdd_lproc.c | 6 +- lustre/mdt/mdt_coordinator.c | 8 +- lustre/mdt/mdt_internal.h | 2 +- lustre/mdt/mdt_lproc.c | 2 +- lustre/mdt/mdt_mds.c | 2 +- lustre/mgc/lproc_mgc.c | 2 +- lustre/mgc/mgc_internal.h | 2 +- lustre/mgs/lproc_mgs.c | 12 +- lustre/obdclass/genops.c | 24 ++- lustre/obdclass/linux/linux-module.c | 4 +- lustre/obdclass/lprocfs_status.c | 301 ++++++++++++++++++++++++++++---- lustre/obdclass/lprocfs_status_server.c | 6 + lustre/obdclass/obd_config.c | 4 +- lustre/obdecho/echo.c | 2 +- lustre/ofd/lproc_ofd.c | 2 +- lustre/ofd/ofd_dev.c | 3 +- lustre/ofd/ofd_internal.h | 2 +- lustre/osc/lproc_osc.c | 2 +- lustre/osc/osc_internal.h | 2 +- lustre/osc/osc_request.c | 6 +- lustre/osd-ldiskfs/osd_internal.h | 4 +- lustre/osd-ldiskfs/osd_lproc.c | 10 +- lustre/osd-zfs/osd_internal.h | 2 +- lustre/osd-zfs/osd_lproc.c | 7 +- lustre/osp/lproc_osp.c | 8 +- lustre/osp/osp_dev.c | 4 +- lustre/ost/ost_handler.c | 2 +- lustre/ptlrpc/gss/lproc_gss.c | 12 +- lustre/ptlrpc/lproc_ptlrpc.c | 8 +- lustre/ptlrpc/nodemap_lproc.c | 29 +-- lustre/ptlrpc/nrs_crr.c | 5 +- lustre/ptlrpc/nrs_orr.c | 11 +- lustre/ptlrpc/nrs_tbf.c | 5 +- lustre/ptlrpc/sec_lproc.c | 6 +- lustre/quota/qmt_dev.c | 4 +- lustre/quota/qmt_pool.c | 6 +- lustre/quota/qsd_lib.c | 6 +- 64 files changed, 546 insertions(+), 224 deletions(-) diff --git a/lustre/fid/fid_handler.c b/lustre/fid/fid_handler.c index a9cf64d..c44f031 100644 --- a/lustre/fid/fid_handler.c +++ b/lustre/fid/fid_handler.c @@ -414,14 +414,16 @@ static int seq_server_proc_init(struct lu_server_seq *seq) int rc; ENTRY; - seq->lss_proc_dir = lprocfs_register(seq->lss_name, seq_type_proc_dir, - NULL, NULL); + seq->lss_proc_dir = lprocfs_seq_register(seq->lss_name, + seq_type_proc_dir, + NULL, NULL); if (IS_ERR(seq->lss_proc_dir)) { rc = PTR_ERR(seq->lss_proc_dir); RETURN(rc); } - rc = lprocfs_add_vars(seq->lss_proc_dir, seq_server_proc_list, seq); + rc = lprocfs_seq_add_vars(seq->lss_proc_dir, + seq_server_proc_list, seq); if (rc) { CERROR("%s: Can't init sequence manager " "proc, rc %d\n", seq->lss_name, rc); diff --git a/lustre/fid/fid_internal.h b/lustre/fid/fid_internal.h index bb6faa4..f8539d8 100644 --- a/lustre/fid/fid_internal.h +++ b/lustre/fid/fid_internal.h @@ -61,7 +61,7 @@ enum { extern struct lu_context_key seq_thread_key; # ifdef LPROCFS -extern struct lprocfs_vars seq_server_proc_list[]; +extern struct lprocfs_seq_vars seq_server_proc_list[]; # endif /* Store API functions. */ @@ -95,7 +95,7 @@ int seq_client_alloc_super(struct lu_client_seq *seq, const struct lu_env *env); # ifdef LPROCFS -extern struct lprocfs_vars seq_client_proc_list[]; +extern struct lprocfs_seq_vars seq_client_proc_list[]; # endif extern struct proc_dir_entry *seq_type_proc_dir; diff --git a/lustre/fid/fid_request.c b/lustre/fid/fid_request.c index 7ccab9c..520cc63 100644 --- a/lustre/fid/fid_request.c +++ b/lustre/fid/fid_request.c @@ -440,8 +440,9 @@ static int seq_client_proc_init(struct lu_client_seq *seq) int rc; ENTRY; - seq->lcs_proc_dir = lprocfs_register(seq->lcs_name, seq_type_proc_dir, - NULL, NULL); + seq->lcs_proc_dir = lprocfs_seq_register(seq->lcs_name, + seq_type_proc_dir, + NULL, NULL); if (IS_ERR(seq->lcs_proc_dir)) { CERROR("%s: LProcFS failed in seq-init\n", seq->lcs_name); @@ -449,7 +450,8 @@ static int seq_client_proc_init(struct lu_client_seq *seq) RETURN(rc); } - rc = lprocfs_add_vars(seq->lcs_proc_dir, seq_client_proc_list, seq); + rc = lprocfs_seq_add_vars(seq->lcs_proc_dir, + seq_client_proc_list, seq); if (rc) { CERROR("%s: Can't init sequence manager " "proc, rc %d\n", seq->lcs_name, rc); @@ -572,8 +574,9 @@ struct proc_dir_entry *seq_type_proc_dir; static int __init fid_mod_init(void) { - seq_type_proc_dir = lprocfs_register(LUSTRE_SEQ_NAME, proc_lustre_root, - NULL, NULL); + seq_type_proc_dir = lprocfs_seq_register(LUSTRE_SEQ_NAME, + proc_lustre_root, + NULL, NULL); if (IS_ERR(seq_type_proc_dir)) return PTR_ERR(seq_type_proc_dir); diff --git a/lustre/fid/lproc_fid.c b/lustre/fid/lproc_fid.c index bec325b..5adbf62 100644 --- a/lustre/fid/lproc_fid.c +++ b/lustre/fid/lproc_fid.c @@ -213,7 +213,7 @@ LPROC_SEQ_FOPS(lprocfs_server_fid_space); LPROC_SEQ_FOPS(lprocfs_server_fid_width); LPROC_SEQ_FOPS_RO(lprocfs_server_fid_server); -struct lprocfs_vars seq_server_proc_list[] = { +struct lprocfs_seq_vars seq_server_proc_list[] = { { .name = "space", .fops = &lprocfs_server_fid_space_fops }, { .name = "width", @@ -636,7 +636,7 @@ LPROC_SEQ_FOPS(lprocfs_client_fid_width); LPROC_SEQ_FOPS_RO(lprocfs_client_fid_server); LPROC_SEQ_FOPS_RO(lprocfs_client_fid_fid); -struct lprocfs_vars seq_client_proc_list[] = { +struct lprocfs_seq_vars seq_client_proc_list[] = { { .name = "space", .fops = &lprocfs_client_fid_space_fops }, { .name = "width", diff --git a/lustre/fld/fld_handler.c b/lustre/fld/fld_handler.c index 7dc26ad..0e80de8 100644 --- a/lustre/fld/fld_handler.c +++ b/lustre/fld/fld_handler.c @@ -402,8 +402,9 @@ static int fld_server_proc_init(struct lu_server_fld *fld) int rc = 0; ENTRY; - fld->lsf_proc_dir = lprocfs_register(fld->lsf_name, fld_type_proc_dir, - fld_server_proc_list, fld); + fld->lsf_proc_dir = lprocfs_seq_register(fld->lsf_name, + fld_type_proc_dir, + fld_server_proc_list, fld); if (IS_ERR(fld->lsf_proc_dir)) { rc = PTR_ERR(fld->lsf_proc_dir); RETURN(rc); diff --git a/lustre/fld/fld_internal.h b/lustre/fld/fld_internal.h index 17f0f0e..43b2f5b 100644 --- a/lustre/fld/fld_internal.h +++ b/lustre/fld/fld_internal.h @@ -151,7 +151,7 @@ extern struct lu_fld_hash fld_hash[]; #ifdef LPROCFS extern struct proc_dir_entry *fld_type_proc_dir; -extern struct lprocfs_vars fld_client_proc_list[]; +extern struct lprocfs_seq_vars fld_client_proc_list[]; #endif # ifdef HAVE_SERVER_SUPPORT @@ -189,7 +189,7 @@ int fld_server_read(const struct lu_env *env, struct lu_server_fld *fld, struct lu_seq_range *range, void *data, int data_len); #ifdef LPROCFS extern const struct file_operations fld_proc_seq_fops; -extern struct lprocfs_vars fld_server_proc_list[]; +extern struct lprocfs_seq_vars fld_server_proc_list[]; #endif # endif /* HAVE_SERVER_SUPPORT */ diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index d10af46..44d5cd0 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -235,8 +235,9 @@ static int fld_client_proc_init(struct lu_client_fld *fld) int rc; ENTRY; - fld->lcf_proc_dir = lprocfs_register(fld->lcf_name, fld_type_proc_dir, - NULL, NULL); + fld->lcf_proc_dir = lprocfs_seq_register(fld->lcf_name, + fld_type_proc_dir, + NULL, NULL); if (IS_ERR(fld->lcf_proc_dir)) { CERROR("%s: LProcFS failed in fld-init\n", fld->lcf_name); @@ -244,7 +245,8 @@ static int fld_client_proc_init(struct lu_client_fld *fld) RETURN(rc); } - rc = lprocfs_add_vars(fld->lcf_proc_dir, fld_client_proc_list, fld); + rc = lprocfs_seq_add_vars(fld->lcf_proc_dir, + fld_client_proc_list, fld); if (rc) { CERROR("%s: Can't init FLD proc, rc %d\n", fld->lcf_name, rc); @@ -523,8 +525,9 @@ struct proc_dir_entry *fld_type_proc_dir; static int __init fld_mod_init(void) { - fld_type_proc_dir = lprocfs_register(LUSTRE_FLD_NAME, proc_lustre_root, - NULL, NULL); + fld_type_proc_dir = lprocfs_seq_register(LUSTRE_FLD_NAME, + proc_lustre_root, + NULL, NULL); if (IS_ERR(fld_type_proc_dir)) return PTR_ERR(fld_type_proc_dir); diff --git a/lustre/fld/lproc_fld.c b/lustre/fld/lproc_fld.c index d915dcd..1eb2346 100644 --- a/lustre/fld/lproc_fld.c +++ b/lustre/fld/lproc_fld.c @@ -136,7 +136,7 @@ LPROC_SEQ_FOPS_RO(fld_proc_targets); LPROC_SEQ_FOPS(fld_proc_hash); LPROC_SEQ_FOPS_WO_TYPE(fld, cache_flush); -struct lprocfs_vars fld_client_proc_list[] = { +struct lprocfs_seq_vars fld_client_proc_list[] = { { .name = "targets", .fops = &fld_proc_targets_fops }, { .name = "hash", @@ -356,7 +356,7 @@ const struct file_operations fld_proc_seq_fops = { .release = fldb_seq_release, }; -struct lprocfs_vars fld_server_proc_list[] = { +struct lprocfs_seq_vars fld_server_proc_list[] = { { NULL } }; diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index edb85d4..4e992e6 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -45,8 +45,28 @@ #include #include +#ifndef HAVE_ONLY_PROCFS_SEQ struct lprocfs_vars { const char *name; + read_proc_t *read_fptr; + write_proc_t *write_fptr; + void *data; + const struct file_operations *fops; + /** + * /proc file mode. + */ + mode_t proc_mode; +}; + +struct lprocfs_static_vars { + struct lprocfs_vars *module_vars; + struct lprocfs_vars *obd_vars; +}; + +#endif + +struct lprocfs_seq_vars { + const char *name; const struct file_operations *fops; void *data; /** @@ -594,17 +614,32 @@ extern int lprocfs_register_stats(struct proc_dir_entry *root, const char *name, struct lprocfs_stats *stats); /* lprocfs_status.c */ +#ifndef HAVE_ONLY_PROCFS_SEQ extern int lprocfs_add_vars(struct proc_dir_entry *root, - struct lprocfs_vars *var, void *data); + struct lprocfs_vars *var, + void *data); + +extern struct proc_dir_entry *lprocfs_register(const char *name, + struct proc_dir_entry *parent, + struct lprocfs_vars *list, + void *data); +#endif +extern int lprocfs_seq_add_vars(struct proc_dir_entry *root, + struct lprocfs_seq_vars *var, + void *data); + extern struct proc_dir_entry * -lprocfs_register(const char *name, struct proc_dir_entry *parent, - struct lprocfs_vars *list, void *data); +lprocfs_seq_register(const char *name, struct proc_dir_entry *parent, + struct lprocfs_seq_vars *list, void *data); extern void lprocfs_remove(struct proc_dir_entry **root); extern void lprocfs_remove_proc_entry(const char *name, struct proc_dir_entry *parent); #ifndef HAVE_ONLY_PROCFS_SEQ -extern void remove_proc_subtree(const char *name, - struct proc_dir_entry *parent); +extern void lprocfs_try_remove_proc_entry(const char *name, + struct proc_dir_entry *parent); + +extern struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *root, + const char *name); #endif extern int lprocfs_obd_setup(struct obd_device *dev); extern int lprocfs_obd_cleanup(struct obd_device *obd); @@ -643,13 +678,19 @@ extern int lprocfs_connect_flags_seq_show(struct seq_file *m, void *data); extern int lprocfs_num_exports_seq_show(struct seq_file *m, void *data); #endif struct adaptive_timeout; -extern int lprocfs_at_hist_helper(struct seq_file *m, +extern int lprocfs_seq_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at); extern int lprocfs_timeouts_seq_show(struct seq_file *m, void *data); extern ssize_t lprocfs_timeouts_seq_write(struct file *file, const char *buffer, size_t count, loff_t *off); #ifdef HAVE_SERVER_SUPPORT +#ifndef HAVE_ONLY_PROCFS_SEQ +extern ssize_t lprocfs_fops_read(struct file *f, char __user *buf, + size_t size, loff_t *ppos); +extern ssize_t lprocfs_fops_write(struct file *f, const char __user *buf, + size_t size, loff_t *ppos); +#endif extern ssize_t lprocfs_evict_client_seq_write(struct file *file, const char *buffer, size_t count, loff_t *off); @@ -966,23 +1007,36 @@ static inline struct proc_dir_entry * lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent, const char *format, ...) {return NULL; } -static inline int lprocfs_add_vars(struct proc_dir_entry *root, - struct lprocfs_vars *var, - void *data) -{ return 0; } +#ifndef HAVE_ONLY_PROCFS_SEQ static inline struct proc_dir_entry * lprocfs_register(const char *name, struct proc_dir_entry *parent, struct lprocfs_vars *list, void *data) { return NULL; } +static inline int lprocfs_add_vars(struct proc_dir_entry *root, + struct lprocfs_vars *var, + void *data) +{ return 0; } +#endif +static inline int lprocfs_seq_add_vars(struct proc_dir_entry *root, + struct lprocfs_seq_vars *var, + void *data) +{ return 0; } +static inline struct proc_dir_entry * +lprocfs_seq_register(const char *name, struct proc_dir_entry *parent, + struct lprocfs_seq_vars *list, void *data) +{ return NULL; } static inline void lprocfs_remove(struct proc_dir_entry **root) { return; } static inline void lprocfs_remove_proc_entry(const char *name, struct proc_dir_entry *parent) { return; } #ifndef HAVE_ONLY_PROCFS_SEQ -static inline void remove_proc_subtree(const char *name, - struct proc_dir_entry *parent) +static inline void lprocfs_try_remove_proc_entry(const char *name, + struct proc_dir_entry *parent) { return; } +static inline struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *head, + const char *name) +{ return 0; } #endif static inline int lprocfs_obd_setup(struct obd_device *dev) { return 0; } @@ -1007,8 +1061,8 @@ static inline int lprocfs_num_exports_seq_show(struct seq_file *m, void *data) { return 0; } #endif struct adaptive_timeout; -static inline int lprocfs_at_hist_helper(struct seq_file *m, - struct adaptive_timeout *at) +static inline int lprocfs_seq_at_hist_helper(struct seq_file *m, + struct adaptive_timeout *at) { return 0; } static inline int lprocfs_timeouts_seq_show(struct seq_file *m, void *data) { return 0; } diff --git a/lustre/include/obd.h b/lustre/include/obd.h index e1d4f0b..88df7cb 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -695,7 +695,7 @@ struct obd_device { struct proc_dir_entry *obd_proc_exports_entry; struct proc_dir_entry *obd_svc_procroot; struct lprocfs_stats *obd_svc_stats; - struct lprocfs_vars *obd_vars; + struct lprocfs_seq_vars *obd_vars; atomic_t obd_evict_inprogress; wait_queue_head_t obd_evict_inprogress_waitq; struct list_head obd_evict_list; /* protected with pet_lock */ diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index ff08224..7a76fd5 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -75,7 +75,7 @@ struct lu_device_type; /* genops.c */ struct obd_export *class_conn2export(struct lustre_handle *); int class_register_type(struct obd_ops *, struct md_ops *, bool enable_proc, - struct lprocfs_vars *module_vars, + struct lprocfs_seq_vars *module_vars, const char *nm, struct lu_device_type *ldt); int class_unregister_type(const char *nm); @@ -126,7 +126,7 @@ typedef int (*llog_cb_t)(const struct lu_env *, struct llog_handle *, struct lustre_cfg *lustre_cfg_rename(struct lustre_cfg *cfg, const char *new_name); int class_process_config(struct lustre_cfg *lcfg); -int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, +int class_process_proc_param(char *prefix, struct lprocfs_seq_vars *lvars, struct lustre_cfg *lcfg, void *data); int class_attach(struct lustre_cfg *lcfg); int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg); diff --git a/lustre/ldlm/ldlm_internal.h b/lustre/ldlm/ldlm_internal.h index ca1e15d..6d2fc61 100644 --- a/lustre/ldlm/ldlm_internal.h +++ b/lustre/ldlm/ldlm_internal.h @@ -288,13 +288,13 @@ typedef enum ldlm_policy_res ldlm_policy_res_t; struct __##var##__dummy_write {;} /* semicolon catcher */ static inline void -ldlm_add_var(struct lprocfs_vars *vars, struct proc_dir_entry *proc_dir, +ldlm_add_var(struct lprocfs_seq_vars *vars, struct proc_dir_entry *proc_dir, const char *name, void *data, const struct file_operations *ops) { snprintf((char *)vars->name, MAX_STRING_SIZE, "%s", name); vars->data = data; vars->fops = ops; - lprocfs_add_vars(proc_dir, vars, 0); + lprocfs_seq_add_vars(proc_dir, vars, 0); } static inline int is_granted_or_cancelled(struct ldlm_lock *lock) diff --git a/lustre/ldlm/ldlm_pool.c b/lustre/ldlm/ldlm_pool.c index 7f4352f..a526f08 100644 --- a/lustre/ldlm/ldlm_pool.c +++ b/lustre/ldlm/ldlm_pool.c @@ -734,7 +734,7 @@ static int ldlm_pool_proc_init(struct ldlm_pool *pl) { struct ldlm_namespace *ns = ldlm_pl2ns(pl); struct proc_dir_entry *parent_ns_proc; - struct lprocfs_vars pool_vars[2]; + struct lprocfs_seq_vars pool_vars[2]; char *var_name = NULL; int rc = 0; ENTRY; @@ -749,7 +749,8 @@ static int ldlm_pool_proc_init(struct ldlm_pool *pl) ldlm_ns_name(ns)); GOTO(out_free_name, rc = -EINVAL); } - pl->pl_proc_dir = lprocfs_register("pool", parent_ns_proc, NULL, NULL); + pl->pl_proc_dir = lprocfs_seq_register("pool", parent_ns_proc, + NULL, NULL); if (IS_ERR(pl->pl_proc_dir)) { rc = PTR_ERR(pl->pl_proc_dir); pl->pl_proc_dir = NULL; diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c index cb5c05f..bed49ee 100644 --- a/lustre/ldlm/ldlm_resource.c +++ b/lustre/ldlm/ldlm_resource.c @@ -88,7 +88,7 @@ LPROC_SEQ_FOPS_RO_TYPE(ldlm, uint); int ldlm_proc_setup(void) { int rc; - struct lprocfs_vars list[] = { + struct lprocfs_seq_vars list[] = { { .name = "dump_namespaces", .fops = &ldlm_dump_ns_fops, .proc_mode = 0222 }, @@ -102,31 +102,34 @@ int ldlm_proc_setup(void) ENTRY; LASSERT(ldlm_ns_proc_dir == NULL); - ldlm_type_proc_dir = lprocfs_register(OBD_LDLM_DEVICENAME, - proc_lustre_root, NULL, NULL); + ldlm_type_proc_dir = lprocfs_seq_register(OBD_LDLM_DEVICENAME, + proc_lustre_root, + NULL, NULL); if (IS_ERR(ldlm_type_proc_dir)) { CERROR("LProcFS failed in ldlm-init\n"); rc = PTR_ERR(ldlm_type_proc_dir); GOTO(err, rc); } - ldlm_ns_proc_dir = lprocfs_register("namespaces", ldlm_type_proc_dir, - NULL, NULL); + ldlm_ns_proc_dir = lprocfs_seq_register("namespaces", + ldlm_type_proc_dir, + NULL, NULL); if (IS_ERR(ldlm_ns_proc_dir)) { CERROR("LProcFS failed in ldlm-init\n"); rc = PTR_ERR(ldlm_ns_proc_dir); GOTO(err_type, rc); } - ldlm_svc_proc_dir = lprocfs_register("services", ldlm_type_proc_dir, - NULL, NULL); + ldlm_svc_proc_dir = lprocfs_seq_register("services", + ldlm_type_proc_dir, + NULL, NULL); if (IS_ERR(ldlm_svc_proc_dir)) { CERROR("LProcFS failed in ldlm-init\n"); rc = PTR_ERR(ldlm_svc_proc_dir); GOTO(err_ns, rc); } - rc = lprocfs_add_vars(ldlm_type_proc_dir, list, NULL); + rc = lprocfs_seq_add_vars(ldlm_type_proc_dir, list, NULL); if (rc != 0) { CERROR("LProcFS failed in ldlm-init\n"); GOTO(err_svc, rc); @@ -323,7 +326,7 @@ void ldlm_namespace_proc_unregister(struct ldlm_namespace *ns) int ldlm_namespace_proc_register(struct ldlm_namespace *ns) { - struct lprocfs_vars lock_vars[2]; + struct lprocfs_seq_vars lock_vars[2]; char lock_name[MAX_STRING_SIZE + 1]; struct proc_dir_entry *ns_pde; diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index fb45474..b71ab58 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -714,7 +714,7 @@ 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); -extern struct lprocfs_vars lprocfs_llite_obd_vars[]; +extern struct lprocfs_seq_vars lprocfs_llite_obd_vars[]; #else static inline int lprocfs_register_mountpoint(struct proc_dir_entry *parent, struct super_block *sb, char *osc, char *mdc){return 0;} diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 154a949..a4d374e 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -959,7 +959,7 @@ static ssize_t ll_nosquash_nids_seq_write(struct file *file, } LPROC_SEQ_FOPS(ll_nosquash_nids); -struct lprocfs_vars lprocfs_llite_obd_vars[] = { +struct lprocfs_seq_vars lprocfs_llite_obd_vars[] = { { .name = "uuid", .fops = &ll_sb_uuid_fops }, { .name = "fstype", @@ -1122,7 +1122,7 @@ LPROC_SEQ_FOPS_RO_TYPE(llite, uuid); int lprocfs_register_mountpoint(struct proc_dir_entry *parent, struct super_block *sb, char *osc, char *mdc) { - struct lprocfs_vars lvars[2]; + struct lprocfs_seq_vars lvars[2]; struct lustre_sb_info *lsi = s2lsi(sb); struct ll_sb_info *sbi = ll_s2sbi(sb); struct obd_device *obd; @@ -1150,7 +1150,7 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent, snprintf(name, MAX_STRING_SIZE, "%.*s-%p", len, lsi->lsi_lmd->lmd_profile, sb); - sbi->ll_proc_root = lprocfs_register(name, parent, NULL, NULL); + sbi->ll_proc_root = lprocfs_seq_register(name, parent, NULL, NULL); if (IS_ERR(sbi->ll_proc_root)) { err = PTR_ERR(sbi->ll_proc_root); sbi->ll_proc_root = NULL; @@ -1215,7 +1215,7 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent, GOTO(out, err); - err = lprocfs_add_vars(sbi->ll_proc_root, lprocfs_llite_obd_vars, sb); + err = lprocfs_seq_add_vars(sbi->ll_proc_root, lprocfs_llite_obd_vars, sb); if (err) GOTO(out, err); @@ -1232,13 +1232,13 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent, snprintf(name, MAX_STRING_SIZE, "common_name"); lvars[0].fops = &llite_name_fops; - err = lprocfs_add_vars(dir, lvars, obd); + err = lprocfs_seq_add_vars(dir, lvars, obd); if (err) GOTO(out, err); snprintf(name, MAX_STRING_SIZE, "uuid"); lvars[0].fops = &llite_uuid_fops; - err = lprocfs_add_vars(dir, lvars, obd); + err = lprocfs_seq_add_vars(dir, lvars, obd); if (err) GOTO(out, err); @@ -1255,13 +1255,13 @@ int lprocfs_register_mountpoint(struct proc_dir_entry *parent, snprintf(name, MAX_STRING_SIZE, "common_name"); lvars[0].fops = &llite_name_fops; - err = lprocfs_add_vars(dir, lvars, obd); + err = lprocfs_seq_add_vars(dir, lvars, obd); if (err) GOTO(out, err); snprintf(name, MAX_STRING_SIZE, "uuid"); lvars[0].fops = &llite_uuid_fops; - err = lprocfs_add_vars(dir, lvars, obd); + err = lprocfs_seq_add_vars(dir, lvars, obd); out: if (err) { lprocfs_remove(&sbi->ll_proc_root); diff --git a/lustre/llite/super25.c b/lustre/llite/super25.c index 8ebe89c..6267c54 100644 --- a/lustre/llite/super25.c +++ b/lustre/llite/super25.c @@ -141,7 +141,7 @@ static int __init init_lustre_lite(void) if (ll_rmtperm_hash_cachep == NULL) GOTO(out_cache, rc = -ENOMEM); - entry = lprocfs_register("llite", proc_lustre_root, NULL, NULL); + entry = lprocfs_seq_register("llite", proc_lustre_root, NULL, NULL); if (IS_ERR(entry)) { rc = PTR_ERR(entry); CERROR("cannot register '/proc/fs/lustre/llite': rc = %d\n", diff --git a/lustre/lmv/lmv_internal.h b/lustre/lmv/lmv_internal.h index fd4dc79..82780bb 100644 --- a/lustre/lmv/lmv_internal.h +++ b/lustre/lmv/lmv_internal.h @@ -163,7 +163,7 @@ struct lmv_tgt_desc struct lu_fid *fid); /* lproc_lmv.c */ #ifdef LPROCFS -extern struct lprocfs_vars lprocfs_lmv_obd_vars[]; +extern struct lprocfs_seq_vars lprocfs_lmv_obd_vars[]; #endif extern struct file_operations lmv_proc_target_fops; diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index 540f479..2a0746d 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -234,9 +234,9 @@ static int lmv_connect(const struct lu_env *env, lmv->conn_data = *data; if (lmv->targets_proc_entry == NULL) { - lmv->targets_proc_entry = lprocfs_register("target_obds", - obd->obd_proc_entry, - NULL, NULL); + lmv->targets_proc_entry = lprocfs_seq_register("target_obds", + obd->obd_proc_entry, + NULL, NULL); if (IS_ERR(lmv->targets_proc_entry)) { CERROR("%s: cannot register " "/proc/fs/lustre/%s/%s/target_obds\n", diff --git a/lustre/lmv/lproc_lmv.c b/lustre/lmv/lproc_lmv.c index ead5670..26461c7 100644 --- a/lustre/lmv/lproc_lmv.c +++ b/lustre/lmv/lproc_lmv.c @@ -203,7 +203,7 @@ static int lmv_target_seq_open(struct inode *inode, struct file *file) LPROC_SEQ_FOPS_RO_TYPE(lmv, uuid); -struct lprocfs_vars lprocfs_lmv_obd_vars[] = { +struct lprocfs_seq_vars lprocfs_lmv_obd_vars[] = { { .name = "numobd", .fops = &lmv_numobd_fops }, { .name = "placement", diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c index e0f1003..fd51f33 100644 --- a/lustre/lod/lod_dev.c +++ b/lustre/lod/lod_dev.c @@ -1195,8 +1195,8 @@ static int __init lod_mod_init(void) return rc; type = class_search_type(LUSTRE_LOD_NAME); - type->typ_procsym = lprocfs_register("lov", proc_lustre_root, - NULL, NULL); + type->typ_procsym = lprocfs_seq_register("lov", proc_lustre_root, + NULL, NULL); if (IS_ERR(type->typ_procsym)) { CERROR("lod: can't create compat entry \"lov\": %d\n", (int)PTR_ERR(type->typ_procsym)); diff --git a/lustre/lod/lproc_lod.c b/lustre/lod/lproc_lod.c index 3511dbb..08c5673 100644 --- a/lustre/lod/lproc_lod.c +++ b/lustre/lod/lproc_lod.c @@ -705,7 +705,7 @@ lod_lmv_failout_seq_write(struct file *file, const char *buffer, } LPROC_SEQ_FOPS(lod_lmv_failout); -static struct lprocfs_vars lprocfs_lod_obd_vars[] = { +static struct lprocfs_seq_vars lprocfs_lod_obd_vars[] = { { .name = "uuid", .fops = &lod_uuid_fops }, { .name = "stripesize", @@ -733,7 +733,7 @@ static struct lprocfs_vars lprocfs_lod_obd_vars[] = { { 0 } }; -static struct lprocfs_vars lprocfs_lod_osd_vars[] = { +static struct lprocfs_seq_vars lprocfs_lod_osd_vars[] = { { "blocksize", &lod_dt_blksize_fops }, { "kbytestotal", &lod_dt_kbytestotal_fops }, { "kbytesfree", &lod_dt_kbytesfree_fops }, @@ -774,8 +774,8 @@ int lod_procfs_init(struct lod_device *lod) RETURN(rc); } - rc = lprocfs_add_vars(obd->obd_proc_entry, lprocfs_lod_osd_vars, - &lod->lod_dt_dev); + rc = lprocfs_seq_add_vars(obd->obd_proc_entry, lprocfs_lod_osd_vars, + &lod->lod_dt_dev); if (rc) { CERROR("%s: cannot setup procfs entry: %d\n", obd->obd_name, rc); @@ -790,9 +790,9 @@ int lod_procfs_init(struct lod_device *lod) GOTO(out, rc); } - lod->lod_pool_proc_entry = lprocfs_register("pools", - obd->obd_proc_entry, - NULL, NULL); + lod->lod_pool_proc_entry = lprocfs_seq_register("pools", + obd->obd_proc_entry, + NULL, NULL); if (IS_ERR(lod->lod_pool_proc_entry)) { rc = PTR_ERR(lod->lod_pool_proc_entry); lod->lod_pool_proc_entry = NULL; diff --git a/lustre/lov/lov_internal.h b/lustre/lov/lov_internal.h index a40b53b..9509ef6 100644 --- a/lustre/lov/lov_internal.h +++ b/lustre/lov/lov_internal.h @@ -212,7 +212,7 @@ void dump_lsm(unsigned int level, const struct lov_stripe_md *lsm); /* lproc_lov.c */ extern struct file_operations lov_proc_target_fops; #ifdef LPROCFS -extern struct lprocfs_vars lprocfs_lov_obd_vars[]; +extern struct lprocfs_seq_vars lprocfs_lov_obd_vars[]; #endif /* lov_cl.c */ diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 37cd4bd..2ef90db 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -238,9 +238,9 @@ static int lov_connect(const struct lu_env *env, if (data) lov->lov_ocd = *data; - lov->targets_proc_entry = lprocfs_register("target_obds", - obd->obd_proc_entry, - NULL, NULL); + lov->targets_proc_entry = lprocfs_seq_register("target_obds", + obd->obd_proc_entry, + NULL, NULL); if (IS_ERR(lov->targets_proc_entry)) { CERROR("%s: cannot register " "/proc/fs/lustre/%s/%s/target_obds\n", @@ -848,9 +848,9 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg) * Instead we use type->typ_procsym as the parent. */ type = class_search_type(LUSTRE_LOD_NAME); if (type != NULL && type->typ_procsym != NULL) { - obd->obd_proc_entry = lprocfs_register(obd->obd_name, - type->typ_procsym, - obd->obd_vars, obd); + obd->obd_proc_entry = lprocfs_seq_register(obd->obd_name, + type->typ_procsym, + obd->obd_vars, obd); if (IS_ERR(obd->obd_proc_entry)) { rc = PTR_ERR(obd->obd_proc_entry); CERROR("error %d setting up lprocfs for %s\n", rc, @@ -867,9 +867,9 @@ int lov_setup(struct obd_device *obd, struct lustre_cfg *lcfg) if (rc) CWARN("Error adding the target_obd file\n"); - lov->lov_pool_proc_entry = lprocfs_register("pools", - obd->obd_proc_entry, - NULL, NULL); + lov->lov_pool_proc_entry = lprocfs_seq_register("pools", + obd->obd_proc_entry, + NULL, NULL); if (IS_ERR(lov->lov_pool_proc_entry)) { rc = PTR_ERR(lov->lov_pool_proc_entry); CERROR("error %d setting up lprocfs for pools\n", rc); diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c index f19d249..e8f9abb 100644 --- a/lustre/lov/lproc_lov.c +++ b/lustre/lov/lproc_lov.c @@ -266,7 +266,7 @@ LPROC_SEQ_FOPS_RO_TYPE(lov, kbytestotal); LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesfree); LPROC_SEQ_FOPS_RO_TYPE(lov, kbytesavail); -struct lprocfs_vars lprocfs_lov_obd_vars[] = { +struct lprocfs_seq_vars lprocfs_lov_obd_vars[] = { { .name = "uuid", .fops = &lov_uuid_fops }, { .name = "stripesize", diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c index a043c76..d6b9c26 100644 --- a/lustre/mdc/lproc_mdc.c +++ b/lustre/mdc/lproc_mdc.c @@ -98,7 +98,7 @@ LPROC_SEQ_FOPS_RO(mdc_obd_max_pages_per_rpc); LPROC_SEQ_FOPS_RW_TYPE(mdc, import); LPROC_SEQ_FOPS_RW_TYPE(mdc, pinger_recov); -struct lprocfs_vars lprocfs_mdc_obd_vars[] = { +struct lprocfs_seq_vars lprocfs_mdc_obd_vars[] = { { .name = "uuid", .fops = &mdc_uuid_fops }, { .name = "ping", diff --git a/lustre/mdc/mdc_internal.h b/lustre/mdc/mdc_internal.h index cd2017e..56798e1 100644 --- a/lustre/mdc/mdc_internal.h +++ b/lustre/mdc/mdc_internal.h @@ -40,7 +40,7 @@ #include #ifdef LPROCFS -extern struct lprocfs_vars lprocfs_mdc_obd_vars[]; +extern struct lprocfs_seq_vars lprocfs_mdc_obd_vars[]; #endif void mdc_pack_body(struct ptlrpc_request *req, const struct lu_fid *fid, diff --git a/lustre/mdd/mdd_lproc.c b/lustre/mdd/mdd_lproc.c index 636d297..ca52771 100644 --- a/lustre/mdd/mdd_lproc.c +++ b/lustre/mdd/mdd_lproc.c @@ -276,7 +276,7 @@ static int mdd_lfsck_layout_seq_show(struct seq_file *m, void *data) } LPROC_SEQ_FOPS_RO(mdd_lfsck_layout); -static struct lprocfs_vars lprocfs_mdd_obd_vars[] = { +static struct lprocfs_seq_vars lprocfs_mdd_obd_vars[] = { { .name = "atime_diff", .fops = &mdd_atime_diff_fops }, { .name = "changelog_mask", @@ -313,8 +313,8 @@ int mdd_procfs_init(struct mdd_device *mdd, const char *name) /* Find the type procroot and add the proc entry for this device */ obd->obd_vars = lprocfs_mdd_obd_vars; - mdd->mdd_proc_entry = lprocfs_register(name, type->typ_procroot, - obd->obd_vars, mdd); + mdd->mdd_proc_entry = lprocfs_seq_register(name, type->typ_procroot, + obd->obd_vars, mdd); if (IS_ERR(mdd->mdd_proc_entry)) { rc = PTR_ERR(mdd->mdd_proc_entry); CERROR("Error %d setting up lprocfs for %s\n", diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c index f2fd1d6..ac5518f 100644 --- a/lustre/mdt/mdt_coordinator.c +++ b/lustre/mdt/mdt_coordinator.c @@ -45,7 +45,7 @@ #include #include "mdt_internal.h" -static struct lprocfs_vars lprocfs_mdt_hsm_vars[]; +static struct lprocfs_seq_vars lprocfs_mdt_hsm_vars[]; /** * get obj and HSM attributes on a fid @@ -400,7 +400,7 @@ int hsm_cdt_procfs_init(struct mdt_device *mdt) ENTRY; /* init /proc entries, failure is not critical */ - cdt->cdt_proc_dir = lprocfs_register("hsm", + cdt->cdt_proc_dir = lprocfs_seq_register("hsm", mdt2obd_dev(mdt)->obd_proc_entry, lprocfs_mdt_hsm_vars, mdt); if (IS_ERR(cdt->cdt_proc_dir)) { @@ -432,7 +432,7 @@ void hsm_cdt_procfs_fini(struct mdt_device *mdt) * \param none * \retval var vector */ -struct lprocfs_vars *hsm_cdt_get_proc_vars(void) +struct lprocfs_seq_vars *hsm_cdt_get_proc_vars(void) { return lprocfs_mdt_hsm_vars; } @@ -2212,7 +2212,7 @@ LPROC_SEQ_FOPS(mdt_hsm_user_request_mask); LPROC_SEQ_FOPS(mdt_hsm_group_request_mask); LPROC_SEQ_FOPS(mdt_hsm_other_request_mask); -static struct lprocfs_vars lprocfs_mdt_hsm_vars[] = { +static struct lprocfs_seq_vars lprocfs_mdt_hsm_vars[] = { { .name = "agents", .fops = &mdt_hsm_agent_fops }, { .name = "actions", diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 25e7d22..68750e0 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -917,7 +917,7 @@ ssize_t mdt_hsm_cdt_control_seq_write(struct file *file, const char *buffer, int mdt_hsm_cdt_control_seq_show(struct seq_file *m, void *data); int hsm_cdt_procfs_init(struct mdt_device *mdt); void hsm_cdt_procfs_fini(struct mdt_device *mdt); -struct lprocfs_vars *hsm_cdt_get_proc_vars(void); +struct lprocfs_seq_vars *hsm_cdt_get_proc_vars(void); /* md_hsm helpers */ struct mdt_object *mdt_hsm_get_md_hsm(struct mdt_thread_info *mti, const struct lu_fid *fid, diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c index b843ae7..f8d0c0a 100644 --- a/lustre/mdt/mdt_lproc.c +++ b/lustre/mdt/mdt_lproc.c @@ -825,7 +825,7 @@ LPROC_SEQ_FOPS_RW_TYPE(mdt, ir_factor); LPROC_SEQ_FOPS_RW_TYPE(mdt, nid_stats_clear); LPROC_SEQ_FOPS(mdt_hsm_cdt_control); -static struct lprocfs_vars lprocfs_mdt_obd_vars[] = { +static struct lprocfs_seq_vars lprocfs_mdt_obd_vars[] = { { .name = "uuid", .fops = &mdt_uuid_fops }, { .name = "recovery_status", diff --git a/lustre/mdt/mdt_mds.c b/lustre/mdt/mdt_mds.c index d990f24..cb28d88 100644 --- a/lustre/mdt/mdt_mds.c +++ b/lustre/mdt/mdt_mds.c @@ -466,7 +466,7 @@ static struct lu_device *mds_device_free(const struct lu_env *env, LPROC_SEQ_FOPS_RO_TYPE(mds, uuid); -static struct lprocfs_vars lprocfs_mds_obd_vars[] = { +static struct lprocfs_seq_vars lprocfs_mds_obd_vars[] = { { "uuid", &mds_uuid_fops }, { 0 } }; diff --git a/lustre/mgc/lproc_mgc.c b/lustre/mgc/lproc_mgc.c index 8cfbb5c..f818def 100644 --- a/lustre/mgc/lproc_mgc.c +++ b/lustre/mgc/lproc_mgc.c @@ -58,7 +58,7 @@ static int mgc_ir_state_seq_show(struct seq_file *m, void *v) } LPROC_SEQ_FOPS_RO(mgc_ir_state); -struct lprocfs_vars lprocfs_mgc_obd_vars[] = { +struct lprocfs_seq_vars lprocfs_mgc_obd_vars[] = { { .name = "uuid", .fops = &mgc_uuid_fops }, { .name = "ping", diff --git a/lustre/mgc/mgc_internal.h b/lustre/mgc/mgc_internal.h index 12830b9..292a212 100644 --- a/lustre/mgc/mgc_internal.h +++ b/lustre/mgc/mgc_internal.h @@ -45,7 +45,7 @@ #include #ifdef LPROCFS -extern struct lprocfs_vars lprocfs_mgc_obd_vars[]; +extern struct lprocfs_seq_vars lprocfs_mgc_obd_vars[]; int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data); #endif /* LPROCFS */ diff --git a/lustre/mgs/lproc_mgs.c b/lustre/mgs/lproc_mgs.c index 1eb6483..b2c5df7 100644 --- a/lustre/mgs/lproc_mgs.c +++ b/lustre/mgs/lproc_mgs.c @@ -207,7 +207,7 @@ LPROC_SEQ_FOPS_RO_TYPE(mgs, hash); LPROC_SEQ_FOPS_WO_TYPE(mgs, evict_client); LPROC_SEQ_FOPS_RW_TYPE(mgs, ir_timeout); -struct lprocfs_vars lprocfs_mgs_obd_vars[] = { +struct lprocfs_seq_vars lprocfs_mgs_obd_vars[] = { { .name = "uuid", .fops = &mgs_uuid_fops }, { .name = "num_exports", @@ -243,17 +243,17 @@ int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name) if (rc != 0) GOTO(out, rc); - mgs->mgs_proc_live = lprocfs_register("live", obd->obd_proc_entry, - NULL, NULL); + mgs->mgs_proc_live = lprocfs_seq_register("live", obd->obd_proc_entry, + NULL, NULL); if (IS_ERR(mgs->mgs_proc_live)) { rc = PTR_ERR(mgs->mgs_proc_live); mgs->mgs_proc_live = NULL; GOTO(out, rc); } - obd->obd_proc_exports_entry = lprocfs_register("exports", - obd->obd_proc_entry, - NULL, NULL); + obd->obd_proc_exports_entry = lprocfs_seq_register("exports", + obd->obd_proc_entry, + NULL, NULL); if (IS_ERR(obd->obd_proc_exports_entry)) { rc = PTR_ERR(obd->obd_proc_exports_entry); obd->obd_proc_exports_entry = NULL; diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index d7bcecf..37c11ad 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -158,7 +158,7 @@ EXPORT_SYMBOL(class_put_type); #define CLASS_MAX_NAME 1024 int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, - bool enable_proc, struct lprocfs_vars *vars, + bool enable_proc, struct lprocfs_seq_vars *vars, const char *name, struct lu_device_type *ldt) { struct obd_type *type; @@ -196,9 +196,9 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, #ifdef LPROCFS if (enable_proc) { - type->typ_procroot = lprocfs_register(type->typ_name, - proc_lustre_root, - vars, type); + type->typ_procroot = lprocfs_seq_register(type->typ_name, + proc_lustre_root, + vars, type); if (IS_ERR(type->typ_procroot)) { rc = PTR_ERR(type->typ_procroot); type->typ_procroot = NULL; @@ -222,9 +222,15 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, failed: if (type->typ_name != NULL) { #ifdef LPROCFS - if (type->typ_procroot != NULL) + if (type->typ_procroot != NULL) { +#ifndef HAVE_ONLY_PROCFS_SEQ + lprocfs_try_remove_proc_entry(type->typ_name, + proc_lustre_root); +#else remove_proc_subtree(type->typ_name, proc_lustre_root); #endif + } +#endif OBD_FREE(type->typ_name, strlen(name) + 1); } if (type->typ_md_ops != NULL) @@ -260,8 +266,14 @@ int class_unregister_type(const char *name) * we can't reference pointer as it can get invalided when another * module removes the entry */ #ifdef LPROCFS - if (type->typ_procroot != NULL) + if (type->typ_procroot != NULL) { +#ifndef HAVE_ONLY_PROCFS_SEQ + lprocfs_try_remove_proc_entry(type->typ_name, proc_lustre_root); +#else remove_proc_subtree(type->typ_name, proc_lustre_root); +#endif + } + if (type->typ_procsym != NULL) lprocfs_remove(&type->typ_procsym); #endif diff --git a/lustre/obdclass/linux/linux-module.c b/lustre/obdclass/linux/linux-module.c index 53bf615..8b114d2 100644 --- a/lustre/obdclass/linux/linux-module.c +++ b/lustre/obdclass/linux/linux-module.c @@ -313,7 +313,7 @@ LPROC_SEQ_FOPS(obd_proc_jobid_var); struct proc_dir_entry *proc_lustre_root = NULL; EXPORT_SYMBOL(proc_lustre_root); -struct lprocfs_vars lprocfs_base[] = { +struct lprocfs_seq_vars lprocfs_base[] = { { .name = "version", .fops = &obd_proc_version_fops }, { .name = "pinger", @@ -412,7 +412,7 @@ int class_procfs_init(void) obd_sysctl_init(); - entry = lprocfs_register("fs/lustre", NULL, lprocfs_base, NULL); + entry = lprocfs_seq_register("fs/lustre", NULL, lprocfs_base, NULL); if (IS_ERR(entry)) { rc = PTR_ERR(entry); CERROR("cannot create '/proc/fs/lustre': rc = %d\n", rc); diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index c52e301..b469fad 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -117,7 +117,204 @@ struct proc_dir_entry *lprocfs_add_symlink(const char *name, } EXPORT_SYMBOL(lprocfs_add_symlink); +#ifdef HAVE_ONLY_PROCFS_SEQ static const struct file_operations lprocfs_generic_fops = { }; +#else + +ssize_t +lprocfs_fops_read(struct file *f, char __user *buf, size_t size, loff_t *ppos) +{ + struct proc_dir_entry *dp = PDE(f->f_dentry->d_inode); + char *page, *start = NULL; + int rc = 0, eof = 1, count; + + if (*ppos >= PAGE_CACHE_SIZE) + return 0; + + page = (char *)__get_free_page(GFP_KERNEL); + if (page == NULL) + return -ENOMEM; + + if (LPROCFS_ENTRY_CHECK(dp)) { + rc = -ENOENT; + goto out; + } + + OBD_FAIL_TIMEOUT(OBD_FAIL_LPROC_REMOVE, 10); + if (dp->read_proc) + rc = dp->read_proc(page, &start, *ppos, PAGE_CACHE_SIZE, + &eof, dp->data); + if (rc <= 0) + goto out; + + /* for lustre proc read, the read count must be less than PAGE_SIZE */ + LASSERT(eof == 1); + + if (start == NULL) { + rc -= *ppos; + if (rc < 0) + rc = 0; + if (rc == 0) + goto out; + start = page + *ppos; + } else if (start < page) { + start = page; + } + + count = (rc < size) ? rc : size; + if (copy_to_user(buf, start, count)) { + rc = -EFAULT; + goto out; + } + *ppos += count; + +out: + free_page((unsigned long)page); + return rc; +} + +ssize_t +lprocfs_fops_write(struct file *f, const char __user *buf, size_t size, + loff_t *ppos) +{ + struct proc_dir_entry *dp = PDE(f->f_dentry->d_inode); + int rc = -EIO; + + if (LPROCFS_ENTRY_CHECK(dp)) + return -ENOENT; + if (dp->write_proc) + rc = dp->write_proc(f, buf, size, dp->data); + return rc; +} + +static struct file_operations lprocfs_generic_fops = { + .owner = THIS_MODULE, + .read = lprocfs_fops_read, + .write = lprocfs_fops_write, +}; + +/* for b=10866, global variable */ +DECLARE_RWSEM(_lprocfs_lock); +EXPORT_SYMBOL(_lprocfs_lock); + +static struct proc_dir_entry *__lprocfs_srch(struct proc_dir_entry *head, + const char *name) +{ + struct proc_dir_entry *temp; + + if (head == NULL) + return NULL; + + temp = head->subdir; + while (temp != NULL) { + if (strcmp(temp->name, name) == 0) + return temp; + temp = temp->next; + } + return NULL; +} + +struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *head, + const char *name) +{ + struct proc_dir_entry *temp; + + LPROCFS_SRCH_ENTRY(); + temp = __lprocfs_srch(head, name); + LPROCFS_SRCH_EXIT(); + return temp; +} +EXPORT_SYMBOL(lprocfs_srch); + +static int __lprocfs_add_vars(struct proc_dir_entry *root, + struct lprocfs_vars *list, + void *data) +{ + int rc = 0; + + if (root == NULL || list == NULL) + return -EINVAL; + + while (list->name != NULL) { + struct proc_dir_entry *cur_root, *proc; + char *pathcopy, *cur, *next, pathbuf[64]; + int pathsize = strlen(list->name) + 1; + + proc = NULL; + cur_root = root; + + /* need copy of path for strsep */ + if (strlen(list->name) > sizeof(pathbuf) - 1) { + OBD_ALLOC(pathcopy, pathsize); + if (pathcopy == NULL) + GOTO(out, rc = -ENOMEM); + } else { + pathcopy = pathbuf; + } + + next = pathcopy; + strcpy(pathcopy, list->name); + + while (cur_root != NULL && (cur = strsep(&next, "/"))) { + if (*cur =='\0') /* skip double/trailing "/" */ + continue; + + proc = __lprocfs_srch(cur_root, cur); + CDEBUG(D_OTHER, "cur_root=%s, cur=%s, next=%s, (%s)\n", + cur_root->name, cur, next, + (proc ? "exists" : "new")); + if (next != NULL) { + cur_root = (proc ? proc : + proc_mkdir(cur, cur_root)); + } else if (proc == NULL) { + mode_t mode = 0; + if (list->proc_mode != 0000) { + mode = list->proc_mode; + } else { + if (list->read_fptr) + mode = 0444; + if (list->write_fptr) + mode |= 0200; + } + proc = create_proc_entry(cur, mode, cur_root); + } + } + + if (pathcopy != pathbuf) + OBD_FREE(pathcopy, pathsize); + + if (cur_root == NULL || proc == NULL) { + CERROR("LprocFS: No memory to create /proc entry %s\n", + list->name); + GOTO(out, rc = -ENOMEM); + } + + if (list->fops) + proc->proc_fops = list->fops; + else + proc->proc_fops = &lprocfs_generic_fops; + proc->read_proc = list->read_fptr; + proc->write_proc = list->write_fptr; + proc->data = (list->data ? list->data : data); + list++; + } +out: + return rc; +} + +int lprocfs_add_vars(struct proc_dir_entry *root, struct lprocfs_vars *list, + void *data) +{ + int rc = 0; + + LPROCFS_WRITE_ENTRY(); + rc = __lprocfs_add_vars(root, list, data); + LPROCFS_WRITE_EXIT(); + + return rc; +} +EXPORT_SYMBOL(lprocfs_add_vars); +#endif /** * Add /proc entries. @@ -131,8 +328,8 @@ static const struct file_operations lprocfs_generic_fops = { }; * < 0 on error */ int -lprocfs_add_vars(struct proc_dir_entry *root, struct lprocfs_vars *list, - void *data) +lprocfs_seq_add_vars(struct proc_dir_entry *root, struct lprocfs_seq_vars *list, + void *data) { if (root == NULL || list == NULL) return -EINVAL; @@ -158,13 +355,9 @@ lprocfs_add_vars(struct proc_dir_entry *root, struct lprocfs_vars *list, } return 0; } -EXPORT_SYMBOL(lprocfs_add_vars); +EXPORT_SYMBOL(lprocfs_seq_add_vars); #ifndef HAVE_ONLY_PROCFS_SEQ -/* for b=10866, global variable */ -DECLARE_RWSEM(_lprocfs_lock); -EXPORT_SYMBOL(_lprocfs_lock); - void lprocfs_remove_nolock(struct proc_dir_entry **proot) { struct proc_dir_entry *root = *proot; @@ -197,8 +390,31 @@ void lprocfs_remove_nolock(struct proc_dir_entry **proot) break; } } +#endif -void remove_proc_subtree(const char *name, struct proc_dir_entry *parent) +void lprocfs_remove(struct proc_dir_entry **rooth) +{ +#ifndef HAVE_ONLY_PROCFS_SEQ + LPROCFS_WRITE_ENTRY(); /* search vs remove race */ + lprocfs_remove_nolock(rooth); + LPROCFS_WRITE_EXIT(); +#else + proc_remove(*rooth); + *rooth = NULL; +#endif +} +EXPORT_SYMBOL(lprocfs_remove); + +void lprocfs_remove_proc_entry(const char *name, struct proc_dir_entry *parent) +{ + LASSERT(parent != NULL); + remove_proc_entry(name, parent); +} +EXPORT_SYMBOL(lprocfs_remove_proc_entry); + +#ifndef HAVE_ONLY_PROCFS_SEQ +void lprocfs_try_remove_proc_entry(const char *name, + struct proc_dir_entry *parent) { struct proc_dir_entry *t = NULL; struct proc_dir_entry **p; @@ -241,32 +457,43 @@ void remove_proc_subtree(const char *name, struct proc_dir_entry *parent) return; } -EXPORT_SYMBOL(remove_proc_subtree); -#endif +EXPORT_SYMBOL(lprocfs_try_remove_proc_entry); -void lprocfs_remove(struct proc_dir_entry **rooth) +struct proc_dir_entry *lprocfs_register(const char *name, + struct proc_dir_entry *parent, + struct lprocfs_vars *list, void *data) { -#ifndef HAVE_ONLY_PROCFS_SEQ - LPROCFS_WRITE_ENTRY(); /* search vs remove race */ - lprocfs_remove_nolock(rooth); - LPROCFS_WRITE_EXIT(); -#else - proc_remove(*rooth); - *rooth = NULL; -#endif -} -EXPORT_SYMBOL(lprocfs_remove); + struct proc_dir_entry *entry; + int rc; -void lprocfs_remove_proc_entry(const char *name, struct proc_dir_entry *parent) -{ - LASSERT(parent != NULL); - remove_proc_entry(name, parent); + LPROCFS_WRITE_ENTRY(); + entry = __lprocfs_srch(parent, name); + if (entry != NULL) { + CERROR("entry '%s' already registered\n", name); + GOTO(out, entry = ERR_PTR(-EALREADY)); + } + + entry = proc_mkdir(name, parent); + if (entry == NULL) + GOTO(out, entry = ERR_PTR(-ENOMEM)); + + if (list != NULL) { + rc = __lprocfs_add_vars(entry, list, data); + if (rc != 0) { + lprocfs_remove_nolock(&entry); + GOTO(out, entry = ERR_PTR(rc)); + } + } +out: + LPROCFS_WRITE_EXIT(); + return entry; } -EXPORT_SYMBOL(lprocfs_remove_proc_entry); +EXPORT_SYMBOL(lprocfs_register); +#endif struct proc_dir_entry * -lprocfs_register(const char *name, struct proc_dir_entry *parent, - struct lprocfs_vars *list, void *data) +lprocfs_seq_register(const char *name, struct proc_dir_entry *parent, + struct lprocfs_seq_vars *list, void *data) { struct proc_dir_entry *newchild; @@ -275,7 +502,7 @@ lprocfs_register(const char *name, struct proc_dir_entry *parent, return ERR_PTR(-ENOMEM); if (list != NULL) { - int rc = lprocfs_add_vars(newchild, list, data); + int rc = lprocfs_seq_add_vars(newchild, list, data); if (rc) { lprocfs_remove(&newchild); return ERR_PTR(rc); @@ -283,7 +510,7 @@ lprocfs_register(const char *name, struct proc_dir_entry *parent, } return newchild; } -EXPORT_SYMBOL(lprocfs_register); +EXPORT_SYMBOL(lprocfs_seq_register); /* Generic callbacks */ int lprocfs_uint_seq_show(struct seq_file *m, void *data) @@ -904,7 +1131,7 @@ int lprocfs_state_seq_show(struct seq_file *m, void *data) } EXPORT_SYMBOL(lprocfs_state_seq_show); -int lprocfs_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at) +int lprocfs_seq_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at) { int i; for (i = 0; i < AT_BINS; i++) @@ -912,7 +1139,7 @@ int lprocfs_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at) seq_printf(m, "\n"); return 0; } -EXPORT_SYMBOL(lprocfs_at_hist_helper); +EXPORT_SYMBOL(lprocfs_seq_at_hist_helper); /* See also ptlrpc_lprocfs_timeouts_show_seq */ int lprocfs_timeouts_seq_show(struct seq_file *m, void *data) @@ -941,7 +1168,7 @@ int lprocfs_timeouts_seq_show(struct seq_file *m, void *data) s2dhms(&ts, now - worstt); seq_printf(m, "%-10s : cur %3u worst %3u (at %ld, "DHMS_FMT" ago) ", "network", cur, worst, worstt, DHMS_VARS(&ts)); - lprocfs_at_hist_helper(m, &imp->imp_at.iat_net_latency); + lprocfs_seq_at_hist_helper(m, &imp->imp_at.iat_net_latency); for(i = 0; i < IMP_AT_MAX_PORTALS; i++) { if (imp->imp_at.iat_portal[i] == 0) @@ -953,7 +1180,7 @@ int lprocfs_timeouts_seq_show(struct seq_file *m, void *data) seq_printf(m, "portal %-2d : cur %3u worst %3u (at %ld, " DHMS_FMT" ago) ", imp->imp_at.iat_portal[i], cur, worst, worstt, DHMS_VARS(&ts)); - lprocfs_at_hist_helper(m, &imp->imp_at.iat_service_estimate[i]); + lprocfs_seq_at_hist_helper(m, &imp->imp_at.iat_service_estimate[i]); } LPROCFS_CLIMP_EXIT(obd); @@ -985,9 +1212,9 @@ lprocfs_obd_setup(struct obd_device *obd) LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC); LASSERT(obd->obd_type->typ_procroot != NULL); - obd->obd_proc_entry = lprocfs_register(obd->obd_name, - obd->obd_type->typ_procroot, - obd->obd_vars, obd); + obd->obd_proc_entry = lprocfs_seq_register(obd->obd_name, + obd->obd_type->typ_procroot, + obd->obd_vars, obd); if (IS_ERR(obd->obd_proc_entry)) { rc = PTR_ERR(obd->obd_proc_entry); CERROR("error %d setting up lprocfs for %s\n",rc,obd->obd_name); diff --git a/lustre/obdclass/lprocfs_status_server.c b/lustre/obdclass/lprocfs_status_server.c index b48c80d..f0d0916 100644 --- a/lustre/obdclass/lprocfs_status_server.c +++ b/lustre/obdclass/lprocfs_status_server.c @@ -334,9 +334,15 @@ int lprocfs_exp_setup(struct obd_export *exp, lnet_nid_t *nid, int *newnid) GOTO(destroy_new, rc = -ENOMEM); memcpy(buffer, libcfs_nid2str(*nid), LNET_NIDSTR_SIZE); +#ifndef HAVE_ONLY_PROCFS_SEQ new_stat->nid_proc = lprocfs_register(buffer, obd->obd_proc_exports_entry, NULL, NULL); +#else + new_stat->nid_proc = lprocfs_seq_register(buffer, + obd->obd_proc_exports_entry, + NULL, NULL); +#endif OBD_FREE(buffer, LNET_NIDSTR_SIZE); if (IS_ERR(new_stat->nid_proc)) { diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 9503180..aecfbd1 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -1260,10 +1260,10 @@ out: } EXPORT_SYMBOL(class_process_config); -int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, +int class_process_proc_param(char *prefix, struct lprocfs_seq_vars *lvars, struct lustre_cfg *lcfg, void *data) { - struct lprocfs_vars *var; + struct lprocfs_seq_vars *var; struct file fakefile; struct seq_file fake_seqfile; char *key, *sval; diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index 930ac33..db3fa79 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -558,7 +558,7 @@ commitrw_cleanup: } LPROC_SEQ_FOPS_RO_TYPE(echo, uuid); -static struct lprocfs_vars lprocfs_echo_obd_vars[] = { +static struct lprocfs_seq_vars lprocfs_echo_obd_vars[] = { { .name = "uuid", .fops = &echo_uuid_fops }, { 0 } diff --git a/lustre/ofd/lproc_ofd.c b/lustre/ofd/lproc_ofd.c index 029ac5a..46466a8 100644 --- a/lustre/ofd/lproc_ofd.c +++ b/lustre/ofd/lproc_ofd.c @@ -983,7 +983,7 @@ LPROC_SEQ_FOPS_RO_TYPE(ofd, target_instance); LPROC_SEQ_FOPS_RW_TYPE(ofd, ir_factor); LPROC_SEQ_FOPS_RW_TYPE(ofd, job_interval); -struct lprocfs_vars lprocfs_ofd_obd_vars[] = { +struct lprocfs_seq_vars lprocfs_ofd_obd_vars[] = { { .name = "uuid", .fops = &ofd_uuid_fops }, { .name = "blocksize", diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index 25b7118..698fd7f 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -697,7 +697,8 @@ static int ofd_procfs_init(struct ofd_device *ofd) obd->obd_uses_nid_stats = 1; - entry = lprocfs_register("exports", obd->obd_proc_entry, NULL, NULL); + entry = lprocfs_seq_register("exports", obd->obd_proc_entry, NULL, + NULL); if (IS_ERR(entry)) { rc = PTR_ERR(entry); CERROR("%s: error %d setting up lprocfs for %s\n", diff --git a/lustre/ofd/ofd_internal.h b/lustre/ofd/ofd_internal.h index 692bfef..92894cb 100644 --- a/lustre/ofd/ofd_internal.h +++ b/lustre/ofd/ofd_internal.h @@ -403,7 +403,7 @@ int ofd_txn_stop_cb(const struct lu_env *env, struct thandle *txn, /* lproc_ofd.c */ #ifdef LPROCFS -extern struct lprocfs_vars lprocfs_ofd_obd_vars[]; +extern struct lprocfs_seq_vars lprocfs_ofd_obd_vars[]; void ofd_stats_counter_init(struct lprocfs_stats *stats); #else static inline void ofd_stats_counter_init(struct lprocfs_stats *stats) {} diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index 5cfc3f0..7e0c550 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -571,7 +571,7 @@ LPROC_SEQ_FOPS_WO_TYPE(osc, ping); LPROC_SEQ_FOPS_RW_TYPE(osc, import); LPROC_SEQ_FOPS_RW_TYPE(osc, pinger_recov); -struct lprocfs_vars lprocfs_osc_obd_vars[] = { +struct lprocfs_seq_vars lprocfs_osc_obd_vars[] = { { .name = "uuid", .fops = &osc_uuid_fops }, { .name = "ping", diff --git a/lustre/osc/osc_internal.h b/lustre/osc/osc_internal.h index 70d96ff..c26e70f 100644 --- a/lustre/osc/osc_internal.h +++ b/lustre/osc/osc_internal.h @@ -141,7 +141,7 @@ int osc_cleanup(struct obd_device *obd); int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg); #ifdef LPROCFS -extern struct lprocfs_vars lprocfs_osc_obd_vars[]; +extern struct lprocfs_seq_vars lprocfs_osc_obd_vars[]; int lproc_osc_attach_seqstat(struct obd_device *dev); #else static inline int lproc_osc_attach_seqstat(struct obd_device *dev) {return 0;} diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index ddefa24..b71705e 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2952,9 +2952,9 @@ int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) * tree to type->typ_procsym instead of obd->obd_type->typ_procroot. */ type = class_search_type(LUSTRE_OSP_NAME); if (type && type->typ_procsym) { - obd->obd_proc_entry = lprocfs_register(obd->obd_name, - type->typ_procsym, - obd->obd_vars, obd); + obd->obd_proc_entry = lprocfs_seq_register(obd->obd_name, + type->typ_procsym, + obd->obd_vars, obd); if (IS_ERR(obd->obd_proc_entry)) { rc = PTR_ERR(obd->obd_proc_entry); CERROR("error %d setting up lprocfs for %s\n", rc, diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index cacdc38..6d92a31 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -644,8 +644,8 @@ static inline int __osd_xattr_set(struct osd_thread_info *info, #ifdef LPROCFS /* osd_lproc.c */ -extern struct lprocfs_vars lprocfs_osd_obd_vars[]; -extern struct lprocfs_vars lprocfs_osd_module_vars[]; +extern struct lprocfs_seq_vars lprocfs_osd_obd_vars[]; +extern struct lprocfs_seq_vars lprocfs_osd_module_vars[]; int osd_procfs_init(struct osd_device *osd, const char *name); int osd_procfs_fini(struct osd_device *osd); void osd_brw_stats_update(struct osd_device *osd, struct osd_iobuf *iobuf); diff --git a/lustre/osd-ldiskfs/osd_lproc.c b/lustre/osd-ldiskfs/osd_lproc.c index 9ac7cb0..c46ef96 100644 --- a/lustre/osd-ldiskfs/osd_lproc.c +++ b/lustre/osd-ldiskfs/osd_lproc.c @@ -588,7 +588,7 @@ LPROC_SEQ_FOPS_RO_TYPE(ldiskfs, dt_kbytesavail); LPROC_SEQ_FOPS_RO_TYPE(ldiskfs, dt_filestotal); LPROC_SEQ_FOPS_RO_TYPE(ldiskfs, dt_filesfree); -struct lprocfs_vars lprocfs_osd_obd_vars[] = { +struct lprocfs_seq_vars lprocfs_osd_obd_vars[] = { { .name = "blocksize", .fops = &ldiskfs_dt_blksize_fops }, { .name = "kbytestotal", @@ -628,7 +628,7 @@ struct lprocfs_vars lprocfs_osd_obd_vars[] = { { 0 } }; -struct lprocfs_vars lprocfs_osd_module_vars[] = { +struct lprocfs_seq_vars lprocfs_osd_module_vars[] = { { .name = "track_declares_assert", .fops = &ldiskfs_osd_track_declares_assert_fops }, { 0 } @@ -652,9 +652,9 @@ int osd_procfs_init(struct osd_device *osd, const char *name) LASSERT(type != NULL); /* Find the type procroot and add the proc entry for this device */ - osd->od_proc_entry = lprocfs_register(name, type->typ_procroot, - lprocfs_osd_obd_vars, - &osd->od_dt_dev); + osd->od_proc_entry = lprocfs_seq_register(name, type->typ_procroot, + lprocfs_osd_obd_vars, + &osd->od_dt_dev); if (IS_ERR(osd->od_proc_entry)) { rc = PTR_ERR(osd->od_proc_entry); CERROR("Error %d setting up lprocfs for %s\n", diff --git a/lustre/osd-zfs/osd_internal.h b/lustre/osd-zfs/osd_internal.h index ac6bd43..9bb7f98 100644 --- a/lustre/osd-zfs/osd_internal.h +++ b/lustre/osd-zfs/osd_internal.h @@ -423,7 +423,7 @@ enum { }; /* osd_lproc.c */ -extern struct lprocfs_vars lprocfs_osd_obd_vars[]; +extern struct lprocfs_seq_vars lprocfs_osd_obd_vars[]; int osd_procfs_init(struct osd_device *osd, const char *name); int osd_procfs_fini(struct osd_device *osd); diff --git a/lustre/osd-zfs/osd_lproc.c b/lustre/osd-zfs/osd_lproc.c index 897c751..f3a662c 100644 --- a/lustre/osd-zfs/osd_lproc.c +++ b/lustre/osd-zfs/osd_lproc.c @@ -177,7 +177,7 @@ LPROC_SEQ_FOPS_RO_TYPE(zfs, dt_kbytesavail); LPROC_SEQ_FOPS_RO_TYPE(zfs, dt_filestotal); LPROC_SEQ_FOPS_RO_TYPE(zfs, dt_filesfree); -struct lprocfs_vars lprocfs_osd_obd_vars[] = { +struct lprocfs_seq_vars lprocfs_osd_obd_vars[] = { { .name = "blocksize", .fops = &zfs_dt_blksize_fops }, { .name = "kbytestotal", @@ -217,9 +217,8 @@ int osd_procfs_init(struct osd_device *osd, const char *name) LASSERT(name != NULL); LASSERT(type != NULL); - osd->od_proc_entry = lprocfs_register(name, type->typ_procroot, - lprocfs_osd_obd_vars, - &osd->od_dt_dev); + osd->od_proc_entry = lprocfs_seq_register(name, type->typ_procroot, + lprocfs_osd_obd_vars, &osd->od_dt_dev); if (IS_ERR(osd->od_proc_entry)) { rc = PTR_ERR(osd->od_proc_entry); CERROR("Error %d setting up lprocfs for %s\n", rc, name); diff --git a/lustre/osp/lproc_osp.c b/lustre/osp/lproc_osp.c index 43fe272..1dd26b7 100644 --- a/lustre/osp/lproc_osp.c +++ b/lustre/osp/lproc_osp.c @@ -717,7 +717,7 @@ LPROC_SEQ_FOPS_RO_TYPE(osp, timeouts); LPROC_SEQ_FOPS_RW_TYPE(osp, import); LPROC_SEQ_FOPS_RO_TYPE(osp, state); -static struct lprocfs_vars lprocfs_osp_obd_vars[] = { +static struct lprocfs_seq_vars lprocfs_osp_obd_vars[] = { { .name = "uuid", .fops = &osp_uuid_fops }, { .name = "ping", @@ -783,7 +783,7 @@ LPROC_SEQ_FOPS_RO_TYPE(osp, dt_kbytesavail); LPROC_SEQ_FOPS_RO_TYPE(osp, dt_filestotal); LPROC_SEQ_FOPS_RO_TYPE(osp, dt_filesfree); -static struct lprocfs_vars lprocfs_osp_osd_vars[] = { +static struct lprocfs_seq_vars lprocfs_osp_osd_vars[] = { { .name = "blocksize", .fops = &osp_dt_blksize_fops }, { .name = "kbytestotal", @@ -815,8 +815,8 @@ void osp_lprocfs_init(struct osp_device *osp) if (lprocfs_obd_setup(obd) != 0) return; - rc = lprocfs_add_vars(obd->obd_proc_entry, lprocfs_osp_osd_vars, - &osp->opd_dt_dev); + rc = lprocfs_seq_add_vars(obd->obd_proc_entry, lprocfs_osp_osd_vars, + &osp->opd_dt_dev); if (rc) { CERROR("%s: can't register in lprocfs, rc %d\n", obd->obd_name, rc); diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c index 8fe0bf3..00e5da0 100644 --- a/lustre/osp/osp_dev.c +++ b/lustre/osp/osp_dev.c @@ -1780,8 +1780,8 @@ static int __init osp_mod_init(void) return rc; type = class_search_type(LUSTRE_OSP_NAME); - type->typ_procsym = lprocfs_register("osc", proc_lustre_root, NULL, - NULL); + type->typ_procsym = lprocfs_seq_register("osc", proc_lustre_root, + NULL, NULL); if (IS_ERR(type->typ_procsym)) { CERROR("osp: can't create compat entry \"osc\": %d\n", (int) PTR_ERR(type->typ_procsym)); diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 26a90b1..8a646dc 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -74,7 +74,7 @@ static struct cfs_cpt_table *ost_io_cptable; #ifdef LPROCFS LPROC_SEQ_FOPS_RO_TYPE(ost, uuid); -static struct lprocfs_vars lprocfs_ost_obd_vars[] = { +static struct lprocfs_seq_vars lprocfs_ost_obd_vars[] = { { .name = "uuid", .fops = &ost_uuid_fops }, { 0 } diff --git a/lustre/ptlrpc/gss/lproc_gss.c b/lustre/ptlrpc/gss/lproc_gss.c index 73e9e66..d05d35b 100644 --- a/lustre/ptlrpc/gss/lproc_gss.c +++ b/lustre/ptlrpc/gss/lproc_gss.c @@ -136,7 +136,7 @@ static const struct file_operations gss_proc_secinit = { .write = gss_proc_write_secinit, }; -static struct lprocfs_vars gss_lprocfs_vars[] = { +static struct lprocfs_seq_vars gss_lprocfs_vars[] = { { .name = "replays", .fops = &gss_proc_oos_fops }, { .name = "init_channel", @@ -175,7 +175,7 @@ gss_lk_proc_dl_seq_write(struct file *file, const char *buffer, } LPROC_SEQ_FOPS(gss_lk_proc_dl); -static struct lprocfs_vars gss_lk_lprocfs_vars[] = { +static struct lprocfs_seq_vars gss_lk_lprocfs_vars[] = { { .name = "debug_level", .fops = &gss_lk_proc_dl_fops }, { NULL } @@ -200,16 +200,16 @@ int gss_init_lproc(void) spin_lock_init(&gss_stat_oos.oos_lock); - gss_proc_root = lprocfs_register("gss", sptlrpc_proc_root, - gss_lprocfs_vars, NULL); + gss_proc_root = lprocfs_seq_register("gss", sptlrpc_proc_root, + gss_lprocfs_vars, NULL); if (IS_ERR(gss_proc_root)) { rc = PTR_ERR(gss_proc_root); gss_proc_root = NULL; GOTO(out, rc); } - gss_proc_lk = lprocfs_register("lgss_keyring", gss_proc_root, - gss_lk_lprocfs_vars, NULL); + gss_proc_lk = lprocfs_seq_register("lgss_keyring", gss_proc_root, + gss_lk_lprocfs_vars, NULL); if (IS_ERR(gss_proc_lk)) { rc = PTR_ERR(gss_proc_lk); gss_proc_lk = NULL; diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 1dc756a..08a2faa 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -202,7 +202,7 @@ void ptlrpc_lprocfs_register(struct proc_dir_entry *root, char *dir, return; if (dir) { - svc_procroot = lprocfs_register(dir, root, NULL, NULL); + svc_procroot = lprocfs_seq_register(dir, root, NULL, NULL); if (IS_ERR(svc_procroot)) { lprocfs_free_stats(&svc_stats); return; @@ -1022,7 +1022,7 @@ static int ptlrpc_lprocfs_timeouts_seq_show(struct seq_file *m, void *n) DHMS_FMT" ago) ", "service", cur, worst, worstt, DHMS_VARS(&ts)); - lprocfs_at_hist_helper(m, &svcpt->scp_at_estimate); + lprocfs_seq_at_hist_helper(m, &svcpt->scp_at_estimate); } return 0; @@ -1062,7 +1062,7 @@ LPROC_SEQ_FOPS(ptlrpc_lprocfs_hp_ratio); void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry, struct ptlrpc_service *svc) { - struct lprocfs_vars lproc_vars[] = { + struct lprocfs_seq_vars lproc_vars[] = { { .name = "high_priority_ratio", .fops = &ptlrpc_lprocfs_hp_ratio_fops, .data = svc }, @@ -1105,7 +1105,7 @@ void ptlrpc_lprocfs_register_service(struct proc_dir_entry *entry, if (svc->srv_procroot == NULL) return; - lprocfs_add_vars(svc->srv_procroot, lproc_vars, NULL); + lprocfs_seq_add_vars(svc->srv_procroot, lproc_vars, NULL); rc = lprocfs_seq_create(svc->srv_procroot, "req_history", 0400, &req_history_fops, svc); diff --git a/lustre/ptlrpc/nodemap_lproc.c b/lustre/ptlrpc/nodemap_lproc.c index 0f4cfe4..1142ec6 100644 --- a/lustre/ptlrpc/nodemap_lproc.c +++ b/lustre/ptlrpc/nodemap_lproc.c @@ -879,7 +879,7 @@ out: LPROC_SEQ_FOPS_WO_TYPE(nodemap, del_nodemap_idmap); #endif /* NODEMAP_PROC_DEBUG */ -static struct lprocfs_vars lprocfs_nm_module_vars[] = { +static struct lprocfs_seq_vars lprocfs_nm_module_vars[] = { { .name = "active", .fops = &nodemap_active_fops, @@ -948,7 +948,7 @@ const struct file_operations nodemap_exports_fops = { .release = single_release }; -static struct lprocfs_vars lprocfs_nodemap_vars[] = { +static struct lprocfs_seq_vars lprocfs_nodemap_vars[] = { { .name = "id", .fops = &nodemap_id_fops, @@ -986,7 +986,7 @@ static struct lprocfs_vars lprocfs_nodemap_vars[] = { } }; -static struct lprocfs_vars lprocfs_default_nodemap_vars[] = { +static struct lprocfs_seq_vars lprocfs_default_nodemap_vars[] = { { .name = "id", .fops = &nodemap_id_fops, @@ -1025,10 +1025,10 @@ int nodemap_procfs_init(void) { int rc = 0; - proc_lustre_nodemap_root = lprocfs_register(LUSTRE_NODEMAP_NAME, - proc_lustre_root, - lprocfs_nm_module_vars, - NULL); + proc_lustre_nodemap_root = lprocfs_seq_register(LUSTRE_NODEMAP_NAME, + proc_lustre_root, + lprocfs_nm_module_vars, + NULL); if (IS_ERR(proc_lustre_nodemap_root)) { rc = PTR_ERR(proc_lustre_nodemap_root); @@ -1052,16 +1052,21 @@ int lprocfs_nodemap_register(const char *name, struct lu_nodemap *nodemap) { struct proc_dir_entry *nodemap_proc_entry; - struct lprocfs_vars *vars; int rc = 0; if (is_default) - vars = lprocfs_default_nodemap_vars; + nodemap_proc_entry = + lprocfs_seq_register(name, + proc_lustre_nodemap_root, + lprocfs_default_nodemap_vars, + nodemap); else - vars = lprocfs_nodemap_vars; + nodemap_proc_entry = + lprocfs_seq_register(name, + proc_lustre_nodemap_root, + lprocfs_nodemap_vars, + nodemap); - nodemap_proc_entry = lprocfs_register(name, proc_lustre_nodemap_root, - vars, nodemap); if (IS_ERR(nodemap_proc_entry)) { rc = PTR_ERR(nodemap_proc_entry); CERROR("cannot create 'nodemap/%s': rc = %d\n", name, rc); diff --git a/lustre/ptlrpc/nrs_crr.c b/lustre/ptlrpc/nrs_crr.c index 059f317..bf16216 100644 --- a/lustre/ptlrpc/nrs_crr.c +++ b/lustre/ptlrpc/nrs_crr.c @@ -818,7 +818,7 @@ LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_crrn_quantum); */ int nrs_crrn_lprocfs_init(struct ptlrpc_service *svc) { - struct lprocfs_vars nrs_crrn_lprocfs_vars[] = { + struct lprocfs_seq_vars nrs_crrn_lprocfs_vars[] = { { .name = "nrs_crrn_quantum", .fops = &ptlrpc_lprocfs_nrs_crrn_quantum_fops, .data = svc }, @@ -828,7 +828,8 @@ int nrs_crrn_lprocfs_init(struct ptlrpc_service *svc) if (svc->srv_procroot == NULL) return 0; - return lprocfs_add_vars(svc->srv_procroot, nrs_crrn_lprocfs_vars, NULL); + return lprocfs_seq_add_vars(svc->srv_procroot, nrs_crrn_lprocfs_vars, + NULL); } /** diff --git a/lustre/ptlrpc/nrs_orr.c b/lustre/ptlrpc/nrs_orr.c index a3c8588..8b5428c 100644 --- a/lustre/ptlrpc/nrs_orr.c +++ b/lustre/ptlrpc/nrs_orr.c @@ -1858,7 +1858,7 @@ int nrs_orr_lprocfs_init(struct ptlrpc_service *svc) { int i; - struct lprocfs_vars nrs_orr_lprocfs_vars[] = { + struct lprocfs_seq_vars nrs_orr_lprocfs_vars[] = { { .name = "nrs_orr_quantum", .fops = &ptlrpc_lprocfs_nrs_orr_quantum_fops }, { .name = "nrs_orr_offset_type", @@ -1876,7 +1876,7 @@ int nrs_orr_lprocfs_init(struct ptlrpc_service *svc) for (i = 0; i < ARRAY_SIZE(nrs_orr_lprocfs_vars); i++) nrs_orr_lprocfs_vars[i].data = &lprocfs_orr_data; - return lprocfs_add_vars(svc->srv_procroot, nrs_orr_lprocfs_vars, NULL); + return lprocfs_seq_add_vars(svc->srv_procroot, nrs_orr_lprocfs_vars, NULL); } void nrs_orr_lprocfs_fini(struct ptlrpc_service *svc) @@ -1925,9 +1925,10 @@ struct ptlrpc_nrs_pol_conf nrs_conf_orr = { int nrs_trr_lprocfs_init(struct ptlrpc_service *svc) { + int rc; int i; - struct lprocfs_vars nrs_trr_lprocfs_vars[] = { + struct lprocfs_seq_vars nrs_trr_lprocfs_vars[] = { { .name = "nrs_trr_quantum", .fops = &ptlrpc_lprocfs_nrs_orr_quantum_fops }, { .name = "nrs_trr_offset_type", @@ -1945,7 +1946,9 @@ int nrs_trr_lprocfs_init(struct ptlrpc_service *svc) for (i = 0; i < ARRAY_SIZE(nrs_trr_lprocfs_vars); i++) nrs_trr_lprocfs_vars[i].data = &lprocfs_trr_data; - return lprocfs_add_vars(svc->srv_procroot, nrs_trr_lprocfs_vars, NULL); + rc = lprocfs_seq_add_vars(svc->srv_procroot, nrs_trr_lprocfs_vars, NULL); + + return rc; } void nrs_trr_lprocfs_fini(struct ptlrpc_service *svc) diff --git a/lustre/ptlrpc/nrs_tbf.c b/lustre/ptlrpc/nrs_tbf.c index af7d696..6c7b5dc 100644 --- a/lustre/ptlrpc/nrs_tbf.c +++ b/lustre/ptlrpc/nrs_tbf.c @@ -1825,7 +1825,7 @@ LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs_tbf_rule); */ int nrs_tbf_lprocfs_init(struct ptlrpc_service *svc) { - struct lprocfs_vars nrs_tbf_lprocfs_vars[] = { + struct lprocfs_seq_vars nrs_tbf_lprocfs_vars[] = { { .name = "nrs_tbf_rule", .fops = &ptlrpc_lprocfs_nrs_tbf_rule_fops, .data = svc }, @@ -1835,7 +1835,8 @@ int nrs_tbf_lprocfs_init(struct ptlrpc_service *svc) if (svc->srv_procroot == NULL) return 0; - return lprocfs_add_vars(svc->srv_procroot, nrs_tbf_lprocfs_vars, NULL); + return lprocfs_seq_add_vars(svc->srv_procroot, nrs_tbf_lprocfs_vars, + NULL); } /** diff --git a/lustre/ptlrpc/sec_lproc.c b/lustre/ptlrpc/sec_lproc.c index e602a63..9416f28 100644 --- a/lustre/ptlrpc/sec_lproc.c +++ b/lustre/ptlrpc/sec_lproc.c @@ -169,7 +169,7 @@ int sptlrpc_lprocfs_cliobd_attach(struct obd_device *dev) EXPORT_SYMBOL(sptlrpc_lprocfs_cliobd_attach); LPROC_SEQ_FOPS_RO(sptlrpc_proc_enc_pool); -static struct lprocfs_vars sptlrpc_lprocfs_vars[] = { +static struct lprocfs_seq_vars sptlrpc_lprocfs_vars[] = { { .name = "encrypt_page_pools", .fops = &sptlrpc_proc_enc_pool_fops }, { NULL } @@ -181,8 +181,8 @@ int sptlrpc_lproc_init(void) LASSERT(sptlrpc_proc_root == NULL); - sptlrpc_proc_root = lprocfs_register("sptlrpc", proc_lustre_root, - sptlrpc_lprocfs_vars, NULL); + sptlrpc_proc_root = lprocfs_seq_register("sptlrpc", proc_lustre_root, + sptlrpc_lprocfs_vars, NULL); if (IS_ERR(sptlrpc_proc_root)) { rc = PTR_ERR(sptlrpc_proc_root); sptlrpc_proc_root = NULL; diff --git a/lustre/quota/qmt_dev.c b/lustre/quota/qmt_dev.c index 6a819d1..8b501c3 100644 --- a/lustre/quota/qmt_dev.c +++ b/lustre/quota/qmt_dev.c @@ -257,8 +257,8 @@ static int qmt_device_init0(const struct lu_env *env, struct qmt_device *qmt, LASSERT(type != NULL); /* register proc directory associated with this qmt */ - qmt->qmt_proc = lprocfs_register(qmt->qmt_svname, type->typ_procroot, - NULL, NULL); + qmt->qmt_proc = lprocfs_seq_register(qmt->qmt_svname, type->typ_procroot, + NULL, NULL); if (IS_ERR(qmt->qmt_proc)) { rc = PTR_ERR(qmt->qmt_proc); CERROR("%s: failed to create qmt proc entry (%d)\n", diff --git a/lustre/quota/qmt_pool.c b/lustre/quota/qmt_pool.c index 2189342..30ad195 100644 --- a/lustre/quota/qmt_pool.c +++ b/lustre/quota/qmt_pool.c @@ -170,7 +170,7 @@ static int qpi_state_seq_show(struct seq_file *m, void *data) } LPROC_SEQ_FOPS_RO(qpi_state); -static struct lprocfs_vars lprocfs_quota_qpi_vars[] = { +static struct lprocfs_seq_vars lprocfs_quota_qpi_vars[] = { { .name = "info", .fops = &qpi_state_fops }, { NULL } @@ -213,8 +213,8 @@ static int qmt_pool_alloc(const struct lu_env *env, struct qmt_device *qmt, /* create pool proc directory */ sprintf(qti->qti_buf, "%s-0x%x", RES_NAME(pool_type), pool_id); - pool->qpi_proc = lprocfs_register(qti->qti_buf, qmt->qmt_proc, - lprocfs_quota_qpi_vars, pool); + pool->qpi_proc = lprocfs_seq_register(qti->qti_buf, qmt->qmt_proc, + lprocfs_quota_qpi_vars, pool); if (IS_ERR(pool->qpi_proc)) { rc = PTR_ERR(pool->qpi_proc); CERROR("%s: failed to create proc entry for pool %s (%d)\n", diff --git a/lustre/quota/qsd_lib.c b/lustre/quota/qsd_lib.c index a9307b7..8be6f6a 100644 --- a/lustre/quota/qsd_lib.c +++ b/lustre/quota/qsd_lib.c @@ -207,7 +207,7 @@ qsd_timeout_seq_write(struct file *file, const char *buffer, } LPROC_SEQ_FOPS(qsd_timeout); -static struct lprocfs_vars lprocfs_quota_qsd_vars[] = { +static struct lprocfs_seq_vars lprocfs_quota_qsd_vars[] = { { .name = "info", .fops = &qsd_state_fops }, { .name = "enabled", @@ -617,8 +617,8 @@ struct qsd_instance *qsd_init(const struct lu_env *env, char *svname, mutex_unlock(&qsd->qsd_fsinfo->qfs_mutex); /* register procfs directory */ - qsd->qsd_proc = lprocfs_register(QSD_DIR, osd_proc, - lprocfs_quota_qsd_vars, qsd); + qsd->qsd_proc = lprocfs_seq_register(QSD_DIR, osd_proc, + lprocfs_quota_qsd_vars, qsd); if (IS_ERR(qsd->qsd_proc)) { rc = PTR_ERR(qsd->qsd_proc); qsd->qsd_proc = NULL; -- 1.8.3.1