ia64/xen-unstable

changeset 2556:376368a98ad9

bitkeeper revision 1.1159.1.182 (41553903CsSyg7DOBEoizwc3e0V0OA)

Move Xen evetchn chrdev to 10,201 so we don't conflict with tun.
author kaf24@freefall.cl.cam.ac.uk
date Sat Sep 25 09:23:15 2004 +0000 (2004-09-25)
parents 1fc8bdfed466
children 0516d2b22caf
files linux-2.6.8.1-xen-sparse/include/asm-xen/evtchn.h tools/python/xen/lowlevel/xu/xu.c
line diff
     1.1 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/evtchn.h	Fri Sep 24 17:46:24 2004 +0000
     1.2 +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/evtchn.h	Sat Sep 25 09:23:15 2004 +0000
     1.3 @@ -72,8 +72,8 @@ static inline void notify_via_evtchn(int
     1.4   * CHARACTER-DEVICE DEFINITIONS
     1.5   */
     1.6  
     1.7 -/* /dev/xen/evtchn resides at device number major=10, minor=200 */
     1.8 -#define EVTCHN_MINOR 200
     1.9 +/* /dev/xen/evtchn resides at device number major=10, minor=201 */
    1.10 +#define EVTCHN_MINOR 201
    1.11  
    1.12  /* /dev/xen/evtchn ioctls: */
    1.13  /* EVTCHN_RESET: Clear and reinit the event buffer. Clear error condition. */
     2.1 --- a/tools/python/xen/lowlevel/xu/xu.c	Fri Sep 24 17:46:24 2004 +0000
     2.2 +++ b/tools/python/xen/lowlevel/xu/xu.c	Sat Sep 25 09:23:15 2004 +0000
     2.3 @@ -15,6 +15,7 @@
     2.4  #include <sys/socket.h>
     2.5  #include <sys/mman.h>
     2.6  #include <sys/poll.h>
     2.7 +#include <sys/sysmacros.h>
     2.8  #include <netinet/in.h>
     2.9  #include <fcntl.h>
    2.10  #include <unistd.h>
    2.11 @@ -37,7 +38,7 @@
    2.12  /* NB. The following should be kept in sync with the kernel's evtchn driver. */
    2.13  #define EVTCHN_DEV_NAME  "/dev/xen/evtchn"
    2.14  #define EVTCHN_DEV_MAJOR 10
    2.15 -#define EVTCHN_DEV_MINOR 200
    2.16 +#define EVTCHN_DEV_MINOR 201
    2.17  /* /dev/xen/evtchn ioctls: */
    2.18  /* EVTCHN_RESET: Clear and reinit the event buffer. Clear error condition. */
    2.19  #define EVTCHN_RESET  _IO('E', 1)
    2.20 @@ -192,12 +193,19 @@ staticforward PyTypeObject xu_notifier_t
    2.21  static PyObject *xu_notifier_new(PyObject *self, PyObject *args)
    2.22  {
    2.23      xu_notifier_object *xun;
    2.24 +    struct stat st;
    2.25  
    2.26      if ( !PyArg_ParseTuple(args, "") )
    2.27          return NULL;
    2.28  
    2.29      xun = PyObject_New(xu_notifier_object, &xu_notifier_type);
    2.30  
    2.31 +    /* Make sure any existing device file links to correct device. */
    2.32 +    if ( (lstat(EVTCHN_DEV_NAME, &st) != 0) ||
    2.33 +         !S_ISCHR(st.st_mode) ||
    2.34 +         (st.st_rdev != makedev(EVTCHN_DEV_MAJOR, EVTCHN_DEV_MINOR)) )
    2.35 +        (void)unlink(EVTCHN_DEV_NAME);
    2.36 +
    2.37   reopen:
    2.38      xun->evtchn_fd = open(EVTCHN_DEV_NAME, O_NONBLOCK|O_RDWR);
    2.39      if ( xun->evtchn_fd == -1 )
    2.40 @@ -205,7 +213,7 @@ static PyObject *xu_notifier_new(PyObjec
    2.41          if ( (errno == ENOENT) &&
    2.42               ((mkdir("/dev/xen", 0755) == 0) || (errno == EEXIST)) &&
    2.43               (mknod(EVTCHN_DEV_NAME, S_IFCHR|0600, 
    2.44 -                    (EVTCHN_DEV_MAJOR << 8) | EVTCHN_DEV_MINOR) == 0) )
    2.45 +                    makedev(EVTCHN_DEV_MAJOR,EVTCHN_DEV_MINOR)) == 0) )
    2.46              goto reopen;
    2.47          PyObject_Del((PyObject *)xun);
    2.48          return PyErr_SetFromErrno(PyExc_IOError);