~james-page/ubuntu/saucy/openvswitch/1.12-snapshot

« back to all changes in this revision

Viewing changes to datapath/linux/compat/include/net/net_namespace.h

  • Committer: James Page
  • Date: 2013-08-21 10:16:57 UTC
  • mfrom: (1.1.20)
  • Revision ID: james.page@canonical.com-20130821101657-3o0z0qeiv5zkwlzi
New upstream snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
#endif /* 2.6.29 */
65
65
 
66
66
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
67
 
#define pernet_operations rpl_pernet_operations
68
 
struct pernet_operations {
 
67
struct rpl_pernet_operations {
69
68
        int (*init)(struct net *net);
70
69
        void (*exit)(struct net *net);
71
70
        int *id;
72
71
        size_t size;
 
72
        struct pernet_operations ops;
73
73
};
74
 
 
 
74
#define pernet_operations rpl_pernet_operations
 
75
 
 
76
#define register_pernet_device rpl_register_pernet_gen_device
 
77
#define unregister_pernet_device rpl_unregister_pernet_gen_device
 
78
 
 
79
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
75
80
extern int rpl_register_pernet_gen_device(struct rpl_pernet_operations *ops);
76
81
extern void rpl_unregister_pernet_gen_device(struct rpl_pernet_operations *ops);
77
82
 
78
 
#define register_pernet_device rpl_register_pernet_gen_device
79
 
#define unregister_pernet_device rpl_unregister_pernet_gen_device
80
 
 
 
83
#else /* for 2.6.32* */
 
84
 
 
85
int __net_init compat_init_net(struct net *net, struct rpl_pernet_operations *pnet);
 
86
void __net_exit compat_exit_net(struct net *net, struct rpl_pernet_operations *pnet);
 
87
 
 
88
#define DEFINE_COMPAT_PNET_REG_FUNC(TYPE)                                       \
 
89
                                                                        \
 
90
static struct rpl_pernet_operations *pnet_gen_##TYPE;                   \
 
91
static int __net_init compat_init_net_gen_##TYPE(struct net *net)       \
 
92
{                                                                       \
 
93
        return compat_init_net(net, pnet_gen_##TYPE);                   \
 
94
}                                                                       \
 
95
                                                                        \
 
96
static void __net_exit compat_exit_net_gen_##TYPE(struct net *net)      \
 
97
{                                                                       \
 
98
        compat_exit_net(net, pnet_gen_##TYPE);                          \
 
99
}                                                                       \
 
100
                                                                        \
 
101
static int __net_init rpl_register_pernet_gen_##TYPE(struct rpl_pernet_operations *rpl_pnet)    \
 
102
{                                                                               \
 
103
        pnet_gen_##TYPE = rpl_pnet;                                             \
 
104
        rpl_pnet->ops.init = compat_init_net_gen_##TYPE;                        \
 
105
        rpl_pnet->ops.exit = compat_exit_net_gen_##TYPE;                        \
 
106
        return register_pernet_gen_##TYPE(pnet_gen_##TYPE->id, &rpl_pnet->ops); \
 
107
}                                                                                       \
 
108
                                                                                        \
 
109
static void __net_exit rpl_unregister_pernet_gen_##TYPE(struct rpl_pernet_operations *rpl_pnet)         \
 
110
{                                                                                       \
 
111
        unregister_pernet_gen_##TYPE(*pnet_gen_##TYPE->id, &rpl_pnet->ops);             \
 
112
}
 
113
#endif
 
114
#endif /* 2.6.33 */
 
115
 
 
116
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32) || \
 
117
    LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
 
118
#define DEFINE_COMPAT_PNET_REG_FUNC(TYPE)
81
119
#endif /* 2.6.33 */
82
120
 
83
121
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)