source: ksyslog/trunk/compat.h @ 271

Revision 271, 912 bytes checked in by atzm, 11 years ago (diff)

improve performance on multi-queue environment

Line 
1/*
2 * ksyslog: In-kernel syslog receiver
3 * Copyright(C) 2013 Atzm WATANABE All rights reserved
4 * Distributed under the GPL
5 */
6
7#ifndef KSYSLOG_COMPAT_H
8#define KSYSLOG_COMPAT_H
9
10#ifndef list_first_or_null_rcu
11#define list_first_or_null_rcu(ptr, type, member) \
12({ \
13        struct list_head *__ptr = (ptr); \
14        struct list_head *__next = ACCESS_ONCE(__ptr->next); \
15        likely(__ptr != __next) ? list_entry_rcu(__next, type, member) : NULL; \
16 })
17#endif
18
19static inline void
20compat_fsnotify_open(struct file *file)
21{
22#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
23        fsnotify_open(file->f_path.dentry);
24#else
25        fsnotify_open(file);
26#endif
27}
28
29#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)
30static inline void
31udp_encap_enable(void)
32{
33}
34#endif
35
36#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
37#ifdef CONFIG_PROC_FS
38static inline void *
39PDE_DATA(const struct inode *inode)
40{
41        return PDE(inode)->data;
42}
43#endif
44#endif
45
46#endif
Note: See TracBrowser for help on using the repository browser.