From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUHTH-0006Zw-8R for qemu-devel@nongnu.org; Tue, 25 Aug 2015 12:53:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUHT8-000681-S9 for qemu-devel@nongnu.org; Tue, 25 Aug 2015 12:53:10 -0400 Received: from e37.co.us.ibm.com ([32.97.110.158]:55010) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUHT8-00067R-8D for qemu-devel@nongnu.org; Tue, 25 Aug 2015 12:53:06 -0400 Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 25 Aug 2015 10:53:05 -0600 Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 8D2231FF002D for ; Tue, 25 Aug 2015 10:42:24 -0600 (MDT) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t7PGpEoT43778068 for ; Tue, 25 Aug 2015 09:51:15 -0700 Received: from d03av01.boulder.ibm.com (localhost [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t7PGpEiJ010180 for ; Tue, 25 Aug 2015 10:51:14 -0600 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1435751267-26378-8-git-send-email-marcandre.lureau@gmail.com> References: <1435751267-26378-1-git-send-email-marcandre.lureau@gmail.com> <1435751267-26378-8-git-send-email-marcandre.lureau@gmail.com> Message-ID: <20150825160431.11069.76525@loki> Date: Tue, 25 Aug 2015 11:04:31 -0500 Subject: Re: [Qemu-devel] [PATCH 07/12] qga: fill default options in main() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , qemu-devel@nongnu.org Quoting Marc-Andr=C3=A9 Lureau (2015-07-01 06:47:42) > Fill all default options during main(). This is a preparation patch > to allow to dump the configuration. > = > Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Michael Roth > --- > qga/main.c | 34 +++++++++++++++++----------------- > 1 file changed, 17 insertions(+), 17 deletions(-) > = > diff --git a/qga/main.c b/qga/main.c > index b965f61..5575637 100644 > --- a/qga/main.c > +++ b/qga/main.c > @@ -658,23 +658,6 @@ static gboolean channel_init(GAState *s, const gchar= *method, const gchar *path) > { > GAChannelMethod channel_method; > = > - if (method =3D=3D NULL) { > - method =3D "virtio-serial"; > - } > - > - if (path =3D=3D NULL) { > - if (strcmp(method, "virtio-serial") =3D=3D 0 ) { > - /* try the default path for the virtio-serial port */ > - path =3D QGA_VIRTIO_PATH_DEFAULT; > - } else if (strcmp(method, "isa-serial") =3D=3D 0){ > - /* try the default path for the serial port - COM1 */ > - path =3D QGA_SERIAL_PATH_DEFAULT; > - } else { > - g_critical("must specify a path for this channel"); > - return false; > - } > - } > - > if (strcmp(method, "virtio-serial") =3D=3D 0) { > s->virtio =3D true; /* virtio requires special handling in some = cases */ > channel_method =3D GA_CHANNEL_VIRTIO_SERIAL; > @@ -1076,6 +1059,23 @@ int main(int argc, char **argv) > state_dir =3D g_strdup(dfl_pathnames.state_dir); > } > = > + if (method =3D=3D NULL) { > + method =3D g_strdup("virtio-serial"); > + } > + > + if (device_path =3D=3D NULL) { > + if (strcmp(method, "virtio-serial") =3D=3D 0) { > + /* try the default path for the virtio-serial port */ > + device_path =3D g_strdup(QGA_VIRTIO_PATH_DEFAULT); > + } else if (strcmp(method, "isa-serial") =3D=3D 0) { > + /* try the default path for the serial port - COM1 */ > + device_path =3D g_strdup(QGA_SERIAL_PATH_DEFAULT); > + } else { > + g_critical("must specify a path for this channel"); > + goto out_bad; > + } > + } > + > #ifdef _WIN32 > /* On win32 the state directory is application specific (be it the d= efault > * or a user override). We got past the command line parsing; let's = create > -- = > 2.4.3 >=20