qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH 05/29] block: use QEMU_IS_ALIGNED macro


From: Eric Blake
Subject: Re: [Qemu-block] [PATCH 05/29] block: use QEMU_IS_ALIGNED macro
Date: Tue, 18 Jul 2017 10:25:51 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 07/18/2017 01:09 AM, Philippe Mathieu-Daudé wrote:
> Applied using the Coccinelle semantic patch scripts/coccinelle/use_osdep.cocci
> 
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
>  block/io.c          | 4 ++--
>  block/qcow2-cache.c | 2 +-
>  block/vhdx-log.c    | 2 +-
>  block/vvfat.c       | 2 +-
>  4 files changed, 5 insertions(+), 5 deletions(-)

The first three look okay,

> --- a/block/vvfat.c
> +++ b/block/vvfat.c
> @@ -454,7 +454,7 @@ static direntry_t *create_long_filename(BDRVVVFATState 
> *s, const char *filename)
>          entry=array_get(&(s->directory),s->directory.next-1-(i/26));
>          if (i >= 2 * length + 2) {
>              entry->name[offset] = 0xff;
> -        } else if (i % 2 == 0) {
> +        } else if (QEMU_IS_ALIGNED(i, 2)) {
>              entry->name[offset] = longname[i / 2] & 0xff;
>          } else {
>              entry->name[offset] = longname[i / 2] >> 8;

but this one looks a bit odd.  Code-wise, it's identical, but
semantically, this doesn't feel like an alignment check, so much as an
even-or-odd check.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]