mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rémi Denis-Courmont" <remi@remlab.net>
To: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: James Courtier-Dutton <james.dutton@gmail.com>,
	<mchehab@infradead.org>, <linux-media@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [RFC] [PATCH] v4l2: use unsigned rather than enums in ioctl() structs
Date: Thu, 12 Apr 2012 17:41:53 +0200	[thread overview]
Message-ID: <0c4d0f509a99540d87224c05fd27d322@chewa.net> (raw)
In-Reply-To: <4F86ECD0.6060708@redhat.com>

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

  reply	other threads:[~2012-04-12 15:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-05 17:52 Rémi Denis-Courmont
2012-04-11 17:02 ` Mauro Carvalho Chehab
2012-04-11 18:47   ` Rémi Denis-Courmont
2012-04-11 19:53     ` Mauro Carvalho Chehab
2012-04-11 20:32       ` Rémi Denis-Courmont
2012-04-12 17:22         ` Nick Bowler
2012-04-11 20:08     ` Mauro Carvalho Chehab
2012-04-12  8:04     ` James Courtier-Dutton
2012-04-12 14:55       ` Mauro Carvalho Chehab
2012-04-12 15:41         ` Rémi Denis-Courmont [this message]
2012-04-17 17:50           ` Mauro Carvalho Chehab
2012-04-27  8:24             ` [RFC 1/1] v4l: Implement compat handlers for ioctls containing enums Sakari Ailus
2012-04-13  8:25         ` [RFC] [PATCH] v4l2: use unsigned rather than enums in ioctl() structs James Courtier-Dutton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0c4d0f509a99540d87224c05fd27d322@chewa.net \
    --to=remi@remlab.net \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=james.dutton@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=mchehab@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®