#ifndef _LPROCFS_SNMP_H
#define _LPROCFS_SNMP_H
-#include <lustre/lustre_idl.h>
#if defined(__linux__)
#include <linux/lprocfs_status.h>
#elif defined(__APPLE__)
#else
#error Unsupported operating system.
#endif
+#include <lustre/lustre_idl.h>
#undef LPROCFS
#if (defined(__KERNEL__) && defined(CONFIG_PROC_FS))
#define LPROCFS_GET_SMP_ID 0x0002
enum lprocfs_stats_flags {
- LPROCFS_STATS_FLAG_PERCPU = 0x0000, /* per cpu counter */
+ LPROCFS_STATS_FLAG_NONE = 0x0000, /* per cpu counter */
LPROCFS_STATS_FLAG_NOPERCPU = 0x0001, /* stats have no percpu
* area and need locking */
+ LPROCFS_STATS_GET_SMP_ID = 0x0002, /* just record locking with
+ * LPROCFS_GET_SMP_ID flag */
};
enum lprocfs_fields_flags {
} else {
if (type & LPROCFS_GET_NUM_CPU)
rc = num_possible_cpus();
- if (type & LPROCFS_GET_SMP_ID)
- rc = smp_processor_id();
+ if (type & LPROCFS_GET_SMP_ID) {
+ stats->ls_flags |= LPROCFS_STATS_GET_SMP_ID;
+ rc = cfs_get_cpu();
+ }
}
return rc;
}
{
if (stats->ls_flags & LPROCFS_STATS_FLAG_NOPERCPU)
spin_unlock(&stats->ls_lock);
+ else if (stats->ls_flags & LPROCFS_STATS_GET_SMP_ID)
+ cfs_put_cpu();
}
/* Two optimized LPROCFS counter increment functions are provided:
int count, int *eof, void *data);
extern int lprocfs_rd_import(char *page, char **start, off_t off, int count,
int *eof, void *data);
+extern int lprocfs_rd_state(char *page, char **start, off_t off, int count,
+ int *eof, void *data);
extern int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
int count, int *eof, void *data);
extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
void lprocfs_oh_clear(struct obd_histogram *oh);
unsigned long lprocfs_oh_sum(struct obd_histogram *oh);
-/* lprocfs_status.c: counter read/write functions */
-extern int lprocfs_counter_read(char *page, char **start, off_t off,
- int count, int *eof, void *data);
-extern int lprocfs_counter_write(struct file *file, const char *buffer,
- unsigned long count, void *data);
+void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
+ struct lprocfs_counter *cnt);
+
/* lprocfs_status.c: recovery status */
int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
int count, int *eof, void *data);
extern int lprocfs_quota_wr_qs_factor(struct file *file, const char *buffer,
unsigned long count, void *data);
+
+/** struct for holding changelog data for seq_file processing */
+struct changelog_seq_iter {
+ void *csi_dev;
+ struct llog_ctxt *csi_ctxt;
+ struct llog_handle *csi_llh;
+ __u64 csi_startrec;
+ __u64 csi_endrec;
+ loff_t csi_pos;
+ int csi_wrote;
+ int csi_startcat;
+ int csi_startidx;
+ int csi_fill:1;
+ int csi_done:1;
+};
+int changelog_seq_open(struct inode *inode, struct file *file,
+ struct changelog_seq_iter **csih);
+int changelog_seq_release(struct inode *inode, struct file *file);
+loff_t changelog_seq_lseek(struct file *file, loff_t offset, int origin);
+
+
+
#else
/* LPROCFS is not defined */
+
+
+
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,
static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
int count, int *eof, void *data)
{ return 0; }
-static inline int lprocfs_rd_import(char *page, char **start, off_t off, int count,
- int *eof, void *data) { return 0; }
+static inline int lprocfs_rd_import(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{ return 0; }
+static inline int lprocfs_rd_state(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{ return 0; }
static inline int lprocfs_rd_connect_flags(char *page, char **start, off_t off,
int count, int *eof, void *data)
{ return 0; }
static inline
unsigned long lprocfs_oh_sum(struct obd_histogram *oh) { return 0; }
static inline
-int lprocfs_counter_read(char *page, char **start, off_t off,
- int count, int *eof, void *data) { return 0; }
-static inline
-int lprocfs_counter_write(struct file *file, const char *buffer,
- unsigned long count, void *data) { return 0; }
+void lprocfs_stats_collect(struct lprocfs_stats *stats, int idx,
+ struct lprocfs_counter *cnt) {}
static inline
__u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx,