Go to the documentation of this file.
30 loff_t *ppos,
char *
fmt, ...);
37 #define DEBUGFS_FORMAT_BUFFER_SIZE 256
39 #define DEBUGFS_READONLY_FILE(name, fmt, value...) \
40 static ssize_t name## _read(struct file *file, char __user *userbuf, \
41 size_t count, loff_t *ppos) \
43 struct wl1271 *wl = file->private_data; \
44 return wl1271_format_buffer(userbuf, count, ppos, \
48 static const struct file_operations name## _ops = { \
49 .read = name## _read, \
50 .open = simple_open, \
51 .llseek = generic_file_llseek, \
54 #define DEBUGFS_ADD(name, parent) \
56 entry = debugfs_create_file(#name, 0400, parent, \
58 if (!entry || IS_ERR(entry)) \
63 #define DEBUGFS_ADD_PREFIX(prefix, name, parent) \
65 entry = debugfs_create_file(#name, 0400, parent, \
66 wl, &prefix## _## name## _ops); \
67 if (!entry || IS_ERR(entry)) \
71 #define DEBUGFS_FWSTATS_FILE(sub, name, fmt, struct_type) \
72 static ssize_t sub## _ ##name## _read(struct file *file, \
73 char __user *userbuf, \
74 size_t count, loff_t *ppos) \
76 struct wl1271 *wl = file->private_data; \
77 struct struct_type *stats = wl->stats.fw_stats; \
79 wl1271_debugfs_update_stats(wl); \
81 return wl1271_format_buffer(userbuf, count, ppos, fmt "\n", \
85 static const struct file_operations sub## _ ##name## _ops = { \
86 .read = sub## _ ##name## _read, \
87 .open = simple_open, \
88 .llseek = generic_file_llseek, \
91 #define DEBUGFS_FWSTATS_FILE_ARRAY(sub, name, len, struct_type) \
92 static ssize_t sub## _ ##name## _read(struct file *file, \
93 char __user *userbuf, \
94 size_t count, loff_t *ppos) \
96 struct wl1271 *wl = file->private_data; \
97 struct struct_type *stats = wl->stats.fw_stats; \
98 char buf[DEBUGFS_FORMAT_BUFFER_SIZE] = ""; \
101 wl1271_debugfs_update_stats(wl); \
103 for (i = 0; i < len; i++) \
104 res = snprintf(buf, sizeof(buf), "%s[%d] = %d\n", \
105 buf, i, stats->sub.name[i]); \
107 return wl1271_format_buffer(userbuf, count, ppos, "%s", buf); \
110 static const struct file_operations sub## _ ##name## _ops = { \
111 .read = sub## _ ##name## _read, \
112 .open = simple_open, \
113 .llseek = generic_file_llseek, \
116 #define DEBUGFS_FWSTATS_ADD(sub, name) \
117 DEBUGFS_ADD(sub## _ ##name, stats)