From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LXYuw-000414-8i for qemu-devel@nongnu.org; Thu, 12 Feb 2009 05:35:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LXYuu-00040P-Cn for qemu-devel@nongnu.org; Thu, 12 Feb 2009 05:35:37 -0500 Received: from [199.232.76.173] (port=46084 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LXYuu-00040H-39 for qemu-devel@nongnu.org; Thu, 12 Feb 2009 05:35:36 -0500 Received: from mx2.suse.de ([195.135.220.15]:33898) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LXYut-0006Qx-5z for qemu-devel@nongnu.org; Thu, 12 Feb 2009 05:35:35 -0500 Message-ID: <4993FD1C.50906@suse.de> Date: Thu, 12 Feb 2009 11:42:36 +0100 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Add args for quiet and prompt References: <1234421329-8119-1-git-send-email-FOSS@AtlasTechnologiesInc.com> <1234421329-8119-3-git-send-email-FOSS@AtlasTechnologiesInc.com> In-Reply-To: <1234421329-8119-3-git-send-email-FOSS@AtlasTechnologiesInc.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: FOSS@AtlasTechnologiesInc.com Cc: qemu-devel@nongnu.org Cory Fields schrieb: > Syntax is -boot [cad],prompt=x,quiet=x where x is [0,1,true,false] > Boot drive is mandatory > If prompt is set user will see "Press f12 for boot menu" > This behavior has changed, it is now off by default > > If quiet is set user will see no normal text output from bios. > Errors will stil be displayed. > > Signed-off-by: Cory Fields > --- > vl.c | 48 ++++++++++++++++++++++++++++++++++++++++++++---- > 1 files changed, 44 insertions(+), 4 deletions(-) > > diff --git a/vl.c b/vl.c > index 3676537..b2da109 100644 > --- a/vl.c > +++ b/vl.c > @@ -230,6 +230,9 @@ int no_shutdown = 0; > int cursor_hide = 1; > int graphic_rotate = 0; > int daemonize = 0; > +int biosprompt = 0; > +int quietbios = 0; > + > const char *option_rom[MAX_OPTION_ROMS]; > int nb_option_roms; > int semihosting_enabled = 0; > @@ -3875,6 +3878,10 @@ static void help(int exitcode) > "-sd file use 'file' as SecureDigital card image\n" > "-pflash file use 'file' as a parallel flash image\n" > "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n" > + " [,quiet=true|false]\n" > + " hide bios text [default=false]\n" > + " [,prompt=true|false]\n" > + " hide boot menu prompt [default=true]\n" > "-snapshot write to temporary files instead of disk image files\n" > "-m megs set virtual RAM size to megs MB [default=%d]\n" > #ifndef _WIN32 > @@ -4556,7 +4563,7 @@ int main(int argc, char **argv, char **envp) > int snapshot, linux_boot, net_boot; > const char *initrd_filename; > const char *kernel_filename, *kernel_cmdline; > - const char *boot_devices = ""; > + char boot_devices[32] = ""; > DisplayState *ds; > DisplayChangeListener *dcl; > int cyls, heads, secs, translation; What is the reason for this change? You could still split optarg in the code below and keep boot_devices as a pointer... > @@ -4829,14 +4836,15 @@ int main(int argc, char **argv, char **envp) > drive_add(optarg, CDROM_ALIAS); > break; > case QEMU_OPTION_boot: > - boot_devices = optarg; > /* We just do some generic consistency checks */ > { > /* Could easily be extended to 64 devices if needed */ > const char *p; > + int num_drive_letters = 0; > + char boot_opts[128]; > > boot_devices_bitmap = 0; > - for (p = boot_devices; *p != '\0'; p++) { > + for (p = optarg; *p != '\0' && *p != ','; p++) { > /* Allowed boot devices are: > * a b : floppy disk drives > * c ... f : IDE disk drives > @@ -4856,6 +4864,38 @@ int main(int argc, char **argv, char **envp) > exit(1); > } > boot_devices_bitmap |= 1 << (*p - 'a'); > + boot_devices[num_drive_letters]=*p; ...so you would avoid a buffer overflow here... > + num_drive_letters++; > + > + } > + > + strcpy(boot_opts,optarg); ...and here. ;-) Kevin