From 8bfea15ddac3a0ae832f181653c36e020f24f007 Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Fri, 11 Apr 2014 19:16:36 +0200 Subject: block: Unlink temporary files in raw-posix/win32 Instead of having unlink() calls in the generic block layer, where we aren't even guarateed to have a file name, move them to those block drivers that are actually used and that always have a filename. Gets us rid of some #ifdefs as well. The patch also converts bs->is_temporary to a new BDRV_O_TEMPORARY open flag so that it is inherited in the protocol layer and the raw-posix and raw-win32 drivers can unlink the file. Signed-off-by: Kevin Wolf Reviewed-by: Max Reitz --- block/raw-win32.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'block/raw-win32.c') diff --git a/block/raw-win32.c b/block/raw-win32.c index 48cb2c2..064ea31 100644 --- a/block/raw-win32.c +++ b/block/raw-win32.c @@ -390,6 +390,9 @@ static void raw_close(BlockDriverState *bs) { BDRVRawState *s = bs->opaque; CloseHandle(s->hfile); + if (bs->open_flags & BDRV_O_TEMPORARY) { + unlink(bs->filename); + } } static int raw_truncate(BlockDriverState *bs, int64_t offset) -- cgit v1.1