From: Laurent Vivier <laurent@vivier.eu>
To: Eric Blake <eblake@redhat.com>, Max Filippov <jcmvbkbc@gmail.com>
Cc: Riku Voipio <riku.voipio@iki.fi>, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] linux-user: fix convertion of flock/flock64 l_type field
Date: Tue, 8 May 2018 21:57:31 +0200 [thread overview]
Message-ID: <8fc5c56b-b49c-66e6-284c-e8590f453884@vivier.eu> (raw)
In-Reply-To: <e6818e2c-62b8-0c42-be22-d8ea9bc50b03@redhat.com>
Le 08/05/2018 à 20:55, Eric Blake a écrit :
> On 05/08/2018 12:08 PM, Max Filippov wrote:
>> On Tue, May 8, 2018 at 9:36 AM, Laurent Vivier <laurent@vivier.eu> wrote:
>
> In the subject, s/convertion/conversion/
>
>>> As l_type values (F_RDLCK, F_WRLCK, F_UNLCK, F_EXLCK, F_SHLCK)
>>> are not bitmasks, we can't use target_to_host_bitmask() and
>>> host_to_target_bitmask() to convert them.
>>>
>>> Introduce target_to_host_flock() and host_to_target_flock()
>>> to convert values between host and target.
>>>
>
>>> +static unsigned int host_to_target_flock(unsigned int type)
>>> +{
>>> + switch (type) {
>>> +#define TRANSTBL_CONVERT(a) case a: return TARGET_##a;
>>> + TRANSTBL_CONVERT(F_RDLCK)
>>> + TRANSTBL_CONVERT(F_WRLCK)
>>> + TRANSTBL_CONVERT(F_UNLCK)
>>> + TRANSTBL_CONVERT(F_EXLCK)
>>> + TRANSTBL_CONVERT(F_SHLCK)
>>> +#undef TRANSTBL_CONVERT
>>> + }
>>> + return type;
>>> +}
>>>
>>
>> There's a duplication. Wouldn't it be better if it was done like the
>> following:
>>
>> #define FLOCK_TRANSTBL \
>> switch (type) {
>> TRANSTBL_CONVERT(F_RDLCK) \
>
> If you do this, I'd lean towards omitting the trailing ; from
> TRANSTBL_CONVERT() and sticking it in FLOCK_TRANSTBL instead (it looks
> weird to see a statement-like macro called without a ';').
>
I have included this patch in the series "linux-user: fix sparc32plus"
and missed your comments. I'll update this patch in the v2 of the series.
Thanks,
Laurent
prev parent reply other threads:[~2018-05-08 19:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-08 16:36 [Qemu-devel] [PATCH] linux-user: fix convertion of flock/flock64 l_type field Laurent Vivier
2018-05-08 17:08 ` Max Filippov
2018-05-08 18:55 ` Eric Blake
2018-05-08 19:57 ` Laurent Vivier [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=8fc5c56b-b49c-66e6-284c-e8590f453884@vivier.eu \
--to=laurent@vivier.eu \
--cc=eblake@redhat.com \
--cc=jcmvbkbc@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).