[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] 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 anthony@xxxxxxxxxxxxxxxxxxxxx
# 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.

Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>

diff -r 10a3d4fbd9b4 -r b3cd1fd958bf 
freebsd-5.3-xen-sparse/i386-xen/include/evtchn.h
--- a/freebsd-5.3-xen-sparse/i386-xen/include/evtchn.h  Wed Sep  7 21:35:05 2005
+++ b/freebsd-5.3-xen-sparse/i386-xen/include/evtchn.h  Wed Sep  7 23:51:42 2005
@@ -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. */
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf 
freebsd-5.3-xen-sparse/i386-xen/xen/misc/evtchn_dev.c
--- a/freebsd-5.3-xen-sparse/i386-xen/xen/misc/evtchn_dev.c     Wed Sep  7 
21:35:05 2005
+++ b/freebsd-5.3-xen-sparse/i386-xen/xen/misc/evtchn_dev.c     Wed Sep  7 
23:51:42 2005
@@ -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 */
 
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf 
linux-2.6-xen-sparse/include/asm-xen/evtchn.h
--- a/linux-2.6-xen-sparse/include/asm-xen/evtchn.h     Wed Sep  7 21:35:05 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/evtchn.h     Wed Sep  7 23:51:42 2005
@@ -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. */
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf tools/console/daemon/io.c
--- a/tools/console/daemon/io.c Wed Sep  7 21:35:05 2005
+++ b/tools/console/daemon/io.c Wed Sep  7 23:51:42 2005
@@ -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;
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf tools/debugger/pdb/evtchn.ml
--- a/tools/debugger/pdb/evtchn.ml      Wed Sep  7 21:35:05 2005
+++ b/tools/debugger/pdb/evtchn.ml      Wed Sep  7 23:51:42 2005
@@ -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 *)
 
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf tools/debugger/pdb/pdb_caml_evtchn.c
--- a/tools/debugger/pdb/pdb_caml_evtchn.c      Wed Sep  7 21:35:05 2005
+++ b/tools/debugger/pdb/pdb_caml_evtchn.c      Wed Sep  7 23:51:42 2005
@@ -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;
     }
 
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf tools/debugger/pdb/pdb_xen.c
--- a/tools/debugger/pdb/pdb_xen.c      Wed Sep  7 21:35:05 2005
+++ b/tools/debugger/pdb/pdb_xen.c      Wed Sep  7 23:51:42 2005
@@ -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 */
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf tools/ioemu/target-i386-dm/helper2.c
--- a/tools/ioemu/target-i386-dm/helper2.c      Wed Sep  7 21:35:05 2005
+++ b/tools/ioemu/target-i386-dm/helper2.c      Wed Sep  7 23:51:42 2005
@@ -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;
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Wed Sep  7 21:35:05 2005
+++ b/tools/libxc/xenctrl.h     Wed Sep  7 23:51:42 2005
@@ -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.
  *
diff -r 10a3d4fbd9b4 -r b3cd1fd958bf tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c Wed Sep  7 21:35:05 2005
+++ b/tools/xenstore/xenstored_domain.c Wed Sep  7 23:51:42 2005
@@ -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
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.