diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2013-10-20 21:24:02 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2013-10-20 21:24:02 +0000 |
commit | fb33eeebaac60c24bf5ead035da2d63f675dc290 (patch) | |
tree | b6964334238130bf91233521e15ebc711a8d8a83 /sys/dev/wsfont | |
parent | 10e70977872a9790c42077be5db06d18048385c9 (diff) |
No longer store fonts added with the WSDISPLAYIO_LDFONT ioctl into the
wsdisplay softc. Instead, since the knowledge about available fonts lies in
the parent driver itself, introduce a list_font wsdisplay_accessop which
queries a font index, suitable to use within the WSDISPLAYIO_LSFONT ioctl.
With this in place:
- there is no global wsdisplay limit on the number of fonts loaded. Such a
limit will be enforced by the display drivers themselves.
- built-in kernel fonts will now appear in the list of fonts.
Grow a list_font accesop for rasops, which relies upon wsfont_enum(), which
is turned into something useful (and abortable if you do not need to iterate
further). Not used by any rasops driver yet.
Diffstat (limited to 'sys/dev/wsfont')
-rw-r--r-- | sys/dev/wsfont/wsfont.c | 12 | ||||
-rw-r--r-- | sys/dev/wsfont/wsfont.h | 4 |
2 files changed, 7 insertions, 9 deletions
diff --git a/sys/dev/wsfont/wsfont.c b/sys/dev/wsfont/wsfont.c index 46e9d7be0e1..4720de12f64 100644 --- a/sys/dev/wsfont/wsfont.c +++ b/sys/dev/wsfont/wsfont.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsfont.c,v 1.34 2013/10/20 16:44:48 miod Exp $ */ +/* $OpenBSD: wsfont.c,v 1.35 2013/10/20 21:24:01 miod Exp $ */ /* $NetBSD: wsfont.c,v 1.17 2001/02/07 13:59:24 ad Exp $ */ /*- @@ -268,18 +268,16 @@ wsfont_revbyte(struct wsdisplay_font *font) * Enumerate the list of fonts */ void -wsfont_enum(void (*cb)(const char *, int, int, int)) +wsfont_enum(int (*cb)(void *, struct wsdisplay_font *), void *cbarg) { - struct wsdisplay_font *f; struct font *ent; int s; s = splhigh(); - TAILQ_FOREACH(ent, &list, chain) { - f = ent->font; - cb(f->name, f->fontwidth, f->fontheight, f->stride); - } + TAILQ_FOREACH(ent, &list, chain) + if (cb(cbarg, ent->font) != 0) + break; splx(s); } diff --git a/sys/dev/wsfont/wsfont.h b/sys/dev/wsfont/wsfont.h index 4ad947cfcb1..f1b989ec300 100644 --- a/sys/dev/wsfont/wsfont.h +++ b/sys/dev/wsfont/wsfont.h @@ -1,4 +1,4 @@ -/* $OpenBSD: wsfont.h,v 1.9 2013/10/20 16:44:48 miod Exp $ */ +/* $OpenBSD: wsfont.h,v 1.10 2013/10/20 21:24:01 miod Exp $ */ /* $NetBSD: wsfont.h,v 1.12 2000/06/13 13:37:07 ad Exp $ */ /*- @@ -69,7 +69,7 @@ void wsfont_init(void); int wsfont_find(const char *, int, int, int); int wsfont_add(struct wsdisplay_font *, int); int wsfont_remove(int); -void wsfont_enum(void (*)(const char *, int, int, int)); +void wsfont_enum(int (*)(void *, struct wsdisplay_font *), void *); int wsfont_lock(int, struct wsdisplay_font **, int, int); int wsfont_unlock(int); int wsfont_map_unichar(struct wsdisplay_font *, int); |