diff options
| author | Christopher Kenna <cjk@cs.unc.edu> | 2011-01-09 19:33:49 -0500 |
|---|---|---|
| committer | Christopher Kenna <cjk@cs.unc.edu> | 2011-01-10 22:43:54 -0500 |
| commit | ecc285136ab25545fe22c2972169e5a191795dda (patch) | |
| tree | 3e5ea6174c7c3f091d4db63b32a938f3cece5c6a /include/litmus/ftdev.h | |
| parent | 7b3808d96ac3778a7516b1eb9a02d7c3f85ccac0 (diff) | |
Dynamic memory allocation and clean exit for FeatherTracewip-sun-port
This patch allocates memory for the minor devices dynamically and
provides clean module exit and error conditions for FeatherTrace.
Diffstat (limited to 'include/litmus/ftdev.h')
| -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 |
