📄 lprocfs_status.h
字号:
extern cfs_proc_dir_entry_t *lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent, struct lprocfs_vars *list, void *data);extern void lprocfs_remove(cfs_proc_dir_entry_t **root);extern cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *root, const char *name);extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);extern int lprocfs_obd_cleanup(struct obd_device *obd);extern int lprocfs_add_simple(struct proc_dir_entry *root, char *name, read_proc_t *read_proc, write_proc_t *write_proc, void *data);struct nid_stat;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(char *page, char **start, off_t off, int count, int *eof, void *data);extern struct file_operations lprocfs_evict_client_fops;extern int lprocfs_seq_create(cfs_proc_dir_entry_t *parent, char *name, mode_t mode, struct file_operations *seq_fops, void *data);extern int lprocfs_obd_seq_create(struct obd_device *dev, char *name, mode_t mode, struct file_operations *seq_fops, void *data);/* Generic callbacks */extern int lprocfs_rd_u64(char *page, char **start, off_t off, int count, int *eof, void *data);extern int lprocfs_rd_atomic(char *page, char **start, off_t off, int count, int *eof, void *data);extern int lprocfs_wr_atomic(struct file *file, const char *buffer, unsigned long count, void *data);extern int lprocfs_rd_uint(char *page, char **start, off_t off, int count, int *eof, void *data);extern int lprocfs_wr_uint(struct file *file, const char *buffer, unsigned long count, 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_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, int count, int *eof, void *data);extern int lprocfs_rd_numrefs(char *page, char **start, off_t off, int count, int *eof, void *data);struct adaptive_timeout;extern int lprocfs_at_hist_helper(char *page, int count, int rc, struct adaptive_timeout *at);extern int lprocfs_rd_timeouts(char *page, char **start, off_t off, int count, int *eof, void *data);extern int lprocfs_wr_timeouts(struct file *file, const char *buffer, unsigned long count, void *data);extern int lprocfs_wr_evict_client(struct file *file, const char *buffer, unsigned long count, void *data);extern int lprocfs_wr_ping(struct file *file, const char *buffer, unsigned long count, 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_kbytesavail(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);extern int lprocfs_write_helper(const char *buffer, unsigned long count, int *val);extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count, int *val, int mult);extern int lprocfs_read_frac_helper(char *buffer, unsigned long count, long val, int mult);extern int lprocfs_write_u64_helper(const char *buffer, unsigned long count, __u64 *val);extern int lprocfs_write_frac_u64_helper(const char *buffer, unsigned long count, __u64 *val, int mult);void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value);void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value);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);/* 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_seq_release(struct inode *, struct file *);/* in lprocfs_stat.c, to protect the private data for proc entries */extern struct rw_semaphore _lprocfs_lock;#define LPROCFS_ENTRY() do { \ down_read(&_lprocfs_lock); \} while(0)#define LPROCFS_EXIT() do { \ up_read(&_lprocfs_lock); \} while(0)#define LPROCFS_ENTRY_AND_CHECK(dp) do { \ typecheck(struct proc_dir_entry *, dp); \ LPROCFS_ENTRY(); \ if ((dp)->deleted) { \ LPROCFS_EXIT(); \ return -ENODEV; \ } \} while(0)/* You must use these macros when you want to refer to * the import in a client obd_device for a lprocfs entry */#define LPROCFS_CLIMP_CHECK(obd) do { \ typecheck(struct obd_device *, obd); \ mutex_down(&(obd)->u.cli.cl_sem); \ if ((obd)->u.cli.cl_import == NULL) { \ mutex_up(&(obd)->u.cli.cl_sem); \ return -ENODEV; \ } \} while(0)#define LPROCFS_CLIMP_EXIT(obd) \ mutex_up(&(obd)->u.cli.cl_sem);/* 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); */#define __LPROC_SEQ_FOPS(name, custom_seq_write) \static int name##_seq_open(struct inode *inode, struct file *file) { \ struct proc_dir_entry *dp = PDE(inode); \ int rc; \ LPROCFS_ENTRY_AND_CHECK(dp); \ rc = single_open(file, name##_seq_show, dp->data); \ if (rc) { \ LPROCFS_EXIT(); \ return rc; \ } \ return 0; \} \struct file_operations name##_fops = { \ .owner = THIS_MODULE, \ .open = name##_seq_open, \ .read = seq_read, \ .write = custom_seq_write, \ .llseek = seq_lseek, \ .release = lprocfs_seq_release, \}#define LPROC_SEQ_FOPS_RO(name) __LPROC_SEQ_FOPS(name, NULL)#define LPROC_SEQ_FOPS(name) __LPROC_SEQ_FOPS(name, name##_seq_write)/* lproc_ptlrpc.c */struct ptlrpc_request;extern void target_print_req(void *seq_file, struct ptlrpc_request *req);#ifdef CRAY_XT3/* lprocfs_status.c: read recovery max time bz13079 */int lprocfs_obd_rd_recovery_maxtime(char *page, char **start, off_t off, int count, int *eof, void *data);/* lprocfs_status.c: write recovery max time bz13079 */int lprocfs_obd_wr_recovery_maxtime(struct file *file, const char *buffer, unsigned long count, void *data);#endif#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, int index) { return; }static inline void lprocfs_counter_sub(struct lprocfs_stats *stats, int index, long amount) { 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; }static inline struct lprocfs_stats* lprocfs_alloc_stats(unsigned int num, enum lprocfs_stats_flags flags){ return NULL; }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(cfs_proc_dir_entry_t *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 int lprocfs_alloc_obd_stats(struct obd_device *obddev, unsigned int num_private_stats){ return 0; }static inline void lprocfs_free_obd_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){ return 0; }static inline int lprocfs_exp_cleanup(struct obd_export *exp){ return 0; }static inline int lprocfs_add_simple(struct proc_dir_entry *root, char *name, read_proc_t *read_proc, write_proc_t *write_proc, void *data){return 0; }struct nid_stat;static inline void lprocfs_free_per_client_stats(struct obd_device *obd){}static inlineint lprocfs_nid_stats_clear_write(struct file *file, const char *buffer, unsigned long count, void *data){return count;}static inlineint lprocfs_nid_stats_clear_read(char *page, char **start, off_t off, int count, int *eof, void *data){return count;}static inline cfs_proc_dir_entry_t *lprocfs_register(const char *name, cfs_proc_dir_entry_t *parent, struct lprocfs_vars *list, void *data) { return NULL; }static inline int lprocfs_add_vars(cfs_proc_dir_entry_t *root, struct lprocfs_vars *var, void *data) { return 0; }static inline void lprocfs_remove(cfs_proc_dir_entry_t **root) {};static inline cfs_proc_dir_entry_t *lprocfs_srch(cfs_proc_dir_entry_t *head, const char *name) {return 0;}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(char *page, char **start, off_t off, int count, int *eof, void *data) { return 0; }static inline int lprocfs_rd_uuid(char *page, char **start, off_t off, int count, int *eof, void *data) { return 0; }static inline int lprocfs_rd_name(char *page, char **start, off_t off, int count, int *eof, void *data) { return 0; }static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off, int count, int *eof, void *data){ return 0; }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_connect_flags(char *page, char **start, off_t off, int count, int *eof, void *data){ return 0; }static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off, int count, int *eof, void *data){ return 0; }static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off, int count, int *eof, void *data){ return 0; }struct adaptive_timeout;static inline int lprocfs_at_hist_helper(char *page, int count, int rc, struct adaptive_timeout *at){ return 0; }static inline int lprocfs_rd_timeouts(char *page, char **start, off_t off, int count, int *eof, void *data){ return 0; }static inline int lprocfs_wr_timeouts(struct file *file, const char *buffer, unsigned long count, void *data){ return 0; }static inline int lprocfs_wr_evict_client(struct file *file, const char *buffer, unsigned long count, void *data){ return 0; }static inline int lprocfs_wr_ping(struct file *file, const char *buffer, unsigned long count, void *data){ return 0; }/* Statfs helpers */static inlineint lprocfs_rd_blksize(char *page, char **start, off_t off, int count, int *eof, void *data) { return 0; }static inlineint lprocfs_rd_kbytestotal(char *page, char **start, off_t off, int count, int *eof, void *data) { return 0; }static inlineint lprocfs_rd_kbytesfree(char *page, char **start, off_t off, int count, int *eof, void *data) { return 0; }static inlineint lprocfs_rd_kbytesavail(char *page, char **start, off_t off, int count, int *eof, void *data) { return 0; }static inlineint lprocfs_rd_filestotal(char *page, char **start, off_t off, int count, int *eof, void *data) { return 0; }static inlineint lprocfs_rd_filesfree(char *page, char **start, off_t off, int count, int *eof, void *data) { return 0; }static inlineint lprocfs_rd_filegroups(char *page, char **start, off_t off, int count, int *eof, void *data) { return 0; }static inlinevoid lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value) {}static inlinevoid lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value) {}static inlinevoid lprocfs_oh_clear(struct obd_histogram *oh) {}static inlineunsigned long lprocfs_oh_sum(struct obd_histogram *oh) { return 0; }static inlineint lprocfs_counter_read(char *page, char **start, off_t off, int count, int *eof, void *data) { return 0; }static inlineint lprocfs_counter_write(struct file *file, const char *buffer, unsigned long count, void *data) { return 0; }static inline__u64 lprocfs_stats_collector(struct lprocfs_stats *stats, int idx, enum lprocfs_fields_flags field){ return (__u64)0; }#define LPROCFS_ENTRY()#define LPROCFS_EXIT()#define LPROCFS_ENTRY_AND_CHECK(dp)#define LPROC_SEQ_FOPS_RO(name)#define LPROC_SEQ_FOPS(name)/* lproc_ptlrpc.c */#define target_print_req NULL#endif /* LPROCFS */#endif /* LPROCFS_SNMP_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -