From: Mathieu Desnoyers Date: Fri, 24 Jun 2011 02:47:25 +0000 (-0400) Subject: Add raw spinlock wrapper for kernels < 2.6.33 X-Git-Tag: v2.0-pre1~38 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=a181050f402c41239e5537b89c66e0349af65d61;p=lttng-modules.git Add raw spinlock wrapper for kernels < 2.6.33 Signed-off-by: Mathieu Desnoyers --- diff --git a/lib/ringbuffer/frontend_types.h b/lib/ringbuffer/frontend_types.h index fe208b67..283a254f 100644 --- a/lib/ringbuffer/frontend_types.h +++ b/lib/ringbuffer/frontend_types.h @@ -19,6 +19,7 @@ #include #include "../../wrapper/ringbuffer/config.h" #include "../../wrapper/ringbuffer/backend_types.h" +#include "../../wrapper/spinlock.h" #include "../../lib/prio_heap/lttng_prio_heap.h" /* For per-CPU read-side iterator */ /* diff --git a/wrapper/spinlock.h b/wrapper/spinlock.h new file mode 100644 index 00000000..af00ef28 --- /dev/null +++ b/wrapper/spinlock.h @@ -0,0 +1,23 @@ +#ifndef _LTT_WRAPPER_SPINLOCK_H +#define _LTT_WRAPPER_SPINLOCK_H + +/* + * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers@efficios.com) + * + * Dual LGPL v2.1/GPL v2 license. + */ + +#include + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) + +#define raw_spin_lock_init(lock) \ + do { \ + *(lock) = __RAW_SPIN_LOCK_UNLOCKED(lock); \ + } while (0) + +#define raw_spin_is_locked(lock) spin_is_locked(lock) + + +#endif +#endif /* _LTT_WRAPPER_SPINLOCK_H */