From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QApoM-0004fK-No for qemu-devel@nongnu.org; Fri, 15 Apr 2011 16:40:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QApoL-0008Dt-PR for qemu-devel@nongnu.org; Fri, 15 Apr 2011 16:40:14 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:59249) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QApoL-0008Dp-KQ for qemu-devel@nongnu.org; Fri, 15 Apr 2011 16:40:13 -0400 Received: by ywl41 with SMTP id 41so1029344ywl.4 for ; Fri, 15 Apr 2011 13:40:12 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <4DA6B246.4080302@redhat.com> References: <20110411083304.GB22987@stefanha-thinkpad.localdomain> <4DA6B246.4080302@redhat.com> Date: Sat, 16 Apr 2011 04:40:12 +0800 Message-ID: From: Lyu Mitnick Content-Type: multipart/alternative; boundary=0016367d628c6b641904a0fb0c29 Subject: Re: [Qemu-devel] Question about total_sectors in block/vpc.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, Christoph Hellwig --0016367d628c6b641904a0fb0c29 Content-Type: text/plain; charset=ISO-8859-1 Hello Kevin, 2011/4/14 Kevin Wolf > 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 } in QEMU?? Thanks Mitnick --0016367d628c6b641904a0fb0c29 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello=A0Kevin,

2011/4/14 Kevin Wolf <kwolf@redhat.com&g= t;
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 =A0is suitable to use instead of doing the search= by
> myself
> in the case like following:
>
> /* Read out options */
> =A0 =A0 while (options && options->name) {
> =A0 =A0 =A0 =A0 if (!strcmp(options->name, BLOCK_OPT_SIZE)) {
> =A0 =A0 =A0 =A0 =A0 =A0 // do something
> =A0 =A0 =A0 =A0 } else if (!strcmp(options->name, BLOCK_OPT_CLUSTER= _SIZE)) {
> =A0 =A0 =A0 =A0 =A0 =A0// do something
> =A0 =A0 =A0 =A0 }
> =A0 =A0 =A0 =A0 options++;
> =A0 =A0 }

Yes, I think it is, though you need to check whether the option has b= een
set in order to allow use default values.

Kevin

I have no idea about the mean of "c= heck whether the option has been=A0set in=A0
order to allow use d= efault values" ,=A0would you mind to give me an example about=A0
=
it??

So as the example above. I am wondering wheth= er the code should be rewritten=A0
as:

/= * Read out options */
if(get_option_parameter(options,=A0BLOCK_OP= T_SIZE)) {
=A0=A0 =A0// do something
}

if (get= _option_parameter(options,=A0BLOCK_OPT_CLUSTER_SIZE)) {
=A0=A0 = =A0// do something
}

in QEMU??

Thanks

Mitnick

--0016367d628c6b641904a0fb0c29--