From: john cooper <john.cooper@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: john.cooper@redhat.com, qemu-devel@nongnu.org,
kvm@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 1/2] Add 'serial' attribute to virtio-blk devices
Date: Mon, 21 Jun 2010 23:40:50 -0400 [thread overview]
Message-ID: <4C2030C2.1060904@redhat.com> (raw)
In-Reply-To: <201006220855.21925.rusty@rustcorp.com.au>
Rusty Russell wrote:
> On Tue, 22 Jun 2010 02:13:21 am Ryan Harper wrote:
>> * john cooper <john.cooper@redhat.com> [2010-06-21 01:11]:
>>> Rusty Russell wrote:
>>>> /* id_str is not necessarily nul-terminated! */
>>>> buf[VIRTIO_BLK_ID_BYTES] = '\0';
>>>> return virtblk_get_id(disk, buf);
>>> The /sys file is rendered according to the length
>>> returned from this function and the trailing nul
>>> is not interpreted in this context. In fact if a
>>> nul is added and included in the byte count of the
>>> string it will appear in the /sys file.
>> Yeah; I like the simplicity; but we do need to know how long the string
>> is so we can return that value.
>
> So we're looking at something like:
>
> /* id_str is not necessarily nul-terminated! */
> buf[VIRTIO_BLK_ID_BYTES] = '\0';
> err = virtblk_get_id(disk, buf);
> if (!err)
> return strlen(buf);
> if (err == -EIO) /* Unsupported? Make it empty. */
> return 0;
> return err;
In my haste reading your prior mail, I'd glossed over
the fact you were copying direct to the sysfs buf. So
in retrospect that (and the above) do make sense.
Thanks,
-john
--
john.cooper@redhat.com
next prev parent reply other threads:[~2010-06-22 3:40 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1276886283-1571-1-git-send-email-ryanh@us.ibm.com>
2010-06-18 18:38 ` [PATCH 2/2] Remove virtio_blk VBID ioctl Ryan Harper
2010-06-19 8:24 ` [Qemu-devel] [PATCH 1/2] Add 'serial' attribute to virtio-blk devices Blue Swirl
[not found] ` <AANLkTin7WwGhL-O4ENzG6u-2q0pYiLpyH1tfzLUxK4PQ@mail.gmail.com>
2010-06-19 10:58 ` Ulrich Drepper
[not found] ` <4C1CA2DB.2080502@redhat.com>
2010-06-19 15:59 ` Blue Swirl
[not found] ` <1276886283-1571-2-git-send-email-ryanh@us.ibm.com>
2010-06-21 1:30 ` [PATCH 2/2] Remove virtio_blk VBID ioctl Rusty Russell
[not found] ` <201006211100.19719.rusty@rustcorp.com.au>
2010-06-21 2:30 ` Ryan Harper
2010-06-21 5:07 ` john cooper
2010-06-21 1:52 ` [PATCH 1/2] Add 'serial' attribute to virtio-blk devices Rusty Russell
[not found] ` <201006211122.38156.rusty@rustcorp.com.au>
2010-06-21 5:51 ` john cooper
[not found] ` <4C1EFDFD.5050907@redhat.com>
2010-06-21 16:43 ` Ryan Harper
[not found] ` <20100621164321.GF1647@us.ibm.com>
2010-06-21 17:11 ` john cooper
2010-06-21 23:25 ` Rusty Russell
[not found] ` <201006220855.21925.rusty@rustcorp.com.au>
2010-06-22 3:40 ` john cooper [this message]
2010-06-21 12:44 ` [Qemu-devel] " Christoph Hellwig
2010-06-21 16:45 ` Ryan Harper
2010-06-18 18:38 Ryan Harper
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=4C2030C2.1060904@redhat.com \
--to=john.cooper@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.linux-foundation.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).