From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=57130 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQDYO-00013V-A2 for qemu-devel@nongnu.org; Wed, 08 Dec 2010 01:31:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PQDYN-0000g2-1h for qemu-devel@nongnu.org; Wed, 08 Dec 2010 01:31:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:16480) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PQDYM-0000fw-NB for qemu-devel@nongnu.org; Wed, 08 Dec 2010 01:31:02 -0500 Message-ID: <4CFF2622.7000107@redhat.com> Date: Wed, 08 Dec 2010 07:30:58 +0100 From: Jes Sorensen MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/1] qemu-img.c: Clean up handling of image size in img_create() References: <1291743586-3518-1-git-send-email-Jes.Sorensen@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: kwolf@redhat.com, qemu-devel@nongnu.org On 12/07/10 21:36, Stefan Hajnoczi wrote: > On Tue, Dec 7, 2010 at 5:39 PM, wrote: >> // The size for the image must always be specified, with one exception: >> // If we are using a backing file, we can obtain the size from there >> - if (get_option_parameter(param, BLOCK_OPT_SIZE)->value.n == -1) { >> - >> + if (get_option_parameter(param, BLOCK_OPT_SIZE)->value.n == 0) { >> QEMUOptionParameter *backing_file = >> get_option_parameter(param, BLOCK_OPT_BACKING_FILE); >> QEMUOptionParameter *backing_fmt = > > 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 file. > 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. The old code also fails if there is no size, except for when a backing file is present. I hadn't thought of the zero sized file, but on the other hand, I don't see it being useful. I would like to make this change to get the option handling cleaned up as it allows me to refactor the code in img_create(). Cheers, Jes