From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HQ3bD-00059n-5O for qemu-devel@nongnu.org; Sat, 10 Mar 2007 10:35:11 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HQ3bB-00059b-Jk for qemu-devel@nongnu.org; Sat, 10 Mar 2007 10:35:09 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HQ3bB-00059Y-Cy for qemu-devel@nongnu.org; Sat, 10 Mar 2007 10:35:09 -0500 Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HQ3aj-0002JR-5g for qemu-devel@nongnu.org; Sat, 10 Mar 2007 10:34:41 -0500 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1HQ3ab-00084f-Ga for qemu-devel@nongnu.org; Sat, 10 Mar 2007 16:34:33 +0100 Received: from d83-190-230-215.cust.tele2.it ([83.190.230.215]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 10 Mar 2007 16:34:33 +0100 Received: from lorenzo.campedelli by d83-190-230-215.cust.tele2.it with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 10 Mar 2007 16:34:33 +0100 From: Lorenzo Campedelli Date: Sat, 10 Mar 2007 16:34:18 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050106090803060808090100" Sender: news Subject: [Qemu-devel] Partial fix for vvfat + -snapshot Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------050106090803060808090100 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, the attached patch is an attempt to fix support of virtual FAT disk images when used with -snapshot option. This combination doesn't work anymore in 0.9.0, and the reason seems to be that code in block.c that handles -snapshot, completely disregards the different "filename" format used for vvfat. The patch only restores the -hdX fat:dirname functionality, while additional options such as :rw:, :floppy: :32: etc, still fail, as some functions (e.g. path_combine() and path_is_absolute()) only support the "fat:" prefix. I'm not sure the fix is correct (I doubt code in block.c should know specific issues of different drivers), but it works for my needs, and maybe somebody else is interested. The patch is agains 0.9.0. Best Regards, Lorenzo --------------050106090803060808090100 Content-Type: text/x-patch; name="block.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="block.c.patch" --- qemu-0.9.0/block.c.orig 2007-03-10 12:53:27.000000000 +0100 +++ qemu-0.9.0/block.c 2007-03-10 16:22:51.000000000 +0100 @@ -331,6 +331,7 @@ if (flags & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; + BlockDriver *drv1; int64_t total_size; /* if snapshot, we create a temporary backing file and open it @@ -346,10 +347,22 @@ return -1; } total_size = bdrv_getlength(bs1) >> SECTOR_BITS; + drv1 = bs1->drv; bdrv_delete(bs1); get_tmp_filename(tmp_filename, sizeof(tmp_filename)); - realpath(filename, backing_filename); + /* + * for vvfat protocol the string "fat::" should remain + * the prefix of the filename even after realpath() call ... + */ + if (drv1 == &bdrv_vvfat) { + int i = strrchr(filename, ':') - filename + 1; + + strncpy(backing_filename, filename, i); + realpath(filename + i, backing_filename + i); + } else { + realpath(filename, backing_filename); + } if (bdrv_create(&bdrv_qcow2, tmp_filename, total_size, backing_filename, 0) < 0) { return -1; --------------050106090803060808090100--