[OpenBIOS] r288 - in openbios-devel: arch/ppc arch/ppc/qemu arch/sparc32 arch/sparc64 drivers fs/grubfs fs/hfsplus include/openbios kernel modules

svn at openbios.org svn at openbios.org
Sun Dec 14 13:54:24 CET 2008


Author: blueswirl
Date: 2008-12-14 13:54:23 +0100 (Sun, 14 Dec 2008)
New Revision: 288

Modified:
   openbios-devel/arch/ppc/kernel.c
   openbios-devel/arch/ppc/qemu/init.c
   openbios-devel/arch/sparc32/boot.c
   openbios-devel/arch/sparc32/openprom.h
   openbios-devel/arch/sparc32/romvec.c
   openbios-devel/arch/sparc64/boot.c
   openbios-devel/drivers/esp.c
   openbios-devel/drivers/ide.c
   openbios-devel/fs/grubfs/fsys_xfs.c
   openbios-devel/fs/grubfs/grubfs_fs.c
   openbios-devel/fs/hfsplus/hfsp_fs.c
   openbios-devel/include/openbios/fs.h
   openbios-devel/include/openbios/kernel.h
   openbios-devel/kernel/bootstrap.c
   openbios-devel/kernel/dict.c
   openbios-devel/modules/nvram.c
   openbios-devel/modules/video.c
Log:
Warning fixes for Sparc32, Sparc64, PPC

Fix warnings that would be caused by gcc flag -Wwrite-strings and
-Wmissing-prototypes. Also fix most PPC specific warnings.


Modified: openbios-devel/arch/ppc/kernel.c
===================================================================
--- openbios-devel/arch/ppc/kernel.c	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/arch/ppc/kernel.c	2008-12-14 12:54:23 UTC (rev 288)
@@ -28,8 +28,6 @@
 #define MEMORY_SIZE	(256*1024)	/* 256K ram for hosted system */
 #define DICTIONARY_SIZE	(512*1024)	/* 128K for the dictionary   */
 
-extern unsigned char 	*dict;
-extern cell 		dicthead;
 static ucell 		*memory;
 
 /************************************************************************/

Modified: openbios-devel/arch/ppc/qemu/init.c
===================================================================
--- openbios-devel/arch/ppc/qemu/init.c	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/arch/ppc/qemu/init.c	2008-12-14 12:54:23 UTC (rev 288)
@@ -87,7 +87,7 @@
 }
 
 static void
