diff options
author | Christopher Kenna <cjk@cs.unc.edu> | 2011-01-09 19:33:49 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-01-12 19:29:48 -0500 |
commit | d11808b5c6b032de4284281ed2ff77ae697a4ebd (patch) | |
tree | 0d135d237e96c3179b2983892b95bb9969a0166c /include/litmus | |
parent | 37eb46be881dde4b405d3d8b48e76b4a8d62ae2c (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.h | 10 |
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 | ||
34 | struct ftdev { | 32 | struct 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 { | |||
46 | struct ft_buffer* alloc_ft_buffer(unsigned int count, size_t size); | 44 | struct ft_buffer* alloc_ft_buffer(unsigned int count, size_t size); |
47 | void free_ft_buffer(struct ft_buffer* buf); | 45 | void free_ft_buffer(struct ft_buffer* buf); |
48 | 46 | ||
49 | void ftdev_init(struct ftdev* ftdev, struct module* owner, const char* name); | 47 | int ftdev_init( struct ftdev* ftdev, struct module* owner, |
48 | const int minor_cnt, const char* name); | ||
49 | void ftdev_exit(struct ftdev* ftdev); | ||
50 | int register_ftdev(struct ftdev* ftdev); | 50 | int register_ftdev(struct ftdev* ftdev); |
51 | 51 | ||
52 | #endif | 52 | #endif |