Deleted Added
full compact
kern_linker.c (355418) kern_linker.c (359652)
1/*-
2 * Copyright (c) 1997-2000 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1997-2000 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: stable/11/sys/kern/kern_linker.c 355418 2019-12-05 14:52:06Z hselasky $");
28__FBSDID("$FreeBSD: stable/11/sys/kern/kern_linker.c 359652 2020-04-06 07:16:31Z hselasky $");
29
30#include "opt_ddb.h"
31#include "opt_kld.h"
32#include "opt_hwpmc_hooks.h"
33
34#include <sys/param.h>
35#include <sys/kernel.h>
36#include <sys/systm.h>

--- 119 unchanged lines hidden (view full) ---

156linker_init(void *arg)
157{
158
159 sx_init(&kld_sx, "kernel linker");
160 TAILQ_INIT(&classes);
161 TAILQ_INIT(&linker_files);
162}
163
29
30#include "opt_ddb.h"
31#include "opt_kld.h"
32#include "opt_hwpmc_hooks.h"
33
34#include <sys/param.h>
35#include <sys/kernel.h>
36#include <sys/systm.h>

--- 119 unchanged lines hidden (view full) ---

156linker_init(void *arg)
157{
158
159 sx_init(&kld_sx, "kernel linker");
160 TAILQ_INIT(&classes);
161 TAILQ_INIT(&linker_files);
162}
163
164SYSINIT(linker, SI_SUB_KLD, SI_ORDER_FIRST, linker_init, 0);
164SYSINIT(linker, SI_SUB_KLD, SI_ORDER_FIRST, linker_init, NULL);
165
166static void
167linker_stop_class_add(void *arg)
168{
169
170 linker_no_more_classes = 1;
171}
172

--- 231 unchanged lines hidden (view full) ---

404{
405
406 sx_xlock(&kld_sx);
407 linker_file_register_modules(linker_kernel_file);
408 sx_xunlock(&kld_sx);
409}
410
411SYSINIT(linker_kernel, SI_SUB_KLD, SI_ORDER_ANY, linker_init_kernel_modules,
165
166static void
167linker_stop_class_add(void *arg)
168{
169
170 linker_no_more_classes = 1;
171}
172

--- 231 unchanged lines hidden (view full) ---

404{
405
406 sx_xlock(&kld_sx);
407 linker_file_register_modules(linker_kernel_file);
408 sx_xunlock(&kld_sx);
409}
410
411SYSINIT(linker_kernel, SI_SUB_KLD, SI_ORDER_ANY, linker_init_kernel_modules,
412 0);
412 NULL);
413
414static int
415linker_load_file(const char *filename, linker_file_t *result)
416{
417 linker_class_t lc;
418 linker_file_t lf;
419 int foundfile, error, modules;
420

--- 1254 unchanged lines hidden (view full) ---

1675fail:
1676 TAILQ_REMOVE(&depended_files, lf, loaded);
1677 linker_file_unload(lf, LINKER_UNLOAD_FORCE);
1678 }
1679 sx_xunlock(&kld_sx);
1680 /* woohoo! we made it! */
1681}
1682
413
414static int
415linker_load_file(const char *filename, linker_file_t *result)
416{
417 linker_class_t lc;
418 linker_file_t lf;
419 int foundfile, error, modules;
420

--- 1254 unchanged lines hidden (view full) ---

1675fail:
1676 TAILQ_REMOVE(&depended_files, lf, loaded);
1677 linker_file_unload(lf, LINKER_UNLOAD_FORCE);
1678 }
1679 sx_xunlock(&kld_sx);
1680 /* woohoo! we made it! */
1681}
1682
1683SYSINIT(preload, SI_SUB_KLD, SI_ORDER_MIDDLE, linker_preload, 0);
1683SYSINIT(preload, SI_SUB_KLD, SI_ORDER_MIDDLE, linker_preload, NULL);
1684
1685/*
1686 * Search for a not-loaded module by name.
1687 *
1688 * Modules may be found in the following locations:
1689 *
1690 * - preloaded (result is just the module name) - on disk (result is full path
1691 * to module)

--- 511 unchanged lines hidden ---
1684
1685/*
1686 * Search for a not-loaded module by name.
1687 *
1688 * Modules may be found in the following locations:
1689 *
1690 * - preloaded (result is just the module name) - on disk (result is full path
1691 * to module)

--- 511 unchanged lines hidden ---