Skip to contentSkip to conversation

Change references to /dev/xen/evtchn to /dev/evtchn

PATCH In review Anthony Liguori 2 participants 2 messages Sep 7, 2005 – Sep 8, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Change references to /dev/xen/evtchn to /dev/evtchn

Change all references to /dev/xen/evtchn to /dev/evtchn as this is where udev creates the device entry. /dev/xen was the location that we used under devfs. In some of the tools, we were creating /dev/xen/evtchn if it did not already exist. We really should not do that.

We currently use the reserved major/minor range. Strictly, this is not right as we may conflict with other software. Ideally, we should use random major/minor numbers and optionally take the major/minor number as a module parameter.

Regards,

Anthony Liguori

# HG changeset patch
# User [email protected]
# Node ID b3cd1fd958bfa45f3194b2e950edc885e24d8261
# Parent 10a3d4fbd9b420f7a6e0e02bae068ff5a8f57cdf
Change all references to /dev/xen/evtchn to /dev/evtchn as this is where udev creates the device entry. /dev/xen was the location that we used under devfs. In some of the tools, we were creating /dev/xen/evtchn if it did not already exist. We really should not do that.

We currently use the reserved major/minor range. Strictly, this is not right as we may conflict with other software. Ideally, we should use random major/minor numbers and optionally take the major/minor number as a module parameter.

freebsd-5.3-xen-sparse/i386-xen/include/evtchn.h +2 -2
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf freebsd-5.3-xen-sparse/i386-xen/include/evtchn.h
@@ -96,10 +96,10 @@
 #define PORT_EXCEPTION 0x8000
 #define PORTIDX_MASK   0x7fff
 
-/* /dev/xen/evtchn resides at device number major=10, minor=200 */
+/* /dev/evtchn resides at device number major=10, minor=200 */
 #define EVTCHN_MINOR 200
 
-/* /dev/xen/evtchn ioctls: */
+/* /dev/evtchn ioctls: */
 /* EVTCHN_RESET: Clear and reinit the event buffer. Clear error condition. */
 #define EVTCHN_RESET  _IO('E', 1)
 /* EVTCHN_BIND: Bind to the specified event-channel port. */
freebsd-5.3-xen-sparse/i386-xen/xen/misc/evtchn_dev.c +3 -3
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf freebsd-5.3-xen-sparse/i386-xen/xen/misc/evtchn_dev.c
@@ -38,14 +38,14 @@
 
 
 #ifdef linuxcrap
-/* NB. This must be shared amongst drivers if more things go in /dev/xen */
+/* NB. This must be shared amongst drivers if more things go in /dev */
 static devfs_handle_t xen_dev_dir;
 #endif
 
-/* Only one process may open /dev/xen/evtchn at any time. */
+/* Only one process may open /dev/evtchn at any time. */
 static unsigned long evtchn_dev_inuse;
 
-/* Notification ring, accessed via /dev/xen/evtchn. */
+/* Notification ring, accessed via /dev/evtchn. */
 
 #define EVTCHN_RING_SIZE     2048  /* 2048 16-bit entries */
 
linux-2.6-xen-sparse/include/asm-xen/evtchn.h +2 -2
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf linux-2.6-xen-sparse/include/asm-xen/evtchn.h
@@ -121,10 +121,10 @@
  * CHARACTER-DEVICE DEFINITIONS
  */
 
-/* /dev/xen/evtchn resides at device number major=10, minor=201 */
+/* /dev/evtchn resides at device number major=10, minor=201 */
 #define EVTCHN_MINOR 201
 
-/* /dev/xen/evtchn ioctls: */
+/* /dev/evtchn ioctls: */
 /* EVTCHN_RESET: Clear and reinit the event buffer. Clear error condition. */
 #define EVTCHN_RESET  _IO('E', 1)
 /* EVTCHN_BIND: Bind to teh specified event-channel port. */
tools/console/daemon/io.c +1 -1
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf tools/console/daemon/io.c
@@ -252,7 +252,7 @@
 			close(dom->evtchn_fd);
 		/* Opening evtchn independently for each console is a bit
 		 * wastefule, but that's how the code is structured... */
-		dom->evtchn_fd = open("/dev/xen/evtchn", O_RDWR);
+		dom->evtchn_fd = open("/dev/evtchn", O_RDWR);
 		if (dom->evtchn_fd == -1) {
 			err = errno;
 			goto out;
tools/debugger/pdb/evtchn.ml +1 -1
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf tools/debugger/pdb/evtchn.ml
@@ -7,7 +7,7 @@
  *  @version 1
  *)
 
