From dc9ba0270bf3ef2c3de5fbd3cf427ffbbabf7428 Mon Sep 17 00:00:00 2001 From: Steven Hartland Date: Fri, 15 Jan 2016 00:55:36 +0000 Subject: [PATCH] Make common boot file_loadraw name parameter const Fix compiler warnings about dropping const qualifier by changing file_loadraw name param to const, and updating method to make that the case (it was abusing the variable). MFC after: 2 weeks X-MFC-With: r293268 Sponsored by: Multiplay --- sys/boot/common/bootstrap.h | 2 +- sys/boot/common/module.c | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/sys/boot/common/bootstrap.h b/sys/boot/common/bootstrap.h index 78d742d62718..7efc2c2ddc68 100644 --- a/sys/boot/common/bootstrap.h +++ b/sys/boot/common/bootstrap.h @@ -237,7 +237,7 @@ void unload(void); struct preloaded_file *file_alloc(void); struct preloaded_file *file_findfile(const char *name, const char *type); struct file_metadata *file_findmetadata(struct preloaded_file *fp, int type); -struct preloaded_file *file_loadraw(char *name, char *type, int insert); +struct preloaded_file *file_loadraw(const char *name, char *type, int insert); void file_discard(struct preloaded_file *fp); void file_addmetadata(struct preloaded_file *fp, int type, size_t size, void *p); int file_addmodule(struct preloaded_file *fp, char *modname, int version, diff --git a/sys/boot/common/module.c b/sys/boot/common/module.c index d73f1c8d0fb9..923da5b4a795 100644 --- a/sys/boot/common/module.c +++ b/sys/boot/common/module.c @@ -388,14 +388,14 @@ file_load_dependencies(struct preloaded_file *base_file) } /* - * We've been asked to load (name) as (type), so just suck it in, + * We've been asked to load (fname) as (type), so just suck it in, * no arguments or anything. */ struct preloaded_file * -file_loadraw(char *name, char *type, int insert) +file_loadraw(const char *fname, char *type, int insert) { struct preloaded_file *fp; - char *cp; + char *name; int fd, got; vm_offset_t laddr; @@ -406,12 +406,11 @@ file_loadraw(char *name, char *type, int insert) } /* locate the file on the load path */ - cp = file_search(name, NULL); - if (cp == NULL) { - sprintf(command_errbuf, "can't find '%s'", name); + name = file_search(fname, NULL); + if (name == NULL) { + sprintf(command_errbuf, "can't find '%s'", fname); return(NULL); } - name = cp; if ((fd = open(name, O_RDONLY)) < 0) { sprintf(command_errbuf, "can't open '%s': %s", name, strerror(errno));