aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/mon/mon_text.c
diff options
context:
space:
mode:
authorPete Zaitcev <zaitcev@redhat.com>2005-08-15 19:53:57 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-08 19:28:36 -0400
commit0256839619d9b1e933cafc83e7f0deaad4216465 (patch)
treeafadd5815781a99e06ebb537d8ac677d307c09fe /drivers/usb/mon/mon_text.c
parentd0384200f6b608e77fb5ddf7dfae1bf0e42c1c6e (diff)
[PATCH] usbmon in 2.6.13: peeking into DMA areas
This code looks at urb->transfer_dma, maps the page and takes the data. I am looking for volunteers to contribute architectures other than i386 or to develop an architecure-neutral API for it (or point me that it was done already). Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/mon/mon_text.c')
-rw-r--r--drivers/usb/mon/mon_text.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c
index 26266b30028e..417464dea9f6 100644
--- a/drivers/usb/mon/mon_text.c
+++ b/drivers/usb/mon/mon_text.c
@@ -91,25 +91,11 @@ static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb,
91 int len, char ev_type) 91 int len, char ev_type)
92{ 92{
93 int pipe = urb->pipe; 93 int pipe = urb->pipe;
94 unsigned char *data;
95
96 /*
97 * The check to see if it's safe to poke at data has an enormous
98 * number of corner cases, but it seems that the following is
99 * more or less safe.
100 *
101 * We do not even try to look transfer_buffer, because it can
102 * contain non-NULL garbage in case the upper level promised to
103 * set DMA for the HCD.
104 */
105 if (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)
106 return 'D';
107 94
108 if (len <= 0) 95 if (len <= 0)
109 return 'L'; 96 return 'L';
110 97 if (len >= DATA_MAX)
111 if ((data = urb->transfer_buffer) == NULL) 98 len = DATA_MAX;
112 return 'Z'; /* '0' would be not as pretty. */
113 99
114 /* 100 /*
115 * Bulk is easy to shortcut reliably. 101 * Bulk is easy to shortcut reliably.
@@ -126,8 +112,21 @@ static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb,
126 } 112 }
127 } 113 }
128 114
129 if (len >= DATA_MAX) 115 /*
130 len = DATA_MAX; 116 * The check to see if it's safe to poke at data has an enormous
117 * number of corner cases, but it seems that the following is
118 * more or less safe.
119 *
120 * We do not even try to look transfer_buffer, because it can
121 * contain non-NULL garbage in case the upper level promised to
122 * set DMA for the HCD.
123 */
124 if (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)
125 return mon_dmapeek(ep->data, urb->transfer_dma, len);
126
127 if (urb->transfer_buffer == NULL)
128 return 'Z'; /* '0' would be not as pretty. */
129
131 memcpy(ep->data, urb->transfer_buffer, len); 130 memcpy(ep->data, urb->transfer_buffer, len);
132 return 0; 131 return 0;
133} 132}