Whamcloud - gitweb
LU-8066 sysfs: make ping sysfs file read and writable
[fs/lustre-release.git] / lustre / include / lprocfs_status.h
index 50b8c11..acf1bc0 100644 (file)
@@ -45,8 +45,7 @@
 #include <linux/spinlock.h>
 #include <linux/seq_file.h>
 
-#include <libcfs/libcfs_time.h>
-#include <libcfs/linux/linux-misc.h>
+#include <libcfs/libcfs.h>
 #include <uapi/linux/lustre/lustre_idl.h>
 
 struct lprocfs_vars {
@@ -59,6 +58,11 @@ struct lprocfs_vars {
        mode_t                           proc_mode;
 };
 
+static inline u32 pct(s64 a, s64 b)
+{
+       return b ? a * 100 / b : 0;
+}
+
 /**
  * Append a space separated list of current set flags to str.
  */
@@ -469,13 +473,9 @@ extern struct lprocfs_stats *
 lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags);
 extern void lprocfs_clear_stats(struct lprocfs_stats *stats);
 extern void lprocfs_free_stats(struct lprocfs_stats **stats);
-extern void lprocfs_init_ops_stats(int num_private_stats,
-                                   struct lprocfs_stats *stats);
-extern void lprocfs_init_mps_stats(int num_private_stats,
-                                   struct lprocfs_stats *stats);
 extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
 extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
-                                   unsigned int num_private_stats);
+                                  unsigned int num_stats);
 extern int lprocfs_alloc_md_stats(struct obd_device *obddev,
                                   unsigned int num_private_stats);
 extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
@@ -576,9 +576,7 @@ extern int lprocfs_obd_seq_create(struct obd_device *dev, const char *name,
 
 /* Generic callbacks */
 extern int lprocfs_uuid_seq_show(struct seq_file *m, void *data);
-extern int lprocfs_name_seq_show(struct seq_file *m, void *data);
 extern int lprocfs_server_uuid_seq_show(struct seq_file *m, void *data);
-extern int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data);
 ssize_t conn_uuid_show(struct kobject *kobj, struct attribute *attr, char *buf);
 extern int lprocfs_import_seq_show(struct seq_file *m, void *data);
 extern int lprocfs_state_seq_show(struct seq_file *m, void *data);
@@ -600,9 +598,9 @@ lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer,
 #endif
 ssize_t ping_store(struct kobject *kobj, struct attribute *attr,
                   const char *buffer, size_t count);
-extern ssize_t
-lprocfs_ping_seq_write(struct file *file, const char __user *buffer,
-                      size_t count, loff_t *off);
+ssize_t ping_show(struct kobject *kobj, struct attribute *attr,
+                 char *buffer);
+
 extern ssize_t
 lprocfs_import_seq_write(struct file *file, const char __user *buffer,
                         size_t count, loff_t *off);
@@ -857,6 +855,10 @@ int lprocfs_obd_short_io_bytes_seq_show(struct seq_file *m, void *data);
 ssize_t lprocfs_obd_short_io_bytes_seq_write(struct file *file,
                                             const char __user *buffer,
                                             size_t count, loff_t *off);
+ssize_t short_io_bytes_show(struct kobject *kobj, struct attribute *attr,
+                           char *buf);
+ssize_t short_io_bytes_store(struct kobject *kobj, struct attribute *attr,
+                            const char *buffer, size_t count);
 
 struct root_squash_info;
 int lprocfs_wr_root_squash(const char __user *buffer, unsigned long count,
@@ -901,16 +903,10 @@ 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)
+                                         unsigned int num_stats)
 { return 0; }
 static inline int lprocfs_alloc_md_stats(struct obd_device *obddev,
                                          unsigned int num_private_stats)
@@ -965,12 +961,8 @@ static inline int lprocfs_obd_cleanup(struct obd_device *dev)
 { return 0; }
 static inline int lprocfs_uuid_seq_show(struct seq_file *m, void *data)
 { return 0; }
-static inline int lprocfs_name_seq_show(struct seq_file *m, void *data)
-{ return 0; }
 static inline int lprocfs_server_seq_show(struct seq_file *m, void *data)
 { return 0; }
-static inline int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data)
-{ return 0; }
 static inline int lprocfs_import_seq_show(struct seq_file *m, void *data)
 { return 0; }
 static inline int lprocfs_state_seq_show(struct seq_file *m, void *data)