[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-trivial] [PATCH 05/29] block: use QEMU_IS_ALIGNED macro
From: |
Eric Blake |
Subject: |
Re: [Qemu-trivial] [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
signature.asc
Description: OpenPGP digital signature
- [Qemu-trivial] [PATCH 00/29] coccinelle script to enforce qemu/osdep.h macros usage, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-trivial] [PATCH 01/29] coccinelle: add a script to enforce qemu/osdep.h macros usage, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-trivial] [PATCH 02/29] pci: remove superfluous parenthesis, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-trivial] [PATCH 03/29] qemu-img: use QEMU_IS_ALIGNED macro, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-trivial] [PATCH 04/29] scsi-disk: use QEMU_IS_ALIGNED macro, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-trivial] [PATCH 05/29] block: use QEMU_IS_ALIGNED macro, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-trivial] [PATCH 06/29] migration/block: use QEMU_IS_ALIGNED macro, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-trivial] [PATCH 07/29] ds1338: use QEMU_IS_ALIGNED macro, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-trivial] [PATCH 08/29] ui: use QEMU_IS_ALIGNED macro, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-trivial] [PATCH 09/29] net: use QEMU_IS_ALIGNED macro, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-trivial] [PATCH 10/29] net/rocker: use QEMU_IS_ALIGNED macro, Philippe Mathieu-Daudé, 2017/07/18