Release 4.7 drivers/usb/mon/mon_stat.c
/*
* The USB Monitor, inspired by Dave Harding's USBMon.
*
* This is the 's' or 'stat' reader which debugs usbmon itself.
* Note that this code blows through locks, so make sure that
* /dbg/usbmon/0s is well protected from non-root users.
*
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/export.h>
#include <linux/usb.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include "usb_mon.h"
#define STAT_BUF_SIZE 80
struct snap {
int slen;
char str[STAT_BUF_SIZE];
};
static int mon_stat_open(struct inode *inode, struct file *file)
{
struct mon_bus *mbus;
struct snap *sp;
sp = kmalloc(sizeof(struct snap), GFP_KERNEL);
if (sp == NULL)
return -ENOMEM;
mbus = inode->i_private;
sp->slen = snprintf(sp->str, STAT_BUF_SIZE,
"nreaders %d events %u text_lost %u\n",
mbus->nreaders, mbus->cnt_events, mbus->cnt_text_lost);
file->private_data = sp;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pete zaitcev | pete zaitcev | 86 | 94.51% | 2 | 50.00% |
greg kroah-hartman | greg kroah-hartman | 4 | 4.40% | 1 | 25.00% |
theodore tso | theodore tso | 1 | 1.10% | 1 | 25.00% |
| Total | 91 | 100.00% | 4 | 100.00% |
static ssize_t mon_stat_read(struct file *file, char __user *buf,
size_t nbytes, loff_t *ppos)
{
struct snap *sp = file->private_data;
return simple_read_from_buffer(buf, nbytes, ppos, sp->str, sp->slen);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pete zaitcev | pete zaitcev | 42 | 84.00% | 1 | 50.00% |
akinobu mita | akinobu mita | 8 | 16.00% | 1 | 50.00% |
| Total | 50 | 100.00% | 2 | 100.00% |
static int mon_stat_release(struct inode *inode, struct file *file)
{
struct snap *sp = file->private_data;
file->private_data = NULL;
kfree(sp);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
lei ming | lei ming | 20 | 51.28% | 1 | 50.00% |
pete zaitcev | pete zaitcev | 19 | 48.72% | 1 | 50.00% |
| Total | 39 | 100.00% | 2 | 100.00% |
const struct file_operations mon_fops_stat = {
.owner = THIS_MODULE,
.open = mon_stat_open,
.llseek = no_llseek,
.read = mon_stat_read,
/* .write = mon_stat_write, */
/* .poll = mon_stat_poll, */
/* .unlocked_ioctl = mon_stat_ioctl, */
.release = mon_stat_release,
};
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
pete zaitcev | pete zaitcev | 211 | 82.75% | 2 | 20.00% |
lei ming | lei ming | 20 | 7.84% | 1 | 10.00% |
akinobu mita | akinobu mita | 11 | 4.31% | 1 | 10.00% |
greg kroah-hartman | greg kroah-hartman | 4 | 1.57% | 1 | 10.00% |
paul gortmaker | paul gortmaker | 3 | 1.18% | 1 | 10.00% |
tejun heo | tejun heo | 3 | 1.18% | 1 | 10.00% |
luiz fernando capitulino | luiz fernando capitulino | 1 | 0.39% | 1 | 10.00% |
theodore tso | theodore tso | 1 | 0.39% | 1 | 10.00% |
arnd bergmann | arnd bergmann | 1 | 0.39% | 1 | 10.00% |
| Total | 255 | 100.00% | 10 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.