module.c (59854) | module.c (64187) |
---|---|
1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * | 1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * $FreeBSD: head/sys/boot/common/module.c 59854 2000-05-01 17:41:25Z bp $ | 26 * $FreeBSD: head/sys/boot/common/module.c 64187 2000-08-03 09:14:02Z jhb $ |
27 */ 28 29/* 30 * file/module function dispatcher, support, etc. 31 */ 32 33#include <stand.h> 34#include <string.h> --- 9 unchanged lines hidden (view full) --- 44struct kernel_module * file_findmodule(struct preloaded_file *fp, char *modname); 45static char *mod_searchmodule(char *name); 46static void file_insert_tail(struct preloaded_file *mp); 47struct file_metadata* metadata_next(struct file_metadata *base_mp, int type); 48 49/* load address should be tweaked by first module loaded (kernel) */ 50static vm_offset_t loadaddr = 0; 51 | 27 */ 28 29/* 30 * file/module function dispatcher, support, etc. 31 */ 32 33#include <stand.h> 34#include <string.h> --- 9 unchanged lines hidden (view full) --- 44struct kernel_module * file_findmodule(struct preloaded_file *fp, char *modname); 45static char *mod_searchmodule(char *name); 46static void file_insert_tail(struct preloaded_file *mp); 47struct file_metadata* metadata_next(struct file_metadata *base_mp, int type); 48 49/* load address should be tweaked by first module loaded (kernel) */ 50static vm_offset_t loadaddr = 0; 51 |
52static char *default_searchpath ="/;/boot;/modules"; | 52static const char *default_searchpath ="/;/boot;/modules"; |
53 54struct preloaded_file *preloaded_files = NULL; 55 56/* 57 * load an object, either a disk file or code module. 58 * 59 * To load a file, the syntax is: 60 * --- 368 unchanged lines hidden (view full) --- 429 * Make a copy of (size) bytes of data from (p), and associate them as 430 * metadata of (type) to the module (mp). 431 */ 432void 433file_addmetadata(struct preloaded_file *fp, int type, size_t size, void *p) 434{ 435 struct file_metadata *md; 436 | 53 54struct preloaded_file *preloaded_files = NULL; 55 56/* 57 * load an object, either a disk file or code module. 58 * 59 * To load a file, the syntax is: 60 * --- 368 unchanged lines hidden (view full) --- 429 * Make a copy of (size) bytes of data from (p), and associate them as 430 * metadata of (type) to the module (mp). 431 */ 432void 433file_addmetadata(struct preloaded_file *fp, int type, size_t size, void *p) 434{ 435 struct file_metadata *md; 436 |
437 md = malloc(sizeof(struct file_metadata) + size); | 437 md = malloc(sizeof(struct file_metadata) - sizeof(md->md_data) + size); |
438 md->md_size = size; 439 md->md_type = type; 440 bcopy(p, md->md_data, size); 441 md->md_next = fp->f_metadata; 442 fp->f_metadata = md; 443} 444 445/* --- 197 unchanged lines hidden --- | 438 md->md_size = size; 439 md->md_type = type; 440 bcopy(p, md->md_data, size); 441 md->md_next = fp->f_metadata; 442 fp->f_metadata = md; 443} 444 445/* --- 197 unchanged lines hidden --- |