diff options
author | Guillem Jover <guillem@hadrons.org> | 2011-09-09 03:40:24 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2011-09-12 21:43:22 +0200 |
commit | ec76bb9b04b851f403fac72fddaa8613025c7da4 (patch) | |
tree | addc5ba4589bf2cc07e78c2a19d6c476455e0b43 /device | |
parent | b509223167d6cf0780e1dd7ac9b2bde6bf6a2728 (diff) |
Remove unused [!MACH_KERNEL] driver code
Use «unifdef -DMACK_KERNEL=1» as a starting point, but only remove
the code not exposed on public headers, the rest is needed to build
properly from userland.
* device/cons.c [!MACH_KERNEL]: Remove includes.
[!MACH_KERNEL] (constty): Remove variable.
(cninit, cnmaygetc) [MACH_KERNEL]: Remove preprocessor conditionals.
[!MACH_KERNEL] (cnopen, cnclose, cnread, cnwrite, cnioctl, cnselect)
(cncontrol): Remove functions.
* device/cons.h (struct consdev) [MACH_KERNEL]: Remove preprocessor
conditional.
* device/kmsg.h [MACH_KERNEL]: Likewise.
* i386/i386at/autoconf.c [!MACH_KERNEL]: Remove includes.
* i386/i386at/kd_event.c [!MACH_KERNEL]: Likewise.
[!MACH_KERNEL] (kbd_sel, kbdpgrp, kbdflag): Remove variables.
[!MACH_KERNEL] (KBD_COLL, KBD_ASYNC, KBD_NBIO): Remove macros.
(kbdopen, kbdclose, kbd_enqueue) [!MACH_KERNEL]: Remove code.
[!MACH_KERNEL] (kbdioctl, kbdselect, kbdread): Remove functions.
[!MACH_KERNEL] (X_kdb_enter_init, X_kdb_exit_init: Likewise.
* i386/i386at/kd_mouse.c [!MACH_KERNEL]: Remove includes.
[!MACH_KERNEL] (mouse_sel, mousepgrp, mouseflag): Remove variables.
[!MACH_KERNEL] (MOUSE_COLL, MOUSE_ASYNC, MOUSE_NBIO): Remove macros.
(mouseopen, mouseclose, kd_mouse_read, mouse_enqueue) [!MACH_KERNEL]: Remove
code.
[!MACH_KERNEL] (mouseioctl, mouseselect, mouseread): Remove functions.
* i386/i386at/lpr.c [!MACH_KERNEL]: Remove includes.
(lpropen) [MACH_KERNEL]: Remove preprocessor conditionals.
(lpropen, lprclose, lprstart) [!MACH_KERNEL]: Remove code.
[!MACH_KERNEL] (lprwrite, lprioctl, lprstop): Remove functions.
* i386/i386at/rtc.c (readtodc, writetodc) [!MACH_KERNEL]: Remove code.
* kern/mach_factor.c [MACH_KERNEL]: Remove preprocessor conditional.
* xen/time.c (readtodc) [!MACH_KERNEL]: Remove code.
Diffstat (limited to 'device')
-rw-r--r-- | device/cons.c | 109 | ||||
-rw-r--r-- | device/cons.h | 2 | ||||
-rw-r--r-- | device/kmsg.h | 2 |
3 files changed, 0 insertions, 113 deletions
diff --git a/device/cons.c b/device/cons.c index e3e95ff..f26f22c 100644 --- a/device/cons.c +++ b/device/cons.c @@ -22,22 +22,10 @@ #include <string.h> #include <kern/debug.h> -#ifdef MACH_KERNEL #include <sys/types.h> #include <device/conf.h> #include <mach/boolean.h> #include <device/cons.h> -#else -#include <sys/param.h> -#include <sys/user.h> -#include <sys/systm.h> -#include <sys/buf.h> -#include <sys/ioctl.h> -#include <sys/tty.h> -#include <sys/file.h> -#include <sys/conf.h> -#include <hpdev/cons.h> -#endif #ifdef MACH_KMSG #include <device/io_req.h> @@ -46,9 +34,6 @@ static int cn_inited = 0; static struct consdev *cn_tab = 0; /* physical console device info */ -#ifndef MACH_KERNEL -static struct tty *constty = 0; /* virtual console output device */ -#endif /* * ROM getc/putc primitives. @@ -76,10 +61,8 @@ void cninit() { struct consdev *cp; -#ifdef MACH_KERNEL dev_ops_t cn_ops; int x; -#endif if (cn_inited) return; @@ -103,7 +86,6 @@ cninit() * Initialize as console */ (*cp->cn_init)(cp); -#ifdef MACH_KERNEL /* * Look up its dev_ops pointer in the device table and * place it in the device indirection table. @@ -111,7 +93,6 @@ cninit() if (dev_name_lookup(cp->cn_name, &cn_ops, &x) == FALSE) panic("cninit: dev_name_lookup failed"); dev_set_indirection("console", cn_ops, minor(cp->cn_dev)); -#endif #if CONSBUFSIZE > 0 /* * Now that the console is initialized, dump any chars in @@ -134,97 +115,9 @@ cninit() /* * No console device found, not a problem for BSD, fatal for Mach */ -#ifdef MACH_KERNEL panic("can't find a console device"); -#endif } -#ifndef MACH_KERNEL -cnopen(dev, flag) - dev_t dev; -{ - if (cn_tab == NULL) - return(0); - dev = cn_tab->cn_dev; - return ((*cdevsw[major(dev)].d_open)(dev, flag)); -} - -cnclose(dev, flag) - dev_t dev; -{ - if (cn_tab == NULL) - return(0); - dev = cn_tab->cn_dev; - return ((*cdevsw[major(dev)].d_close)(dev, flag)); -} - -cnread(dev, uio) - dev_t dev; - struct uio *uio; -{ - if (cn_tab == NULL) - return(0); - dev = cn_tab->cn_dev; - return ((*cdevsw[major(dev)].d_read)(dev, uio)); -} - -cnwrite(dev, uio) - dev_t dev; - struct uio *uio; -{ - if (cn_tab == NULL) - return(0); - dev = cn_tab->cn_dev; - return ((*cdevsw[major(dev)].d_write)(dev, uio)); -} - -cnioctl(dev, cmd, data, flag) - dev_t dev; - caddr_t data; -{ - if (cn_tab == NULL) - return(0); - /* - * Superuser can always use this to wrest control of console - * output from the "virtual" console. - */ - if (cmd == TIOCCONS && constty) { - if (!suser()) - return(EPERM); - constty = NULL; - return(0); - } - dev = cn_tab->cn_dev; - return ((*cdevsw[major(dev)].d_ioctl)(dev, cmd, data, flag)); -} - -cnselect(dev, rw) - dev_t dev; - int rw; -{ - if (cn_tab == NULL) - return(1); - return(ttselect(cn_tab->cn_dev, rw)); -} - -#ifndef hp300 -/* - * XXX Should go away when the new CIO MUX driver is in place - */ -#define d_control d_mmap -cncontrol(dev, cmd, data) - dev_t dev; - int cmd; - int data; -{ - if (cn_tab == NULL) - return(0); - dev = cn_tab->cn_dev; - return((*cdevsw[major(dev)].d_control)(dev, cmd, data)); -} -#undef d_control -#endif -#endif int cngetc() @@ -236,7 +129,6 @@ cngetc() return (0); } -#ifdef MACH_KERNEL int cnmaygetc() { @@ -246,7 +138,6 @@ cnmaygetc() return ((*romgetc)(0)); return (0); } -#endif void cnputc(c) diff --git a/device/cons.h b/device/cons.h index c210f8c..6a0ae85 100644 --- a/device/cons.h +++ b/device/cons.h @@ -26,9 +26,7 @@ #include <sys/types.h> struct consdev { -#ifdef MACH_KERNEL char *cn_name; /* name of device in dev_name_list */ -#endif int (*cn_probe)(struct consdev *cp); /* probe hardware and fill in consdev info */ int (*cn_init)(struct consdev *cp); /* turn on as console */ int (*cn_getc)(dev_t dev, int wait); /* kernel getchar interface */ diff --git a/device/kmsg.h b/device/kmsg.h index adfc945..b8c1f36 100644 --- a/device/kmsg.h +++ b/device/kmsg.h @@ -1,7 +1,6 @@ #ifndef _DEVICE_KMSG_H_ #define _DEVICE_KMSG_H_ 1 -#ifdef MACH_KERNEL #include <sys/types.h> @@ -15,6 +14,5 @@ io_return_t kmsggetstat (dev_t dev, int flavor, int *data, unsigned int *count); void kmsg_putchar (int c); -#endif /* MACH_KERNEL */ #endif /* !_DEVICE_KMSG_H_ */ |