diff --git a/include/mango/object.h b/include/mango/object.h index 855ddcf..cce6904 100644 --- a/include/mango/object.h +++ b/include/mango/object.h @@ -11,6 +11,28 @@ extern "C" { #endif +#define DEFINE_OBJECT_LOCK_FUNCTION(object_name, base) \ + static inline void object_name##_lock(struct object_name *p) \ + { \ + object_lock(&p->base); \ + } \ + static inline void object_name##_unlock(struct object_name *p) \ + { \ + object_unlock(&p->base); \ + } \ + static inline void object_name##_lock_irqsave( \ + struct object_name *p, \ + unsigned long *flags) \ + { \ + object_lock_irqsave(&p->base, flags); \ + } \ + static inline void object_name##_unlock_irqrestore( \ + struct object_name *p, \ + unsigned long flags) \ + { \ + object_unlock_irqrestore(&p->base, flags); \ + } + #define OBJECT_MAGIC 0xBADDCAFE #define OBJECT_NAME_MAX 64 #define OBJECT_PATH_MAX 256