diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/include/lprocfs_status.h')
-rw-r--r-- | drivers/staging/lustre/lustre/include/lprocfs_status.h | 316 |
1 files changed, 58 insertions, 258 deletions
diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index d030847e5..8ede2a00c 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -42,7 +42,7 @@ #ifndef _LPROCFS_SNMP_H #define _LPROCFS_SNMP_H -#include <linux/proc_fs.h> +#include <linux/debugfs.h> #include <linux/seq_file.h> #include <linux/spinlock.h> #include <linux/types.h> @@ -60,8 +60,8 @@ struct lprocfs_vars { }; struct lprocfs_static_vars { - struct lprocfs_vars *module_vars; struct lprocfs_vars *obd_vars; + struct attribute_group *sysfs_vars; }; /* if we find more consumers this could be generalized */ @@ -348,7 +348,8 @@ enum { #define EXTRA_FIRST_OPC LDLM_GLIMPSE_ENQUEUE /* class_obd.c */ -extern struct proc_dir_entry *proc_lustre_root; +extern struct dentry *debugfs_lustre_root; +extern struct kobject *lustre_kobj; struct obd_device; struct obd_histogram; @@ -378,8 +379,6 @@ extern int lprocfs_write_frac_helper(const char __user *buffer, unsigned long count, int *val, int mult); extern int lprocfs_read_frac_helper(char *buffer, unsigned long count, long val, int mult); -#if defined (CONFIG_PROC_FS) - extern int lprocfs_stats_alloc_one(struct lprocfs_stats *stats, unsigned int cpuid); /* @@ -422,9 +421,8 @@ static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc, else spin_lock(&stats->ls_lock); return 1; - } else { - return stats->ls_biggest_alloc_num; } + return stats->ls_biggest_alloc_num; } } @@ -556,53 +554,45 @@ extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index, extern void lprocfs_free_obd_stats(struct obd_device *obddev); extern void lprocfs_free_md_stats(struct obd_device *obddev); struct obd_export; -struct nid_stat; -extern int lprocfs_add_clear_entry(struct obd_device *obd, - struct proc_dir_entry *entry); -extern int lprocfs_exp_setup(struct obd_export *exp, - lnet_nid_t *peer_nid, int *newnid); extern int lprocfs_exp_cleanup(struct obd_export *exp); -extern struct proc_dir_entry *lprocfs_add_simple(struct proc_dir_entry *root, - char *name, - void *data, - struct file_operations *fops); -extern struct proc_dir_entry * -lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent, +extern struct dentry *ldebugfs_add_simple(struct dentry *root, + char *name, + void *data, + struct file_operations *fops); +extern struct dentry * +ldebugfs_add_symlink(const char *name, struct dentry *parent, const char *format, ...); -extern void lprocfs_free_per_client_stats(struct obd_device *obd); -extern int -lprocfs_nid_stats_clear_write(struct file *file, const char *buffer, - unsigned long count, void *data); -extern int lprocfs_nid_stats_clear_read(struct seq_file *m, void *data); -extern int lprocfs_register_stats(struct proc_dir_entry *root, const char *name, - struct lprocfs_stats *stats); +extern int ldebugfs_register_stats(struct dentry *parent, + const char *name, + struct lprocfs_stats *stats); /* lprocfs_status.c */ -extern int lprocfs_add_vars(struct proc_dir_entry *root, - struct lprocfs_vars *var, - void *data); +extern int ldebugfs_add_vars(struct dentry *parent, + 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); +extern struct dentry *ldebugfs_register(const char *name, + struct dentry *parent, + struct lprocfs_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); +extern void ldebugfs_remove(struct dentry **entryp); -extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list); +extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list, + struct attribute_group *attrs); extern int lprocfs_obd_cleanup(struct obd_device *obd); -extern int lprocfs_seq_create(struct proc_dir_entry *parent, const char *name, - umode_t mode, - const struct file_operations *seq_fops, - void *data); -extern int lprocfs_obd_seq_create(struct obd_device *dev, const char *name, - umode_t mode, - const struct file_operations *seq_fops, - void *data); +extern int ldebugfs_seq_create(struct dentry *parent, + const char *name, + umode_t mode, + const struct file_operations *seq_fops, + void *data); +extern int ldebugfs_obd_seq_create(struct obd_device *dev, + const char *name, + umode_t mode, + const struct file_operations *seq_fops, + void *data); /* Generic callbacks */ @@ -613,15 +603,12 @@ extern int lprocfs_wr_atomic(struct file *file, const char __user *buffer, extern int lprocfs_rd_uint(struct seq_file *m, void *data); extern int lprocfs_wr_uint(struct file *file, const char __user *buffer, unsigned long count, void *data); -extern int lprocfs_rd_uuid(struct seq_file *m, void *data); extern int lprocfs_rd_name(struct seq_file *m, void *data); extern int lprocfs_rd_server_uuid(struct seq_file *m, void *data); extern int lprocfs_rd_conn_uuid(struct seq_file *m, void *data); extern int lprocfs_rd_import(struct seq_file *m, void *data); extern int lprocfs_rd_state(struct seq_file *m, void *data); extern int lprocfs_rd_connect_flags(struct seq_file *m, void *data); -extern int lprocfs_rd_num_exports(struct seq_file *m, void *data); -extern int lprocfs_rd_numrefs(struct seq_file *m, void *data); struct adaptive_timeout; extern int lprocfs_at_hist_helper(struct seq_file *m, @@ -640,12 +627,6 @@ extern int lprocfs_wr_pinger_recov(struct file *file, const char __user *buffer, size_t count, loff_t *off); /* Statfs helpers */ -extern int lprocfs_rd_blksize(struct seq_file *m, void *data); -extern int lprocfs_rd_kbytestotal(struct seq_file *m, void *data); -extern int lprocfs_rd_kbytesfree(struct seq_file *m, void *data); -extern int lprocfs_rd_kbytesavail(struct seq_file *m, void *data); -extern int lprocfs_rd_filestotal(struct seq_file *m, void *data); -extern int lprocfs_rd_filesfree(struct seq_file *m, void *data); extern int lprocfs_write_helper(const char __user *buffer, unsigned long count, int *val); @@ -685,11 +666,11 @@ extern int lprocfs_seq_release(struct inode *, struct file *); /* write the name##_seq_show function, call LPROC_SEQ_FOPS_RO for read-only proc entries; otherwise, you will define name##_seq_write function also for a read-write proc entry, and then call LPROC_SEQ_SEQ instead. Finally, - call lprocfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */ + call ldebugfs_obd_seq_create(obd, filename, 0444, &name#_fops, data); */ #define __LPROC_SEQ_FOPS(name, custom_seq_write) \ static int name##_single_open(struct inode *inode, struct file *file) \ { \ - return single_open(file, name##_seq_show, PDE_DATA(inode)); \ + return single_open(file, name##_seq_show, inode->i_private); \ } \ static struct file_operations name##_fops = { \ .owner = THIS_MODULE, \ @@ -734,7 +715,7 @@ static struct file_operations name##_fops = { \ } \ static int name##_##type##_open(struct inode *inode, struct file *file) \ { \ - return single_open(file, NULL, PDE_DATA(inode)); \ + return single_open(file, NULL, inode->i_private); \ } \ static struct file_operations name##_##type##_fops = { \ .open = name##_##type##_open, \ @@ -742,6 +723,27 @@ static struct file_operations name##_fops = { \ .release = lprocfs_single_release, \ } +struct lustre_attr { + struct attribute attr; + ssize_t (*show)(struct kobject *kobj, struct attribute *attr, + char *buf); + ssize_t (*store)(struct kobject *kobj, struct attribute *attr, + const char *buf, size_t len); +}; + +#define LUSTRE_ATTR(name, mode, show, store) \ +static struct lustre_attr lustre_attr_##name = __ATTR(name, mode, show, store) + +#define LUSTRE_RO_ATTR(name) LUSTRE_ATTR(name, 0444, name##_show, NULL) +#define LUSTRE_RW_ATTR(name) LUSTRE_ATTR(name, 0644, name##_show, name##_store) + +ssize_t lustre_attr_show(struct kobject *kobj, struct attribute *attr, + char *buf); +ssize_t lustre_attr_store(struct kobject *kobj, struct attribute *attr, + const char *buf, size_t len); + +extern const struct sysfs_ops lustre_sysfs_ops; + /* lproc_ptlrpc.c */ struct ptlrpc_request; extern void target_print_req(void *seq_file, struct ptlrpc_request *req); @@ -810,206 +812,4 @@ extern int lprocfs_quota_rd_qs_factor(char *page, char **start, loff_t off, extern int lprocfs_quota_wr_qs_factor(struct file *file, const char *buffer, unsigned long count, void *data); -#else -/* CONFIG_PROC_FS is not defined */ - -#define proc_lustre_root NULL - -static inline void lprocfs_counter_add(struct lprocfs_stats *stats, - int index, long amount) -{ return; } -static inline void lprocfs_counter_incr(struct lprocfs_stats *stats, - int index) -{ return; } -static inline void lprocfs_counter_sub(struct lprocfs_stats *stats, - int index, long amount) -{ return; } -static inline void lprocfs_counter_decr(struct lprocfs_stats *stats, - int index) -{ return; } -static inline void lprocfs_counter_init(struct lprocfs_stats *stats, - int index, unsigned conf, - const char *name, const char *units) -{ return; } - -static inline __u64 lc_read_helper(struct lprocfs_counter *lc, - enum lprocfs_fields_flags field) -{ return 0; } - -/* NB: we return !NULL to satisfy error checker */ -static inline struct lprocfs_stats * -lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags) -{ return (struct lprocfs_stats *)1; } -static inline void lprocfs_clear_stats(struct lprocfs_stats *stats) -{ return; } -static inline void lprocfs_free_stats(struct lprocfs_stats **stats) -{ return; } -static inline int lprocfs_register_stats(struct proc_dir_entry *root, - const char *name, - struct lprocfs_stats *stats) -{ return 0; } -static inline void lprocfs_init_ops_stats(int num_private_stats, - struct lprocfs_stats *stats) -{ return; } -static inline void lprocfs_init_mps_stats(int num_private_stats, - struct lprocfs_stats *stats) -{ return; } -static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats) -{ return; } -static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev, - unsigned int num_private_stats) -{ return 0; } -static inline int lprocfs_alloc_md_stats(struct obd_device *obddev, - unsigned int num_private_stats) -{ return 0; } -static inline void lprocfs_free_obd_stats(struct obd_device *obddev) -{ return; } -static inline void lprocfs_free_md_stats(struct obd_device *obddev) -{ return; } - -struct obd_export; -static inline int lprocfs_add_clear_entry(struct obd_export *exp) -{ return 0; } -static inline int lprocfs_exp_setup(struct obd_export *exp, - lnet_nid_t *peer_nid, - int *newnid) -{ return 0; } -static inline int lprocfs_exp_cleanup(struct obd_export *exp) -{ return 0; } -static inline struct proc_dir_entry * -lprocfs_add_simple(struct proc_dir_entry *root, char *name, - void *data, struct file_operations *fops) -{return 0; } -static inline struct proc_dir_entry * -lprocfs_add_symlink(const char *name, struct proc_dir_entry *parent, - const char *format, ...) -{return NULL; } -static inline void lprocfs_free_per_client_stats(struct obd_device *obd) -{ return; } -static inline -int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer, - unsigned long count, void *data) -{return count;} -static inline -int lprocfs_nid_stats_clear_read(struct seq_file *m, void *data) -{ return 0; } - -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; } -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; } -static inline int lprocfs_obd_setup(struct obd_device *dev, - struct lprocfs_vars *list) -{ return 0; } -static inline int lprocfs_obd_cleanup(struct obd_device *dev) -{ return 0; } -static inline int lprocfs_rd_u64(struct seq_file *m, void *data) -{ return 0; } -static inline int lprocfs_rd_uuid(struct seq_file *m, void *data) -{ return 0; } -static inline int lprocfs_rd_name(struct seq_file *m, void *data) -{ return 0; } -static inline int lprocfs_rd_server_uuid(struct seq_file *m, void *data) -{ return 0; } -static inline int lprocfs_rd_conn_uuid(struct seq_file *m, void *data) -{ return 0; } -static inline int lprocfs_rd_import(struct seq_file *m, void *data) -{ return 0; } -static inline int lprocfs_rd_pinger_recov(struct seq_file *m, void *n) -{ return 0; } -static inline int lprocfs_rd_state(struct seq_file *m, void *data) -{ return 0; } -static inline int lprocfs_rd_connect_flags(struct seq_file *m, void *data) -{ return 0; } -static inline int lprocfs_rd_num_exports(struct seq_file *m, void *data) -{ return 0; } -extern inline int lprocfs_rd_numrefs(struct seq_file *m, void *data) -{ return 0; } -struct adaptive_timeout; -static inline int lprocfs_at_hist_helper(struct seq_file *m, - struct adaptive_timeout *at) -{ return 0; } -static inline int lprocfs_rd_timeouts(struct seq_file *m, void *data) -{ return 0; } -static inline int lprocfs_wr_timeouts(struct file *file, - const char __user *buffer, - unsigned long count, void *data) -{ return 0; } -static inline int lprocfs_wr_evict_client(struct file *file, - const char __user *buffer, - size_t count, loff_t *off) -{ return 0; } -static inline int lprocfs_wr_ping(struct file *file, - const char __user *buffer, - size_t count, loff_t *off) -{ return 0; } -static inline int lprocfs_wr_import(struct file *file, - const char __user *buffer, - size_t count, loff_t *off) -{ return 0; } -static inline int lprocfs_wr_pinger_recov(struct file *file, - const char __user *buffer, - size_t count, loff_t *off) -{ return 0; } - -/* Statfs helpers */ -static inline -int lprocfs_rd_blksize(struct seq_file *m, void *data) -{ return 0; } -static inline -int lprocfs_rd_kbytestotal(struct seq_file *m, void *data) -{ return 0; } -static inline -int lprocfs_rd_kbytesfree(struct seq_file *m, void *data) -{ return 0; } -static inline -int lprocfs_rd_kbytesavail(struct seq_file *m, void *data) -{ return 0; } -static inline -int lprocfs_rd_filestotal(struct seq_file *m, void *data) -{ return 0; } -static inline -int lprocfs_rd_filesfree(struct seq_file *m, void *data) -{ return 0; } -static inline -void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value) -{ return; } -static inline -void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value) -{ return; } -static inline -void lprocfs_oh_clear(struct obd_histogram *oh) -{ return; } -static inline -unsigned long lprocfs_oh_sum(struct obd_histogram *oh) -{ return 0; } -static inline -void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx, - struct lprocfs_counter *cnt) -{ return; } -static inline -__u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx, - enum lprocfs_fields_flags field) -{ return (__u64)0; } - -#define LPROC_SEQ_FOPS_RO(name) -#define LPROC_SEQ_FOPS(name) -#define LPROC_SEQ_FOPS_RO_TYPE(name, type) -#define LPROC_SEQ_FOPS_RW_TYPE(name, type) -#define LPROC_SEQ_FOPS_WR_ONLY(name, type) - -/* lproc_ptlrpc.c */ -#define target_print_req NULL - -#endif /* CONFIG_PROC_FS */ - #endif /* LPROCFS_SNMP_H */ |