summaryrefslogtreecommitdiff
path: root/block/raw-win32.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2009-06-15 14:04:22 +0200
committerChristoph Hellwig <hch@brick.lst.de>2009-06-15 14:04:22 +0200
commit508c7cb3fa666f0c4723946869f318ec7751ecbd (patch)
treeaba6e675fcd8b94b7019e3eaa56e4cc06502b9c5 /block/raw-win32.c
parentf3a5d3f8a1a992376e3dd128ceee917cd1281da7 (diff)
downloadqemu-508c7cb3fa666f0c4723946869f318ec7751ecbd.tar.gz
block: add bdrv_probe_device method
Add a bdrv_probe_device method to all BlockDriver instances implementing host devices to move matching of host device types into the actual drivers. For now we keep exacly the old matching behaviour based on the devices names, although we really should have better detetion methods based on device information in the future. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'block/raw-win32.c')
-rw-r--r--block/raw-win32.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/block/raw-win32.c b/block/raw-win32.c
index 1e95153d56..72acad58f9 100644
--- a/block/raw-win32.c
+++ b/block/raw-win32.c
@@ -306,6 +306,15 @@ static int find_device_type(BlockDriverState *bs, const char *filename)
}
}
+static int hdev_probe_device(const char *filename)
+{
+ if (strstart(filename, "/dev/cdrom", NULL))
+ return 100;
+ if (is_windows_drive(filename))
+ return 100;
+ return 0;
+}
+
static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
{
BDRVRawState *s = bs->opaque;
@@ -391,6 +400,7 @@ static int raw_set_locked(BlockDriverState *bs, int locked)
static BlockDriver bdrv_host_device = {
.format_name = "host_device",
.instance_size = sizeof(BDRVRawState),
+ .bdrv_probe_device = hdev_probe_device,
.bdrv_open = hdev_open,
.bdrv_close = raw_close,
.bdrv_flush = raw_flush,