aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2009-12-08 10:19:42 -0500
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2009-12-08 12:44:48 -0500
commitf369d531a5add5bd978a5c41fdb9fd607038e51b (patch)
treedb24a3c7345e9d45af4efddc04ea9c3372e6f7ed /include/litmus
parent940bd1a0dfe070e009060e2f304f1a337e6e29f0 (diff)
add Feather-Trace device file support
(KConfig still missing.)
Diffstat (limited to 'include/litmus')
-rw-r--r--include/litmus/ftdev.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/include/litmus/ftdev.h b/include/litmus/ftdev.h
new file mode 100644
index 000000000000..7697b4616699
--- /dev/null
+++ b/include/litmus/ftdev.h
@@ -0,0 +1,49 @@
1#ifndef _LITMUS_FTDEV_H_
2#define _LITMUS_FTDEV_H_
3
4#include <litmus/feather_trace.h>
5#include <litmus/feather_buffer.h>
6#include <linux/mutex.h>
7#include <linux/cdev.h>
8
9#define MAX_FTDEV_MINORS NR_CPUS
10
11#define FTDEV_ENABLE_CMD 0
12#define FTDEV_DISABLE_CMD 1
13
14struct ftdev;
15
16/* return 0 if buffer can be opened, otherwise -$REASON */
17typedef int (*ftdev_can_open_t)(struct ftdev* dev, unsigned int buf_no);
18/* return 0 on success, otherwise -$REASON */
19typedef int (*ftdev_alloc_t)(struct ftdev* dev, unsigned int buf_no);
20typedef void (*ftdev_free_t)(struct ftdev* dev, unsigned int buf_no);
21
22
23struct ftdev_event;
24
25struct ftdev_minor {
26 struct ft_buffer* buf;
27 unsigned int readers;
28 struct mutex lock;
29 /* FIXME: filter for authorized events */
30 struct ftdev_event* events;
31};
32
33struct ftdev {
34 struct cdev cdev;
35 /* FIXME: don't waste memory, allocate dynamically */
36 struct ftdev_minor minor[MAX_FTDEV_MINORS];
37 unsigned int minor_cnt;
38 ftdev_alloc_t alloc;
39 ftdev_free_t free;
40 ftdev_can_open_t can_open;
41};
42
43struct ft_buffer* alloc_ft_buffer(unsigned int count, size_t size);
44void free_ft_buffer(struct ft_buffer* buf);
45
46void ftdev_init(struct ftdev* ftdev, struct module* owner);
47int register_ftdev(struct ftdev* ftdev, const char* name, int major);
48
49#endif