summaryrefslogtreecommitdiffstats
path: root/sys/boot/common
diff options
context:
space:
mode:
authorsmh <smh@FreeBSD.org>2016-01-15 00:55:36 +0000
committersmh <smh@FreeBSD.org>2016-01-15 00:55:36 +0000
commit5739e2c8f76bb0f3302998a46ed95ea141fe7e66 (patch)
treee53ad6dbe6e666e477d706a57205268dab165fbc /sys/boot/common
parent527a9ccfedaadb9646bab7e92a44f742de07cce1 (diff)
downloadFreeBSD-src-5739e2c8f76bb0f3302998a46ed95ea141fe7e66.zip
FreeBSD-src-5739e2c8f76bb0f3302998a46ed95ea141fe7e66.tar.gz
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
Diffstat (limited to 'sys/boot/common')
-rw-r--r--sys/boot/common/bootstrap.h2
-rw-r--r--sys/boot/common/module.c13
2 files changed, 7 insertions, 8 deletions
diff --git a/sys/boot/common/bootstrap.h b/sys/boot/common/bootstrap.h
index 78d742d..7efc2c2 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 d73f1c8..923da5b 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));
OpenPOWER on IntegriCloud