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

[Xen-changelog] [xen-unstable] [LINUX] console: Add option to use /dev/xvc0, major=204, minor=191.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 8832712b0b3740daf9c2d5993fcc1d640ff1564e
# Parent  15e80a946a6a7b8f865416e0c9c707d3ce413e3d
[LINUX] console: Add option to use /dev/xvc0, major=204, minor=191.

The major/minor has now been allocated to us by lanana.org.

This is based on previous patches from:
 Jeremy Katz <katzj@xxxxxxxxxx>
 Amos Waterland <apw@xxxxxxxxxx>

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/drivers/xen/console/console.c |   68 +++++++++++++--------
 1 files changed, 43 insertions(+), 25 deletions(-)

diff -r 15e80a946a6a -r 8832712b0b37 
linux-2.6-xen-sparse/drivers/xen/console/console.c
--- a/linux-2.6-xen-sparse/drivers/xen/console/console.c        Wed Nov 29 
11:07:51 2006 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c        Wed Nov 29 
11:37:59 2006 +0000
@@ -64,13 +64,20 @@
  *  'xencons=off'  [XC_OFF]:     Console is disabled.
  *  'xencons=tty'  [XC_TTY]:     Console attached to '/dev/tty[0-9]+'.
  *  'xencons=ttyS' [XC_SERIAL]:  Console attached to '/dev/ttyS[0-9]+'.
+ *  'xencons=xvc'  [XC_SERIAL]:  Console attached to '/dev/xvc0'.
  *                 [XC_DEFAULT]: DOM0 -> XC_SERIAL ; all others -> XC_TTY.
  * 
  * NB. In mode XC_TTY, we create dummy consoles for tty2-63. This suppresses
  * warnings from standard distro startup scripts.
  */
-static enum { XC_OFF, XC_DEFAULT, XC_TTY, XC_SERIAL } xc_mode = XC_DEFAULT;
+static enum {
+       XC_OFF, XC_DEFAULT, XC_TTY, XC_SERIAL, XC_XVC
+} xc_mode = XC_DEFAULT;
 static int xc_num = -1;
+
+/* /dev/xvc0 device number allocated by lanana.org. */
+#define XEN_XVC_MAJOR 204
+#define XEN_XVC_MINOR 191
 
 #ifdef CONFIG_MAGIC_SYSRQ
 static unsigned long sysrq_requested;
@@ -82,27 +89,23 @@ static int __init xencons_setup(char *st
        char *q;
        int n;
 
-       if (!strncmp(str, "ttyS", 4))
+       if (!strncmp(str, "ttyS", 4)) {
                xc_mode = XC_SERIAL;
-       else if (!strncmp(str, "tty", 3))
+               str += 4;
+       } else if (!strncmp(str, "tty", 3)) {
                xc_mode = XC_TTY;
-       else if (!strncmp(str, "off", 3))
+               str += 3;
+       } else if (!strncmp(str, "xvc", 3)) {
+               xc_mode = XC_XVC;
+               str += 3;
+       } else if (!strncmp(str, "off", 3)) {
                xc_mode = XC_OFF;
-
-       switch (xc_mode) {
-       case XC_SERIAL:
-               n = simple_strtol(str+4, &q, 10);
-               if (q > (str + 4))
-                       xc_num = n;
-               break;
-       case XC_TTY:
-               n = simple_strtol(str+3, &q, 10);
-               if (q > (str + 3))
-                       xc_num = n;
-               break;
-       default:
-               break;
-       }
+               str += 3;
+       }
+
+       n = simple_strtol(str, &q, 10);
+       if (q != str)
+               xc_num = n;
 
        return 1;
 }
@@ -201,6 +204,12 @@ static int __init xen_console_init(void)
        }
 
        switch (xc_mode) {
+       case XC_XVC:
+               strcpy(kcons_info.name, "xvc");
+               if (xc_num == -1)
+                       xc_num = 0;
+               break;
+
        case XC_SERIAL:
                strcpy(kcons_info.name, "ttyS");
                if (xc_num == -1)
@@ -305,7 +314,7 @@ void dom0_init_screen_info(const struct 
 /******************** User-space console driver (/dev/console) ************/
 
 #define DRV(_d)         (_d)
-#define DUMMY_TTY(_tty) ((xc_mode != XC_SERIAL) &&             \
+#define DUMMY_TTY(_tty) ((xc_mode == XC_TTY) &&                \
                         ((_tty)->index != (xc_num - 1)))
 
 static struct termios *xencons_termios[MAX_NR_CONSOLES];
@@ -628,8 +637,8 @@ static int __init xencons_init(void)
                        return rc;
        }
 
-       xencons_driver = alloc_tty_driver((xc_mode == XC_SERIAL) ?
-                                         1 : MAX_NR_CONSOLES);
+       xencons_driver = alloc_tty_driver((xc_mode == XC_TTY) ?
+                                         MAX_NR_CONSOLES : 1);
        if (xencons_driver == NULL)
                return -ENOMEM;
 
@@ -644,14 +653,23 @@ static int __init xencons_init(void)
        DRV(xencons_driver)->termios         = xencons_termios;
        DRV(xencons_driver)->termios_locked  = xencons_termios_locked;
 
-       if (xc_mode == XC_SERIAL) {
+       switch (xc_mode) {
+       case XC_XVC:
+               DRV(xencons_driver)->name        = "xvc";
+               DRV(xencons_driver)->major       = XEN_XVC_MAJOR;
+               DRV(xencons_driver)->minor_start = XEN_XVC_MINOR;
+               DRV(xencons_driver)->name_base   = xc_num;
+               break;
+       case XC_SERIAL:
                DRV(xencons_driver)->name        = "ttyS";
                DRV(xencons_driver)->minor_start = 64 + xc_num;
-               DRV(xencons_driver)->name_base   = 0 + xc_num;
-       } else {
+               DRV(xencons_driver)->name_base   = xc_num;
+               break;
+       default:
                DRV(xencons_driver)->name        = "tty";
                DRV(xencons_driver)->minor_start = 1;
                DRV(xencons_driver)->name_base   = 1;
+               break;
        }
 
        tty_set_operations(xencons_driver, &xencons_ops);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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