From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Daniel P. Berrange" Subject: PATCH: Fix PVFB device initialization Date: Fri, 26 Oct 2007 17:12:28 +0100 Message-ID: <20071026161227.GD31349@redhat.com> Reply-To: "Daniel P. Berrange" Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="AhhlLboLdkugWU4S" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline The final series of patches I sent out lost 2 hunks in the big refactoring patches I did thanks to a messed up rebase/rediff :-( The attached patch fixes the device nodename initialization so that watches work correctly. Signed-off-by: Daniel P. Berrange Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=| --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="xen-pvfb-nodename.patch" diff -r a1da8e458838 tools/ioemu/hw/xenfb.c --- a/tools/ioemu/hw/xenfb.c Wed Oct 24 16:07:10 2007 -0400 +++ b/tools/ioemu/hw/xenfb.c Fri Oct 26 11:58:09 2007 -0400 @@ -180,6 +180,51 @@ static void xenfb_device_init(struct xen dev->xenfb = xenfb; } +static char *xenfb_path_in_dom(struct xs_handle *xsh, + char *buf, size_t size, + unsigned domid, const char *fmt, ...) +{ + va_list ap; + char *domp = xs_get_domain_path(xsh, domid); + int n; + + if (domp == NULL) + return NULL; + + n = snprintf(buf, size, "%s/", domp); + free(domp); + if (n >= size) + return NULL; + + va_start(ap, fmt); + n += vsnprintf(buf + n, size - n, fmt, ap); + va_end(ap); + if (n >= size) + return NULL; + + return buf; +} + +static int xenfb_device_set_domain(struct xenfb_device *dev, int domid) +{ + dev->otherend_id = domid; + + if (!xenfb_path_in_dom(dev->xenfb->xsh, + dev->otherend, sizeof(dev->otherend), + domid, "device/%s/0", dev->devicetype)) { + errno = ENOENT; + return -1; + } + if (!xenfb_path_in_dom(dev->xenfb->xsh, + dev->nodename, sizeof(dev->nodename), + 0, "backend/%s/%d/0", dev->devicetype, domid)) { + errno = ENOENT; + return -1; + } + + return 0; +} + struct xenfb *xenfb_new(int domid, DisplayState *ds) { struct xenfb *xenfb = qemu_malloc(sizeof(struct xenfb)); @@ -212,6 +257,10 @@ struct xenfb *xenfb_new(int domid, Displ xenfb->xsh = xs_daemon_open(); if (!xenfb->xsh) goto fail; + + xenfb->ds = ds; + xenfb_device_set_domain(&xenfb->fb, domid); + xenfb_device_set_domain(&xenfb->kbd, domid); fprintf(stderr, "FB: Waiting for KBD backend creation\n"); xenfb_wait_for_backend(&xenfb->kbd, xenfb_backend_created_kbd); --AhhlLboLdkugWU4S 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 --AhhlLboLdkugWU4S--