aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-12-18 18:28:15 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2005-12-18 18:28:15 +0000
commit95389c8681d4e52f9192fb15e12dba29c6807545 (patch)
tree4a76ad301f9c01366418ff92e60b8a151028e4c9 /block.c
parent1658b44bf506464cc811e421ac41372ee400371a (diff)
downloadqemu-95389c8681d4e52f9192fb15e12dba29c6807545.zip
qemu-95389c8681d4e52f9192fb15e12dba29c6807545.tar.gz
qemu-95389c8681d4e52f9192fb15e12dba29c6807545.tar.bz2
qcow_make_empty() support (Johannes Schindelin)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1716 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block.c')
-rw-r--r--block.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/block.c b/block.c
index efd96e6..6924cee 100644
--- a/block.c
+++ b/block.c
@@ -150,13 +150,19 @@ int bdrv_create(BlockDriver *drv,
}
#ifdef _WIN32
-static void get_tmp_filename(char *filename, int size)
+void get_tmp_filename(char *filename, int size)
{
+ char* p = strrchr(filename, '/');
+
+ if (p == NULL)
+ return;
+
/* XXX: find a better function */
- tmpnam(filename);
+ tmpnam(p);
+ *p = '/';
}
#else
-static void get_tmp_filename(char *filename, int size)
+void get_tmp_filename(char *filename, int size)
{
int fd;
/* XXX: race condition possible */
@@ -394,6 +400,10 @@ int bdrv_commit(BlockDriverState *bs)
i += n;
}
}
+
+ if (bs->drv->bdrv_make_empty)
+ return bs->drv->bdrv_make_empty(bs);
+
return 0;
}