summaryrefslogtreecommitdiff
path: root/build-aux/extract-odp-netlink-h
blob: 907a70af0c3526943464ad260c0aca1a6977e6ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# This is a "sed" script that transforms <linux/openvswitch.h> into a
# form that is suitable for inclusion within the Open vSwitch tree on
# both Linux and non-Linux systems.

# Add a header warning that this is a generated file.  It might save somebody
# some frustration (maybe even me!).
1i\
/* -*- mode: c; buffer-read-only: t -*- */\
/* Generated automatically from <linux/openvswitch.h> -- do not modify! */\
\
\


# Avoid using reserved names in header guards.
s/_LINUX_OPENVSWITCH_H/ODP_NETLINK_H/

# Include platform extensions header file on Win32.
$i\
#ifdef _WIN32\
#include "OvsDpInterfaceExt.h"\
#include "OvsDpInterfaceCtExt.h"\
#endif\

# Use OVS's own struct eth_addr instead of a 6-byte char array.
s,<linux/types\.h>,"openvswitch/types.h"\
#include <netinet/in.h>,
s,#.*<linux/if_ether\.h>,,
s/__u8[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*\[[[:space:]]*ETH_ALEN[[:space:]]*\]/struct eth_addr \1/

# Transform IPv6 addresses from an array to struct in6_addr
s/__be32[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*\[[[:space:]]*4[[:space:]]*\]/struct in6_addr \1/

# Transform most Linux-specific __u<N> types into C99 uint<N>_t types,
# and most Linux-specific __be<N> into Open vSwitch ovs_be<N>,
# and use the appropriate userspace header.
s/__u32/uint32_t/g
s/__u16/uint16_t/g
s/__u8/uint8_t/g
s/__be32/ovs_be32/g
s/__be16/ovs_be16/g

# Transform 64-bit Linux-specific types into Open vSwitch specialized
# types for 64-bit numbers that might only be aligned on a 32-bit
# boundary.
s/__u64/ovs_32aligned_u64/g
s/__be64/ovs_32aligned_be64/g