aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/trace.c
diff options
context:
space:
mode:
authorChristopher Kenna <cjk@cs.unc.edu>2011-01-09 19:33:49 -0500
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2011-01-12 19:29:48 -0500
commitd11808b5c6b032de4284281ed2ff77ae697a4ebd (patch)
tree0d135d237e96c3179b2983892b95bb9969a0166c /litmus/trace.c
parent37eb46be881dde4b405d3d8b48e76b4a8d62ae2c (diff)
Feather-Trace: dynamic memory allocation and clean exit2011.1
This patch changes Feather-Trace to allocate memory for the minor devices dynamically, which addresses a long-standing FIXME. It also provides clean module exit and error conditions for Feather-Trace.
Diffstat (limited to 'litmus/trace.c')
-rw-r--r--litmus/trace.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/litmus/trace.c b/litmus/trace.c
index da650dfe7f4d..e7ea1c2ab3e4 100644
--- a/litmus/trace.c
+++ b/litmus/trace.c
@@ -90,12 +90,33 @@ static void free_timestamp_buffer(struct ftdev* ftdev, unsigned int idx)
90 90
91static int __init init_ft_overhead_trace(void) 91static int __init init_ft_overhead_trace(void)
92{ 92{
93 int err;
94
93 printk("Initializing Feather-Trace overhead tracing device.\n"); 95 printk("Initializing Feather-Trace overhead tracing device.\n");
94 ftdev_init(&overhead_dev, THIS_MODULE, "ft_trace"); 96 err = ftdev_init(&overhead_dev, THIS_MODULE, 1, "ft_trace");
95 overhead_dev.minor_cnt = 1; /* only one buffer */ 97 if (err)
98 goto err_out;
99
96 overhead_dev.alloc = alloc_timestamp_buffer; 100 overhead_dev.alloc = alloc_timestamp_buffer;
97 overhead_dev.free = free_timestamp_buffer; 101 overhead_dev.free = free_timestamp_buffer;
98 return register_ftdev(&overhead_dev); 102
103 err = register_ftdev(&overhead_dev);
104 if (err)
105 goto err_dealloc;
106
107 return 0;
108
109err_dealloc:
110 ftdev_exit(&overhead_dev);
111err_out:
112 printk(KERN_WARNING "Could not register ft_trace module.\n");
113 return err;
114}
115
116static void __exit exit_ft_overhead_trace(void)
117{
118 ftdev_exit(&overhead_dev);
99} 119}
100 120
101module_init(init_ft_overhead_trace); 121module_init(init_ft_overhead_trace);
122module_exit(exit_ft_overhead_trace);