[ovs-dev] [PATCH 1/4] datapath: Factor out code for getting and setting listen mask.

Ben Pfaff blp at nicira.com
Thu Oct 15 17:23:02 UTC 2009


Justin Pettit <jpettit at nicira.com> writes:

> On Oct 12, 2009, at 11:14 AM, Ben Pfaff wrote:
>
>> +static int get_listen_mask(const struct file *f)
>> +{
>> +	return (long)f->private_data;
>> +}
>
> The changes look reasonable to me.  I guess I'm surprised that you
> don't get a warning on this, since I thought an int was smaller than a
> long on 64-bit Linux systems and there would be the possibility for
> truncation (which I know won't happen here, since the protocol defines
> the listen_mask to be an int).  Is there a reason that you don't cast
> it into an int instead of a long?  Sorry, I don't have a 64-bit system
> handy to test this on.

I don't cast it to an int because that provokes a warning about
casting a pointer to a different size integer.  That's the whole
point of this commit: we were casting to int before, which caused
a warning.

Implicit conversion from long to int doesn't provoke a warning
with GCC as far as I know.




More information about the dev mailing list