Message ID | 1394144739-2294-5-git-send-email-mreitz@redhat.com |
---|---|
State | New |
Headers | show |
The Thursday 06 Mar 2014 à 23:25:38 (+0100), Max Reitz wrote : > 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, it any of the associated prefixes may occur and exactly > one should be stripped, if it does (thus, > "host_device:host_cdrom:/dev/cdrom" is not shortened to "/dev/cdrom"). > > Signed-off-by: Max Reitz <mreitz@redhat.com> > --- > block/raw-posix.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/block/raw-posix.c b/block/raw-posix.c > index 6c9b8f2..598d736 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.9.0 > > Reviewed-by: Benoit Canet <benoit@irqsave.net>
On 03/06/2014 03:25 PM, Max Reitz wrote: > 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, it any of the associated prefixes may occur and exactly s/it // > one should be stripped, if it does (thus, > "host_device:host_cdrom:/dev/cdrom" is not shortened to "/dev/cdrom"). > > Signed-off-by: Max Reitz <mreitz@redhat.com> > --- > block/raw-posix.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+)
diff --git a/block/raw-posix.c b/block/raw-posix.c index 6c9b8f2..598d736 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) {
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, it any of the associated prefixes may occur and exactly one should be stripped, if it does (thus, "host_device:host_cdrom:/dev/cdrom" is not shortened to "/dev/cdrom"). Signed-off-by: Max Reitz <mreitz@redhat.com> --- block/raw-posix.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)