summaryrefslogtreecommitdiffstats
path: root/sys/dev/syscons/syscons.h
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-06-13 10:58:39 +0000
committerpeter <peter@FreeBSD.org>2001-06-13 10:58:39 +0000
commitf10fa038c14063eaf2da32ed734e644e5f569694 (patch)
tree88aef8097c80f09c2f725d61b6da4d433a595a61 /sys/dev/syscons/syscons.h
parent2514663dd721b9ac234d35a4dac65dfc457ff6bc (diff)
downloadFreeBSD-src-f10fa038c14063eaf2da32ed734e644e5f569694.zip
FreeBSD-src-f10fa038c14063eaf2da32ed734e644e5f569694.tar.gz
With this commit, I hereby pronounce gensetdefs past its use-by date.
Replace the a.out emulation of 'struct linker_set' with something a little more flexible. <sys/linker_set.h> now provides macros for accessing elements and completely hides the implementation. The linker_set.h macros have been on the back burner in various forms since 1998 and has ideas and code from Mike Smith (SET_FOREACH()), John Polstra (ELF clue) and myself (cleaned up API and the conversion of the rest of the kernel to use it). The macros declare a strongly typed set. They return elements with the type that you declare the set with, rather than a generic void *. For ELF, we use the magic ld symbols (__start_<setname> and __stop_<setname>). Thanks to Richard Henderson <rth@redhat.com> for the trick about how to force ld to provide them for kld's. For a.out, we use the old linker_set struct. NOTE: the item lists are no longer null terminated. This is why the code impact is high in certain areas. The runtime linker has a new method to find the linker set boundaries depending on which backend format is in use. linker sets are still module/kld unfriendly and should never be used for anything that may be modular one day. Reviewed by: eivind
Diffstat (limited to 'sys/dev/syscons/syscons.h')
-rw-r--r--sys/dev/syscons/syscons.h16
1 files changed, 5 insertions, 11 deletions
diff --git a/sys/dev/syscons/syscons.h b/sys/dev/syscons/syscons.h
index d2d605d..ef10f4d 100644
--- a/sys/dev/syscons/syscons.h
+++ b/sys/dev/syscons/syscons.h
@@ -342,8 +342,6 @@ typedef struct sc_term_sw {
sc_term_input_t *te_input;
} sc_term_sw_t;
-extern struct linker_set scterm_set;
-
#define SCTERM_MODULE(name, sw) \
DATA_SET(scterm_set, sw); \
static int \
@@ -398,8 +396,6 @@ typedef struct sc_renderer {
LIST_ENTRY(sc_renderer) link;
} sc_renderer_t;
-extern struct linker_set scrndr_set;
-
#define RENDERER(name, mode, sw, set) \
static struct sc_renderer scrndr_##name##_##mode## = { \
#name, mode, &sw \
@@ -408,25 +404,23 @@ extern struct linker_set scrndr_set;
DATA_SET(set, scrndr_##name##_##mode##)
#define RENDERER_MODULE(name, set) \
+ SET_DECLARE(set, sc_renderer_t); \
static int \
scrndr_##name##_event(module_t mod, int type, void *data) \
{ \
sc_renderer_t **list; \
- sc_renderer_t *p; \
int error = 0; \
switch (type) { \
case MOD_LOAD: \
- list = (sc_renderer_t **)set.ls_items; \
- while ((p = *list++) != NULL) { \
- error = sc_render_add(p); \
+ SET_FOREACH(list, set) { \
+ error = sc_render_add(*list); \
if (error) \
break; \
} \
break; \
case MOD_UNLOAD: \
- list = (sc_renderer_t **)set.ls_items; \
- while ((p = *list++) != NULL) { \
- error = sc_render_remove(p); \
+ SET_FOREACH(list, set) { \
+ error = sc_render_remove(*list);\
if (error) \
break; \
} \
OpenPOWER on IntegriCloud