WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] merge?

# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 7bc32f4c67fb57a1afb86cb5f004107a742249d5
# Parent  a39b1fa10edc70d2ec446f5b181c7101ffeb2f93
# Parent  b7c7cb88f0ba9c0473d926c3cf531f9e086c3d09
merge?

diff -r a39b1fa10edc -r 7bc32f4c67fb tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c Wed Sep  7 21:24:34 2005
+++ b/tools/xenstore/xenstored_domain.c Wed Sep  7 21:34:17 2005
@@ -1,4 +1,4 @@
-/* 
+/*
     Domain communications for Xen Store Daemon.
     Copyright (C) 2005 Rusty Russell IBM Corporation
 
@@ -407,7 +407,7 @@
        else
                domain = find_domain_by_domid(domid);
 
-       if (!domain) 
+       if (!domain)
                send_error(conn, ENOENT);
        else
                send_reply(conn, XS_GET_DOMAIN_PATH, domain->path,
@@ -433,27 +433,49 @@
 {
 }
 
+#define EVTCHN_DEV_NAME  "/dev/xen/evtchn"
+#define EVTCHN_DEV_MAJOR 10
+#define EVTCHN_DEV_MINOR 201
+
 /* Returns the event channel handle. */
 int domain_init(void)
 {
+       struct stat st;
+
        /* The size of the ringbuffer: half a page minus head structure. */
        ringbuf_datasize = getpagesize() / 2 - sizeof(struct ringbuf_head);
 
        xc_handle = talloc(talloc_autofree_context(), int);
        if (!xc_handle)
                barf_perror("Failed to allocate domain handle");
+
        *xc_handle = xc_interface_open();
        if (*xc_handle < 0)
                barf_perror("Failed to open connection to hypervisor");
+
        talloc_set_destructor(xc_handle, close_xc_handle);
 
 #ifdef TESTING
        eventchn_fd = fake_open_eventchn();
 #else
-       eventchn_fd = open("/dev/xen/evtchn", O_RDWR);
+       /* Make sure any existing device file links to correct device. */
+       if ((lstat(EVTCHN_DEV_NAME, &st) != 0) || !S_ISCHR(st.st_mode) ||
+           (st.st_rdev != makedev(EVTCHN_DEV_MAJOR, EVTCHN_DEV_MINOR)))
+               (void)unlink(EVTCHN_DEV_NAME);
+
+ reopen:
+       eventchn_fd = open(EVTCHN_DEV_NAME, O_NONBLOCK|O_RDWR);
+       if (eventchn_fd == -1) {
+               if ((errno == ENOENT) &&
+                   ((mkdir("/dev/xen", 0755) == 0) || (errno == EEXIST)) &&
+                   (mknod(EVTCHN_DEV_NAME, S_IFCHR|0600,
+                          makedev(EVTCHN_DEV_MAJOR, EVTCHN_DEV_MINOR)) == 0))
+                       goto reopen;
+               return -errno;
+       }
 #endif
        if (eventchn_fd < 0)
-               barf_perror("Failed to open connection to hypervisor");
+               barf_perror("Failed to open connection evtchn device");
 
        if (xc_evtchn_bind_virq(*xc_handle, VIRQ_DOM_EXC, &virq_port))
                barf_perror("Failed to bind to domain exception virq");

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>