module.c (293835) | module.c (294058) |
---|---|
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 --- 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) 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 --- 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: head/sys/boot/common/module.c 293835 2016-01-13 18:33:12Z smh $"); | 28__FBSDID("$FreeBSD: head/sys/boot/common/module.c 294058 2016-01-15 00:55:36Z smh $"); |
29 30/* 31 * file/module function dispatcher, support, etc. 32 */ 33 34#include <stand.h> 35#include <string.h> 36#include <sys/param.h> --- 346 unchanged lines hidden (view full) --- 383 fp = base_file; 384 base_file = base_file->f_next; 385 file_discard(fp); 386 } 387 return (error); 388} 389 390/* | 29 30/* 31 * file/module function dispatcher, support, etc. 32 */ 33 34#include <stand.h> 35#include <string.h> 36#include <sys/param.h> --- 346 unchanged lines hidden (view full) --- 383 fp = base_file; 384 base_file = base_file->f_next; 385 file_discard(fp); 386 } 387 return (error); 388} 389 390/* |
391 * We've been asked to load (name) as (type), so just suck it in, | 391 * We've been asked to load (fname) as (type), so just suck it in, |
392 * no arguments or anything. 393 */ 394struct preloaded_file * | 392 * no arguments or anything. 393 */ 394struct preloaded_file * |
395file_loadraw(char *name, char *type, int insert) | 395file_loadraw(const char *fname, char *type, int insert) |
396{ 397 struct preloaded_file *fp; | 396{ 397 struct preloaded_file *fp; |
398 char *cp; | 398 char *name; |
399 int fd, got; 400 vm_offset_t laddr; 401 402 /* We can't load first */ 403 if ((file_findfile(NULL, NULL)) == NULL) { 404 command_errmsg = "can't load file before kernel"; 405 return(NULL); 406 } 407 408 /* locate the file on the load path */ | 399 int fd, got; 400 vm_offset_t laddr; 401 402 /* We can't load first */ 403 if ((file_findfile(NULL, NULL)) == NULL) { 404 command_errmsg = "can't load file before kernel"; 405 return(NULL); 406 } 407 408 /* locate the file on the load path */ |
409 cp = file_search(name, NULL); 410 if (cp == NULL) { 411 sprintf(command_errbuf, "can't find '%s'", name); | 409 name = file_search(fname, NULL); 410 if (name == NULL) { 411 sprintf(command_errbuf, "can't find '%s'", fname); |
412 return(NULL); 413 } | 412 return(NULL); 413 } |
414 name = cp; | |
415 416 if ((fd = open(name, O_RDONLY)) < 0) { 417 sprintf(command_errbuf, "can't open '%s': %s", name, strerror(errno)); 418 free(name); 419 return(NULL); 420 } 421 422 if (archsw.arch_loadaddr != NULL) --- 634 unchanged lines hidden --- | 414 415 if ((fd = open(name, O_RDONLY)) < 0) { 416 sprintf(command_errbuf, "can't open '%s': %s", name, strerror(errno)); 417 free(name); 418 return(NULL); 419 } 420 421 if (archsw.arch_loadaddr != NULL) --- 634 unchanged lines hidden --- |