From: Stefan Hajnoczi <stefanha@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] ide-test: Fix endianness problems
Date: Thu, 16 May 2013 11:04:07 +0200 [thread overview]
Message-ID: <20130516090407.GI1597@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1368622839-7084-1-git-send-email-kwolf@redhat.com>
On Wed, May 15, 2013 at 03:00:39PM +0200, Kevin Wolf wrote:
> @@ -355,6 +364,17 @@ static void test_bmdma_teardown(void)
> ide_test_quit();
> }
>
> +static void string_cpu_to_be16(uint16_t *s, size_t bytes)
> +{
> + g_assert((bytes & 1) == 0);
> + bytes /= 2;
> +
> + while (bytes--) {
> + *s = cpu_to_be16(*s);
> + s++;
> + }
> +}
> +
> static void test_identify(void)
> {
> uint8_t data;
> @@ -389,10 +409,12 @@ static void test_identify(void)
> assert_bit_clear(data, BSY | DF | ERR | DRQ);
>
> /* Check serial number/version in the buffer */
> - ret = memcmp(&buf[10], "ettsidks ", 20);
> + string_cpu_to_be16(&buf[10], 20);
> + ret = memcmp(&buf[10], "testdisk ", 20);
> g_assert(ret == 0);
>
> - ret = memcmp(&buf[23], "evsroi n", 8);
> + string_cpu_to_be16(&buf[23], 8);
> + ret = memcmp(&buf[23], "version ", 8);
It would have been simpler to specify string_cpu_to_be16() length in
"elements" instead of bytes. Then you can drop the assertion and
conversion. Not a problem though.
Anthony: Please take this patch without a pull request. I think me
sending pull requests for a single late-rc fix doesn't add value.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
next prev parent reply other threads:[~2013-05-16 9:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-15 13:00 [Qemu-devel] [PATCH] ide-test: Fix endianness problems Kevin Wolf
2013-05-15 13:15 ` [Qemu-devel] [PATCH for-1.5?] " Paolo Bonzini
2013-05-15 13:24 ` Kevin Wolf
2013-05-15 13:47 ` Paolo Bonzini
2013-05-15 15:37 ` Anthony Liguori
2013-05-15 16:07 ` mdroth
2013-05-16 9:04 ` Stefan Hajnoczi [this message]
2013-05-16 9:12 ` [Qemu-devel] [PATCH] " Kevin Wolf
2013-05-16 12:50 ` Anthony Liguori
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=20130516090407.GI1597@stefanha-thinkpad.redhat.com \
--to=stefanha@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@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).