提交 1ff1cc20 编写于 作者: P Pavel Emelyanov 提交者: David S. Miller

[IPV4] ROUTE: Convert rt_hash_lock_init() macro into function

There's no need in having this function exist in a form
of macro. Properly formatted function looks much better.
Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 107f1634
......@@ -235,16 +235,25 @@ struct rt_hash_bucket {
static spinlock_t *rt_hash_locks;
# define rt_hash_lock_addr(slot) &rt_hash_locks[(slot) & (RT_HASH_LOCK_SZ - 1)]
# define rt_hash_lock_init() { \
int i; \
rt_hash_locks = kmalloc(sizeof(spinlock_t) * RT_HASH_LOCK_SZ, GFP_KERNEL); \
if (!rt_hash_locks) panic("IP: failed to allocate rt_hash_locks\n"); \
for (i = 0; i < RT_HASH_LOCK_SZ; i++) \
spin_lock_init(&rt_hash_locks[i]); \
}
static __init void rt_hash_lock_init(void)
{
int i;
rt_hash_locks = kmalloc(sizeof(spinlock_t) * RT_HASH_LOCK_SZ,
GFP_KERNEL);
if (!rt_hash_locks)
panic("IP: failed to allocate rt_hash_locks\n");
for (i = 0; i < RT_HASH_LOCK_SZ; i++)
spin_lock_init(&rt_hash_locks[i]);
}
#else
# define rt_hash_lock_addr(slot) NULL
# define rt_hash_lock_init()
static inline void rt_hash_lock_init(void)
{
}
#endif
static struct rt_hash_bucket *rt_hash_table;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册