mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-20 06:06:23 +00:00
scst/include/backport.h: Add kfree_rcu() definition for kernels < 3.0
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6730 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -365,6 +365,21 @@ static inline __attribute__ ((format (printf, 1, 2)))
|
||||
int no_printk(const char *s, ...) { return 0; }
|
||||
#endif
|
||||
|
||||
/* <linux/rcupdate.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
|
||||
typedef void (*rcu_callback_t)(struct rcu_head *);
|
||||
#define __is_kfree_rcu_offset(offset) ((offset) < 4096)
|
||||
#define kfree_call_rcu(head, rcb) call_rcu(head, rcb)
|
||||
#define __kfree_rcu(head, offset) \
|
||||
do { \
|
||||
BUILD_BUG_ON(!__is_kfree_rcu_offset(offset)); \
|
||||
kfree_call_rcu(head, (rcu_callback_t)(unsigned long)(offset)); \
|
||||
} while (0)
|
||||
#define kfree_rcu(ptr, rcu_head) \
|
||||
__kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
|
||||
#endif
|
||||
|
||||
/* <linux/sched.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) && \
|
||||
|
||||
Reference in New Issue
Block a user