summaryrefslogtreecommitdiff
path: root/i386/i386at/kd_mouse.c
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2011-09-09 03:40:24 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2011-09-12 21:43:22 +0200
commitec76bb9b04b851f403fac72fddaa8613025c7da4 (patch)
treeaddc5ba4589bf2cc07e78c2a19d6c476455e0b43 /i386/i386at/kd_mouse.c
parentb509223167d6cf0780e1dd7ac9b2bde6bf6a2728 (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 'i386/i386at/kd_mouse.c')
-rw-r--r--i386/i386at/kd_mouse.c160
1 files changed, 1 insertions, 159 deletions
diff --git a/i386/i386at/kd_mouse.c b/i386/i386at/kd_mouse.c
index 770a3fe..6e7b68a 100644
--- a/i386/i386at/kd_mouse.c
+++ b/i386/i386at/kd_mouse.c
@@ -67,21 +67,10 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <mach/boolean.h>
#include <sys/types.h>
#include <kern/printf.h>
-#ifdef MACH_KERNEL
#include <device/ds_routines.h>
#include <device/device_types.h>
#include <device/io_req.h>
#include <device/subrs.h>
-#else /* MACH_KERNEL */
-#include <sys/file.h>
-#include <sys/errno.h>
-#include <kern/thread.h>
-#include <sys/user.h>
-#include <sys/proc.h>
-#include <sys/kernel.h>
-#include <sys/ioctl.h>
-#include <sys/tty.h>
-#endif /* MACH_KERNEL */
#include <i386/ipl.h>
#include <i386/pic.h>
#include <i386/pio.h>
@@ -100,20 +89,8 @@ extern struct bus_device *cominfo[];
kd_event_queue mouse_queue; /* queue of mouse events */
boolean_t mouse_in_use = FALSE;
-#ifdef MACH_KERNEL
queue_head_t mouse_read_queue = { &mouse_read_queue, &mouse_read_queue };
-#else /* MACH_KERNEL */
-struct proc *mouse_sel = 0; /* selecting process, if any */
-short mousepgrp = 0; /* process group leader when dev is open */
-#endif /* MACH_KERNEL */
-
-#ifdef MACH_KERNEL
-#else /* MACH_KERNEL */
-int mouseflag = 0;
-#define MOUSE_COLL 1 /* select collision */
-#define MOUSE_ASYNC 2 /* user wants asynch notification */
-#define MOUSE_NBIO 4 /* user wants non-blocking I/O */
-#endif /* MACH_KERNEL */
+
/*
* The state of the 3 buttons is encoded in the low-order 3 bits (both
@@ -176,20 +153,11 @@ mouseopen(dev, flags)
dev_t dev;
int flags;
{
-#ifdef MACH_KERNEL
-#else /* MACH_KERNEL */
- if (flags & FWRITE)
- return (D_NO_SUCH_DEVICE);
-#endif /* MACH_KERNEL */
if (mouse_in_use)
return (D_ALREADY_OPEN);
mouse_in_use = TRUE; /* locking? */
kdq_reset(&mouse_queue);
lastbuttons = MOUSE_ALL_UP;
-#ifdef MACH_KERNEL
-#else /* MACH_KERNEL */
- mousepgrp = u.u_procp->p_pgrp;
-#endif /* MACH_KERNEL */
switch (mouse_type = ((minor(dev) & 0xf8) >> 3)) {
case MICROSOFT_MOUSE7:
@@ -294,12 +262,6 @@ mouseclose(dev, flags)
kdq_reset(&mouse_queue); /* paranoia */
mouse_in_use = FALSE;
-#ifdef MACH_KERNEL
-#else /* MACH_KERNEL */
- mousepgrp = 0;
- mouseflag = 0;
- mouse_sel = 0;
-#endif /* MACH_KERNEL */
}
/*ARGSUSED*/
@@ -335,7 +297,6 @@ kd_mouse_close(dev, mouse_pic)
splx(s);
}
-#ifdef MACH_KERNEL
io_return_t mousegetstat(dev, flavor, data, count)
dev_t dev;
int flavor;
@@ -354,75 +315,10 @@ io_return_t mousegetstat(dev, flavor, data, count)
return D_SUCCESS;
}
-#else /* MACH_KERNEL */
-/*
- * mouseioctl - handling for asynch & non-blocking I/O.
- */
-
-/*ARGSUSED*/
-int
-mouseioctl(dev, cmd, data, flag)
- dev_t dev;
- int cmd;
- caddr_t data;
- int flag;
-{
- int s = SPLKD();
- int err = 0;
-
- switch (cmd) {
- case FIONBIO:
- if (*(int *)data)
- mouseflag |= MOUSE_NBIO;
- else
- mouseflag &= ~MOUSE_NBIO;
- break;
- case FIOASYNC:
- if (*(int *)data)
- mouseflag |= MOUSE_ASYNC;
- else
- mouseflag &= ~MOUSE_ASYNC;
- break;
- default:
- err = ENOTTY;
- break;
- }
-
- splx(s);
- return(err);
-}
-
-
-/*
- * mouseselect - check for pending events, etc.
- */
-
-/*ARGSUSED*/
-int
-mouseselect(dev, rw)
-{
- int s = SPLKD();
-
- if (!kdq_empty(&mouse_queue)) {
- splx(s);
- return(1);
- }
-
- if (mouse_sel)
- mouseflag |= MOUSE_COLL;
- else
- mouse_sel = (struct proc *)current_thread();
- /* eeeyuck */
-
- splx(s);
- return(0);
-}
-#endif /* MACH_KERNEL */
/*
* mouseread - dequeue and return any queued events.
*/
-#ifdef MACH_KERNEL
boolean_t mouse_read_done(); /* forward */
int
@@ -495,45 +391,6 @@ boolean_t mouse_read_done(ior)
return (TRUE);
}
-#else /* MACH_KERNEL */
-/*ARGSUSED*/
-int
-mouseread(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
- int s = SPLKD();
- int err = 0;
- kd_event *ev;
- int i;
- char *cp;
-
- if (kdq_empty(&mouse_queue))
- if (mouseflag & MOUSE_NBIO) {
- err = EWOULDBLOCK;
- goto done;
- } else
- while (kdq_empty(&mouse_queue)) {
- splx(s);
- sleep((caddr_t)&mouse_queue, TTIPRI);
- s = SPLKD();
- }
-
- while (!kdq_empty(&mouse_queue) && uio->uio_resid >= sizeof(kd_event)) {
- ev = kdq_get(&mouse_queue);
- for (cp = (char *)ev, i = 0; i < sizeof(kd_event);
- ++i, ++cp) {
- err = ureadc(*cp, uio);
- if (err)
- goto done;
- }
- }
-
-done:
- splx(s);
- return(err);
-}
-#endif /* MACH_KERNEL */
/*
@@ -780,12 +637,8 @@ int kd_mouse_read(void)
while (mousebufindex <= mouse_char_index) {
mouse_char_wanted = TRUE;
-#ifdef MACH_KERNEL
assert_wait((event_t) &mousebuf, FALSE);
thread_block((void (*)()) 0);
-#else /* MACH_KERNEL */
- sleep(&mousebuf, PZERO);
-#endif /* MACH_KERNEL */
}
ch = mousebuf[mouse_char_index++];
@@ -955,20 +808,9 @@ mouse_enqueue(ev)
else
kdq_put(&mouse_queue, ev);
-#ifdef MACH_KERNEL
{
register io_req_t ior;
while ((ior = (io_req_t)dequeue_head(&mouse_read_queue)) != 0)
iodone(ior);
}
-#else /* MACH_KERNEL */
- if (mouse_sel) {
- selwakeup(mouse_sel, mouseflag & MOUSE_COLL);
- mouse_sel = 0;
- mouseflag &= ~MOUSE_COLL;
- }
- if (mouseflag & MOUSE_ASYNC)
- gsignal(mousepgrp, SIGIO);
- wakeup((caddr_t)&mouse_queue);
-#endif /* MACH_KERNEL */
}