[ovs-dev] [PATCH] lib: Fix compiler warnings on x86_64

Ethan Jackson ethan at nicira.com
Mon Dec 27 19:50:29 UTC 2010


On Mon, Dec 27, 2010 at 12:40 PM, Ben Pfaff <blp at nicira.com> wrote:
> This patch mixes together a lot of different stuff.  I'd prefer to see
> it broken apart.

Sure no problem.

>
> I don't understand what difference the change to lib/multipath.c would
> make.  What warning does it suppress, for example?

I was getting a warning:
 error: cast from function call of type 'uint16_t' to non-matching
type 'enum nx_mp_fields'

> I don't see why it
> would be x86-64 specific, are you sure that this isn't a GCC version
> issue?  (What GCC version are you using again?)
>

I'm using gcc 4.5.0

>
> Why did you change minLen and maxLen to unsigned long long int?  I don't
> understand what this would fix.  OVSDB is not going to survive someone
> creating a string longer than 4 GB--its performance would be
> unacceptably bad.

Yes this deserves some more explanation I think.  On my system I was
getting a lot of warnings because the database initializers were
incorrectly setting the string maxLen to 2^64 - 1 instead of 2^32 - 1.
 This is because python/ovs/db/types.py incorrectly assumes sys.maxint
is the maximum possible value for the length of a string.  Of course,
this is true on a 32 bit system but on a 64bit system this is untrue
and was causing warnings (which probably lead to bugs that I haven't
run into yet).  There are two possible solutions to this problem.
Change the string maximum length to unsigned long long so that
sys.maxint is correct.  Or change the python code to realize that the
maximum length of a string is 2^32 - 1.  I figured limiting the length
of a string to 32 bits was arbitrary so I increased it.  We can do it
the other way if you prefer.

Ethan




More information about the dev mailing list