qemu-block
[Top][All Lists]
Advanced

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

Re: [PATCH 1/7] block/null: Make more explicit the driver default size i


From: Li Qiang
Subject: Re: [PATCH 1/7] block/null: Make more explicit the driver default size is 1GiB
Date: Sat, 15 Aug 2020 11:15:14 +0800

Philippe Mathieu-Daudé <f4bug@amsat.org> 于2020年8月14日周五 下午4:29写道:
>
> As it is not obvious the default size for the null block driver
> is 1 GiB, replace the obfuscated '1 << 30' magic value by a
> definition using IEC binary prefixes.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Reviewed-by: Li Qiang <liq3ea@gmail.com>

> ---
>  block/null.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/block/null.c b/block/null.c
> index 15e1d56746..8354def367 100644
> --- a/block/null.c
> +++ b/block/null.c
> @@ -11,6 +11,7 @@
>   */
>
>  #include "qemu/osdep.h"
> +#include "qemu/units.h"
>  #include "qapi/error.h"
>  #include "qapi/qmp/qdict.h"
>  #include "qapi/qmp/qstring.h"
> @@ -21,6 +22,7 @@
>
>  #define NULL_OPT_LATENCY "latency-ns"
>  #define NULL_OPT_ZEROES  "read-zeroes"
> +#define NULL_OPT_SIZE    (1 * GiB)
>
>  typedef struct {
>      int64_t length;
> @@ -86,7 +88,7 @@ static int null_file_open(BlockDriverState *bs, QDict 
> *options, int flags,
>      opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
>      qemu_opts_absorb_qdict(opts, options, &error_abort);
>      s->length =
> -        qemu_opt_get_size(opts, BLOCK_OPT_SIZE, 1 << 30);
> +        qemu_opt_get_size(opts, BLOCK_OPT_SIZE, NULL_OPT_SIZE);
>      s->latency_ns =
>          qemu_opt_get_number(opts, NULL_OPT_LATENCY, 0);
>      if (s->latency_ns < 0) {
> --
> 2.21.3
>
>



reply via email to

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