From 30bb245b67c5be41a53203a5cc874e84985c528a Mon Sep 17 00:00:00 2001 From: Bryan Ward Date: Fri, 10 Aug 2012 23:05:11 -0400 Subject: 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. --- include/litmus/locking.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include') 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 @@ struct litmus_lock_ops; +extern struct fdso_ops generic_lock_ops; + /* Generic base struct for LITMUS^RT userspace semaphores. * This structure should be embedded in protocol-specific semaphores. */ @@ -34,4 +36,15 @@ struct litmus_lock_ops { void (*deallocate)(struct litmus_lock*); }; +static inline bool is_lock(struct od_table_entry* entry) +{ + return entry->class == &generic_lock_ops; +} + +static inline struct litmus_lock* get_lock(struct od_table_entry* entry) +{ + BUG_ON(!is_lock(entry)); + return (struct litmus_lock*) entry->obj->obj; +} + #endif -- cgit v1.2.2