summaryrefslogtreecommitdiff
path: root/sys/dev/wscons
diff options
context:
space:
mode:
authorVitaliy Makkoveev <mvs@cvs.openbsd.org>2024-03-25 13:01:50 +0000
committerVitaliy Makkoveev <mvs@cvs.openbsd.org>2024-03-25 13:01:50 +0000
commitbc721b3ea7d7dc0d1e53dc048eec9ea6faf1b4c0 (patch)
treeea37937d1e64605cc4e24db736fcd4e6ce2910d9 /sys/dev/wscons
parentf32f453ae08b479f22325126a7bccddc6cf9ae6c (diff)
Add 'ws_' prefix to 'wseventvar' structure members. No functional
changes. ok miod
Diffstat (limited to 'sys/dev/wscons')
-rw-r--r--sys/dev/wscons/wsevent.c57
-rw-r--r--sys/dev/wscons/wseventvar.h28
-rw-r--r--sys/dev/wscons/wskbd.c22
-rw-r--r--sys/dev/wscons/wsmouse.c24
-rw-r--r--sys/dev/wscons/wsmux.c16
-rw-r--r--sys/dev/wscons/wstpad.c6
6 files changed, 78 insertions, 75 deletions
diff --git a/sys/dev/wscons/wsevent.c b/sys/dev/wscons/wsevent.c
index 37dc66bc72d..c28f89c3705 100644
--- a/sys/dev/wscons/wsevent.c
+++ b/sys/dev/wscons/wsevent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsevent.c,v 1.27 2023/07/06 10:16:58 visa Exp $ */
+/* $OpenBSD: wsevent.c,v 1.28 2024/03/25 13:01:49 mvs Exp $ */
/* $NetBSD: wsevent.c,v 1.16 2003/08/07 16:31:29 agc Exp $ */
/*
@@ -101,20 +101,21 @@ wsevent_init(struct wseventvar *ev)
{
struct wscons_event *queue;
- if (ev->q != NULL)
+ if (ev->ws_q != NULL)
return (0);
queue = mallocarray(WSEVENT_QSIZE, sizeof(struct wscons_event),
M_DEVBUF, M_WAITOK | M_ZERO);
- if (ev->q != NULL) {
- free(queue, M_DEVBUF, WSEVENT_QSIZE * sizeof(struct wscons_event));
+ if (ev->ws_q != NULL) {
+ free(queue, M_DEVBUF,
+ WSEVENT_QSIZE * sizeof(struct wscons_event));
return (1);
}
- ev->q = queue;
- ev->get = ev->put = 0;
+ ev->ws_q = queue;
+ ev->ws_get = ev->ws_put = 0;
- sigio_init(&ev->sigio);
+ sigio_init(&ev->ws_sigio);
return (0);
}
@@ -125,18 +126,18 @@ wsevent_init(struct wseventvar *ev)
void
wsevent_fini(struct wseventvar *ev)
{
- if (ev->q == NULL) {
+ if (ev->ws_q == NULL) {
#ifdef DIAGNOSTIC
printf("wsevent_fini: already invoked\n");
#endif
return;
}
- free(ev->q, M_DEVBUF, WSEVENT_QSIZE * sizeof(struct wscons_event));
- ev->q = NULL;
+ free(ev->ws_q, M_DEVBUF, WSEVENT_QSIZE * sizeof(struct wscons_event));
+ ev->ws_q = NULL;
- klist_invalidate(&ev->sel.si_note);
+ klist_invalidate(&ev->ws_sel.si_note);
- sigio_free(&ev->sigio);
+ sigio_free(&ev->ws_sigio);
}
/*
@@ -156,12 +157,12 @@ wsevent_read(struct wseventvar *ev, struct uio *uio, int flags)
if (uio->uio_resid < sizeof(struct wscons_event))
return (EMSGSIZE); /* ??? */
s = splwsevent();
- while (ev->get == ev->put) {
+ while (ev->ws_get == ev->ws_put) {
if (flags & IO_NDELAY) {
splx(s);
return (EWOULDBLOCK);
}
- ev->wanted = 1;
+ ev->ws_wanted = 1;
error = tsleep_nsec(ev, PWSEVENT | PCATCH,
"wsevent_read", INFSLP);
if (error) {
@@ -173,15 +174,15 @@ wsevent_read(struct wseventvar *ev, struct uio *uio, int flags)
* Move wscons_event from tail end of queue (there is at least one
* there).
*/
- if (ev->put < ev->get)
- cnt = WSEVENT_QSIZE - ev->get; /* events in [get..QSIZE) */
+ if (ev->ws_put < ev->ws_get)
+ cnt = WSEVENT_QSIZE - ev->ws_get; /* events in [get..QSIZE) */
else
- cnt = ev->put - ev->get; /* events in [get..put) */
+ cnt = ev->ws_put - ev->ws_get; /* events in [get..put) */
splx(s);
n = howmany(uio->uio_resid, sizeof(struct wscons_event));
if (cnt > n)
cnt = n;
- error = uiomove((caddr_t)&ev->q[ev->get],
+ error = uiomove((caddr_t)&ev->ws_q[ev->ws_get],
cnt * sizeof(struct wscons_event), uio);
n -= cnt;
/*
@@ -189,14 +190,14 @@ wsevent_read(struct wseventvar *ev, struct uio *uio, int flags)
* stop. Otherwise move from front of queue to put index, if there
* is anything there to move.
*/
- if ((ev->get = (ev->get + cnt) % WSEVENT_QSIZE) != 0 ||
- n == 0 || error || (cnt = ev->put) == 0)
+ if ((ev->ws_get = (ev->ws_get + cnt) % WSEVENT_QSIZE) != 0 ||
+ n == 0 || error || (cnt = ev->ws_put) == 0)
return (error);
if (cnt > n)
cnt = n;
- error = uiomove((caddr_t)&ev->q[0],
+ error = uiomove((caddr_t)&ev->ws_q[0],
cnt * sizeof(struct wscons_event), uio);
- ev->get = cnt;
+ ev->ws_get = cnt;
return (error);
}
@@ -206,7 +207,7 @@ wsevent_kqfilter(struct wseventvar *ev, struct knote *kn)
struct klist *klist;
int s;
- klist = &ev->sel.si_note;
+ klist = &ev->ws_sel.si_note;
switch (kn->kn_filter) {
case EVFILT_READ:
@@ -229,7 +230,7 @@ void
filt_wseventdetach(struct knote *kn)
{
struct wseventvar *ev = kn->kn_hook;
- struct klist *klist = &ev->sel.si_note;
+ struct klist *klist = &ev->ws_sel.si_note;
int s;
s = splwsevent();
@@ -242,13 +243,13 @@ filt_wseventread(struct knote *kn, long hint)
{
struct wseventvar *ev = kn->kn_hook;
- if (ev->get == ev->put)
+ if (ev->ws_get == ev->ws_put)
return (0);
- if (ev->get < ev->put)
- kn->kn_data = ev->put - ev->get;
+ if (ev->ws_get < ev->ws_put)
+ kn->kn_data = ev->ws_put - ev->ws_get;
else
- kn->kn_data = (WSEVENT_QSIZE - ev->get) + ev->put;
+ kn->kn_data = (WSEVENT_QSIZE - ev->ws_get) + ev->ws_put;
return (1);
}
diff --git a/sys/dev/wscons/wseventvar.h b/sys/dev/wscons/wseventvar.h
index 29ef66b27c5..657a3006635 100644
--- a/sys/dev/wscons/wseventvar.h
+++ b/sys/dev/wscons/wseventvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wseventvar.h,v 1.12 2023/09/08 20:00:28 mvs Exp $ */
+/* $OpenBSD: wseventvar.h,v 1.13 2024/03/25 13:01:49 mvs Exp $ */
/* $NetBSD: wseventvar.h,v 1.1 1998/03/22 14:24:03 drochner Exp $ */
/*
@@ -84,25 +84,27 @@
#define WSEVENT_QSIZE 256 /* may need tuning; this uses 2k */
struct wseventvar {
- u_int get; /* get (read) index (modified synchronously) */
- volatile u_int put; /* put (write) index (modified by interrupt) */
- struct selinfo sel; /* process selecting */
- struct sigio_ref sigio; /* async I/O registration */
- int wanted; /* wake up on input ready */
- int async; /* send SIGIO on input ready */
- struct wscons_event *q; /* circular buffer (queue) of events */
+ u_int ws_get; /* get (read) index (modified
+ synchronously) */
+ volatile u_int ws_put; /* put (write) index (modified by
+ interrupt) */
+ struct selinfo ws_sel; /* process selecting */
+ struct sigio_ref ws_sigio; /* async I/O registration */
+ int ws_wanted; /* wake up on input ready */
+ int ws_async; /* send SIGIO on input ready */
+ struct wscons_event *ws_q; /* circular buffer (queue) of events */
};
#define splwsevent() spltty()
#define WSEVENT_WAKEUP(ev) { \
- selwakeup(&(ev)->sel); \
- if ((ev)->wanted) { \
- (ev)->wanted = 0; \
+ selwakeup(&(ev)->ws_sel); \
+ if ((ev)->ws_wanted) { \
+ (ev)->ws_wanted = 0; \
wakeup((caddr_t)(ev)); \
} \
- if ((ev)->async) \
- pgsigio(&(ev)->sigio, SIGIO, 0); \
+ if ((ev)->ws_async) \
+ pgsigio(&(ev)->ws_sigio, SIGIO, 0); \
}
int wsevent_init(struct wseventvar *);
diff --git a/sys/dev/wscons/wskbd.c b/sys/dev/wscons/wskbd.c
index f551bf5b892..1ea596fc26c 100644
--- a/sys/dev/wscons/wskbd.c
+++ b/sys/dev/wscons/wskbd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wskbd.c,v 1.118 2024/02/18 20:17:48 anton Exp $ */
+/* $OpenBSD: wskbd.c,v 1.119 2024/03/25 13:01:49 mvs Exp $ */
/* $NetBSD: wskbd.c,v 1.80 2005/05/04 01:52:16 augustss Exp $ */
/*
@@ -650,8 +650,8 @@ wskbd_detach(struct device *self, int flags)
s = spltty();
if (--sc->sc_refcnt >= 0) {
/* Wake everyone by generating a dummy event. */
- if (++evar->put >= WSEVENT_QSIZE)
- evar->put = 0;
+ if (++evar->ws_put >= WSEVENT_QSIZE)
+ evar->ws_put = 0;
WSEVENT_WAKEUP(evar);
/* Wait for processes to go away. */
if (tsleep_nsec(sc, PZERO, "wskdet", SEC_TO_NSEC(60)))
@@ -757,16 +757,16 @@ wskbd_deliver_event(struct wskbd_softc *sc, u_int type, int value)
}
#ifdef DIAGNOSTIC
- if (evar->q == NULL) {
+ if (evar->ws_q == NULL) {
printf("wskbd_input: evar->q=NULL\n");
return;
}
#endif
- put = evar->put;
- ev = &evar->q[put];
+ put = evar->ws_put;
+ ev = &evar->ws_q[put];
put = (put + 1) % WSEVENT_QSIZE;
- if (put == evar->get) {
+ if (put == evar->ws_get) {
log(LOG_WARNING, "%s: event queue overflow\n",
sc->sc_base.me_dv.dv_xname);
return;
@@ -774,7 +774,7 @@ wskbd_deliver_event(struct wskbd_softc *sc, u_int type, int value)
ev->type = type;
ev->value = value;
nanotime(&ev->time);
- evar->put = put;
+ evar->ws_put = put;
WSEVENT_WAKEUP(evar);
}
@@ -1008,7 +1008,7 @@ wskbd_do_ioctl_sc(struct wskbd_softc *sc, u_long cmd, caddr_t data, int flag,
case FIOASYNC:
if (sc->sc_base.me_evp == NULL)
return (EINVAL);
- sc->sc_base.me_evp->async = *(int *)data != 0;
+ sc->sc_base.me_evp->ws_async = *(int *)data != 0;
return (0);
case FIOGETOWN:
@@ -1016,7 +1016,7 @@ wskbd_do_ioctl_sc(struct wskbd_softc *sc, u_long cmd, caddr_t data, int flag,
evar = sc->sc_base.me_evp;
if (evar == NULL)
return (EINVAL);
- sigio_getown(&evar->sigio, cmd, data);
+ sigio_getown(&evar->ws_sigio, cmd, data);
return (0);
case FIOSETOWN:
@@ -1024,7 +1024,7 @@ wskbd_do_ioctl_sc(struct wskbd_softc *sc, u_long cmd, caddr_t data, int flag,
evar = sc->sc_base.me_evp;
if (evar == NULL)
return (EINVAL);
- return (sigio_setown(&evar->sigio, cmd, data));
+ return (sigio_setown(&evar->ws_sigio, cmd, data));
}
/*
diff --git a/sys/dev/wscons/wsmouse.c b/sys/dev/wscons/wsmouse.c
index 17279f76949..785e7811c7a 100644
--- a/sys/dev/wscons/wsmouse.c
+++ b/sys/dev/wscons/wsmouse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmouse.c,v 1.70 2022/10/16 18:23:44 bru Exp $ */
+/* $OpenBSD: wsmouse.c,v 1.71 2024/03/25 13:01:49 mvs Exp $ */
/* $NetBSD: wsmouse.c,v 1.35 2005/02/27 00:27:52 perry Exp $ */
/*
@@ -265,8 +265,8 @@ wsmouse_detach(struct device *self, int flags)
s = spltty();
if (--sc->sc_refcnt >= 0) {
/* Wake everyone by generating a dummy event. */
- if (++evar->put >= WSEVENT_QSIZE)
- evar->put = 0;
+ if (++evar->ws_put >= WSEVENT_QSIZE)
+ evar->ws_put = 0;
WSEVENT_WAKEUP(evar);
/* Wait for processes to go away. */
if (tsleep_nsec(sc, PZERO, "wsmdet", SEC_TO_NSEC(60)))
@@ -498,7 +498,7 @@ wsmouse_do_ioctl(struct wsmouse_softc *sc, u_long cmd, caddr_t data, int flag,
case FIOASYNC:
if (sc->sc_base.me_evp == NULL)
return (EINVAL);
- sc->sc_base.me_evp->async = *(int *)data != 0;
+ sc->sc_base.me_evp->ws_async = *(int *)data != 0;
return (0);
case FIOGETOWN:
@@ -506,7 +506,7 @@ wsmouse_do_ioctl(struct wsmouse_softc *sc, u_long cmd, caddr_t data, int flag,
evar = sc->sc_base.me_evp;
if (evar == NULL)
return (EINVAL);
- sigio_getown(&evar->sigio, cmd, data);
+ sigio_getown(&evar->ws_sigio, cmd, data);
return (0);
case FIOSETOWN:
@@ -514,7 +514,7 @@ wsmouse_do_ioctl(struct wsmouse_softc *sc, u_long cmd, caddr_t data, int flag,
evar = sc->sc_base.me_evp;
if (evar == NULL)
return (EINVAL);
- return (sigio_setown(&evar->sigio, cmd, data));
+ return (sigio_setown(&evar->ws_sigio, cmd, data));
case WSMOUSEIO_GETPARAMS:
case WSMOUSEIO_SETPARAMS:
@@ -958,9 +958,9 @@ wsmouse_evq_put(struct evq_access *evq, int ev_type, int ev_value)
struct wscons_event *ev;
int space;
- space = evq->evar->get - evq->put;
+ space = evq->evar->ws_get - evq->put;
if (space != 1 && space != 1 - WSEVENT_QSIZE) {
- ev = &evq->evar->q[evq->put++];
+ ev = &evq->evar->ws_q[evq->put++];
evq->put %= WSEVENT_QSIZE;
ev->type = ev_type;
ev->value = ev_value;
@@ -1102,12 +1102,12 @@ void
wsmouse_log_events(struct wsmouseinput *input, struct evq_access *evq)
{
struct wscons_event *ev;
- int n = evq->evar->put;
+ int n = evq->evar->ws_put;
if (n != evq->put) {
printf("[%s-ev][%04d]", DEVNAME(input), LOGTIME(&evq->ts));
while (n != evq->put) {
- ev = &evq->evar->q[n++];
+ ev = &evq->evar->ws_q[n++];
n %= WSEVENT_QSIZE;
printf(" %d:%d", ev->type, ev->value);
}
@@ -1141,7 +1141,7 @@ wsmouse_input_sync(struct device *sc)
evq.evar = *input->evar;
if (evq.evar == NULL)
return;
- evq.put = evq.evar->put;
+ evq.put = evq.evar->ws_put;
evq.result = EVQ_RESULT_NONE;
getnanotime(&evq.ts);
@@ -1184,7 +1184,7 @@ wsmouse_input_sync(struct device *sc)
if (input->flags & LOG_EVENTS) {
wsmouse_log_events(input, &evq);
}
- evq.evar->put = evq.put;
+ evq.evar->ws_put = evq.put;
WSEVENT_WAKEUP(evq.evar);
}
}
diff --git a/sys/dev/wscons/wsmux.c b/sys/dev/wscons/wsmux.c
index a8a4f45e218..5ae2755ebe0 100644
--- a/sys/dev/wscons/wsmux.c
+++ b/sys/dev/wscons/wsmux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wsmux.c,v 1.56 2022/07/02 08:50:42 visa Exp $ */
+/* $OpenBSD: wsmux.c,v 1.57 2024/03/25 13:01:49 mvs Exp $ */
/* $NetBSD: wsmux.c,v 1.37 2005/04/30 03:47:12 augustss Exp $ */
/*
@@ -416,9 +416,9 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, caddr_t data, int flag,
}
s = spltty();
- get = evar->get;
- put = evar->put;
- ev = &evar->q[put];
+ get = evar->ws_get;
+ put = evar->ws_put;
+ ev = &evar->ws_q[put];
if (++put % WSEVENT_QSIZE == get) {
put--;
splx(s);
@@ -428,7 +428,7 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, caddr_t data, int flag,
put = 0;
*ev = *(struct wscons_event *)data;
nanotime(&ev->time);
- evar->put = put;
+ evar->ws_put = put;
WSEVENT_WAKEUP(evar);
splx(s);
return (0);
@@ -500,7 +500,7 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, caddr_t data, int flag,
evar = sc->sc_base.me_evp;
if (evar == NULL)
return (EINVAL);
- evar->async = *(int *)data != 0;
+ evar->ws_async = *(int *)data != 0;
return (0);
case FIOGETOWN:
case TIOCGPGRP:
@@ -509,7 +509,7 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, caddr_t data, int flag,
evar = sc->sc_base.me_evp;
if (evar == NULL)
return (EINVAL);
- sigio_getown(&evar->sigio, cmd, data);
+ sigio_getown(&evar->ws_sigio, cmd, data);
return (0);
case FIOSETOWN:
case TIOCSPGRP:
@@ -518,7 +518,7 @@ wsmux_do_ioctl(struct device *dv, u_long cmd, caddr_t data, int flag,
evar = sc->sc_base.me_evp;
if (evar == NULL)
return (EINVAL);
- return (sigio_setown(&evar->sigio, cmd, data));
+ return (sigio_setown(&evar->ws_sigio, cmd, data));
default:
DPRINTF(("%s: unknown\n", sc->sc_base.me_dv.dv_xname));
break;
diff --git a/sys/dev/wscons/wstpad.c b/sys/dev/wscons/wstpad.c
index 3a6e3104eda..6c8b6a88e0c 100644
--- a/sys/dev/wscons/wstpad.c
+++ b/sys/dev/wscons/wstpad.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wstpad.c,v 1.33 2023/08/15 08:27:30 miod Exp $ */
+/* $OpenBSD: wstpad.c,v 1.34 2024/03/25 13:01:49 mvs Exp $ */
/*
* Copyright (c) 2015, 2016 Ulf Brosziewski
@@ -931,7 +931,7 @@ wstpad_tap_timeout(void *p)
tp->tap.state = TAP_DETECT;
}
if (ev) {
- evq.put = evq.evar->put;
+ evq.put = evq.evar->ws_put;
evq.result = EVQ_RESULT_NONE;
getnanotime(&evq.ts);
wsmouse_evq_put(&evq, ev, btn);
@@ -940,7 +940,7 @@ wstpad_tap_timeout(void *p)
if (input->flags & LOG_EVENTS) {
wsmouse_log_events(input, &evq);
}
- evq.evar->put = evq.put;
+ evq.evar->ws_put = evq.put;
WSEVENT_WAKEUP(evq.evar);
} else {
input->sbtn.sync |= tp->tap.button;