Messages in this thread | | | Subject | Re: [RFC] [PATCH] v4l2: use unsigned rather than enums in ioctl() structs | Date | Thu, 12 Apr 2012 17:41:53 +0200 | From | Rémi Denis-Courmont <> |
| |
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/
| |