-setenv( char *env, char *value )
+setenv( const char *env, const char *value )
 {
 	push_str( value );
 	push_str( env );
@@ -97,7 +97,7 @@
 void
 arch_of_init( void )
 {
-#if USE_RTAS
+#ifdef USE_RTAS
 	phandle_t ph;
 #endif
 	int autoboot;
@@ -114,7 +114,7 @@
 
 	node_methods_init();
 
-#if USE_RTAS
+#ifdef USE_RTAS
 	if( !(ph=find_dev("/rtas")) )
 		printk("Warning: No /rtas node\n");
 	else {

Modified: openbios-devel/arch/sparc32/boot.c
===================================================================
--- openbios-devel/arch/sparc32/boot.c	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/arch/sparc32/boot.c	2008-12-14 12:54:23 UTC (rev 288)
@@ -34,8 +34,8 @@
 
 void boot(void)
 {
-        char *path = pop_fstr_copy(), *param, *oldpath = path;
-        char altpath[256];
+        char *path = pop_fstr_copy(), *param, altpath[256];
+        const char *oldpath = path;
         int unit = 0;
         const void *romvec;
 

Modified: openbios-devel/arch/sparc32/openprom.h
===================================================================
--- openbios-devel/arch/sparc32/openprom.h	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/arch/sparc32/openprom.h	2008-12-14 12:54:23 UTC (rev 288)
@@ -172,10 +172,10 @@
 struct linux_nodeops {
 	int (*no_nextnode)(int node);
 	int (*no_child)(int node);
-	int (*no_proplen)(int node, char *name);
-	int (*no_getprop)(int node, char *name, char *val);
-	int (*no_setprop)(int node, char *name, char *val, int len);
-	const char * (*no_nextprop)(int node, char *name);
+        int (*no_proplen)(int node, const char *name);
+        int (*no_getprop)(int node, const char *name, char *val);
+        int (*no_setprop)(int node, const char *name, char *val, int len);
+        const char * (*no_nextprop)(int node, const char *name);
 };
 
 /* More fun PROM structures for device probing. */

Modified: openbios-devel/arch/sparc32/romvec.c
===================================================================
--- openbios-devel/arch/sparc32/romvec.c	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/arch/sparc32/romvec.c	2008-12-14 12:54:23 UTC (rev 288)
@@ -41,10 +41,10 @@
 
 static int obp_nextnode(int node);
 static int obp_child(int node);
-static int obp_proplen(int node, char *name);
-static int obp_getprop(int node, char *name, char *val);
-static int obp_setprop(int node, char *name, char *val, int len);
-static const char *obp_nextprop(int node, char *name);
+static int obp_proplen(int node, const char *name);
+static int obp_getprop(int node, const char *name, char *val);
+static int obp_setprop(int node, const char *name, char *val, int len);
+static const char *obp_nextprop(int node, const char *name);
 static int obp_devread(int dev_desc, char *buf, int nbytes);
 static int obp_devseek(int dev_desc, int hi, int lo);
 
@@ -85,7 +85,7 @@
     return child;
 }
 
-static int obp_proplen(int node, char *name)
+static int obp_proplen(int node, const char *name)
 {
     int notfound;
 
@@ -129,11 +129,11 @@
 }
 #endif
 
-static int obp_getprop(int node, char *name, char *value)
+static int obp_getprop(int node, const char *name, char *value)
 {
     int notfound, found;
     int len;
-    char *str;
+    const char *str;
 
     if (!node) {
         DPRINTF("obp_getprop(0x0, %s) = -1\n", name);
@@ -192,7 +192,7 @@
     }
 }
 
-static const char *obp_nextprop(int node, char *name)
+static const char *obp_nextprop(int node, const char *name)
 {
     int found;
 
@@ -224,7 +224,7 @@
 }
 
 static int obp_setprop(__attribute__((unused)) int node,
-		       __attribute__((unused)) char *name,
+                       __attribute__((unused)) const char *name,
 		       __attribute__((unused)) char *value,
 		       __attribute__((unused)) int len)
 {

Modified: openbios-devel/arch/sparc64/boot.c
===================================================================
--- openbios-devel/arch/sparc64/boot.c	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/arch/sparc64/boot.c	2008-12-14 12:54:23 UTC (rev 288)
@@ -44,17 +44,17 @@
             } else {
                 switch (boot_device) {
                 case 'a':
-                    path = "/obio/SUNW,fdtwo";
+                    path = strdup("/obio/SUNW,fdtwo");
                     break;
                 case 'c':
-                    path = "disk";
+                    path = strdup("disk");
                     break;
                 default:
                 case 'd':
-                    path = "cdrom";
+                    path = strdup("cdrom");
                     break;
                 case 'n':
-                    path = "net";
+                    path = strdup("net");
                     break;
                 }
             }

Modified: openbios-devel/drivers/esp.c
===================================================================
--- openbios-devel/drivers/esp.c	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/drivers/esp.c	2008-12-14 12:54:23 UTC (rev 288)
@@ -41,7 +41,7 @@
 
 typedef struct sd_private {
     unsigned int bs;
-    char *media_str;
+    const char *media_str;
     uint32_t sectors;
     uint8_t media;
     uint8_t id;
@@ -182,7 +182,7 @@
 static unsigned int
 inquiry(esp_private_t *esp, sd_private_t *sd)
 {
-    char *media = "UNKNOWN";
+    const char *media = "UNKNOWN";
 
     // Setup command = Inquiry
     memset(esp->buffer, 0, 7);

Modified: openbios-devel/drivers/ide.c
===================================================================
--- openbios-devel/drivers/ide.c	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/drivers/ide.c	2008-12-14 12:54:23 UTC (rev 288)
@@ -157,7 +157,7 @@
 }
 
 static void
-ob_ide_error(struct ide_drive *drive, unsigned char stat, char *msg)
+ob_ide_error(struct ide_drive *drive, unsigned char stat, const char *msg)
 {
 	struct ide_channel *chan = drive->channel;
 	unsigned char err;
@@ -1285,8 +1285,8 @@
 {
 	int i, j;
 
-	char * nodetemp_chan = "/pci/isa/ide%d";
-	char * nodetemp = "/pci/isa/ide%d/%s";
+        const char *nodetemp_chan = "/pci/isa/ide%d";
+        const char *nodetemp = "/pci/isa/ide%d/%s";
 	char nodebuff[32];
 	phandle_t dnode;
 
@@ -1336,7 +1336,7 @@
 		printk("ide%d: [io ports 0x%x-0x%x,0x%x]\n", i, chan->io_regs[0], chan->io_regs[0] + 7, chan->io_regs[8]);
 		for (j = 0; j < 2; j++) {
 			struct ide_drive *drive = &chan->drives[j];
-			char *media = "UNKNOWN";
+                        const char *media = "UNKNOWN";
 
 			if (!drive->present)
 				continue;

Modified: openbios-devel/fs/grubfs/fsys_xfs.c
===================================================================
--- openbios-devel/fs/grubfs/fsys_xfs.c	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/fs/grubfs/fsys_xfs.c	2008-12-14 12:54:23 UTC (rev 288)
@@ -342,10 +342,16 @@
 {
 	int namelen = 1;
 	int toread;
-	static char *usual[2] = {".", ".."};
+        static char *usual[2];
 	static xfs_dir2_sf_entry_t *sfe;
-	char *name = usual[0];
+        char *name;
 
+        if (!usual[0]) {
+            usual[0] = strdup(".");
+            usual[1] = strdup("..");
+        }
+        name = usual[0];
+
 	if (xfs.dirpos >= xfs.dirmax) {
 		if (xfs.forw == 0)
 			return NULL;

Modified: openbios-devel/fs/grubfs/grubfs_fs.c
===================================================================
--- openbios-devel/fs/grubfs/grubfs_fs.c	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/fs/grubfs/grubfs_fs.c	2008-12-14 12:54:23 UTC (rev 288)
@@ -47,7 +47,7 @@
 /************************************************************************/
 
 typedef struct fsys_entry {
-	char	*name;
+        const char *name;
 	int	(*mount_func) (void);
 	int	(*read_func) (char *buf, int len);
 	int	(*dir_func) (char *dirname);
@@ -221,7 +221,7 @@
 	/* callers responsibility to call free(fs) */
 }
 
-static char *
+static const char *
 grubfs_get_fstype( fs_ops_t *fs )
 {
 	grubfs_t *gfs = (grubfs_t*)fs->fs_data;

Modified: openbios-devel/fs/hfsplus/hfsp_fs.c
===================================================================
--- openbios-devel/fs/hfsplus/hfsp_fs.c	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/fs/hfsplus/hfsp_fs.c	2008-12-14 12:54:23 UTC (rev 288)
@@ -67,7 +67,9 @@
 	} while( ret && !record_next(&r) );
 
 	if( !ret && pt ) {
-		char name[256], *s2 = t.path ? t.path : "";
+                char name[256];
+                const char *s2 = t.path ? t.path : "";
+
 		unicode_uni2asc( name, &r.key.name, sizeof(name));
 
 		pt->rec = t.rec;
@@ -359,7 +361,7 @@
 	return get_hfs_vol_name( fs->fd, buf, size );
 }
 
-static char *
+static const char *
 get_fstype( fs_ops_t *fs )
 {
 	return ("HFS+");

Modified: openbios-devel/include/openbios/fs.h
===================================================================
--- openbios-devel/include/openbios/fs.h	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/include/openbios/fs.h	2008-12-14 12:54:23 UTC (rev 288)
@@ -43,7 +43,7 @@
 	int		(*lseek)( file_desc_t *file, off_t offset, int whence );
 	char		*(*get_path)( file_desc_t *file, char *buf, int len );
 
-	char		*(*get_fstype)( fs_ops_t *fs );
+        const char     	*(*get_fstype)( fs_ops_t *fs );
 };
 
 extern fs_ops_t		*fs_open( int fs_type, int fd );

Modified: openbios-devel/include/openbios/kernel.h
===================================================================
--- openbios-devel/include/openbios/kernel.h	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/include/openbios/kernel.h	2008-12-14 12:54:23 UTC (rev 288)
@@ -25,7 +25,7 @@
 extern int		enterforth( xt_t xt );
 extern void		panic(const char *error) __attribute__ ((noreturn));
 
-extern xt_t		findword(char *s1);
+extern xt_t		findword(const char *s1);
 extern void		modules_init( void );
 
 /* arch kernel hooks */

Modified: openbios-devel/kernel/bootstrap.c
===================================================================
--- openbios-devel/kernel/bootstrap.c	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/kernel/bootstrap.c	2008-12-14 12:54:23 UTC (rev 288)
@@ -53,7 +53,7 @@
 /* include path handling */
 typedef struct include_path include;
 struct include_path {
-	char *path;
+        const char *path;
 	include *next;
 };
 
@@ -137,7 +137,7 @@
 	relocation_address=reloc_table;
 }
 
-static void write_dictionary(char *filename)
+static void write_dictionary(const char *filename)
 {
 	FILE *f;
 	unsigned char *write_data, *walk_data;
@@ -375,7 +375,7 @@
  * generic forth word creator function.
  */
 
-static void fcreate(char *word, ucell cfaval)
+static void fcreate(const char *word, ucell cfaval)
 {
 	if (strlen(word) == 0) {
 		printk("WARNING: tried to create unnamed word.\n");
@@ -395,20 +395,20 @@
 }
 
 
-static ucell *buildvariable(char *name, cell defval)
+static ucell *buildvariable(const char *name, cell defval)
 {
 	fcreate(name, DOVAR);	/* see dict.h for DOVAR and other CFA ids */
 	writecell(defval);
 	return (ucell *) (dict + dicthead - sizeof(cell));
 }
 
-static void buildconstant(char *name, cell defval)
+static void buildconstant(const char *name, cell defval)
 {
 	fcreate(name, DOCON);	/* see dict.h for DOCON and other CFA ids */
 	writecell(defval);
 }
 
-static void builddefer(char *name)
+static void builddefer(const char *name)
 {
 	fcreate(name, DODFR);	/* see dict.h for DODFR and other CFA ids */
         writecell((ucell)0);

Modified: openbios-devel/kernel/dict.c
===================================================================
--- openbios-devel/kernel/dict.c	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/kernel/dict.c	2008-12-14 12:54:23 UTC (rev 288)
@@ -68,7 +68,7 @@
 
 /* fstrcmp - compare null terminated string with forth string. */
 
-static int fstrcmp(char *s1, ucell fstr)
+static int fstrcmp(const char *s1, ucell fstr)
 {
 	char *s2 = (char*)cell2pointer(fstr);
 	while (*s1) {
@@ -84,7 +84,7 @@
  * word.
  */
 
-xt_t findword(char *s1)
+xt_t findword(const char *s1)
 {
 	ucell tmplfa, len;
 

Modified: openbios-devel/modules/nvram.c
===================================================================
--- openbios-devel/modules/nvram.c	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/modules/nvram.c	2008-12-14 12:54:23 UTC (rev 288)
@@ -110,7 +110,7 @@
 }
 
 static int
-create_nv_part( int signature, char *name, int size )
+create_nv_part( int signature, const char *name, int size )
 {
 	nvpart_t *p = NULL;
 	int fs;

Modified: openbios-devel/modules/video.c
===================================================================
--- openbios-devel/modules/video.c	2008-12-14 10:28:56 UTC (rev 287)
+++ openbios-devel/modules/video.c	2008-12-14 12:54:23 UTC (rev 288)
@@ -174,7 +174,7 @@
 #ifdef CONFIG_MOL
 	if( video.fb.depth == 8 )
 		OSI_SetColor( ind, color );
-#elif CONFIG_SPARC32
+#elif defined(CONFIG_SPARC32)
 	if( video.fb.depth == 8 ) {
             dac[0] = ind << 24;
             dac[1] = ((color >> 16) & 0xff) << 24; // Red




More information about the OpenBIOS mailing list