Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jan 2016 00:55:36 +0000 (UTC)
From:      Steven Hartland <smh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r294058 - head/sys/boot/common
Message-ID:  <201601150055.u0F0takc014192@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: smh
Date: Fri Jan 15 00:55:36 2016
New Revision: 294058
URL: https://svnweb.freebsd.org/changeset/base/294058

Log:
  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

Modified:
  head/sys/boot/common/bootstrap.h
  head/sys/boot/common/module.c

Modified: head/sys/boot/common/bootstrap.h
==============================================================================
--- head/sys/boot/common/bootstrap.h	Fri Jan 15 00:26:15 2016	(r294057)
+++ head/sys/boot/common/bootstrap.h	Fri Jan 15 00:55:36 2016	(r294058)
@@ -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,

Modified: head/sys/boot/common/module.c
==============================================================================
--- head/sys/boot/common/module.c	Fri Jan 15 00:26:15 2016	(r294057)
+++ head/sys/boot/common/module.c	Fri Jan 15 00:55:36 2016	(r294058)
@@ -388,14 +388,14 @@ file_load_dependencies(struct preloaded_
 }
 
 /*
- * 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
     }
 
     /* 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));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601150055.u0F0takc014192>