From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43204) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEnoe-0002wg-00 for qemu-devel@nongnu.org; Thu, 20 Sep 2012 16:57:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TEnoc-0004Lm-V5 for qemu-devel@nongnu.org; Thu, 20 Sep 2012 16:57:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52292) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEnoc-0004Li-Mv for qemu-devel@nongnu.org; Thu, 20 Sep 2012 16:57:42 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8KKvf84027284 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 20 Sep 2012 16:57:41 -0400 Message-ID: <505B8343.7080605@redhat.com> Date: Thu, 20 Sep 2012 14:57:39 -0600 From: Eric Blake MIME-Version: 1.0 References: <20120920071706.GA22158@dhcp-16-143.nay.redhat.com> In-Reply-To: <20120920071706.GA22158@dhcp-16-143.nay.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig1717079C5A956F348B925994" Subject: Re: [Qemu-devel] [PATCH] virtio-blk: add default serial id List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dave Young Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig1717079C5A956F348B925994 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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. >=20 > Doing something similar to ide disks, add a "VD0000?" default serial > number if user does not specify it. >=20 > Signed-off-by: Dave Young > --- > =20 > +#define DEFAULT_VIRTIO_BLK_SERIAL_LEN 8 > + char serial[DEFAULT_VIRTIO_BLK_SERIAL_LEN]; > =20 > 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 =3D req->dev; > =20 > + 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? --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig1717079C5A956F348B925994 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iQEcBAEBCAAGBQJQW4NFAAoJEKeha0olJ0NqPtMH+gKbBfqE4ubctl9/AOuJNK7R nJ58xuhmw3r3K98oWeuWkldJErV20KxZExCEGZIqSdFeX0TAmN8ue8gXMeB0ikDR CdwIPSEmohwEOX8Av1AlYbd5hyneT8Fdq85HrWQq2mxuebCBJp75iB+N9Icbp7+d GNY62x0eaCb3Hfs4H5UR1vLXIvmVwWT92/nx7BqPQjCqyXp/pV6pYDsuJoh2+7SX rz/FsCtNPUYQw9kJsugqZUPeracELufRwtKjTfC8tAx0bpv98xyEW6lGpw4V7HcN WmJUYvOlKnojjdBQIKssgg29ETeVPi0Lb9xv4cuePaOLCq0zhQlHA7q4d6mt2g0= =RmEF -----END PGP SIGNATURE----- --------------enig1717079C5A956F348B925994--