diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-01-29 15:50:52 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-02-01 16:53:21 -0500 |
commit | 7f0bd4c213ff8dca0eb3bdd887f5c62c8d30fab5 (patch) | |
tree | 99b45b5466dc27308e6d65751baf5e109eb37385 /litmus/locking.c | |
parent | fab768a4cdc49ad7886cac0d0361f8432965a817 (diff) |
fdso: pass userpsace config argument to object constructor
As Glenn pointed out, it is useful for some protocols (e.g.,
k-exclusion protocols) to know the userspace configuration at object
creation time. This patch changes the fdso API to pass the parameter
to the object constructor, which is then in turn passed to the lock
allocater. The return code from the lock allocater is passed to
userspace in return.
This also fixes some null pointer dereferences in the FDSO code found
by the test suite in liblitmus.
Diffstat (limited to 'litmus/locking.c')
-rw-r--r-- | litmus/locking.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/litmus/locking.c b/litmus/locking.c index d39afaeefffe..8ee6a6b68009 100644 --- a/litmus/locking.c +++ b/litmus/locking.c | |||
@@ -5,7 +5,7 @@ | |||
5 | #include <litmus/sched_plugin.h> | 5 | #include <litmus/sched_plugin.h> |
6 | #include <litmus/trace.h> | 6 | #include <litmus/trace.h> |
7 | 7 | ||
8 | static void* create_generic_lock(obj_type_t type); | 8 | static int create_generic_lock(void** obj_ref, obj_type_t type, void* __user arg); |
9 | static int open_generic_lock(struct od_table_entry* entry, void* __user arg); | 9 | static int open_generic_lock(struct od_table_entry* entry, void* __user arg); |
10 | static int close_generic_lock(struct od_table_entry* entry); | 10 | static int close_generic_lock(struct od_table_entry* entry); |
11 | static void destroy_generic_lock(obj_type_t type, void* sem); | 11 | static void destroy_generic_lock(obj_type_t type, void* sem); |
@@ -28,16 +28,15 @@ static inline struct litmus_lock* get_lock(struct od_table_entry* entry) | |||
28 | return (struct litmus_lock*) entry->obj->obj; | 28 | return (struct litmus_lock*) entry->obj->obj; |
29 | } | 29 | } |
30 | 30 | ||
31 | static void* create_generic_lock(obj_type_t type) | 31 | static int create_generic_lock(void** obj_ref, obj_type_t type, void* __user arg) |
32 | { | 32 | { |
33 | struct litmus_lock* lock; | 33 | struct litmus_lock* lock; |
34 | int err; | 34 | int err; |
35 | 35 | ||
36 | err = litmus->allocate_lock(&lock, type); | 36 | err = litmus->allocate_lock(&lock, type, arg); |
37 | if (err == 0) | 37 | if (err == 0) |
38 | return lock; | 38 | *obj_ref = lock; |
39 | else | 39 | return err; |
40 | return NULL; | ||
41 | } | 40 | } |
42 | 41 | ||
43 | static int open_generic_lock(struct od_table_entry* entry, void* __user arg) | 42 | static int open_generic_lock(struct od_table_entry* entry, void* __user arg) |