mon_stat.c (f0eef25339f92f7cd4aeea23d9ae97987a5a1e82) mon_stat.c (d4062fcb9e6164cbbcef773f6b6602e30c4b6007)
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 */

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

54 if (copy_to_user(buf, sp->str + pos, cnt))
55 return -EFAULT;
56 *ppos = pos + cnt;
57 return cnt;
58}
59
60static int mon_stat_release(struct inode *inode, struct file *file)
61{
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 */

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

54 if (copy_to_user(buf, sp->str + pos, cnt))
55 return -EFAULT;
56 *ppos = pos + cnt;
57 return cnt;
58}
59
60static int mon_stat_release(struct inode *inode, struct file *file)
61{
62 struct snap *sp = file->private_data;
63 file->private_data = NULL;
64 kfree(sp);
62 return 0;
63}
64
65const struct file_operations mon_fops_stat = {
66 .owner = THIS_MODULE,
67 .open = mon_stat_open,
68 .llseek = no_llseek,
69 .read = mon_stat_read,
70 /* .write = mon_stat_write, */
71 /* .poll = mon_stat_poll, */
72 /* .ioctl = mon_stat_ioctl, */
73 .release = mon_stat_release,
74};
65 return 0;
66}
67
68const struct file_operations mon_fops_stat = {
69 .owner = THIS_MODULE,
70 .open = mon_stat_open,
71 .llseek = no_llseek,
72 .read = mon_stat_read,
73 /* .write = mon_stat_write, */
74 /* .poll = mon_stat_poll, */
75 /* .ioctl = mon_stat_ioctl, */
76 .release = mon_stat_release,
77};