0001
0002
0003
0004
0005
0006 #ifndef _HFI1_DEBUGFS_H
0007 #define _HFI1_DEBUGFS_H
0008
0009 struct hfi1_ibdev;
0010
0011 #define DEBUGFS_SEQ_FILE_OPS(name) \
0012 static const struct seq_operations _##name##_seq_ops = { \
0013 .start = _##name##_seq_start, \
0014 .next = _##name##_seq_next, \
0015 .stop = _##name##_seq_stop, \
0016 .show = _##name##_seq_show \
0017 }
0018
0019 #define DEBUGFS_SEQ_FILE_OPEN(name) \
0020 static int _##name##_open(struct inode *inode, struct file *s) \
0021 { \
0022 struct seq_file *seq; \
0023 int ret; \
0024 ret = seq_open(s, &_##name##_seq_ops); \
0025 if (ret) \
0026 return ret; \
0027 seq = s->private_data; \
0028 seq->private = inode->i_private; \
0029 return 0; \
0030 }
0031
0032 #define DEBUGFS_FILE_OPS(name) \
0033 static const struct file_operations _##name##_file_ops = { \
0034 .owner = THIS_MODULE, \
0035 .open = _##name##_open, \
0036 .read = hfi1_seq_read, \
0037 .llseek = hfi1_seq_lseek, \
0038 .release = seq_release \
0039 }
0040
0041
0042 ssize_t hfi1_seq_read(struct file *file, char __user *buf, size_t size,
0043 loff_t *ppos);
0044 loff_t hfi1_seq_lseek(struct file *file, loff_t offset, int whence);
0045
0046 #ifdef CONFIG_DEBUG_FS
0047 void hfi1_dbg_ibdev_init(struct hfi1_ibdev *ibd);
0048 void hfi1_dbg_ibdev_exit(struct hfi1_ibdev *ibd);
0049 void hfi1_dbg_init(void);
0050 void hfi1_dbg_exit(void);
0051
0052 #else
0053 static inline void hfi1_dbg_ibdev_init(struct hfi1_ibdev *ibd)
0054 {
0055 }
0056
0057 static inline void hfi1_dbg_ibdev_exit(struct hfi1_ibdev *ibd)
0058 {
0059 }
0060
0061 static inline void hfi1_dbg_init(void)
0062 {
0063 }
0064
0065 static inline void hfi1_dbg_exit(void)
0066 {
0067 }
0068 #endif
0069
0070 #endif