2 * Copyright (c) 2016 Mellanox Technologies, Ltd.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice unmodified, this list of conditions, and the following
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #ifndef _LINUX_RCUPDATE_H_
29 #define _LINUX_RCUPDATE_H_
31 #include <sys/param.h>
35 extern struct sx linux_global_rcu_lock;
40 typedef void (*rcu_callback_t)(struct rcu_head *);
43 call_rcu(struct rcu_head *ptr, rcu_callback_t func)
45 sx_xlock(&linux_global_rcu_lock);
47 sx_xunlock(&linux_global_rcu_lock);
53 sx_slock(&linux_global_rcu_lock);
59 sx_sunlock(&linux_global_rcu_lock);
65 sx_xlock(&linux_global_rcu_lock);
66 sx_xunlock(&linux_global_rcu_lock);
72 sx_xlock(&linux_global_rcu_lock);
73 sx_xunlock(&linux_global_rcu_lock);
76 #define hlist_add_head_rcu(n, h) \
78 sx_xlock(&linux_global_rcu_lock); \
79 hlist_add_head(n, h); \
80 sx_xunlock(&linux_global_rcu_lock); \
83 #define hlist_del_init_rcu(n) \
85 sx_xlock(&linux_global_rcu_lock); \
87 sx_xunlock(&linux_global_rcu_lock); \
90 #define hlist_del_rcu(n) \
92 sx_xlock(&linux_global_rcu_lock); \
94 sx_xunlock(&linux_global_rcu_lock); \
97 #endif /* _LINUX_RCUPDATE_H_ */