From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=51191 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQ4HL-0003Ff-Hh for qemu-devel@nongnu.org; Tue, 07 Dec 2010 15:36:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PQ4HK-0002lz-HJ for qemu-devel@nongnu.org; Tue, 07 Dec 2010 15:36:51 -0500 Received: from mail-ww0-f53.google.com ([74.125.82.53]:43674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PQ4HK-0002lo-Ci for qemu-devel@nongnu.org; Tue, 07 Dec 2010 15:36:50 -0500 Received: by wwi18 with SMTP id 18so315037wwi.10 for ; Tue, 07 Dec 2010 12:36:48 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <1291743586-3518-1-git-send-email-Jes.Sorensen@redhat.com> References: <1291743586-3518-1-git-send-email-Jes.Sorensen@redhat.com> Date: Tue, 7 Dec 2010 20:36:47 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH 1/1] qemu-img.c: Clean up handling of image size in img_create() From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes.Sorensen@redhat.com Cc: kwolf@redhat.com, qemu-devel@nongnu.org On Tue, Dec 7, 2010 at 5:39 PM, wrote: > =A0 =A0 // The size for the image must always be specified, with one exce= ption: > =A0 =A0 // If we are using a backing file, we can obtain the size from th= ere > - =A0 =A0if (get_option_parameter(param, BLOCK_OPT_SIZE)->value.n =3D=3D = -1) { > - > + =A0 =A0if (get_option_parameter(param, BLOCK_OPT_SIZE)->value.n =3D=3D = 0) { > =A0 =A0 =A0 =A0 QEMUOptionParameter *backing_file =3D > =A0 =A0 =A0 =A0 =A0 =A0 get_option_parameter(param, BLOCK_OPT_BACKING_FIL= E); > =A0 =A0 =A0 =A0 QEMUOptionParameter *backing_fmt =3D Today it is possible to create 0 byte sized images. Your patch will change that: If there is a backing file, then the size will be taken from the backing fi= le. If there is no backing file, then an error about missing size will be printed, even though a size of 0 has been given. I don't think 0 sized images are very useful, but I'm not sure we should make this change. Stefan