[ovs-git] Open vSwitch: dpif-linux: Fix build with certain 64-bit kernel/userspace combinations. (master)

dev at openvswitch.org dev at openvswitch.org
Fri Oct 14 21:08:35 UTC 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, master has been updated
       via  320232ec7f37218a6fce0704f9b0ba7696e5ad21 (commit)
      from  4ca66bfaeb49e6fe85ccd8d8f4f11dbb96213636 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 320232ec7f37218a6fce0704f9b0ba7696e5ad21
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=320232ec7f37218a6fce0704f9b0ba7696e5ad21
Author: Ben Pfaff <blp at nicira.com>
		
dpif-linux: Fix build with certain 64-bit kernel/userspace combinations.
		
Unix 64-bit ABIs have two 64-bit types: "long" and "long long".  Either of
these is a reasonable choice for uint64_t (the userspace type) and for
__u64 (the kernel type).  Unfortunately, kernel and userspace don't
necessarily agree on the choice, and in fact the choice varies across
kernel versions and architectures.

Now that OVS is actually using kernel types in its kernel header, this
can make a difference: when __u64 and uint64_t differ, passing a pointer
to __u64 to OVS function get_unaligned_u64() yields a compiler warning
or error.

This commit fixes up the problems of this type found in OVS, by making
get_unaligned_u64() accept all 64-bit unsigned integer types, not just
whichever one happens to be uint64_t.  I didn't do the same thing for
put_unaligned_u64() because it is less likely to be a problem in
practice: usually, when userspace writes to kernel data structures it
does so with copies that it knows to be aligned, so that it's not
necessary to use put_unaligned_u64().

This problem won't occur for uint8_t, uint16_t, or uint32_t, since there is
only one reasonable choice of type for each.  It won't occur for ovs_be<N>
because OVS always defines those as aliases for the kernel's __be<N> types
when those are available.

This compiled cleanly for me in Scientific Linux 6.0 x86-64.

Reported-by: Pravin Shelar <pshelar at nicira.com>


-----------------------------------------------------------------------

Summary of changes:
 lib/unaligned.h |   41 +++++++++++++++++++++++++++++++++++++----
 lib/util.h      |    8 ++++++++
 2 files changed, 45 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
Open vSwitch



More information about the git mailing list