aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_trace.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-01-16 19:39:40 -0500
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-29 17:21:44 -0400
commitcddade083e5ea74cba6f0e4b2fa10c6bbec1336c (patch)
tree83834a457cfd6b52d895629036f84a1aed36ea2f /litmus/sched_trace.c
parenta084c01569bcfe13fd880a0b1e3a9026629a89da (diff)
Add optional dynamic assignment of tracing devices major nr
Setting FT_TASK_TRACE_MAJOR, LOG_MAJOR, FT_TRACE_MAJOR to 0 allows to have them automatically assigned by the kernel
Diffstat (limited to 'litmus/sched_trace.c')
-rw-r--r--litmus/sched_trace.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/litmus/sched_trace.c b/litmus/sched_trace.c
index 4c1ea7eab635..87e725a35eb3 100644
--- a/litmus/sched_trace.c
+++ b/litmus/sched_trace.c
@@ -28,6 +28,8 @@
28/* 28/*
29 * Major number for the tracing char device. 29 * Major number for the tracing char device.
30 * the major numbes are from the unassigned/local use block 30 * the major numbes are from the unassigned/local use block
31 *
32 * set MAJOR to 0 to have it dynamically assigned
31 */ 33 */
32#define LOG_MAJOR 251 34#define LOG_MAJOR 251
33 35
@@ -328,14 +330,19 @@ static int __init register_buffer_dev(const char* name,
328 struct file_operations* fops, 330 struct file_operations* fops,
329 int major, int count) 331 int major, int count)
330{ 332{
331 dev_t trace_dev; 333 dev_t trace_dev;
332 struct cdev *cdev; 334 struct cdev *cdev;
333 int error = 0; 335 int error = 0;
334 336
335 trace_dev = MKDEV(major, 0); 337 if(major) {
336 error = register_chrdev_region(trace_dev, count, name); 338 trace_dev = MKDEV(major, 0);
337 if (error) 339 error = register_chrdev_region(trace_dev, count, name);
338 { 340 } else {
341 /* dynamically allocate major number */
342 error = alloc_chrdev_region(&trace_dev, 0, count, name);
343 major = MAJOR(trace_dev);
344 }
345 if (error) {
339 printk(KERN_WARNING "sched trace: " 346 printk(KERN_WARNING "sched trace: "
340 "Could not register major/minor number %d\n", major); 347 "Could not register major/minor number %d\n", major);
341 return error; 348 return error;