From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MJ8D1-0000yj-S7 for qemu-devel@nongnu.org; Tue, 23 Jun 2009 11:46:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MJ8Cw-0000wy-TD for qemu-devel@nongnu.org; Tue, 23 Jun 2009 11:46:55 -0400 Received: from [199.232.76.173] (port=36667 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MJ8Cw-0000wl-A7 for qemu-devel@nongnu.org; Tue, 23 Jun 2009 11:46:50 -0400 Received: from mx2.redhat.com ([66.187.237.31]:38951) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MJ8Cv-0007sh-P5 for qemu-devel@nongnu.org; Tue, 23 Jun 2009 11:46:50 -0400 Message-ID: <4A40F91D.5060102@redhat.com> Date: Tue, 23 Jun 2009 18:47:41 +0300 From: Avi Kivity MIME-Version: 1.0 References: <20090623100009.827553739@sgi.com> <4A40BE90.4040709@redhat.com> <4A40D965.7010508@sgi.com> <4A40DA69.7010300@redhat.com> <4A40EF9D.90303@sgi.com> In-Reply-To: <4A40EF9D.90303@sgi.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [patch 0/2] QEMU maxcpus support List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes Sorensen Cc: Anthony Liguori , qemu-devel@nongnu.org On 06/23/2009 06:07 PM, Jes Sorensen wrote: > On 06/23/2009 03:36 PM, Avi Kivity wrote: >> On 06/23/2009 04:32 PM, Jes Sorensen wrote: >>>> I should have said this at your previous post, but it only occurred to >>>> me now: we could have -smp 4,maxcpus=65536 instead of a new parameter. >>> >>> We could do that too, but is it really worth it? It seems to me >>> -maxcpus >>> is fine? >> >> The trend is to consolidate related options into a single option, -to >> -avoid -command -lines -with -too -many -dashes. > > Ok, so how about this then? > > > DEF("smp", HAS_ARG, QEMU_OPTION_smp, > - "-smp n set the number of CPUs to 'n' [default=1]\n") > + "-smp n,[maxcpus=cpus]\n" > -smp n[,maxcpus=cpus] > @@ -5550,12 +5551,29 @@ int main(int argc, char **argv, char **e > usb_devices_index++; > break; > case QEMU_OPTION_smp: > - smp_cpus = atoi(optarg); > + { > + char *p; > + char option[128]; > + smp_cpus = strtol(optarg,&p, 10); > if (smp_cpus< 1) { > fprintf(stderr, "Invalid number of CPUs\n"); > exit(1); > } > + if (*p++ != ',') > + break; > Won't this misparse "-smp 17z"? > + if (get_param_value(option, 128, "maxcpus", p)) > + max_cpus = strtol(option, NULL, 0); > + if (max_cpus< smp_cpus) { > + fprintf(stderr, "maxcpus must be equal to or greater than " > + "smp\n"); > + exit(1); > + } > + if (max_cpus> 255) { > + fprintf(stderr, "Unsupported number of maxcpus\n"); > + exit(1); > + } > break; > + } > We really need a table-driven parser for options. -- error compiling committee.c: too many arguments to function