diff options
author | Bryan Ward <bcw@cs.unc.edu> | 2012-08-10 23:05:11 -0400 |
---|---|---|
committer | Bryan Ward <bcw@cs.unc.edu> | 2013-04-16 14:34:35 -0400 |
commit | 30bb245b67c5be41a53203a5cc874e84985c528a (patch) | |
tree | 44731df2feb1a5a2b45e194ec0a3291e2a03f099 /include | |
parent | ba3f616d900d1a8caad96d0fb8c4f168c30a8afd (diff) |
Check for valid fdsos in a dgl request.
Apply bitwise operations to quickly check if the set of resources
requested are contained within one group.
Diffstat (limited to 'include')
-rw-r--r-- | include/litmus/locking.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/litmus/locking.h b/include/litmus/locking.h index 203466933f3c..8e501c326b8b 100644 --- a/include/litmus/locking.h +++ b/include/litmus/locking.h | |||
@@ -5,6 +5,8 @@ | |||
5 | 5 | ||
6 | struct litmus_lock_ops; | 6 | struct litmus_lock_ops; |
7 | 7 | ||
8 | extern struct fdso_ops generic_lock_ops; | ||
9 | |||
8 | /* Generic base struct for LITMUS^RT userspace semaphores. | 10 | /* Generic base struct for LITMUS^RT userspace semaphores. |
9 | * This structure should be embedded in protocol-specific semaphores. | 11 | * This structure should be embedded in protocol-specific semaphores. |
10 | */ | 12 | */ |
@@ -34,4 +36,15 @@ struct litmus_lock_ops { | |||
34 | void (*deallocate)(struct litmus_lock*); | 36 | void (*deallocate)(struct litmus_lock*); |
35 | }; | 37 | }; |
36 | 38 | ||
39 | static inline bool is_lock(struct od_table_entry* entry) | ||
40 | { | ||
41 | return entry->class == &generic_lock_ops; | ||
42 | } | ||
43 | |||
44 | static inline struct litmus_lock* get_lock(struct od_table_entry* entry) | ||
45 | { | ||
46 | BUG_ON(!is_lock(entry)); | ||
47 | return (struct litmus_lock*) entry->obj->obj; | ||
48 | } | ||
49 | |||
37 | #endif | 50 | #endif |