aboutsummaryrefslogtreecommitdiffstats
path: root/litmus
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-01-16 19:39:40 -0500
commite745cd9f0d056f1d00951c1eecdad2374b343d67 (patch)
tree31c12324c4f22248cdbf6fafe0e0ee60cfc0901a /litmus
parent0c2bf955125bdc449bd489f307d29bdc82f41328 (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')
-rw-r--r--litmus/ftdev.c11
-rw-r--r--litmus/sched_task_trace.c2
-rw-r--r--litmus/sched_trace.c17
-rw-r--r--litmus/trace.c1
4 files changed, 24 insertions, 7 deletions
diff --git a/litmus/ftdev.c b/litmus/ftdev.c
index 1c1c241a0a69..8b2d74d816a2 100644
--- a/litmus/ftdev.c
+++ b/litmus/ftdev.c
@@ -332,8 +332,15 @@ int register_ftdev(struct ftdev* ftdev, const char* name, int major)
332 dev_t trace_dev; 332 dev_t trace_dev;
333 int error = 0; 333 int error = 0;
334 334
335 trace_dev = MKDEV(major, 0); 335 if(major) {
336 error = register_chrdev_region(trace_dev, ftdev->minor_cnt, name); 336 trace_dev = MKDEV(major, 0);
337 error = register_chrdev_region(trace_dev, ftdev->minor_cnt,
338 name);
339 } else {
340 error = alloc_chrdev_region(&trace_dev, 0, ftdev->minor_cnt,
341 name);
342 major = MAJOR(trace_dev);
343 }
337 if (error) 344 if (error)
338 { 345 {
339 printk(KERN_WARNING "ftdev(%s): " 346 printk(KERN_WARNING "ftdev(%s): "
diff --git a/litmus/sched_task_trace.c b/litmus/sched_task_trace.c
index b7ea6d4e6e57..b59105110d7f 100644
--- a/litmus/sched_task_trace.c
+++ b/litmus/sched_task_trace.c
@@ -15,6 +15,8 @@
15#include <litmus/feather_trace.h> 15#include <litmus/feather_trace.h>
16#include <litmus/ftdev.h> 16#include <litmus/ftdev.h>
17 17
18
19/* set MAJOR to 0 to have it dynamically assigned */
18#define FT_TASK_TRACE_MAJOR 253 20#define FT_TASK_TRACE_MAJOR 253
19#define NO_EVENTS 4096 /* this is a buffer of 12 4k pages per CPU */ 21#define NO_EVENTS 4096 /* this is a buffer of 12 4k pages per CPU */
20 22
diff --git a/litmus/sched_trace.c b/litmus/sched_trace.c
index b2a71c4c6215..fcf6f44b0899 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;
diff --git a/litmus/trace.c b/litmus/trace.c
index 5735d28f5e30..440376998dc9 100644
--- a/litmus/trace.c
+++ b/litmus/trace.c
@@ -70,6 +70,7 @@ feather_callback void save_timestamp_cpu(unsigned long event,
70 */ 70 */
71#define NO_TIMESTAMPS (2 << 11) 71#define NO_TIMESTAMPS (2 << 11)
72 72
73/* set MAJOR to 0 to have it dynamically assigned */
73#define FT_TRACE_MAJOR 252 74#define FT_TRACE_MAJOR 252
74 75
75static int alloc_timestamp_buffer(struct ftdev* ftdev, unsigned int idx) 76static int alloc_timestamp_buffer(struct ftdev* ftdev, unsigned int idx)