diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-05-22 11:02:58 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-05-22 11:02:58 -0400 |
commit | 05684bf81966b173b9387a06a72a36c8a047eba5 (patch) | |
tree | 52d671a49488eeda72701d9eed925caf70043881 | |
parent | 4ab1f834b1d0fd79fc029c4073b42d7aa6ed8260 (diff) |
Feather-Trace: use fixed size fields
-rw-r--r-- | include/litmus/trace.h | 8 | ||||
-rw-r--r-- | litmus/trace.c | 28 |
2 files changed, 19 insertions, 17 deletions
diff --git a/include/litmus/trace.h b/include/litmus/trace.h index c340d4408d..ad7a782a97 100644 --- a/include/litmus/trace.h +++ b/include/litmus/trace.h | |||
@@ -10,10 +10,10 @@ | |||
10 | /*********************** TIMESTAMPS ************************/ | 10 | /*********************** TIMESTAMPS ************************/ |
11 | 11 | ||
12 | struct timestamp { | 12 | struct timestamp { |
13 | unsigned long event; | 13 | uint64_t timestamp; |
14 | unsigned long long timestamp; | 14 | uint32_t seq_no; |
15 | unsigned int seq_no; | 15 | uint16_t cpu; |
16 | int cpu; | 16 | uint16_t event; |
17 | }; | 17 | }; |
18 | 18 | ||
19 | 19 | ||
diff --git a/litmus/trace.c b/litmus/trace.c index 1686134ce0..0c1916f507 100644 --- a/litmus/trace.c +++ b/litmus/trace.c | |||
@@ -173,22 +173,24 @@ out: | |||
173 | #define ENABLE_CMD 0 | 173 | #define ENABLE_CMD 0 |
174 | #define DISABLE_CMD 1 | 174 | #define DISABLE_CMD 1 |
175 | 175 | ||
176 | typedef uint32_t cmd_t; | ||
177 | |||
176 | static ssize_t trace_write(struct file *filp, const char __user *from, | 178 | static ssize_t trace_write(struct file *filp, const char __user *from, |
177 | size_t len, loff_t *f_pos) | 179 | size_t len, loff_t *f_pos) |
178 | { | 180 | { |
179 | ssize_t error = -EINVAL; | 181 | ssize_t error = -EINVAL; |
180 | unsigned long cmd; | 182 | cmd_t cmd; |
181 | unsigned long id; | 183 | cmd_t id; |
182 | 184 | ||
183 | if (len % sizeof(long) || len < 2 * sizeof(long)) | 185 | if (len % sizeof(cmd_t) || len < 2 * sizeof(cmd_t)) |
184 | goto out; | 186 | goto out; |
185 | 187 | ||
186 | if (copy_from_user(&cmd, from, sizeof(long))) { | 188 | if (copy_from_user(&cmd, from, sizeof(cmd_t))) { |
187 | error = -EFAULT; | 189 | error = -EFAULT; |
188 | goto out; | 190 | goto out; |
189 | } | 191 | } |
190 | len -= sizeof(long); | 192 | len -= sizeof(cmd_t); |
191 | from += sizeof(long); | 193 | from += sizeof(cmd_t); |
192 | 194 | ||
193 | if (cmd != ENABLE_CMD && cmd != DISABLE_CMD) | 195 | if (cmd != ENABLE_CMD && cmd != DISABLE_CMD) |
194 | goto out; | 196 | goto out; |
@@ -198,26 +200,26 @@ static ssize_t trace_write(struct file *filp, const char __user *from, | |||
198 | goto out; | 200 | goto out; |
199 | } | 201 | } |
200 | 202 | ||
201 | error = sizeof(long); | 203 | error = sizeof(cmd_t); |
202 | while (len) { | 204 | while (len) { |
203 | if (copy_from_user(&id, from, sizeof(long))) { | 205 | if (copy_from_user(&id, from, sizeof(cmd_t))) { |
204 | error = -EFAULT; | 206 | error = -EFAULT; |
205 | goto out; | 207 | goto out; |
206 | } | 208 | } |
207 | len -= sizeof(long); | 209 | len -= sizeof(cmd_t); |
208 | from += sizeof(long); | 210 | from += sizeof(cmd_t); |
209 | if (cmd) { | 211 | if (cmd) { |
210 | printk(KERN_INFO | 212 | printk(KERN_INFO |
211 | "Disabling feather-trace event %lu.\n", id); | 213 | "Disabling feather-trace event %d.\n", (int) id); |
212 | ft_disable_event(id); | 214 | ft_disable_event(id); |
213 | enabled_events--; | 215 | enabled_events--; |
214 | } else { | 216 | } else { |
215 | printk(KERN_INFO | 217 | printk(KERN_INFO |
216 | "Enabling feather-trace event %lu.\n", id); | 218 | "Enabling feather-trace event %d.\n", (int) id); |
217 | ft_enable_event(id); | 219 | ft_enable_event(id); |
218 | enabled_events++; | 220 | enabled_events++; |
219 | } | 221 | } |
220 | error += sizeof(long); | 222 | error += sizeof(cmd_t); |
221 | } | 223 | } |
222 | 224 | ||
223 | up(&feather_lock); | 225 | up(&feather_lock); |