qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: Fam Zheng <fam@euphon.net>, Kevin Wolf <kwolf@redhat.com>,
	qemu-block@nongnu.org, qemu-trivial@nongnu.org,
	Michael Tokarev <mjt@tls.msk.ru>,
	Laurent Vivier <laurent@vivier.eu>, Max Reitz <mreitz@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>, John Snow <jsnow@redhat.com>
Subject: Re: [PATCH 5/7] hw/ide/atapi: Replace magic '512' value by BDRV_SECTOR_SIZE
Date: Fri, 14 Aug 2020 10:00:10 -0700	[thread overview]
Message-ID: <22f4a10e-c90b-7d80-bac5-4b181283d610@linaro.org> (raw)
In-Reply-To: <20200814082841.27000-6-f4bug@amsat.org>

On 8/14/20 1:28 AM, Philippe Mathieu-Daudé wrote:
> Use self-explicit definitions instead of magic '512' value.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/ide/atapi.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


> diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
> index 17a9d635d8..14a2b0bb2f 100644
> --- a/hw/ide/atapi.c
> +++ b/hw/ide/atapi.c
> @@ -824,9 +824,9 @@ static void cmd_get_configuration(IDEState *s, uint8_t *buf)
>       *
>       *      Only a problem if the feature/profiles grow.
>       */
> -    if (max_len > 512) {
> +    if (max_len > BDRV_SECTOR_SIZE) {
>          /* XXX: assume 1 sector */
> -        max_len = 512;
> +        max_len = BDRV_SECTOR_SIZE;
>      }
>  
>      memset(buf, 0, max_len);
> @@ -1186,8 +1186,8 @@ static void cmd_read_dvd_structure(IDEState *s, uint8_t* buf)
>          }
>      }
>  
> -    memset(buf, 0, max_len > IDE_DMA_BUF_SECTORS * 512 + 4 ?
> -           IDE_DMA_BUF_SECTORS * 512 + 4 : max_len);
> +    memset(buf, 0, max_len > IDE_DMA_BUF_SECTORS * BDRV_SECTOR_SIZE + 4 ?
> +           IDE_DMA_BUF_SECTORS * BDRV_SECTOR_SIZE + 4 : max_len);

If you're queuing other cleanups, both of these places could usefully use MIN().


r~


  reply	other threads:[~2020-08-14 17:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14  8:28 [PATCH 0/7] block: Use definitions instead of magic values Philippe Mathieu-Daudé
2020-08-14  8:28 ` [PATCH 1/7] block/null: Make more explicit the driver default size is 1GiB Philippe Mathieu-Daudé
2020-08-14 16:58   ` Richard Henderson
2020-08-15  3:15   ` Li Qiang
2020-08-17 11:07   ` Kevin Wolf
2020-08-14  8:28 ` [PATCH 2/7] hw/ide/core: Trivial typo fix Philippe Mathieu-Daudé
2020-08-14 16:58   ` Richard Henderson
2020-08-15  3:18   ` Li Qiang
2020-08-17 11:10   ` Kevin Wolf
2020-08-14  8:28 ` [PATCH 3/7] hw/ide/core: Replace magic '512' value by BDRV_SECTOR_SIZE Philippe Mathieu-Daudé
2020-08-14 16:58   ` Richard Henderson
2020-08-15  3:19   ` Li Qiang
2020-08-17 11:17   ` Kevin Wolf
2020-09-23 14:53     ` John Snow
2020-09-23 16:57       ` Philippe Mathieu-Daudé
2020-08-14  8:28 ` [PATCH 4/7] hw/ide/ahci: " Philippe Mathieu-Daudé
2020-08-14 16:58   ` Richard Henderson
2020-08-15  3:21   ` Li Qiang
2020-08-14  8:28 ` [PATCH 5/7] hw/ide/atapi: " Philippe Mathieu-Daudé
2020-08-14 17:00   ` Richard Henderson [this message]
2020-08-15  3:22   ` Li Qiang
2020-08-14  8:28 ` [PATCH 6/7] hw/ide/pci: " Philippe Mathieu-Daudé
2020-08-14 17:00   ` Richard Henderson
2020-08-15  3:23   ` Li Qiang
2020-08-14  8:28 ` [PATCH 7/7] hw/scsi/scsi-disk: " Philippe Mathieu-Daudé
2020-08-14 17:01   ` Richard Henderson
2020-08-15  3:24   ` Li Qiang
2020-08-17 11:21   ` Kevin Wolf
2020-08-17  9:03 ` [PATCH 0/7] block: Use definitions instead of magic values Stefano Garzarella
2020-09-01  9:27 ` Laurent Vivier
2020-09-01 13:55   ` Philippe Mathieu-Daudé

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=22f4a10e-c90b-7d80-bac5-4b181283d610@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=f4bug@amsat.org \
    --cc=fam@euphon.net \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=mjt@tls.msk.ru \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /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).