0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __USB_MON_H
0009 #define __USB_MON_H
0010
0011 #include <linux/list.h>
0012 #include <linux/slab.h>
0013 #include <linux/kref.h>
0014
0015
0016 #define TAG "usbmon"
0017
0018 struct mon_bus {
0019 struct list_head bus_link;
0020 spinlock_t lock;
0021 struct usb_bus *u_bus;
0022
0023 int text_inited;
0024 int bin_inited;
0025 struct dentry *dent_s;
0026 struct dentry *dent_t;
0027 struct dentry *dent_u;
0028 struct device *classdev;
0029
0030
0031 int nreaders;
0032 struct list_head r_list;
0033 struct kref ref;
0034
0035
0036 unsigned int cnt_events;
0037 unsigned int cnt_text_lost;
0038 };
0039
0040
0041
0042
0043 struct mon_reader {
0044 struct list_head r_link;
0045 struct mon_bus *m_bus;
0046 void *r_data;
0047
0048 void (*rnf_submit)(void *data, struct urb *urb);
0049 void (*rnf_error)(void *data, struct urb *urb, int error);
0050 void (*rnf_complete)(void *data, struct urb *urb, int status);
0051 };
0052
0053 void mon_reader_add(struct mon_bus *mbus, struct mon_reader *r);
0054 void mon_reader_del(struct mon_bus *mbus, struct mon_reader *r);
0055
0056 struct mon_bus *mon_bus_lookup(unsigned int num);
0057
0058 int mon_text_add(struct mon_bus *mbus, const struct usb_bus *ubus);
0059 void mon_text_del(struct mon_bus *mbus);
0060 int mon_bin_add(struct mon_bus *mbus, const struct usb_bus *ubus);
0061 void mon_bin_del(struct mon_bus *mbus);
0062
0063 int __init mon_text_init(void);
0064 void mon_text_exit(void);
0065 int __init mon_bin_init(void);
0066 void mon_bin_exit(void);
0067
0068
0069
0070 extern struct mutex mon_lock;
0071
0072 extern const struct file_operations mon_fops_stat;
0073
0074 extern struct mon_bus mon_bus0;
0075
0076 #endif