[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-block] [PATCH v2 1/4] qtest/ahci: use generate_pa
From: |
Eric Blake |
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 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
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 <address@hidden>
> ---
> 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
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v2 0/4] ide: simple ATAPI tests, John Snow, 2015/09/10
- [Qemu-devel] [PATCH v2 3/4] ide-test: add cdrom pio test, John Snow, 2015/09/10
- [Qemu-devel] [PATCH v2 4/4] ide-test: add cdrom dma test, John Snow, 2015/09/10
- [Qemu-devel] [PATCH v2 2/4] qtest/ahci: export generate_pattern, John Snow, 2015/09/10
- [Qemu-devel] [PATCH v2 1/4] qtest/ahci: use generate_pattern everywhere, John Snow, 2015/09/10
- Re: [Qemu-devel] [Qemu-block] [PATCH v2 1/4] qtest/ahci: use generate_pattern everywhere,
Eric Blake <=
- Re: [Qemu-devel] [PATCH v2 0/4] ide: simple ATAPI tests, John Snow, 2015/09/14