diff options
author | Ed Schouten <ed@FreeBSD.org> | 2008-05-23 16:06:35 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2008-05-23 16:06:35 +0000 |
commit | 8837b0dd0922c1bf147498a81f2dc78eb642fb98 (patch) | |
tree | 45dcbc030933869fb3a8e3fe224f3cbe1488ad22 /sys/kern | |
parent | 81590c5b3704d78a2a08502cc6eb53fdc7d09687 (diff) | |
download | src-8837b0dd0922c1bf147498a81f2dc78eb642fb98.tar.gz src-8837b0dd0922c1bf147498a81f2dc78eb642fb98.zip |
Move TTY unrelated bits out of <sys/tty.h>.
For some reason, the <sys/tty.h> header file also contains routines of the
clists and console that are used inside the TTY layer. Because the clists
are not only used by the TTY layer (example: various input drivers), we'd
better move the entire clist programming interface into <sys/clist.h>. Also
remove a declaration of nonexistent variable.
The <sys/tty.h> header also contains various definitions for the console
code (tty_cons.c). Also move these to <sys/cons.h>, because they are
not implemented inside the TTY layer.
While there, create separate malloc pools for the clist and console code.
Approved by: philip (mentor)
Notes
Notes:
svn path=/head/; revision=179246
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/subr_clist.c | 8 | ||||
-rw-r--r-- | sys/kern/tty.c | 1 | ||||
-rw-r--r-- | sys/kern/tty_cons.c | 6 | ||||
-rw-r--r-- | sys/kern/tty_subr.c | 8 |
4 files changed, 15 insertions, 8 deletions
diff --git a/sys/kern/subr_clist.c b/sys/kern/subr_clist.c index 5b53efa73ccc..57225dbc5ea1 100644 --- a/sys/kern/subr_clist.c +++ b/sys/kern/subr_clist.c @@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$"); static void clist_init(void *); SYSINIT(clist, SI_SUB_CLIST, SI_ORDER_FIRST, clist_init, NULL); +static MALLOC_DEFINE(M_CLIST, "clist", "clist queue blocks"); + static struct cblock *cfreelist = 0; int cfreecount = 0; static int cslushcount; @@ -133,11 +135,11 @@ cblock_alloc_cblocks(number) struct cblock *cbp; for (i = 0; i < number; ++i) { - cbp = malloc(sizeof *cbp, M_TTYS, M_NOWAIT); + cbp = malloc(sizeof *cbp, M_CLIST, M_NOWAIT); if (cbp == NULL) { printf( "cblock_alloc_cblocks: M_NOWAIT malloc failed, trying M_WAITOK\n"); - cbp = malloc(sizeof *cbp, M_TTYS, M_WAITOK); + cbp = malloc(sizeof *cbp, M_CLIST, M_WAITOK); } /* * Freed cblocks have zero quotes and garbage elsewhere. @@ -192,7 +194,7 @@ cblock_free_cblocks(number) int i; for (i = 0; i < number; ++i) - free(cblock_alloc(), M_TTYS); + free(cblock_alloc(), M_CLIST); ctotcount -= number; } diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 97fc0ccd15f8..c5947ff41e74 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> +#include <sys/cons.h> #include <sys/filio.h> #include <sys/lock.h> #include <sys/mutex.h> diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index 99f6f5195276..ff57d820e8c7 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -66,6 +66,8 @@ __FBSDID("$FreeBSD$"); #include <machine/cpu.h> #include <machine/clock.h> +static MALLOC_DEFINE(M_TTYCONS, "tty console", "tty console handling"); + static d_open_t cnopen; static d_close_t cnclose; static d_read_t cnread; @@ -673,7 +675,7 @@ constty_set(struct tty *tp) KASSERT(tp != NULL, ("constty_set: NULL tp")); if (consbuf == NULL) { size = consmsgbuf_size; - consbuf = malloc(size, M_TTYS, M_WAITOK); + consbuf = malloc(size, M_TTYCONS, M_WAITOK); msgbuf_init(&consmsgbuf, consbuf, size); callout_init(&conscallout, 0); } @@ -695,7 +697,7 @@ constty_clear(void) callout_stop(&conscallout); while ((c = msgbuf_getchar(&consmsgbuf)) != -1) cnputc(c); - free(consbuf, M_TTYS); + free(consbuf, M_TTYCONS); consbuf = NULL; } diff --git a/sys/kern/tty_subr.c b/sys/kern/tty_subr.c index 5b53efa73ccc..57225dbc5ea1 100644 --- a/sys/kern/tty_subr.c +++ b/sys/kern/tty_subr.c @@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$"); static void clist_init(void *); SYSINIT(clist, SI_SUB_CLIST, SI_ORDER_FIRST, clist_init, NULL); +static MALLOC_DEFINE(M_CLIST, "clist", "clist queue blocks"); + static struct cblock *cfreelist = 0; int cfreecount = 0; static int cslushcount; @@ -133,11 +135,11 @@ cblock_alloc_cblocks(number) struct cblock *cbp; for (i = 0; i < number; ++i) { - cbp = malloc(sizeof *cbp, M_TTYS, M_NOWAIT); + cbp = malloc(sizeof *cbp, M_CLIST, M_NOWAIT); if (cbp == NULL) { printf( "cblock_alloc_cblocks: M_NOWAIT malloc failed, trying M_WAITOK\n"); - cbp = malloc(sizeof *cbp, M_TTYS, M_WAITOK); + cbp = malloc(sizeof *cbp, M_CLIST, M_WAITOK); } /* * Freed cblocks have zero quotes and garbage elsewhere. @@ -192,7 +194,7 @@ cblock_free_cblocks(number) int i; for (i = 0; i < number; ++i) - free(cblock_alloc(), M_TTYS); + free(cblock_alloc(), M_CLIST); ctotcount -= number; } |