From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Sakari Ailus <sakari.ailus@iki.fi>,
linux-media@vger.kernel.org, remi@remlab.net,
nbowler@elliptictech.com, james.dutton@gmail.com,
Mike Isely <isely@pobox.com>
Subject: Re: [RFC v3 2/2] v4l: Implement compat functions for enum to __u32 change
Date: Thu, 03 May 2012 09:20:44 -0300 [thread overview]
Message-ID: <4FA2781C.7000301@redhat.com> (raw)
In-Reply-To: <5025043.7iaR9beiqz@avalon>
Em 02-05-2012 20:38, Laurent Pinchart escreveu:
> Hi Mauro,
>
> On Wednesday 02 May 2012 19:32:23 Mauro Carvalho Chehab wrote:
>> Em 02-05-2012 16:13, Sakari Ailus escreveu:
>>> Implement compat functions to provide conversion between structs
>>> containing enums and those not. The functions are intended to be removed
>>> when the support for such old binaries is no longer necessary.
>>
>> This is not a full review of this patch, as checking the full logic
>> will consume some time.
>>
>> This is just a few points to consider.
>
> [snip]
>
>>> -video_usercopy(struct file *file, unsigned int cmd, unsigned long arg,
>>> +video_usercopy(struct file *file, unsigned int compat_cmd, unsigned long
>>> arg,>
>>> v4l2_kioctl func)
>>>
>>> {
>>>
>>> char sbuf[128];
>>>
>>> @@ -2401,6 +3048,7 @@ video_usercopy(struct file *file, unsigned int cmd,
>>> unsigned long arg,>
>>> size_t array_size = 0;
>>> void __user *user_ptr = NULL;
>>> void **kernel_ptr = NULL;
>>>
>>> + unsigned int cmd = get_non_compat_cmd(compat_cmd);
>>
>> This will put a penalty on archs where sizeof(u32) == sizeof(enum), with
>> covers most of the cases.
>>
>> My suggestion is to, instead, call it at the end of __video_do_ioctl, at
>> the "default" clause, with a recursive call to __video_do_ioctl().
>
> Would that work for "has_array_args" ioctls ? video_usercopy() won't copy the
> array. The compat code could possibly handle that though.
>
> What about making get_non_compat_cmd() return its argument directly when
> sizeof(__u32) == sizeof(enum) ? The performance impact should be negligible.
Good idea. GCC optimizer will probably just discard the entire code, by merging
'compat_cmd' var with 'cmd' var.
Regards,
Mauro
prev parent reply other threads:[~2012-05-03 12:21 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-02 19:13 [RFC v2 0/2] V4L2 IOCTL enum compat wrapper Sakari Ailus
2012-05-02 19:13 ` [RFC v3 1/2] v4l: Do not use enums in IOCTL structs Sakari Ailus
2012-05-02 20:45 ` Hans Verkuil
2012-05-02 21:39 ` Sakari Ailus
2012-05-03 7:02 ` Hans Verkuil
2012-05-03 13:42 ` Mauro Carvalho Chehab
2012-05-03 14:12 ` Hans Verkuil
2012-05-03 10:57 ` Rémi Denis-Courmont
2012-05-03 10:58 ` Rémi Denis-Courmont
2012-05-03 12:20 ` Sakari Ailus
2012-05-02 22:17 ` Mauro Carvalho Chehab
2012-05-03 0:42 ` Andy Walls
2012-05-03 10:22 ` Mauro Carvalho Chehab
2012-05-03 10:35 ` Sakari Ailus
2012-05-03 12:07 ` Mauro Carvalho Chehab
2012-05-03 10:45 ` Sylwester Nawrocki
2012-05-03 23:02 ` Andy Walls
2012-05-03 10:39 ` Mauro Carvalho Chehab
2012-05-02 19:13 ` [RFC v3 2/2] v4l: Implement compat functions for enum to __u32 change Sakari Ailus
2012-05-02 22:32 ` Mauro Carvalho Chehab
2012-05-02 23:38 ` Laurent Pinchart
2012-05-03 12:20 ` Mauro Carvalho Chehab [this message]
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=4FA2781C.7000301@redhat.com \
--to=mchehab@redhat.com \
--cc=isely@pobox.com \
--cc=james.dutton@gmail.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=nbowler@elliptictech.com \
--cc=remi@remlab.net \
--cc=sakari.ailus@iki.fi \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.