lkml.org 
[lkml]   [2012]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC] [PATCH] v4l2: use unsigned rather than enums in ioctl() structs
Date
From
On Thu, 12 Apr 2012 11:55:12 -0300, Mauro Carvalho Chehab
<mchehab@redhat.com> wrote:
> I can see only two viable fixes for it:
>
> 1) add a typedef for the enum, using the sizeof(enum) in order to select
> the
> size of the used integer.
>
> Pros:
> - Patch is easy to write/easy to review;
> - Won't change the struct size, so applications compiled without
> strong gcc optimization won't break;
> Cons:
> - It will add a typedef, with is ugly;
> - struct size on 32 bits will be different thant he size on 64 bits
> (not really an issue, as v4l2-compat32 will handle that;

On which platforms do enums occupy 64-bits? Alpha? More to the point, on
which platform is enum not the same size as unsigned?

At least on x86-64, enum is 32-bits and so is unsigned.

> - v4l2-compat32 code may require changes.
>
> 2) just replace it by a 32 bits integer.
>
> Pros:
> - no typedefs;
> - struct size won't change between 32/64 bits (except when they also
> have pointers);
> Cons:
> - will break ABI. So, a compat code is required;
> - will require a "videodev2.h" fork for the legacy API with the enum's;
> - will require a compat code to convert from enum into integer and
> vice-versa.
>
> Comments/Votes?

--
Rémi Denis-Courmont
Sent from my collocated server
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-04-12 17:45    [W:0.157 / U:0.024 seconds]
©2003-2014 Jasper Spaans. Advertise on this site