aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus/locking.h
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2011-01-28 12:24:58 -0500
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2011-02-01 16:30:37 -0500
commit2dea9d5e7727b8474981557cbf925687b8f33865 (patch)
tree96134311a3b67372e19a5f7eb232acb3d0be9b09 /include/litmus/locking.h
parentfd8ae31c74975c8499983c9831bff2b136b98434 (diff)
Litmus core: change plugin locking interface to generic 'allocate_lock()'
As the number of supported locking protocols is expected to rise, hard-coding things like priority inheritance in the plugin interface doesn't scale. Instead, use a new generic lock-ops approach. With this approach, each plugin can define its own protocol implementation (or use a generic one), and plugins can support multiple protocols without having to change the plugin interface for each protocol.
Diffstat (limited to 'include/litmus/locking.h')
-rw-r--r--include/litmus/locking.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/include/litmus/locking.h b/include/litmus/locking.h
new file mode 100644
index 00000000000..4d7b870cb44
--- /dev/null
+++ b/include/litmus/locking.h
@@ -0,0 +1,28 @@
1#ifndef LITMUS_LOCKING_H
2#define LITMUS_LOCKING_H
3
4struct litmus_lock_ops;
5
6/* Generic base struct for LITMUS^RT userspace semaphores.
7 * This structure should be embedded in protocol-specific semaphores.
8 */
9struct litmus_lock {
10 struct litmus_lock_ops *ops;
11 int type;
12};
13
14struct litmus_lock_ops {
15 /* Current task tries to obtain / drop a reference to a lock.
16 * Optional methods, allowed by default. */
17 int (*open)(struct litmus_lock*, void* __user);
18 int (*close)(struct litmus_lock*);
19
20 /* Current tries to lock/unlock this lock (mandatory methods). */
21 int (*lock)(struct litmus_lock*);
22 int (*unlock)(struct litmus_lock*);
23
24 /* The lock is no longer being referenced (mandatory method). */
25 void (*deallocate)(struct litmus_lock*);
26};
27
28#endif