From: Lorenzo Campedelli <lorenzo.campedelli@tele2.it>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Partial fix for vvfat + -snapshot
Date: Sat, 10 Mar 2007 16:34:18 +0100 [thread overview]
Message-ID: <esuj5r$9hi$1@sea.gmane.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 755 bytes --]
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
[-- Attachment #2: block.c.patch --]
[-- Type: text/x-patch, Size: 1241 bytes --]
--- 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:<options>:" 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;
reply other threads:[~2007-03-10 15:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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='esuj5r$9hi$1@sea.gmane.org' \
--to=lorenzo.campedelli@tele2.it \
--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).