diff options
author | Christoph Hellwig <hch@lst.de> | 2009-06-15 14:04:22 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@brick.lst.de> | 2009-06-15 14:04:22 +0200 |
commit | 0968db3e1f89506967b70305225f4a2937cf7119 (patch) | |
tree | aba6e675fcd8b94b7019e3eaa56e4cc06502b9c5 /block/raw-win32.c | |
parent | 795174f0ba7208e713ee5dbe4fcc50d99a5591c0 (diff) | |
download | qemu-0968db3e1f89506967b70305225f4a2937cf7119.tar.gz qemu-0968db3e1f89506967b70305225f4a2937cf7119.tar.bz2 qemu-0968db3e1f89506967b70305225f4a2937cf7119.zip |
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.c | 10 |
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, |