[PATCH] fault injection: documentation and scripts
[linux-2.6/x86.git] / drivers / usb / mon / usb_mon.h
blobab9d02d5df77a448c0c829c42b5b3633fbdfc054
1 /*
2 * The USB Monitor, inspired by Dave Harding's USBMon.
4 * Copyright (C) 2005 Pete Zaitcev (zaitcev@redhat.com)
5 */
7 #ifndef __USB_MON_H
8 #define __USB_MON_H
10 #include <linux/list.h>
11 #include <linux/slab.h>
12 #include <linux/kref.h>
13 /* #include <linux/usb.h> */ /* We use struct pointers only in this header */
15 #define TAG "usbmon"
17 struct mon_bus {
18 struct list_head bus_link;
19 spinlock_t lock;
20 struct dentry *dent_s; /* Debugging file */
21 struct dentry *dent_t; /* Text interface file */
22 struct usb_bus *u_bus;
23 int uses_dma;
25 /* Ref */
26 int nreaders; /* Under mon_lock AND mbus->lock */
27 struct list_head r_list; /* Chain of readers (usually one) */
28 struct kref ref; /* Under mon_lock */
30 /* Stats */
31 unsigned int cnt_events;
32 unsigned int cnt_text_lost;
36 * An instance of a process which opened a file (but can fork later)
38 struct mon_reader {
39 struct list_head r_link;
40 struct mon_bus *m_bus;
41 void *r_data; /* Use container_of instead? */
43 void (*rnf_submit)(void *data, struct urb *urb);
44 void (*rnf_error)(void *data, struct urb *urb, int error);
45 void (*rnf_complete)(void *data, struct urb *urb);
48 void mon_reader_add(struct mon_bus *mbus, struct mon_reader *r);
49 void mon_reader_del(struct mon_bus *mbus, struct mon_reader *r);
53 extern char mon_dmapeek(unsigned char *dst, dma_addr_t dma_addr, int len);
55 extern struct mutex mon_lock;
57 extern const struct file_operations mon_fops_text;
58 extern const struct file_operations mon_fops_stat;
60 #endif /* __USB_MON_H */