Skip to contentSkip to conversation

PATCH: Fix PVFB device initialization

PATCH Daniel P. Berrange 2 participants 2 messages Oct 26, 2007 – Oct 29, 2007

lore
Share & tools
lore
#0 lore raw

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.

Dan.

Signature · 4 lines
|=- 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  -=| 
tools/ioemu/hw/xenfb.c +49 -0
diff -r a1da8e458838 tools/ioemu/hw/xenfb.c
@@ -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);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 3 lines · Daniel P. Berrange

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.

Thanks Dan, this seems to solve the regression I was seeing on ia64.

Alex

Signature · 1 line
Alex Williamson                             HP Open Source & Linux Org.