Download raw body.
lpt should not use bufs
struct buf is not meant to be a generic malloc alternative.
I think it's good, but uh, who has an lpt to test?
Index: lpt.c
===================================================================
RCS file: /home/cvs/src/sys/dev/ic/lpt.c,v
diff -u -p -r1.15 lpt.c
--- lpt.c 15 Jan 2020 16:43:13 -0000 1.15
+++ lpt.c 2 May 2025 04:45:12 -0000
@@ -56,7 +56,7 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/buf.h>
+#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/uio.h>
#include <sys/device.h>
@@ -216,7 +216,7 @@ lptopen(dev_t dev, int flag, int mode, s
sc->sc_control = control;
bus_space_write_1(sc->sc_iot, sc->sc_ioh, lpt_control, control);
- sc->sc_inbuf = geteblk(LPT_BSIZE);
+ sc->sc_inbuf = malloc(LPT_BSIZE, M_DEVBUF, M_WAITOK);
sc->sc_count = 0;
sc->sc_state = LPT_OPEN;
@@ -280,7 +280,7 @@ lptclose(dev_t dev, int flag, int mode,
bus_space_write_1(iot, ioh, lpt_control, LPC_NINIT);
sc->sc_state = 0;
bus_space_write_1(iot, ioh, lpt_control, LPC_NINIT);
- brelse(sc->sc_inbuf);
+ free(sc->sc_inbuf, M_DEVBUF, LPT_BSIZE);
LPRINTF(("%s: closed\n", sc->sc_dev.dv_xname));
return 0;
@@ -370,7 +370,8 @@ lptwrite(dev_t dev, struct uio *uio, int
int error = 0;
while ((n = ulmin(LPT_BSIZE, uio->uio_resid)) != 0) {
- error = uiomove(sc->sc_cp = sc->sc_inbuf->b_data, n, uio);
+ sc->sc_cp = sc->sc_inbuf;
+ error = uiomove(sc->sc_cp, n, uio);
if (error != 0)
return error;
sc->sc_count = n;
Index: lptvar.h
===================================================================
RCS file: /home/cvs/src/sys/dev/ic/lptvar.h,v
diff -u -p -r1.4 lptvar.h
--- lptvar.h 12 Jun 2013 19:07:40 -0000 1.4
+++ lptvar.h 2 May 2025 04:34:40 -0000
@@ -58,7 +58,7 @@ struct lpt_softc {
struct timeout sc_wakeup_tmo;
size_t sc_count;
- struct buf *sc_inbuf;
+ void *sc_inbuf;
u_int8_t *sc_cp;
int sc_spinmax;
bus_space_tag_t sc_iot; /* bus tag */
lpt should not use bufs