-static inline void lprocfs_counter_add(struct lprocfs_stats *stats, int idx,
- long amount)
-{
- struct lprocfs_counter *percpu_cntr;
-
- LASSERT(stats != NULL);
- percpu_cntr = &(stats->ls_percpu[smp_processor_id()]->lp_cntr[idx]);
- atomic_inc(&percpu_cntr->lc_cntl.la_entry);
- percpu_cntr->lc_count++;
-
- if (percpu_cntr->lc_config & LPROCFS_CNTR_AVGMINMAX) {
- percpu_cntr->lc_sum += amount;
- if (percpu_cntr->lc_config & LPROCFS_CNTR_STDDEV)
- percpu_cntr->lc_sumsquare += (__u64)amount * amount;
- if (amount < percpu_cntr->lc_min)
- percpu_cntr->lc_min = amount;
- if (amount > percpu_cntr->lc_max)
- percpu_cntr->lc_max = amount;
- }
- atomic_inc(&percpu_cntr->lc_cntl.la_exit);
-}
-
-static inline void lprocfs_counter_incr(struct lprocfs_stats *stats, int idx)
-{
- struct lprocfs_counter *percpu_cntr;
-
- LASSERT(stats != NULL);
- percpu_cntr = &(stats->ls_percpu[smp_processor_id()]->lp_cntr[idx]);
- atomic_inc(&percpu_cntr->lc_cntl.la_entry);
- percpu_cntr->lc_count++;
- atomic_inc(&percpu_cntr->lc_cntl.la_exit);
-}
-
-extern struct lprocfs_stats *lprocfs_alloc_stats(unsigned int num);
-extern void lprocfs_free_stats(struct lprocfs_stats *stats);
-extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
- unsigned int num_private_stats);
-extern void lprocfs_counter_init(struct lprocfs_stats *stats, int index,
- unsigned conf, const char *name,
- const char *units);
-extern void lprocfs_free_obd_stats(struct obd_device *obddev);
-extern int lprocfs_register_stats(struct proc_dir_entry *root, const char *name,
- struct lprocfs_stats *stats);
-
-#define LPROCFS_INIT_MULTI_VARS(array, size) \
-void lprocfs_init_multi_vars(unsigned int idx, \
- struct lprocfs_static_vars *x) \
-{ \
- struct lprocfs_static_vars *glob = (struct lprocfs_static_vars*)array; \
- LASSERT(glob != 0); \
- LASSERT(idx < (unsigned int)(size)); \
- x->module_vars = glob[idx].module_vars; \
- x->obd_vars = glob[idx].obd_vars; \
-} \
-
-#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)
-extern void lprocfs_init_multi_vars(unsigned int idx,
- struct lprocfs_static_vars *var);
-/* lprocfs_status.c */
-extern int lprocfs_add_vars(struct proc_dir_entry *root,
- 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 void lprocfs_remove(struct proc_dir_entry *root);
-
-extern struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *root,
- const char *name);
-
-extern int lprocfs_obd_attach(struct obd_device *dev, struct lprocfs_vars *list);
-extern int lprocfs_obd_detach(struct obd_device *dev);
-
-/* Generic callbacks */
-
-extern int lprocfs_rd_u64(char *page, char **start, off_t off,
- int count, int *eof, void *data);
-extern int lprocfs_rd_uuid(char *page, char **start, off_t off,
- int count, int *eof, void *data);
-extern int lprocfs_rd_name(char *page, char **start, off_t off,
- int count, int *eof, void *data);
-extern int lprocfs_rd_fstype(char *page, char **start, off_t off,
- int count, int *eof, void *data);
-extern int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
- int count, int *eof, void *data);
-extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
- int count, int *eof, void *data);
-extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
- int count, int *eof, void *data);
-
-/* Statfs helpers */
-extern int lprocfs_rd_blksize(char *page, char **start, off_t off,
- int count, int *eof, void *data);
-extern int lprocfs_rd_kbytestotal(char *page, char **start, off_t off,
- int count, int *eof, void *data);
-extern int lprocfs_rd_kbytesfree(char *page, char **start, off_t off,
- int count, int *eof, void *data);
-extern int lprocfs_rd_filestotal(char *page, char **start, off_t off,
- int count, int *eof, void *data);
-extern int lprocfs_rd_filesfree(char *page, char **start, off_t off,
- int count, int *eof, void *data);
-extern int lprocfs_rd_filegroups(char *page, char **start, off_t off,
- int count, int *eof, void *data);