[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 for-2.0 23/24] block/raw-posix: Strip protocol pre
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL v2 for-2.0 23/24] block/raw-posix: Strip protocol prefix on creation |
Date: |
Thu, 13 Mar 2014 15:11:07 +0100 |
From: Max Reitz <address@hidden>
The hdev_create() implementation in block/raw-posix.c is used by the
"host_device", "host_cdrom" and "host_floppy" protocol block drivers
together. Thus, any of the associated prefixes may occur and exactly one
should should be stripped, if it does (thus,
"host_device:host_cdrom:/dev/cdrom" is not shortened to "/dev/cdrom").
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Benoit Canet <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/raw-posix.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 697cd2e..1688e16 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1776,6 +1776,18 @@ static int hdev_create(const char *filename,
QEMUOptionParameter *options,
int ret = 0;
struct stat stat_buf;
int64_t total_size = 0;
+ bool has_prefix;
+
+ /* This function is used by all three protocol block drivers and therefore
+ * any of these three prefixes may be given.
+ * The return value has to be stored somewhere, otherwise this is an error
+ * due to -Werror=unused-value. */
+ has_prefix =
+ strstart(filename, "host_device:", &filename) ||
+ strstart(filename, "host_cdrom:" , &filename) ||
+ strstart(filename, "host_floppy:", &filename);
+
+ (void)has_prefix;
/* Read out options */
while (options && options->name) {
--
1.8.5.3
- [Qemu-devel] [PULL v2 for-2.0 04/24] block: bs->drv may be NULL in bdrv_debug_resume(), (continued)
[Qemu-devel] [PULL v2 for-2.0 14/24] iothread: stash thread ID away, Stefan Hajnoczi, 2014/03/13
[Qemu-devel] [PULL v2 for-2.0 18/24] block: Unlink temporary file, Stefan Hajnoczi, 2014/03/13
[Qemu-devel] [PULL v2 for-2.0 22/24] block/raw-posix: bdrv_parse_filename() for cdrom, Stefan Hajnoczi, 2014/03/13
[Qemu-devel] [PULL v2 for-2.0 23/24] block/raw-posix: Strip protocol prefix on creation,
Stefan Hajnoczi <=
Re: [Qemu-devel] [PULL v2 for-2.0 00/24] Block patches, Peter Maydell, 2014/03/13
Re: [Qemu-devel] [PULL v2 for-2.0 00/24] Block patches, Hu Tao, 2014/03/13