qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH v1 4/5] qemu-option: Remove qemu_opts_create


From: Peter Crosthwaite
Subject: Re: [Qemu-devel] [RFC PATCH v1 4/5] qemu-option: Remove qemu_opts_create_nofail
Date: Wed, 4 Dec 2013 16:45:26 +1000

On Tue, Dec 3, 2013 at 7:42 PM, Markus Armbruster <address@hidden> wrote:
> Peter Crosthwaite <address@hidden> writes:
>
>> This is a boiler-plate _nofail variant of qemu_opts_create. Remove and
>> use error_abort in call sites.
>>
>> A null argument needs to be added for the id field in affected callsites
>> due to inconsistency between the normal and no_fail variants.
>
> Two arguments, actually, NULL id and zero fail_if_exists:
>
> QemuOpts *qemu_opts_create_nofail(QemuOptsList *list)
> {
>     QemuOpts *opts;
>     Error *errp = NULL;
>     opts = qemu_opts_create(list, NULL, 0, &errp);
>     assert_no_error(errp);
>     return opts;
> }
>
>> Signed-off-by: Peter Crosthwaite <address@hidden>
>> ---
>>
>>  block/blkdebug.c       |  2 +-
>>  block/blkverify.c      |  2 +-
>>  block/curl.c           |  2 +-
>>  block/gluster.c        |  2 +-
>>  block/iscsi.c          |  2 +-
>>  block/nbd.c            |  2 +-
>>  block/qcow2.c          |  2 +-
>>  block/raw-posix.c      |  2 +-
>>  block/raw-win32.c      |  4 ++--
>>  block/rbd.c            |  2 +-
>>  block/sheepdog.c       |  2 +-
>>  block/vvfat.c          |  2 +-
>>  blockdev.c             |  6 ++++--
>>  hw/watchdog/watchdog.c |  3 ++-
>>  include/qemu/option.h  |  1 -
>>  qdev-monitor.c         |  2 +-
>>  qemu-img.c             |  2 +-
>>  util/qemu-config.c     |  2 +-
>>  util/qemu-option.c     |  9 ---------
>>  util/qemu-sockets.c    | 18 +++++++++---------
>>  vl.c                   | 17 ++++++++++-------
>>  21 files changed, 41 insertions(+), 45 deletions(-)
>>
>> diff --git a/block/blkdebug.c b/block/blkdebug.c
>> index 16d2b91..6b49df8 100644
>> --- a/block/blkdebug.c
>> +++ b/block/blkdebug.c
>> @@ -359,7 +359,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict 
>> *options, int flags,
>>      const char *filename, *config;
>>      int ret;
>>
>> -    opts = qemu_opts_create_nofail(&runtime_opts);
>> +    opts = qemu_opts_create(&runtime_opts, NULL, 1, &error_abort);
>>      qemu_opts_absorb_qdict(opts, options, &local_err);
>>      if (error_is_set(&local_err)) {
>>          error_propagate(errp, local_err);
>
> Err, doesn't this change fail_if_exists from zero to one?  Same
> everywhere.
>
>> diff --git a/block/blkverify.c b/block/blkverify.c
>> index 3c63528..d901852 100644
>> --- a/block/blkverify.c
>> +++ b/block/blkverify.c
>> @@ -125,7 +125,7 @@ static int blkverify_open(BlockDriverState *bs, QDict 
>> *options, int flags,
>>      const char *filename, *raw;
>>      int ret;
>>
>> -    opts = qemu_opts_create_nofail(&runtime_opts);
>> +    opts = qemu_opts_create(&runtime_opts, NULL, 1, &error_abort);
>>      qemu_opts_absorb_qdict(opts, options, &local_err);
>>      if (error_is_set(&local_err)) {
>>          error_propagate(errp, local_err);
>> diff --git a/block/curl.c b/block/curl.c
>> index 5a46f97..25dd433 100644
>> --- a/block/curl.c
>> +++ b/block/curl.c
>> @@ -413,7 +413,7 @@ static int curl_open(BlockDriverState *bs, QDict 
>> *options, int flags,
>>          return -EROFS;
>>      }
>>
>> -    opts = qemu_opts_create_nofail(&runtime_opts);
>> +    opts = qemu_opts_create(&runtime_opts, NULL, 1, &error_abort);
>>      qemu_opts_absorb_qdict(opts, options, &local_err);
>>      if (error_is_set(&local_err)) {
>>          qerror_report_err(local_err);
>> diff --git a/block/gluster.c b/block/gluster.c
>> index 877686a..38c1a72 100644
>> --- a/block/gluster.c
>> +++ b/block/gluster.c
>> @@ -298,7 +298,7 @@ static int qemu_gluster_open(BlockDriverState *bs,  
>> QDict *options,
>>      Error *local_err = NULL;
>>      const char *filename;
>>
>> -    opts = qemu_opts_create_nofail(&runtime_opts);
>> +    opts = qemu_opts_create(&runtime_opts, NULL, 1, &error_abort);
>>      qemu_opts_absorb_qdict(opts, options, &local_err);
>>      if (error_is_set(&local_err)) {
>>          qerror_report_err(local_err);
>> diff --git a/block/iscsi.c b/block/iscsi.c
>> index a2d578c..b5a8221 100644
>> --- a/block/iscsi.c
>> +++ b/block/iscsi.c
>> @@ -1241,7 +1241,7 @@ static int iscsi_open(BlockDriverState *bs, QDict 
>> *options, int flags,
>>          return -EINVAL;
>>      }
>>
>> -    opts = qemu_opts_create_nofail(&runtime_opts);
>> +    opts = qemu_opts_create(&runtime_opts, NULL, 1, &error_abort);
>>      qemu_opts_absorb_qdict(opts, options, &local_err);
>>      if (error_is_set(&local_err)) {
>>          qerror_report_err(local_err);
>> diff --git a/block/nbd.c b/block/nbd.c
>> index c8deeee..b281b9c 100644
>> --- a/block/nbd.c
>> +++ b/block/nbd.c
>> @@ -234,7 +234,7 @@ static int nbd_config(BDRVNBDState *s, QDict *options)
>>          return -EINVAL;
>>      }
>>
>> -    s->socket_opts = qemu_opts_create_nofail(&socket_optslist);
>> +    s->socket_opts = qemu_opts_create(&socket_optslist, NULL, 1, 
>> &error_abort);
>
> Long line, please wrap.
>

I have this as length 79 and it passes checkpatch. Is it just for the
sake of making some spare space?

Regards,
Peter



reply via email to

[Prev in Thread] Current Thread [Next in Thread]