.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Sync File validation framework and debug information |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2012 Google, Inc. |
---|
5 | | - * |
---|
6 | | - * This software is licensed under the terms of the GNU General Public |
---|
7 | | - * License version 2, as published by the Free Software Foundation, and |
---|
8 | | - * may be copied, distributed, and modified under those terms. |
---|
9 | | - * |
---|
10 | | - * This program is distributed in the hope that it will be useful, |
---|
11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | | - * GNU General Public License for more details. |
---|
14 | | - * |
---|
15 | 6 | */ |
---|
16 | 7 | |
---|
17 | 8 | #include <linux/debugfs.h> |
---|
18 | 9 | #include "sync_debug.h" |
---|
19 | 10 | |
---|
20 | | -#ifdef CONFIG_DEBUG_FS |
---|
21 | 11 | static struct dentry *dbgfs; |
---|
22 | 12 | |
---|
23 | 13 | static LIST_HEAD(sync_timeline_list_head); |
---|
.. | .. |
---|
148 | 138 | } |
---|
149 | 139 | } |
---|
150 | 140 | |
---|
151 | | -static int sync_debugfs_show(struct seq_file *s, void *unused) |
---|
| 141 | +static int sync_info_debugfs_show(struct seq_file *s, void *unused) |
---|
152 | 142 | { |
---|
153 | 143 | struct list_head *pos; |
---|
154 | 144 | |
---|
.. | .. |
---|
179 | 169 | return 0; |
---|
180 | 170 | } |
---|
181 | 171 | |
---|
182 | | -static int sync_info_debugfs_open(struct inode *inode, struct file *file) |
---|
183 | | -{ |
---|
184 | | - return single_open(file, sync_debugfs_show, inode->i_private); |
---|
185 | | -} |
---|
186 | | - |
---|
187 | | -static const struct file_operations sync_info_debugfs_fops = { |
---|
188 | | - .open = sync_info_debugfs_open, |
---|
189 | | - .read = seq_read, |
---|
190 | | - .llseek = seq_lseek, |
---|
191 | | - .release = single_release, |
---|
192 | | -}; |
---|
| 172 | +DEFINE_SHOW_ATTRIBUTE(sync_info_debugfs); |
---|
193 | 173 | |
---|
194 | 174 | static __init int sync_debugfs_init(void) |
---|
195 | 175 | { |
---|
.. | .. |
---|
208 | 188 | return 0; |
---|
209 | 189 | } |
---|
210 | 190 | late_initcall(sync_debugfs_init); |
---|
211 | | - |
---|
212 | | -#define DUMP_CHUNK 256 |
---|
213 | | -static char sync_dump_buf[64 * 1024]; |
---|
214 | | -void sync_dump(void) |
---|
215 | | -{ |
---|
216 | | - struct seq_file s = { |
---|
217 | | - .buf = sync_dump_buf, |
---|
218 | | - .size = sizeof(sync_dump_buf) - 1, |
---|
219 | | - }; |
---|
220 | | - int i; |
---|
221 | | - |
---|
222 | | - sync_debugfs_show(&s, NULL); |
---|
223 | | - |
---|
224 | | - for (i = 0; i < s.count; i += DUMP_CHUNK) { |
---|
225 | | - if ((s.count - i) > DUMP_CHUNK) { |
---|
226 | | - char c = s.buf[i + DUMP_CHUNK]; |
---|
227 | | - |
---|
228 | | - s.buf[i + DUMP_CHUNK] = 0; |
---|
229 | | - pr_cont("%s", s.buf + i); |
---|
230 | | - s.buf[i + DUMP_CHUNK] = c; |
---|
231 | | - } else { |
---|
232 | | - s.buf[s.count] = 0; |
---|
233 | | - pr_cont("%s", s.buf + i); |
---|
234 | | - } |
---|
235 | | - } |
---|
236 | | -} |
---|
237 | | -#endif |
---|