aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus
diff options
context:
space:
mode:
authorBryan Ward <bcw@cs.unc.edu>2012-08-10 16:27:47 -0400
committerBryan Ward <bcw@cs.unc.edu>2013-04-16 14:34:35 -0400
commitba3f616d900d1a8caad96d0fb8c4f168c30a8afd (patch)
treee227efbddcc7582d3d164d177683aaedb6e8f39d /include/litmus
parentb2d92665e4dadc946f0c84b7eec7b6eae6be0d7f (diff)
Allow one litmus_lock to control multiple fdsos.
Each fdso in a resource group now points to a single litmus_lock object which will arbitrate access to each of the fdsos.
Diffstat (limited to 'include/litmus')
-rw-r--r--include/litmus/fdso.h2
-rw-r--r--include/litmus/locking.h27
-rw-r--r--include/litmus/unistd_32.h3
-rw-r--r--include/litmus/unistd_64.h4
4 files changed, 12 insertions, 24 deletions
diff --git a/include/litmus/fdso.h b/include/litmus/fdso.h
index 82f88221f4f0..85a649e2722d 100644
--- a/include/litmus/fdso.h
+++ b/include/litmus/fdso.h
@@ -73,7 +73,7 @@ static inline void* od_lookup(int od, obj_type_t type)
73 return e && e->obj->type == type ? e->obj->obj : NULL; 73 return e && e->obj->type == type ? e->obj->obj : NULL;
74} 74}
75 75
76#define lookup_fmlp_sem(od)((struct pi_semaphore*) od_lookup(od, FMLP_SEM)) 76#define lookup_fmlp_sem(od)((struct fmlp_semaphore*) od_lookup(od, FMLP_SEM))
77#define lookup_srp_sem(od) ((struct srp_semaphore*) od_lookup(od, SRP_SEM)) 77#define lookup_srp_sem(od) ((struct srp_semaphore*) od_lookup(od, SRP_SEM))
78#define lookup_ics(od) ((struct ics*) od_lookup(od, ICS_ID)) 78#define lookup_ics(od) ((struct ics*) od_lookup(od, ICS_ID))
79 79
diff --git a/include/litmus/locking.h b/include/litmus/locking.h
index e9998946e7de..203466933f3c 100644
--- a/include/litmus/locking.h
+++ b/include/litmus/locking.h
@@ -1,9 +1,9 @@
1#ifndef LITMUS_LOCKING_H 1#ifndef LITMUS_LOCKING_H
2#define LITMUS_LOCKING_H 2#define LITMUS_LOCKING_H
3 3
4struct litmus_lock_ops; 4#include <litmus/fdso.h>
5 5
6struct dynamic_group_lock_ops; 6struct litmus_lock_ops;
7 7
8/* Generic base struct for LITMUS^RT userspace semaphores. 8/* Generic base struct for LITMUS^RT userspace semaphores.
9 * This structure should be embedded in protocol-specific semaphores. 9 * This structure should be embedded in protocol-specific semaphores.
@@ -18,29 +18,20 @@ struct litmus_lock_ops {
18 * Optional methods, allowed by default. */ 18 * Optional methods, allowed by default. */
19 int (*open)(struct litmus_lock*, void* __user); 19 int (*open)(struct litmus_lock*, void* __user);
20 int (*close)(struct litmus_lock*); 20 int (*close)(struct litmus_lock*);
21
22 /* add or remove a resource from control by the dynamic group lock */
23 int (*add)(struct litmus_lock*, int);
24 int (*remove)(struct litmus_lock*, int);
21 25
22 /* Current tries to lock/unlock this lock (mandatory methods). */ 26 /* Current tries to lock/unlock this lock (mandatory methods). */
23 int (*lock)(struct litmus_lock*); 27 int (*lock)(struct litmus_lock*);
24 int (*unlock)(struct litmus_lock*); 28 int (*unlock)(struct litmus_lock*);
25 29
30 int (*dynamic_group_lock)(struct litmus_lock*, resource_mask_t);
31 int (*dynamic_group_unlock)(struct litmus_lock*, resource_mask_t);
32
26 /* The lock is no longer being referenced (mandatory method). */ 33 /* The lock is no longer being referenced (mandatory method). */
27 void (*deallocate)(struct litmus_lock*); 34 void (*deallocate)(struct litmus_lock*);
28}; 35};
29 36
30struct dynamic_group_lock {
31 struct dynamic_group_lock_ops *ops;
32
33 /* Probably useful for different RNLP variants. */
34 int type;
35};
36
37struct dynamic_group_lock_ops {
38 // Do we need open and close?
39
40 int (*lock)(struct dynamic_group_lock*);
41 int (*unlock)(struct dynamic_group_lock*);
42
43 void (*deallocate)(struct dynamic_group_lock*);
44};
45
46#endif 37#endif
diff --git a/include/litmus/unistd_32.h b/include/litmus/unistd_32.h
index 1c59c92547c5..04e453e89914 100644
--- a/include/litmus/unistd_32.h
+++ b/include/litmus/unistd_32.h
@@ -19,6 +19,5 @@
19#define __NR_null_call __LSC(11) 19#define __NR_null_call __LSC(11)
20#define __NR_dynamic_group_lock __LSC(12) 20#define __NR_dynamic_group_lock __LSC(12)
21#define __NR_dynamic_group_unlock __LSC(13) 21#define __NR_dynamic_group_unlock __LSC(13)
22#define __NR_dynamic_group_add __LSC(14)
23 22
24#define NR_litmus_syscalls 15 23#define NR_litmus_syscalls 14
diff --git a/include/litmus/unistd_64.h b/include/litmus/unistd_64.h
index 1ad4aa92ae5f..ae55b4884666 100644
--- a/include/litmus/unistd_64.h
+++ b/include/litmus/unistd_64.h
@@ -33,7 +33,5 @@ __SYSCALL(__NR_null_call, sys_null_call)
33__SYSCALL(__NR_dynamic_group_lock, sys_dynamic_group_lock) 33__SYSCALL(__NR_dynamic_group_lock, sys_dynamic_group_lock)
34#define __NR_dynamic_group_unlock __LSC(13) 34#define __NR_dynamic_group_unlock __LSC(13)
35__SYSCALL(__NR_dynamic_group_unlock, sys_dynamic_group_unlock) 35__SYSCALL(__NR_dynamic_group_unlock, sys_dynamic_group_unlock)
36#define __NR_dynamic_group_add __LSC(14)
37__SYSCALL(__NR_dynamic_group_add, sys_dynamic_group_add)
38 36
39#define NR_litmus_syscalls 15 37#define NR_litmus_syscalls 14