qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Dave Young <dyoung@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] virtio-blk: add default serial id
Date: Thu, 20 Sep 2012 14:57:39 -0600	[thread overview]
Message-ID: <505B8343.7080605@redhat.com> (raw)
In-Reply-To: <20120920071706.GA22158@dhcp-16-143.nay.redhat.com>

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

On 09/20/2012 01:17 AM, Dave Young wrote:
> For virtio block device, if user does not specify the serial attribute,
> There will be not serial availabe, this is not convinient for identify

s/not serial availabe/no serial available/
s/convinient/convenient/
s/identify/identifying/

> the disk.
> 
> Doing something similar to ide disks, add a "VD0000?" default serial
> number if user does not specify it.
> 
> Signed-off-by: Dave Young <dyoung@redhat.com>
> ---

>  
> +#define DEFAULT_VIRTIO_BLK_SERIAL_LEN 8

> +    char serial[DEFAULT_VIRTIO_BLK_SERIAL_LEN];
>  
>      if (req->elem.out_num < 1 || req->elem.in_num < 1) {
>          error_report("virtio-blk missing headers");
> @@ -388,12 +391,14 @@ static void virtio_blk_handle_request(Vi
>      } else if (type & VIRTIO_BLK_T_GET_ID) {
>          VirtIOBlock *s = req->dev;
>  
> +        snprintf(serial, DEFAULT_VIRTIO_BLK_SERIAL_LEN,
> +                 "VD%05d", s->drive_serial);

So if I cycle through hotplug and unplug for 100000 times, my string
will now be silently truncated, and I can end up with disks with shared
serial numbers?

-- 
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: 617 bytes --]

      reply	other threads:[~2012-09-20 20:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-20  7:17 [Qemu-devel] [PATCH] virtio-blk: add default serial id Dave Young
2012-09-20 20:57 ` Eric Blake [this message]

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=505B8343.7080605@redhat.com \
    --to=eblake@redhat.com \
    --cc=dyoung@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).