aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus
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 /include/litmus
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 'include/litmus')
-rw-r--r--include/litmus/ftdev.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/include/litmus/ftdev.h b/include/litmus/ftdev.h
index efb2a5c9a9b0..348387e9adf9 100644
--- a/include/litmus/ftdev.h
+++ b/include/litmus/ftdev.h
@@ -6,8 +6,6 @@
6#include <linux/mutex.h> 6#include <linux/mutex.h>
7#include <linux/cdev.h> 7#include <linux/cdev.h>
8 8
9#define MAX_FTDEV_MINORS NR_CPUS
10
11#define FTDEV_ENABLE_CMD 0 9#define FTDEV_ENABLE_CMD 0
12#define FTDEV_DISABLE_CMD 1 10#define FTDEV_DISABLE_CMD 1
13 11
@@ -32,11 +30,11 @@ struct ftdev_minor {
32}; 30};
33 31
34struct ftdev { 32struct ftdev {
33 dev_t major;
35 struct cdev cdev; 34 struct cdev cdev;
36 struct class* class; 35 struct class* class;
37 const char* name; 36 const char* name;
38 /* FIXME: don't waste memory, allocate dynamically */ 37 struct ftdev_minor* minor;
39 struct ftdev_minor minor[MAX_FTDEV_MINORS];
40 unsigned int minor_cnt; 38 unsigned int minor_cnt;
41 ftdev_alloc_t alloc; 39 ftdev_alloc_t alloc;
42 ftdev_free_t free; 40 ftdev_free_t free;
@@ -46,7 +44,9 @@ struct ftdev {
46struct ft_buffer* alloc_ft_buffer(unsigned int count, size_t size); 44struct ft_buffer* alloc_ft_buffer(unsigned int count, size_t size);
47void free_ft_buffer(struct ft_buffer* buf); 45void free_ft_buffer(struct ft_buffer* buf);
48 46
49void ftdev_init(struct ftdev* ftdev, struct module* owner, const char* name); 47int ftdev_init( struct ftdev* ftdev, struct module* owner,
48 const int minor_cnt, const char* name);
49void ftdev_exit(struct ftdev* ftdev);
50int register_ftdev(struct ftdev* ftdev); 50int register_ftdev(struct ftdev* ftdev);
51 51
52#endif 52#endif