From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Ling Xiaofeng" Subject: Re: [PATCH] enable xm console for vmx guest Date: Mon, 7 Nov 2005 21:18:06 +0800 Message-ID: <001b01c5e39d$b1f4aca0$9a6010ac@ccr.corp.intel.com> References: <436EBFB2.10303@intel.com> <200511062210.53265.dsteklof@us.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0018_01C5E3E0.BEEF7230" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Daniel Stekloff , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. ------=_NextPart_000_0018_01C5E3E0.BEEF7230 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Yes, thanks for pointing out. I've updated in the attach patch. ----- Original Message ----- From: "Daniel Stekloff" To: Cc: "Ling, Xiaofeng" Sent: Monday, November 07, 2005 2:10 PM Subject: Re: [Xen-devel] [PATCH] enable xm console for vmx guest > On Sunday 06 November 2005 18:45, Ling, Xiaofeng wrote: > > Enable xm console for vmx guest. > > When the serial port is redirect to pty, write the allocated > > device to xenstore, then xm console can get it. > > TODO:serial port by pty shall not block if there are no reading > > on the other end > > > > Signed-off-by: Xiaofeng Ling > > Hi, > > I believe that you must free() path in store_console_dev() when you're done > with it: > > from xs.h: > > /* Query the home path of a domain. Call free() after use. > */ > char *xs_get_domain_path(struct xs_handle *h, unsigned int domid); > > Thanks, > > Dan > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > ------=_NextPart_000_0018_01C5E3E0.BEEF7230 Content-Type: application/octet-stream; name="vmxconsole.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="vmxconsole.patch" # HG changeset patch=0A= # User Xiaofeng Ling =0A= # Node ID 34d300132f3b4dc3944fbe980c97b84671c40e46=0A= # Parent 1e82f5c841ac5cac5598040a5bc305835ff2965c=0A= Enable xm console for vmx guest.=0A= When the serial port is redirect to pty, write the allocated=0A= device to xenstore, then xm console can get it.=0A= TODO:serial port by pty shall not block if there are no reading=0A= on the other end=0A= =0A= Signed-off-by: Xiaofeng Ling =0A= =0A= diff -r 01a959ee39dd tools/examples/xmexample.vmx=0A= --- a/tools/examples/xmexample.vmx Mon Nov 7 10:47:10 2005 +0800=0A= +++ b/tools/examples/xmexample.vmx Mon Nov 7 20:52:16 2005 +0800=0A= @@ -117,6 +117,11 @@=0A= #nographic=3D0=0A= =0A= =0A= +#-----------------------------------------------------------------------= ------=0A= +# serial port re-direct to pty deivce, /dev/pts/n =0A= +# then xm console or minicom can connect=0A= +#serial=3D'pty'=0A= +=0A= = #------------------------------------------------------------------------= ----=0A= # enable ne2000, default =3D 0(use pcnet)=0A= ne2000=3D0=0A= diff -r 01a959ee39dd tools/ioemu/target-i386-dm/Makefile=0A= --- a/tools/ioemu/target-i386-dm/Makefile Mon Nov 7 10:47:10 2005 +0800=0A= +++ b/tools/ioemu/target-i386-dm/Makefile Mon Nov 7 20:52:16 2005 +0800=0A= @@ -7,7 +7,7 @@=0A= TARGET_PATH=3D$(SRC_PATH)/target-$(TARGET_ARCH)=0A= VPATH=3D$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio=0A= DEFINES=3D-I. -I$(TARGET_PATH) -I$(SRC_PATH)=0A= -DEFINES+=3D -I$(XEN_ROOT)/tools/libxc=0A= +DEFINES+=3D -I$(XEN_ROOT)/tools/libxc -I$(XEN_ROOT)/tools/xenstore=0A= ifdef CONFIG_USER_ONLY=0A= VPATH+=3D:$(SRC_PATH)/linux-user=0A= DEFINES+=3D-I$(SRC_PATH)/linux-user = -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)=0A= @@ -188,7 +188,7 @@=0A= #########################################################=0A= =0A= DEFINES+=3D-D_GNU_SOURCE -D_FILE_OFFSET_BITS=3D64 -D_LARGEFILE_SOURCE=0A= -LIBS+=3D-lm -L../../libxc -lxenctrl=0A= +LIBS+=3D-lm -L../../libxc -lxenctrl -L../../xenstore -lxenstore=0A= ifndef CONFIG_USER_ONLY=0A= LIBS+=3D-lz=0A= endif=0A= diff -r 01a959ee39dd tools/ioemu/vl.c=0A= --- a/tools/ioemu/vl.c Mon Nov 7 10:47:10 2005 +0800=0A= +++ b/tools/ioemu/vl.c Mon Nov 7 20:52:16 2005 +0800=0A= @@ -76,6 +76,7 @@=0A= #endif /* CONFIG_SDL */=0A= =0A= #include "xenctrl.h"=0A= +#include "xs.h"=0A= #include "exec-all.h"=0A= =0A= //#define DO_TB_FLUSH=0A= @@ -1171,6 +1172,47 @@=0A= return chr;=0A= }=0A= =0A= +int store_console_dev(int domid, char *pts)=0A= +{=0A= + int xc_handle;=0A= + unsigned int len =3D 0;=0A= + struct xs_handle *xs;=0A= + char *path;=0A= +=0A= + xs =3D xs_daemon_open();=0A= + if (xs =3D=3D NULL) {=0A= + fprintf(logfile, "Could not contact XenStore\n");=0A= + return -1;=0A= + }=0A= +=0A= + xc_handle =3D xc_interface_open();=0A= + if (xc_handle =3D=3D -1) {=0A= + fprintf(logfile, "xc_interface_open() error\n");=0A= + return -1;=0A= + }=0A= + =0A= + path =3D xs_get_domain_path(xs, domid);=0A= + if (path =3D=3D NULL) {=0A= + fprintf(logfile, "xs_get_domain_path() error\n");=0A= + return -1;=0A= + }=0A= + path =3D realloc(path, strlen(path) + strlen("/console/tty") + 1);=0A= + if (path =3D=3D NULL) {=0A= + fprintf(logfile, "realloc error\n");=0A= + return -1;=0A= + }=0A= + strcat(path, "/console/tty");=0A= + if (!xs_write(xs, NULL, path, pts, strlen(pts))) {=0A= + fprintf(logfile, "xs_write for console fail");=0A= + return -1;=0A= + }=0A= +=0A= + xs_daemon_close(xs);=0A= + close(xc_handle);=0A= +=0A= + return 0;=0A= +}=0A= +=0A= #if defined(__linux__)=0A= CharDriverState *qemu_chr_open_pty(void)=0A= {=0A= @@ -1182,6 +1224,7 @@=0A= return NULL;=0A= }=0A= fprintf(stderr, "char device redirected to %s\n", slave_name);=0A= + store_console_dev(domid, slave_name);=0A= return qemu_chr_open_fd(master_fd, master_fd);=0A= }=0A= #else=0A= @@ -2701,7 +2744,9 @@=0A= break;=0A= case QEMU_OPTION_nographic:=0A= pstrcpy(monitor_device, sizeof(monitor_device), = "stdio");=0A= - pstrcpy(serial_devices[0], sizeof(serial_devices[0]), = "stdio");=0A= + if(!strcmp(serial_devices[0], "vc"))=0A= + pstrcpy(serial_devices[0], = sizeof(serial_devices[0]),=0A= + "stdio");=0A= nographic =3D 1;=0A= break;=0A= #ifdef CONFIG_VNC=0A= ------=_NextPart_000_0018_01C5E3E0.BEEF7230 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.xensource.com http://lists.xensource.com/xen-devel ------=_NextPart_000_0018_01C5E3E0.BEEF7230--