[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Question about total_sectors in block/vpc.c
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] Question about total_sectors in block/vpc.c |
Date: |
Mon, 18 Apr 2011 15:13:33 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Fedora/3.0.10-1.fc12 Thunderbird/3.0.10 |
Am 15.04.2011 22:40, schrieb Lyu Mitnick:
> Hello Kevin,
>
> 2011/4/14 Kevin Wolf <address@hidden <mailto:address@hidden>>
>
> Am 13.04.2011 22:59, schrieb Lyu Mitnick:
> > Hello Stefan,
> >
> > I have a question about get_option_parameter(). I am wondering whether
> > get_option_parameter is suitable to use instead of doing the
> search by
> > myself
> > in the case like following:
> >
> > /* Read out options */
> > while (options && options->name) {
> > if (!strcmp(options->name, BLOCK_OPT_SIZE)) {
> > // do something
> > } else if (!strcmp(options->name, BLOCK_OPT_CLUSTER_SIZE)) {
> > // do something
> > }
> > options++;
> > }
>
> Yes, I think it is, though you need to check whether the option has been
> set in order to allow use default values.
>
> Kevin
>
>
> I have no idea about the mean of "check whether the option has been set in
> order to allow use default values" , would you mind to give me an
> example about
> it??
>
> So as the example above. I am wondering whether the code should be
> rewritten
> as:
>
> /* Read out options */
> if(get_option_parameter(options, BLOCK_OPT_SIZE)) {
> // do something
> }
>
> if (get_option_parameter(options, BLOCK_OPT_CLUSTER_SIZE)) {
> // do something
> }
get_option_parameter would never return NULL in your example.
Kevin
Re: [Qemu-devel] Question about total_sectors in block/vpc.c, Christoph Hellwig, 2011/04/11