From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: Re: [PATCH v3 26/32] xenconsole: try to attach to PV console if HVM fails Date: Tue, 14 Jul 2015 14:46:05 +0100 Message-ID: References: <1435923310-9019-1-git-send-email-roger.pau@citrix.com> <1435923310-9019-27-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="1342847746-788844195-1436881571=:17378" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZF0YA-000396-7Y for xen-devel@lists.xenproject.org; Tue, 14 Jul 2015 13:47:10 +0000 In-Reply-To: <1435923310-9019-27-git-send-email-roger.pau@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Roger Pau Monne Cc: xen-devel@lists.xenproject.org, Wei Liu , Ian Jackson , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org --1342847746-788844195-1436881571=:17378 Content-Type: text/plain; charset="UTF-8" Content-Length: 1860 Content-Transfer-Encoding: quoted-printable On Fri, 3 Jul 2015, Roger Pau Monne wrote: > HVM guests have always used the emulated serial console by default, but if > the emulated serial pty cannot be fetched from xenstore try to use the PV > console instead. > > Signed-off-by: Roger Pau Monn=C3=A9 > Cc: Ian Jackson > Cc: Stefano Stabellini > Cc: Ian Campbell > Cc: Wei Liu > --- > tools/console/client/main.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/tools/console/client/main.c b/tools/console/client/main.c > index f4c783b..c92553e 100644 > --- a/tools/console/client/main.c > +++ b/tools/console/client/main.c > @@ -279,7 +279,7 @@ int main(int argc, char **argv) > { 0 }, > > }; > - char *dom_path =3D NULL, *path =3D NULL; > + char *dom_path =3D NULL, *path =3D NULL, *test =3D NULL; > int spty, xsfd; > struct xs_handle *xs; > char *end; > @@ -357,9 +357,14 @@ int main(int argc, char **argv) > path =3D malloc(strlen(dom_path) + strlen("/device/console/0/tty") + 5); > if (path =3D=3D NULL) > err(ENOMEM, "malloc"); > - if (type =3D=3D CONSOLE_SERIAL) > + if (type =3D=3D CONSOLE_SERIAL) { > snprintf(path, strlen(dom_path) + strlen("/serial/0/tty") + 5, "%s/serial/%d/tty", dom_path, num); > - else { > + test =3D xs_read(xs, XBT_NULL, path, NULL); > + free(test); > + if (test =3D=3D NULL) > + goto pv_console; instead of using labels I would probably do: if (test =3D=3D NULL) type =3D CONSOLE_PV; } if (type =3D=3D CONSOLE_PV) { ... > + } else { > +pv_console: > if (num =3D=3D 0) > snprintf(path, strlen(dom_path) + strlen("/console/tty") + 1, "%s/console/tty", dom_path); > else --1342847746-788844195-1436881571=:17378 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --1342847746-788844195-1436881571=:17378--