mon_stat.c (498495dba268b20e8eadd7fe93c140c68b6cc9d2) mon_stat.c (79632569619f4d57ff745398dba98e09105b5108)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * The USB Monitor, inspired by Dave Harding's USBMon.
4 *
5 * This is the 's' or 'stat' reader which debugs usbmon itself.
6 * Note that this code blows through locks, so make sure that
7 * /dbg/usbmon/0s is well protected from non-root users.
8 *

--- 21 unchanged lines hidden (view full) ---

30 struct snap *sp;
31
32 sp = kmalloc(sizeof(struct snap), GFP_KERNEL);
33 if (sp == NULL)
34 return -ENOMEM;
35
36 mbus = inode->i_private;
37
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * The USB Monitor, inspired by Dave Harding's USBMon.
4 *
5 * This is the 's' or 'stat' reader which debugs usbmon itself.
6 * Note that this code blows through locks, so make sure that
7 * /dbg/usbmon/0s is well protected from non-root users.
8 *

--- 21 unchanged lines hidden (view full) ---

30 struct snap *sp;
31
32 sp = kmalloc(sizeof(struct snap), GFP_KERNEL);
33 if (sp == NULL)
34 return -ENOMEM;
35
36 mbus = inode->i_private;
37
38 sp->slen = snprintf(sp->str, STAT_BUF_SIZE,
39 "nreaders %d events %u text_lost %u\n",
40 mbus->nreaders, mbus->cnt_events, mbus->cnt_text_lost);
38 sp->slen = scnprintf(sp->str, STAT_BUF_SIZE,
39 "nreaders %d events %u text_lost %u\n",
40 mbus->nreaders, mbus->cnt_events, mbus->cnt_text_lost);
41
42 file->private_data = sp;
43 return 0;
44}
45
46static ssize_t mon_stat_read(struct file *file, char __user *buf,
47 size_t nbytes, loff_t *ppos)
48{

--- 23 unchanged lines hidden ---
41
42 file->private_data = sp;
43 return 0;
44}
45
46static ssize_t mon_stat_read(struct file *file, char __user *buf,
47 size_t nbytes, loff_t *ppos)
48{

--- 23 unchanged lines hidden ---