qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: John Snow <jsnow@redhat.com>, qemu-block@nongnu.org
Cc: kwolf@redhat.com, armbru@redhat.com, zuban32s@gmail.com,
	qemu-devel@nongnu.org, stefanha@redhat.com, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2 1/4] qtest/ahci: use generate_pattern everywhere
Date: Thu, 10 Sep 2015 17:47:21 -0600	[thread overview]
Message-ID: <55F21689.1080608@redhat.com> (raw)
In-Reply-To: <1441926555-19471-2-git-send-email-jsnow@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1160 bytes --]

On 09/10/2015 05:09 PM, John Snow wrote:
> Fix the pattern generation to actually be interesting,
> and make sure all buffers in the ahci-test actually use it.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  tests/ahci-test.c | 23 ++++++-----------------
>  1 file changed, 6 insertions(+), 17 deletions(-)
> 
> diff --git a/tests/ahci-test.c b/tests/ahci-test.c
> index 87d7691..b1a785c 100644
> --- a/tests/ahci-test.c
> +++ b/tests/ahci-test.c
> @@ -80,9 +80,9 @@ static void generate_pattern(void *buffer, size_t len, size_t cycle_len)
>  
>      /* Write an indicative pattern that varies and is unique per-cycle */
>      p = rand() % 256;
> -    for (i = j = 0; i < len; i++, j++) {
> -        tx[i] = p;
> -        if (j % cycle_len == 0) {
> +    for (i = 0; i < len; i++) {
> +        tx[i] = p++ % 256;
> +        if (i % cycle_len == 0) {
>              p = rand() % 256;

I'd drop the pointless %256, since the compiler already automatically
truncates int to char when assigning to a char variable.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2015-09-10 23:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10 23:09 [Qemu-devel] [PATCH v2 0/4] ide: simple ATAPI tests John Snow
2015-09-10 23:09 ` [Qemu-devel] [PATCH v2 1/4] qtest/ahci: use generate_pattern everywhere John Snow
2015-09-10 23:47   ` Eric Blake [this message]
2015-09-10 23:09 ` [Qemu-devel] [PATCH v2 2/4] qtest/ahci: export generate_pattern John Snow
2015-09-10 23:09 ` [Qemu-devel] [PATCH v2 3/4] ide-test: add cdrom pio test John Snow
2015-09-10 23:09 ` [Qemu-devel] [PATCH v2 4/4] ide-test: add cdrom dma test John Snow
2015-09-14 18:09 ` [Qemu-devel] [PATCH v2 0/4] ide: simple ATAPI tests John Snow

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=55F21689.1080608@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=zuban32s@gmail.com \
    /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).