All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Xen-changelog] Create /dev/xen/evtchn if it doesn't exist.
       [not found] <E1ED6aa-0006WS-5H@xenbits.xensource.com>
@ 2005-09-07 21:06 ` Anthony Liguori
  2005-09-07 22:31   ` Jeremy Katz
  0 siblings, 1 reply; 2+ messages in thread
From: Anthony Liguori @ 2005-09-07 21:06 UTC (permalink / raw)
  To: xen-devel; +Cc: Steven Hand

Another way to solve this problem is to just use "/dev/evtchn" as that 
is what will be created by udev.

In fact, what does everyone think about just deprecating /dev/xen/evtchn 
and just using /dev/evtchn everywhere?  I'll submit a patch if it's 
acceptable (including removing the places where we create /dev/xen/evtchn).

Regards,

Anthony Liguori

Xen patchbot -unstable wrote:

># HG changeset patch
># User shand@ubuntu.eng.hq.xensource.com
># Node ID b7c7cb88f0ba9c0473d926c3cf531f9e086c3d09
># Parent  7d0fb56b4a916cccc497d200e6a8329537ce740d
>Create /dev/xen/evtchn if it doesn't exist. 
>
>Signed-off-by: Steven Hand <steven@xensource.com>
>
>diff -r 7d0fb56b4a91 -r b7c7cb88f0ba tools/xenstore/xenstored_domain.c
>--- a/tools/xenstore/xenstored_domain.c	Wed Sep  7 19:01:31 2005
>+++ b/tools/xenstore/xenstored_domain.c	Wed Sep  7 20:30:00 2005
>@@ -433,33 +433,57 @@
> {
> }
> 
>+#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)
> {
>-	/* 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);
>-
>+    /* 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 (privcmd)");
>+
>+    talloc_set_destructor(xc_handle, close_xc_handle);
>+    
> #ifdef TESTING
>-	eventchn_fd = fake_open_eventchn();
>+    eventchn_fd = fake_open_eventchn();
> #else
>-	eventchn_fd = open("/dev/xen/evtchn", O_RDWR);
>+    {
>+        struct stat st;
>+        
>+        /* 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");
>-
>-	if (xc_evtchn_bind_virq(*xc_handle, VIRQ_DOM_EXC, &virq_port))
>-		barf_perror("Failed to bind to domain exception virq");
>-
>-	if (ioctl(eventchn_fd, EVENTCHN_BIND, virq_port) != 0)
>-		barf_perror("Failed to bind to domain exception virq port");
>-
>-	return eventchn_fd;
>-}
>+    if (eventchn_fd < 0)
>+        barf_perror("Failed to open connection to hypervisor (evtchn)");
>+    
>+    if (xc_evtchn_bind_virq(*xc_handle, VIRQ_DOM_EXC, &virq_port))
>+        barf_perror("Failed to bind to domain exception virq");
>+    
>+    if (ioctl(eventchn_fd, EVENTCHN_BIND, virq_port) != 0)
>+        barf_perror("Failed to bind to domain exception virq port");
>+    
>+    return eventchn_fd;
>+}
>
>_______________________________________________
>Xen-changelog mailing list
>Xen-changelog@lists.xensource.com
>http://lists.xensource.com/xen-changelog
>
>  
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Re: [Xen-changelog] Create /dev/xen/evtchn if it doesn't exist.
  2005-09-07 21:06 ` [Xen-changelog] Create /dev/xen/evtchn if it doesn't exist Anthony Liguori
@ 2005-09-07 22:31   ` Jeremy Katz
  0 siblings, 0 replies; 2+ messages in thread
From: Jeremy Katz @ 2005-09-07 22:31 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: xen-devel@lists.xensource.com

On Wed, 2005-09-07 at 16:06 -0500, Anthony Liguori wrote:
> Another way to solve this problem is to just use "/dev/evtchn" as that 
> is what will be created by udev.
> 
> In fact, what does everyone think about just deprecating /dev/xen/evtchn 
> and just using /dev/evtchn everywhere?  I'll submit a patch if it's 
> acceptable (including removing the places where we create /dev/xen/evtchn).

Sounds sane to me.  If that's not done, then really, xenstored should
instead look in /proc to figure out the major/minor in case Linus ever
goes through with his threat to make all major/minors random ;-)

Jeremy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-09-07 22:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1ED6aa-0006WS-5H@xenbits.xensource.com>
2005-09-07 21:06 ` [Xen-changelog] Create /dev/xen/evtchn if it doesn't exist Anthony Liguori
2005-09-07 22:31   ` Jeremy Katz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.