From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: Re: [PATCH v4 27/31] xenconsole: try to attach to PV console if HVM fails Date: Fri, 7 Aug 2015 13:25:13 +0100 Message-ID: <20150807122513.GO6005@zion.uk.xensource.com> References: <1438942688-7610-1-git-send-email-roger.pau@citrix.com> <1438942688-7610-28-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZNgiB-0004kP-Uy for xen-devel@lists.xenproject.org; Fri, 07 Aug 2015 12:25:24 +0000 Content-Disposition: inline In-Reply-To: <1438942688-7610-28-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 On Fri, Aug 07, 2015 at 12:18:04PM +0200, 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=E9 > Cc: Ian Jackson > Cc: Stefano Stabellini > Cc: Ian Campbell > Cc: Wei Liu Acked-by: Wei Liu > --- > Changes since v3: > - Drop the usage of a label and instead use if conditions. > --- > tools/console/client/main.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > = > diff --git a/tools/console/client/main.c b/tools/console/client/main.c > index f130a60..d006fdc 100644 > --- a/tools/console/client/main.c > +++ b/tools/console/client/main.c > @@ -333,7 +333,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; > @@ -415,9 +415,15 @@ 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/ser= ial/%d/tty", dom_path, num); > - else { > + test =3D xs_read(xs, XBT_NULL, path, NULL); > + free(test); > + if (test =3D=3D NULL) > + type =3D CONSOLE_PV; > + } > + if (type =3D=3D CONSOLE_PV) { > + > if (num =3D=3D 0) > snprintf(path, strlen(dom_path) + strlen("/console/tty") + 1, "%s/con= sole/tty", dom_path); > else > -- = > 1.9.5 (Apple Git-50.3)