changes.
ok miod
-/* $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 $ */
/*
{
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);
}
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);
}
/*
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) {
* 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;
/*
* 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);
}
struct klist *klist;
int s;
- klist = &ev->sel.si_note;
+ klist = &ev->ws_sel.si_note;
switch (kn->kn_filter) {
case EVFILT_READ:
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();
{
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);
}
-/* $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 $ */
/*
#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 *);
-/* $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 $ */
/*
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)))
}
#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;
ev->type = type;
ev->value = value;
nanotime(&ev->time);
- evar->put = put;
+ evar->ws_put = put;
WSEVENT_WAKEUP(evar);
}
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:
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:
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));
}
/*
-/* $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 $ */
/*
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)))
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:
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:
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:
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;
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);
}
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);
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);
}
}
-/* $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 $ */
/*
}
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);
put = 0;
*ev = *(struct wscons_event *)data;
nanotime(&ev->time);
- evar->put = put;
+ evar->ws_put = put;
WSEVENT_WAKEUP(evar);
splx(s);
return (0);
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:
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:
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;
-/* $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
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);
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;