qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Question about total_sectors in block/vpc.c


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] Question about total_sectors in block/vpc.c
Date: Mon, 11 Apr 2011 09:33:04 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, Apr 10, 2011 at 05:02:20PM +0800, Lyu Mitnick wrote:
> diff --git a/block.c b/block.c
> index f731c7a..a80ec49 100644
> --- a/block.c
> +++ b/block.c
> @@ -239,6 +239,16 @@ int bdrv_create(BlockDriver *drv, const char* filename,
>     if (!drv->bdrv_create)
>         return -ENOTSUP;
> 
> +       while (options && options->name) {
> +               if (!strcmp(options->name, "size")) {
> +                       if (options->value.n % 512 == 0)
> +                               break;
> +                       else
> +                               return -EINVAL;
> +               }
> +               options++;
> +       }

Please use BDRV_SECTOR_SIZE instead of hardcoding 512.

get_option_parameter() does the search for you, please use it instead of
duplicating the loop.

Please see the CODING_STYLE and HACKING files, new code should follow it:
 * Indentation is 4 spaces
 * Always use {} even for if/else with single-statement bodies

Stefan



reply via email to

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