ia64/xen-unstable

changeset 1137:4d18dbf45e16

bitkeeper revision 1.759 (40431ad2YWsArtM623Q4wpLgPvrt5A)

xend.c, Makefile:
new file
Many files:
Rename /proc/xeno and /dev/xeno to /proc/xen and /dev/xen. Created a skeleton xend.
author kaf24@scramble.cl.cam.ac.uk
date Mon Mar 01 11:13:22 2004 +0000 (2004-03-01)
parents 1d81002643e4
children 5b6243a7571b
files .rootkeys tools/Makefile tools/balloon/balloon.c tools/misc/xen_cpuperf.c tools/misc/xen_log.c tools/xc/lib/xc_misc.c tools/xc/py/XenoUtil.py tools/xend/Makefile tools/xend/xend.c xenolinux-2.4.25-sparse/arch/xeno/drivers/evtchn/xl_evtchn.c xenolinux-2.4.25-sparse/arch/xeno/lib/xeno_proc.c
line diff
     1.1 --- a/.rootkeys	Mon Mar 01 09:48:25 2004 +0000
     1.2 +++ b/.rootkeys	Mon Mar 01 11:13:22 2004 +0000
     1.3 @@ -88,6 +88,8 @@ 3fbd0a3dTwnDcfdw0-v46dPbX98zDw tools/xc/
     1.4  3fbd0a42l40lM0IICw2jXbQBVZSdZg tools/xc/py/Xc.c
     1.5  3fbd4bd6GtGwZGxYUJPOheYIR7bPaA tools/xc/py/XenoUtil.py
     1.6  3fbd0a40yT6G3M9hMpaz5xTUdl0E4g tools/xc/py/setup.py
     1.7 +40431ac64Hj4ixUnKmlugZKhXPFE_Q tools/xend/Makefile
     1.8 +40431ac8wrUEj-XM7B8smFtx_HA7lQ tools/xend/xend.c
     1.9  403a3edbrr8RE34gkbR40zep98SXbg tools/xentrace/Makefile
    1.10  403a3edbVpV2E_wq1zeEkJ_n4Uu2eg tools/xentrace/xentrace.c
    1.11  403a3edb0lzD0Fojc-NYNoXr3SYrnA tools/xentrace/xentrace_cpusplit.py
     2.1 --- a/tools/Makefile	Mon Mar 01 09:48:25 2004 +0000
     2.2 +++ b/tools/Makefile	Mon Mar 01 11:13:22 2004 +0000
     2.3 @@ -23,6 +23,7 @@ all:
     2.4  	$(MAKE) -C misc
     2.5  	$(MAKE) -C examples
     2.6  	$(MAKE) -C xentrace
     2.7 +	$(MAKE) -C xend
     2.8  
     2.9  install: all
    2.10  	$(MAKE) -C balloon install
    2.11 @@ -30,6 +31,7 @@ install: all
    2.12  	$(MAKE) -C misc install
    2.13  	$(MAKE) -C examples install
    2.14  	$(MAKE) -C xentrace install
    2.15 +	$(MAKE) -C xend install
    2.16  
    2.17  dist: all
    2.18  	$(MAKE) -C balloon dist
    2.19 @@ -37,6 +39,7 @@ dist: all
    2.20  	$(MAKE) -C misc dist
    2.21  	$(MAKE) -C examples dist
    2.22  	$(MAKE) -C xentrace dist
    2.23 +	$(MAKE) -C xend dist
    2.24  
    2.25  clean:
    2.26  	$(MAKE) -C balloon clean
    2.27 @@ -45,4 +48,5 @@ clean:
    2.28  	$(MAKE) -C examples clean
    2.29  	$(MAKE) -C nsplitd clean
    2.30  	$(MAKE) -C xentrace clean
    2.31 +	$(MAKE) -C xend clean
    2.32  
     3.1 --- a/tools/balloon/balloon.c	Mon Mar 01 09:48:25 2004 +0000
     3.2 +++ b/tools/balloon/balloon.c	Mon Mar 01 11:13:22 2004 +0000
     3.3 @@ -1,7 +1,7 @@
     3.4  /******************************************************************************
     3.5   * balloon.c
     3.6   *
     3.7 - * Xeno balloon driver userspace control tool. Used to shrink/grow domain's 
     3.8 + * Xen balloon driver userspace control tool. Used to shrink/grow domain's 
     3.9   * memory.
    3.10   *
    3.11   * Copyright (c) 2003, B Dragovic
    3.12 @@ -31,7 +31,7 @@ typedef struct user_balloon_op {
    3.13  
    3.14  static int open_balloon_proc()
    3.15  {
    3.16 -    return open("/proc/xeno/balloon", O_RDWR);
    3.17 +    return open("/proc/xen/balloon", O_RDWR);
    3.18  }
    3.19  
    3.20  /* inflate balloon function signals to kernel it should relinquish memory */
     4.1 --- a/tools/misc/xen_cpuperf.c	Mon Mar 01 09:48:25 2004 +0000
     4.2 +++ b/tools/misc/xen_cpuperf.c	Mon Mar 01 11:13:22 2004 +0000
     4.3 @@ -1,10 +1,5 @@
     4.4  /*
     4.5   * User mode program to prod MSR values through /proc/perfcntr
     4.6 - *
     4.7 - *
     4.8 - * $Id$
     4.9 - *
    4.10 - * $Log$
    4.11   */
    4.12  
    4.13  #include <sys/types.h>
    4.14 @@ -217,7 +212,7 @@ int main(int argc, char **argv)
    4.15          }
    4.16      }
    4.17  
    4.18 -    if ( (privfd = open("/proc/xeno/privcmd", O_RDWR)) == -1 )
    4.19 +    if ( (privfd = open("/proc/xen/privcmd", O_RDWR)) == -1 )
    4.20      {
    4.21          fprintf(stderr, "Could not open privileged Xen control interface.\n");
    4.22          exit(1);
     5.1 --- a/tools/misc/xen_log.c	Mon Mar 01 09:48:25 2004 +0000
     5.2 +++ b/tools/misc/xen_log.c	Mon Mar 01 11:13:22 2004 +0000
     5.3 @@ -155,11 +155,11 @@ int main(int argc, char **argv)
     5.4                  errno = 2;
     5.5                  errexit("daemon");
     5.6              } else {
     5.7 -                openlog("xenolog", LOG_PID, SYSLOGTO);
     5.8 +                openlog("xen_log", LOG_PID, SYSLOGTO);
     5.9              }
    5.10              break;
    5.11          case 'h':
    5.12 -            printf("Usage: xenolog [options]\n");
    5.13 +            printf("Usage: xen_log [options]\n");
    5.14              printf("Capture and display output of xen domains.\n\n");
    5.15              printf("  -d       Daemonize and send output to syslog.\n");
    5.16              exit(0);
     6.1 --- a/tools/xc/lib/xc_misc.c	Mon Mar 01 09:48:25 2004 +0000
     6.2 +++ b/tools/xc/lib/xc_misc.c	Mon Mar 01 11:13:22 2004 +0000
     6.3 @@ -8,7 +8,7 @@
     6.4  
     6.5  int xc_interface_open(void)
     6.6  {
     6.7 -    int fd = open("/proc/xeno/privcmd", O_RDWR);
     6.8 +    int fd = open("/proc/xen/privcmd", O_RDWR);
     6.9      if ( fd == -1 )
    6.10          PERROR("Could not obtain handle on privileged command interface");
    6.11      return fd;
     7.1 --- a/tools/xc/py/XenoUtil.py	Mon Mar 01 09:48:25 2004 +0000
     7.2 +++ b/tools/xc/py/XenoUtil.py	Mon Mar 01 11:13:22 2004 +0000
     7.3 @@ -72,7 +72,7 @@ def setup_vfr_rules_for_vif(dom,vif,addr
     7.4      is expressed as a textual dotted quad, and set up appropriate routing
     7.5      rules in Xen. No return value.
     7.6      """
     7.7 -    fd = os.open( '/proc/xeno/vfr', os.O_WRONLY )
     7.8 +    fd = os.open( '/proc/xen/vfr', os.O_WRONLY )
     7.9      if ( re.search( '169\.254', addr) ):
    7.10          os.write( fd, 'ADD ACCEPT srcaddr=' + addr +
    7.11                    ' srcaddrmask=255.255.255.255' +
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/tools/xend/Makefile	Mon Mar 01 11:13:22 2004 +0000
     8.3 @@ -0,0 +1,30 @@
     8.4 +
     8.5 +CC       = gcc
     8.6 +CFLAGS   = -Wall -O3 
     8.7 +CFLAGS  += -I../../xen/include -I../../xenolinux-sparse/include
     8.8 +
     8.9 +HDRS     = $(wildcard *.h)
    8.10 +OBJS     = $(patsubst %.c,%.o,$(wildcard *.c))
    8.11 +
    8.12 +BIN      = xend
    8.13 +
    8.14 +all: $(BIN)
    8.15 +
    8.16 +install: all
    8.17 +	mkdir -p /usr/sbin
    8.18 +	cp $(BIN) /usr/sbin
    8.19 +	chmod 755 /usr/sbin/$(BIN)
    8.20 +
    8.21 +dist: all
    8.22 +	mkdir -p ../../../install/sbin
    8.23 +	cp $(BIN) ../../../install/sbin
    8.24 +	chmod 755 ../../../install/sbin/$(BIN)
    8.25 +
    8.26 +clean:
    8.27 +	$(RM) *.a *.so *.o *.rpm $(BIN)
    8.28 +
    8.29 +$(BIN): $(OBJS)
    8.30 +	$(CC) $(CFLAGS) -o $@ $^ -L../xc/lib -lxc
    8.31 +
    8.32 +%.o: %.c $(HDRS) Makefile
    8.33 +	$(CC) $(CFLAGS) -c -o $@ $<
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/tools/xend/xend.c	Mon Mar 01 11:13:22 2004 +0000
     9.3 @@ -0,0 +1,12 @@
     9.4 +/******************************************************************************
     9.5 + * xend.c
     9.6 + * 
     9.7 + * The grand Xen daemon. For now it's just a console concentrator.
     9.8 + * 
     9.9 + * Copyright (c) 2004, K A Fraser
    9.10 + */
    9.11 +
    9.12 +int main(int argc, char **argv)
    9.13 +{
    9.14 +    return 0;
    9.15 +}
    10.1 --- a/xenolinux-2.4.25-sparse/arch/xeno/drivers/evtchn/xl_evtchn.c	Mon Mar 01 09:48:25 2004 +0000
    10.2 +++ b/xenolinux-2.4.25-sparse/arch/xeno/drivers/evtchn/xl_evtchn.c	Mon Mar 01 11:13:22 2004 +0000
    10.3 @@ -27,26 +27,26 @@ typedef void (*evtchn_receiver_t)(unsign
    10.4  #define PORT_DISCONNECT 0x8000
    10.5  #define PORTIDX_MASK    0x7fff
    10.6  
    10.7 -/* /dev/xeno/evtchn resides at device number major=10, minor=200 */
    10.8 +/* /dev/xen/evtchn resides at device number major=10, minor=200 */
    10.9  #define EVTCHN_MINOR 200
   10.10  
   10.11 -/* /dev/xeno/evtchn ioctls: */
   10.12 +/* /dev/xen/evtchn ioctls: */
   10.13  /* EVTCHN_RESET: Clear and reinit the event buffer. Clear error condition. */
   10.14  #define EVTCHN_RESET _IO('E', 1)
   10.15  
   10.16 -/* NB. This must be shared amongst drivers if more things go in /dev/xeno */
   10.17 -static devfs_handle_t xeno_dev_dir;
   10.18 +/* NB. This must be shared amongst drivers if more things go in /dev/xen */
   10.19 +static devfs_handle_t xen_dev_dir;
   10.20  
   10.21 -/* Only one process may open /dev/xeno/evtchn at any time. */
   10.22 +/* Only one process may open /dev/xen/evtchn at any time. */
   10.23  static unsigned long evtchn_dev_inuse;
   10.24  
   10.25 -/* Notification ring, accessed via /dev/xeno/evtchn. */
   10.26 +/* Notification ring, accessed via /dev/xen/evtchn. */
   10.27  #define RING_SIZE     2048  /* 2048 16-bit entries */
   10.28  #define RING_MASK(_i) ((_i)&(RING_SIZE-1))
   10.29  static u16 *ring;
   10.30  static unsigned int ring_cons, ring_prod, ring_overflow;
   10.31  
   10.32 -/* Processes wait on this queue via /dev/xeno/evtchn when ring is empty. */
   10.33 +/* Processes wait on this queue via /dev/xen/evtchn when ring is empty. */
   10.34  static DECLARE_WAIT_QUEUE_HEAD(evtchn_wait);
   10.35  static struct fasync_struct *evtchn_async_queue;
   10.36  
   10.37 @@ -228,12 +228,17 @@ static ssize_t evtchn_read(struct file *
   10.38  
   10.39      add_wait_queue(&evtchn_wait, &wait);
   10.40  
   10.41 -    if ( (count <= 0) || (count > PAGE_SIZE) || ((count&1) != 0) )
   10.42 +    count &= ~1; /* even number of bytes */
   10.43 +
   10.44 +    if ( count == 0 )
   10.45      {
   10.46 -        rc = -EINVAL;
   10.47 +        rc = 0;
   10.48          goto out;
   10.49      }
   10.50  
   10.51 +    if ( count > PAGE_SIZE )
   10.52 +        count = PAGE_SIZE;
   10.53 +
   10.54      for ( ; ; )
   10.55      {
   10.56          set_current_state(TASK_INTERRUPTIBLE);
   10.57 @@ -307,12 +312,17 @@ static ssize_t evtchn_write(struct file 
   10.58      if ( kbuf == NULL )
   10.59          return -ENOMEM;
   10.60  
   10.61 -    if ( (count <= 0) || (count > PAGE_SIZE) || ((count&1) != 0) )
   10.62 +    count &= ~1; /* even number of bytes */
   10.63 +
   10.64 +    if ( count == 0 )
   10.65      {
   10.66 -        rc = -EINVAL;
   10.67 +        rc = 0;
   10.68          goto out;
   10.69      }
   10.70  
   10.71 +    if ( count > PAGE_SIZE )
   10.72 +        count = PAGE_SIZE;
   10.73 +
   10.74      if ( copy_from_user(kbuf, buf, count) != 0 )
   10.75      {
   10.76          rc = -EFAULT;
   10.77 @@ -427,8 +437,8 @@ static int __init init_module(void)
   10.78          return err;
   10.79      }
   10.80  
   10.81 -    /* (DEVFS) create directory '/dev/xeno'. */
   10.82 -    xeno_dev_dir = devfs_mk_dir(NULL, "xeno", NULL);
   10.83 +    /* (DEVFS) create directory '/dev/xen'. */
   10.84 +    xen_dev_dir = devfs_mk_dir(NULL, "xen", NULL);
   10.85  
   10.86      /* (DEVFS) &link_dest[pos] == '../misc/evtchn'. */
   10.87      pos = devfs_generate_path(evtchn_miscdev.devfs_handle, 
   10.88 @@ -437,8 +447,8 @@ static int __init init_module(void)
   10.89      if ( pos >= 0 )
   10.90          strncpy(&link_dest[pos], "../", 3);
   10.91  
   10.92 -    /* (DEVFS) symlink '/dev/xeno/evtchn' -> '../misc/evtchn'. */
   10.93 -    (void)devfs_mk_symlink(xeno_dev_dir, 
   10.94 +    /* (DEVFS) symlink '/dev/xen/evtchn' -> '../misc/evtchn'. */
   10.95 +    (void)devfs_mk_symlink(xen_dev_dir, 
   10.96                             "evtchn", 
   10.97                             DEVFS_FL_DEFAULT, 
   10.98                             &link_dest[pos],
    11.1 --- a/xenolinux-2.4.25-sparse/arch/xeno/lib/xeno_proc.c	Mon Mar 01 09:48:25 2004 +0000
    11.2 +++ b/xenolinux-2.4.25-sparse/arch/xeno/lib/xeno_proc.c	Mon Mar 01 11:13:22 2004 +0000
    11.3 @@ -7,8 +7,8 @@ static struct proc_dir_entry *xeno_base;
    11.4  struct proc_dir_entry *create_xeno_proc_entry(const char *name, mode_t mode)
    11.5  {
    11.6      if ( xeno_base == NULL )
    11.7 -        if ( (xeno_base = proc_mkdir("xeno", &proc_root)) == NULL )
    11.8 -            panic("Couldn't create /proc/xeno");
    11.9 +        if ( (xeno_base = proc_mkdir("xen", &proc_root)) == NULL )
   11.10 +            panic("Couldn't create /proc/xen");
   11.11      return create_proc_entry(name, mode, xeno_base);
   11.12  }
   11.13