summaryrefslogtreecommitdiff
path: root/build-aux/extract-odp-netlink-h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2014-06-13 15:28:29 -0700
committerBen Pfaff <blp@nicira.com>2014-08-04 11:11:44 -0700
commit6a54dedc66931ef01c3cabb6d6fd481461c99687 (patch)
treed4e3bb094193c88a639fae7302ac460c9389062c /build-aux/extract-odp-netlink-h
parent837eefc76b3c79bb790a4c4c2d0a314d81b71a28 (diff)
downloadopenvswitch-6a54dedc66931ef01c3cabb6d6fd481461c99687.tar.gz
odp-netlink.h: Use 32-bit aligned 64-bit types.
Open vSwitch userspace uses special types to indicate that a particular object may not be naturally aligned. Netlink is one source of such problems: in Netlink, 64-bit integers are often aligned only on 32-bit boundaries. This commit changes the odp-netlink.h that is transformed from <linux/openvswitch.h> to use these types to make it harder to accidentally access a misaligned 64-bit member. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'build-aux/extract-odp-netlink-h')
-rwxr-xr-xbuild-aux/extract-odp-netlink-h12
1 files changed, 8 insertions, 4 deletions
diff --git a/build-aux/extract-odp-netlink-h b/build-aux/extract-odp-netlink-h
index c61a1b73a..068fde43b 100755
--- a/build-aux/extract-odp-netlink-h
+++ b/build-aux/extract-odp-netlink-h
@@ -14,18 +14,22 @@
# Avoid using reserved names in header guards.
s/_LINUX_OPENVSWITCH_H/ODP_NETLINK_H/
-# Transform Linux-specific __u<N> types into C99 uint<N>_t types,
-# and Linux-specific __be<N> into Open vSwitch ovs_be<N>,
+# 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,<linux/types\.h>,"openvswitch/types.h",
-s/__u64/uint64_t/g
s/__u32/uint32_t/g
s/__u16/uint16_t/g
s/__u8/uint8_t/g
-s/__be64/ovs_be64/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
+
# Use OVS's own ETH_ADDR_LEN instead of Linux-specific ETH_ALEN.
s,<linux/if_ether\.h>,"packets.h",
s/ETH_ALEN/ETH_ADDR_LEN/