summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2006-06-04 11:39:07 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2006-06-04 11:39:07 +0000
commit7a6cba611d09f8eccdfc90d5ad3eb03762e60ce9 (patch)
tree43cfb9b27d844ba04ed506226d4cfc0246d5506e /block.c
parent17acfe326ce2038033934485145ddd2390337986 (diff)
downloadhqemu-7a6cba611d09f8eccdfc90d5ad3eb03762e60ce9.zip
hqemu-7a6cba611d09f8eccdfc90d5ad3eb03762e60ce9.tar.gz
Disk cache flush support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1949 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block.c')
-rw-r--r--block.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/block.c b/block.c
index b908167..c25c686 100644
--- a/block.c
+++ b/block.c
@@ -615,6 +615,14 @@ const char *bdrv_get_device_name(BlockDriverState *bs)
return bs->device_name;
}
+void bdrv_flush(BlockDriverState *bs)
+{
+ if (bs->drv->bdrv_flush)
+ bs->drv->bdrv_flush(bs);
+ if (bs->backing_hd)
+ bdrv_flush(bs->backing_hd);
+}
+
void bdrv_info(void)
{
BlockDriverState *bs;
@@ -770,6 +778,12 @@ static int raw_create(const char *filename, int64_t total_size,
return 0;
}
+static void raw_flush(BlockDriverState *bs)
+{
+ BDRVRawState *s = bs->opaque;
+ fsync(s->fd);
+}
+
BlockDriver bdrv_raw = {
"raw",
sizeof(BDRVRawState),
@@ -779,6 +793,7 @@ BlockDriver bdrv_raw = {
raw_write,
raw_close,
raw_create,
+ raw_flush,
};
void bdrv_init(void)
OpenPOWER on IntegriCloud