Sat Mar 7 03:19:06 2015 UTC ()
use __COMPAT so that we get argument expansion.


(christos)
diff -r1.35 -r1.36 src/sys/sys/module.h

cvs diff -r1.35 -r1.36 src/sys/sys/module.h (expand / switch to unified diff)

--- src/sys/sys/module.h 2014/04/23 23:25:45 1.35
+++ src/sys/sys/module.h 2015/03/07 03:19:06 1.36
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: module.h,v 1.35 2014/04/23 23:25:45 pooka Exp $ */ 1/* $NetBSD: module.h,v 1.36 2015/03/07 03:19:06 christos Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -104,49 +104,49 @@ typedef struct module { @@ -104,49 +104,49 @@ typedef struct module {
104 * 104 *
105 * Alternatively, in some environments rump kernels use 105 * Alternatively, in some environments rump kernels use
106 * __attribute__((constructor)) due to link sets being 106 * __attribute__((constructor)) due to link sets being
107 * difficult (impossible?) to implement (e.g. GNU gold, OS X, etc.) 107 * difficult (impossible?) to implement (e.g. GNU gold, OS X, etc.)
108 */ 108 */
109 109
110#ifdef RUMP_USE_CTOR 110#ifdef RUMP_USE_CTOR
111struct modinfo_chain { 111struct modinfo_chain {
112 const struct modinfo *mc_info; 112 const struct modinfo *mc_info;
113 LIST_ENTRY(modinfo_chain) mc_entries; 113 LIST_ENTRY(modinfo_chain) mc_entries;
114}; 114};
115LIST_HEAD(modinfo_boot_chain, modinfo_chain); 115LIST_HEAD(modinfo_boot_chain, modinfo_chain);
116#define _MODULE_REGISTER(name) \ 116#define _MODULE_REGISTER(name) \
117static void modctor_##name(void) __attribute__((constructor)); \ 117static void __CONCAT(modctor_,name)(void) __attribute__((__constructor__));\
118static void modctor_##name(void) \ 118static void __CONCAT(modctor_,name)(void) \
119{ \ 119{ \
120 static struct modinfo_chain mc = { \ 120 static struct modinfo_chain mc = { \
121 .mc_info = &name##_modinfo, \ 121 .mc_info = &__CONCAT(name,_modinfo), \
122 }; \ 122 }; \
123 extern struct modinfo_boot_chain modinfo_boot_chain; \ 123 extern struct modinfo_boot_chain modinfo_boot_chain; \
124 LIST_INSERT_HEAD(&modinfo_boot_chain, &mc, mc_entries); \ 124 LIST_INSERT_HEAD(&modinfo_boot_chain, &mc, mc_entries); \
125} 125}
126 126
127#else /* RUMP_USE_CTOR */ 127#else /* RUMP_USE_CTOR */
128 128
129#define _MODULE_REGISTER(name) __link_set_add_rodata(modules, name##_modinfo); 129#define _MODULE_REGISTER(name) __link_set_add_rodata(modules, __CONCAT(name,_modinfo));
130 130
131#endif /* RUMP_USE_CTOR */ 131#endif /* RUMP_USE_CTOR */
132 132
133#define MODULE(class, name, required) \ 133#define MODULE(class, name, required) \
134static int name##_modcmd(modcmd_t, void *); \ 134static int __CONCAT(name,_modcmd)(modcmd_t, void *); \
135static const modinfo_t name##_modinfo = { \ 135static const modinfo_t __CONCAT(name,_modinfo) = { \
136 .mi_version = __NetBSD_Version__, \ 136 .mi_version = __NetBSD_Version__, \
137 .mi_class = (class), \ 137 .mi_class = (class), \
138 .mi_modcmd = name##_modcmd, \ 138 .mi_modcmd = __CONCAT(name,_modcmd), \
139 .mi_name = #name, \ 139 .mi_name = __STRING(name), \
140 .mi_required = (required) \ 140 .mi_required = (required) \
141}; \ 141}; \
142_MODULE_REGISTER(name) 142_MODULE_REGISTER(name)
143 143
144TAILQ_HEAD(modlist, module); 144TAILQ_HEAD(modlist, module);
145 145
146extern struct vm_map *module_map; 146extern struct vm_map *module_map;
147extern u_int module_count; 147extern u_int module_count;
148extern u_int module_builtinlist; 148extern u_int module_builtinlist;
149extern struct modlist module_list; 149extern struct modlist module_list;
150extern struct modlist module_builtins; 150extern struct modlist module_builtins;
151extern u_int module_gen; 151extern u_int module_gen;
152 152