diff options
author | phk <phk@FreeBSD.org> | 2000-05-05 09:05:39 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2000-05-05 09:05:39 +0000 |
commit | ffbad65d92c49d515f764f94217069d615ad9e91 (patch) | |
tree | 2b5cf933a060335cafab33b7e70082b8cdeb5bf2 /sys/i386/isa | |
parent | d23c57bbfd7483781c0186d0adbaa31ee0223c4a (diff) | |
download | FreeBSD-src-ffbad65d92c49d515f764f94217069d615ad9e91.zip FreeBSD-src-ffbad65d92c49d515f764f94217069d615ad9e91.tar.gz |
Don't use struct buf for random small temporary buffers.
Diffstat (limited to 'sys/i386/isa')
-rw-r--r-- | sys/i386/isa/spkr.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c index 8f4b8aa..0f7ed61 100644 --- a/sys/i386/isa/spkr.c +++ b/sys/i386/isa/spkr.c @@ -10,10 +10,10 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> -#include <sys/buf.h> #include <sys/uio.h> #include <sys/conf.h> #include <sys/ctype.h> +#include <sys/malloc.h> #include <i386/isa/isa.h> #include <i386/isa/timerreg.h> #include <machine/clock.h> @@ -42,6 +42,8 @@ static struct cdevsw spkr_cdevsw = { /* bmaj */ -1 }; +MALLOC_DEFINE(M_SPKR, "spkr", "Speaker buffer"); + /**************** MACHINE DEPENDENT PART STARTS HERE ************************* * * This section defines a function tone() which causes a tone of given @@ -453,7 +455,7 @@ playstring(cp, slen) */ static int spkr_active = FALSE; /* exclusion flag */ -static struct buf *spkr_inbuf; /* incoming buf */ +static char *spkr_inbuf; /* incoming buf */ int spkropen(dev, flags, fmt, p) @@ -476,7 +478,7 @@ spkropen(dev, flags, fmt, p) (void) printf("spkropen: about to perform play initialization\n"); #endif /* DEBUG */ playinit(); - spkr_inbuf = geteblk(DEV_BSIZE); + spkr_inbuf = malloc(DEV_BSIZE, M_SPKR, M_WAITOK); spkr_active = TRUE; return(0); } @@ -504,7 +506,7 @@ spkrwrite(dev, uio, ioflag) int error; n = uio->uio_resid; - cp = spkr_inbuf->b_data; + cp = spkr_inbuf; error = uiomove(cp, n, uio); if (!error) { cp[n] = '\0'; @@ -531,7 +533,7 @@ spkrclose(dev, flags, fmt, p) { wakeup((caddr_t)&endtone); wakeup((caddr_t)&endrest); - brelse(spkr_inbuf); + free(spkr_inbuf, M_SPKR); spkr_active = FALSE; return(0); } |