-let dev_name = "/dev/xen/evtchn"                          (* EVTCHN_DEV_NAME *)
+let dev_name = "/dev/evtchn"                             (* EVTCHN_DEV_NAME *)
 let dev_major = 10                                       (* EVTCHN_DEV_MAJOR *)
 let dev_minor = 201                                      (* EVTCHN_DEV_MINOR *)
 
tools/debugger/pdb/pdb_caml_evtchn.c +0 -15
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf tools/debugger/pdb/pdb_caml_evtchn.c
@@ -32,24 +32,9 @@
     int   evtchn_fd;
     struct stat st;
     
-    /* Make sure any existing device file links to correct device. */
-    if ( (lstat(filename, &st) != 0) ||
-         !S_ISCHR(st.st_mode) ||
-         (st.st_rdev != makedev(major, minor)) )
-    {
-        (void)unlink(filename);
-    }
-
- reopen:
     evtchn_fd = open(filename, O_RDWR); 
     if ( evtchn_fd == -1 )
     {
-        if ( (errno == ENOENT) &&
-             ((mkdir("/dev/xen", 0755) == 0) || (errno == EEXIST)) &&
-             (mknod(filename, S_IFCHR|0600, makedev(major,minor)) == 0) )
-        {
-            goto reopen;
-        }
         return -errno;
     }
 
tools/debugger/pdb/pdb_xen.c +1 -1
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf tools/debugger/pdb/pdb_xen.c
@@ -44,7 +44,7 @@
 
 #include <sys/ioctl.h>
 
-/* /dev/xen/evtchn ioctls */
+/* /dev/evtchn ioctls */
 #define EVTCHN_RESET  _IO('E', 1)                   /* clear & reinit buffer */
 #define EVTCHN_BIND   _IO('E', 2)                   /* bind to event channel */
 #define EVTCHN_UNBIND _IO('E', 3)               /* unbind from event channel */
tools/ioemu/target-i386-dm/helper2.c +1 -1
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf tools/ioemu/target-i386-dm/helper2.c
@@ -524,7 +524,7 @@
 		return NULL;
 
 	//use nonblock reading not polling, may change in future.
-	evtchn_fd = open("/dev/xen/evtchn", O_RDWR|O_NONBLOCK); 
+	evtchn_fd = open("/dev/evtchn", O_RDWR|O_NONBLOCK); 
 	if (evtchn_fd == -1) {
 		perror("open");
 		return NULL;
tools/libxc/xenctrl.h +2 -2
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf tools/libxc/xenctrl.h
@@ -344,10 +344,10 @@
 /**
  * This function generates a notify event on a bound port.
  *
- * Notifies can be read within Linux by opening /dev/xen/evtchn and reading
+ * Notifies can be read within Linux by opening /dev/evtchn and reading
  * a 16 bit value.  The result will be the port the event occurred on.  When
  * events occur, the port is masked until the 16 bit port value is written back
- * to the file.  When /dev/xen/evtchn is opened, it has to be bound via an
+ * to the file.  When /dev/evtchn is opened, it has to be bound via an
  * ioctl to each port to listen on.  The ioctl for binding is _IO('E', 2).  The
  * parameter is the port to listen on.
  *
tools/xenstore/xenstored_domain.c +1 -16
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf tools/xenstore/xenstored_domain.c
@@ -433,15 +433,11 @@
 {
 }
 
-#define EVTCHN_DEV_NAME  "/dev/xen/evtchn"
-#define EVTCHN_DEV_MAJOR 10
-#define EVTCHN_DEV_MINOR 201
+#define EVTCHN_DEV_NAME  "/dev/evtchn"
 
 /* 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);
 
@@ -458,19 +454,8 @@
 #ifdef TESTING
 	eventchn_fd = fake_open_eventchn();
 #else
-	/* 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

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

#1 lore raw
Quoted 4 lines · Anthony Liguori

Change all references to /dev/xen/evtchn to /dev/evtchn as this is where udev creates the device entry. /dev/xen was the location that we used under devfs. In some of the tools, we were creating /dev/xen/evtchn if it did not already exist. We really should not do that.

It'd be good to keep /dev/xen/evtchn. Perhaps we can make udev create the device node there instead of /dev/evtchn? Also changes less code....

-- Keir