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

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

23 char str[STAT_BUF_SIZE];
24};
25
26static int mon_stat_open(struct inode *inode, struct file *file)
27{
28 struct mon_bus *mbus;
29 struct snap *sp;
30
1/*
2 * The USB Monitor, inspired by Dave Harding's USBMon.
3 *
4 * This is the 's' or 'stat' reader which debugs usbmon itself.
5 * Note that this code blows through locks, so make sure that
6 * /dbg/usbmon/0s is well protected from non-root users.
7 *
8 */

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

23 char str[STAT_BUF_SIZE];
24};
25
26static int mon_stat_open(struct inode *inode, struct file *file)
27{
28 struct mon_bus *mbus;
29 struct snap *sp;
30
31 if ((sp = kmalloc(sizeof(struct snap), GFP_KERNEL)) == NULL)
31 sp = kmalloc(sizeof(struct snap), GFP_KERNEL);
32 if (sp == NULL)
32 return -ENOMEM;
33
34 mbus = inode->i_private;
35
36 sp->slen = snprintf(sp->str, STAT_BUF_SIZE,
37 "nreaders %d events %u text_lost %u\n",
38 mbus->nreaders, mbus->cnt_events, mbus->cnt_text_lost);
39

--- 30 unchanged lines hidden ---
33 return -ENOMEM;
34
35 mbus = inode->i_private;
36
37 sp->slen = snprintf(sp->str, STAT_BUF_SIZE,
38 "nreaders %d events %u text_lost %u\n",
39 mbus->nreaders, mbus->cnt_events, mbus->cnt_text_lost);
40

--- 30 unchanged lines hidden ---