From: Avi Kivity <avi@redhat.com>
To: Jes Sorensen <jes@sgi.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [patch 0/2] QEMU maxcpus support
Date: Tue, 23 Jun 2009 18:47:41 +0300 [thread overview]
Message-ID: <4A40F91D.5060102@redhat.com> (raw)
In-Reply-To: <4A40EF9D.90303@sgi.com>
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
next prev parent reply other threads:[~2009-06-23 15:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-23 10:00 [Qemu-devel] [patch 0/2] QEMU maxcpus support Jes Sorensen
2009-06-23 10:00 ` [Qemu-devel] [patch 1/2] Introduce -maxcpus flag to QEMU and pass the value to the BIOS through FW_CFG Jes Sorensen
2009-06-23 10:00 ` [Qemu-devel] [patch 2/2] QEMU BOCHS bios patches to use maxcpus value Jes Sorensen
2009-06-23 11:37 ` [Qemu-devel] Re: [patch 0/2] QEMU maxcpus support Avi Kivity
2009-06-23 13:32 ` Jes Sorensen
2009-06-23 13:36 ` Avi Kivity
2009-06-23 15:07 ` Jes Sorensen
2009-06-23 15:47 ` Avi Kivity [this message]
2009-06-24 7:16 ` Jes Sorensen
2009-06-24 7:25 ` Filip Navara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A40F91D.5060102@redhat.com \
--to=avi@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=jes@sgi.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).