[OpenBIOS] r302 - in openbios-devel: arch/ppc/qemu fs/hfs fs/hfs/include include

svn at openbios.org svn at openbios.org
Sun Dec 21 10:15:57 CET 2008


Author: blueswirl
Date: 2008-12-21 10:15:57 +0100 (Sun, 21 Dec 2008)
New Revision: 302

Modified:
   openbios-devel/arch/ppc/qemu/init.c
   openbios-devel/arch/ppc/qemu/kernel.c
   openbios-devel/arch/ppc/qemu/kernel.h
   openbios-devel/arch/ppc/qemu/main.c
   openbios-devel/arch/ppc/qemu/methods.c
   openbios-devel/arch/ppc/qemu/ofmem.c
   openbios-devel/fs/hfs/block.c
   openbios-devel/fs/hfs/btree.c
   openbios-devel/fs/hfs/data.c
   openbios-devel/fs/hfs/file.c
   openbios-devel/fs/hfs/hfs.c
   openbios-devel/fs/hfs/hfs_fs.c
   openbios-devel/fs/hfs/include/data.h
   openbios-devel/fs/hfs/include/libhfs.h
   openbios-devel/fs/hfs/include/volume.h
   openbios-devel/fs/hfs/volume.c
   openbios-devel/include/ofmem.h
Log:
Fix gcc and Sparse warnings generated by r301

Modified: openbios-devel/arch/ppc/qemu/init.c
===================================================================
--- openbios-devel/arch/ppc/qemu/init.c	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/arch/ppc/qemu/init.c	2008-12-21 09:15:57 UTC (rev 302)
@@ -32,11 +32,6 @@
 extern void ob_pci_init( void );
 extern void setup_timers( void );
 
-extern ulong get_ram_size( void );
-extern ulong get_ram_top( void );
-extern ulong get_ram_bottom( void );
-
-
 void
 unexpected_excep( int vector )
 {
@@ -88,21 +83,12 @@
 		;
 }
 
-static void
-setenv( const char *env, const char *value )
-{
-	push_str( value );
-	push_str( env );
-	fword("$setenv");
-}
-
 void
 arch_of_init( void )
 {
 #ifdef USE_RTAS
 	phandle_t ph;
 #endif
-	int autoboot;
 	uint64_t ram_size;
 
 	devtree_init();

Modified: openbios-devel/arch/ppc/qemu/kernel.c
===================================================================
--- openbios-devel/arch/ppc/qemu/kernel.c	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/arch/ppc/qemu/kernel.c	2008-12-21 09:15:57 UTC (rev 302)
@@ -29,8 +29,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/kernel.h
===================================================================
--- openbios-devel/arch/ppc/qemu/kernel.h	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/arch/ppc/qemu/kernel.h	2008-12-21 09:15:57 UTC (rev 302)
@@ -22,6 +22,7 @@
 /* start.S */
 extern void 		flush_icache_range( char *start, char *stop );
 extern char		of_rtas_start[], of_rtas_end[];
+extern void             call_elf( ulong elf_entry );
 
 /* methods.c */
 extern void		node_methods_init( void );

Modified: openbios-devel/arch/ppc/qemu/main.c
===================================================================
--- openbios-devel/arch/ppc/qemu/main.c	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/arch/ppc/qemu/main.c	2008-12-21 09:15:57 UTC (rev 302)
@@ -21,6 +21,7 @@
 #include "openbios/nvram.h"
 #include "libc/diskio.h"
 #include "libc/vsprintf.h"
+#include "kernel.h"
 #include "ofmem.h"
 
 //#define DEBUG_ELF
@@ -33,11 +34,10 @@
 #endif
 
 static void
-transfer_control_to_elf( ulong entry )
+transfer_control_to_elf( ulong elf_entry )
 {
-	extern void call_elf( ulong entry );
 	ELF_DPRINTF("Starting ELF boot loader\n");
-	call_elf( entry );
+        call_elf( elf_entry );
 
 	fatal_error("call_elf returned unexpectedly\n");
 }
@@ -46,7 +46,7 @@
 load_elf_rom( ulong *elf_entry, int fd )
 {
 	int i, lszz_offs, elf_offs;
-	char buf[128], *addr;
+        char *addr;
 	Elf_ehdr ehdr;
 	Elf_phdr *phdr;
 	size_t s;

Modified: openbios-devel/arch/ppc/qemu/methods.c
===================================================================
--- openbios-devel/arch/ppc/qemu/methods.c	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/arch/ppc/qemu/methods.c	2008-12-21 09:15:57 UTC (rev 302)
@@ -232,7 +232,7 @@
 static void
 mmu_translate( void )
 {
-	ulong mode;
+        int mode;
 	int virt = POP();
 	int phys = ofmem_translate( virt, &mode );
 
@@ -240,7 +240,7 @@
 		PUSH( 0 );
 	} else {
 		PUSH( phys );
-		PUSH( (int)mode );
+                PUSH( mode );
 		PUSH( -1 );
 	}
 }

Modified: openbios-devel/arch/ppc/qemu/ofmem.c
===================================================================
--- openbios-devel/arch/ppc/qemu/ofmem.c	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/arch/ppc/qemu/ofmem.c	2008-12-21 09:15:57 UTC (rev 302)
@@ -70,7 +70,7 @@
 {
 	ulong sdr1;
 
-	asm volatile("mfsdr1 %0" :: "r" (sdr1) );
+	asm volatile("mfsdr1 %0" : "=r" (sdr1) );
 
 	return (sdr1 & 0xffff0000);
 }
@@ -80,7 +80,7 @@
 {
 	ulong sdr1;
 
-	asm volatile("mfsdr1 %0" :: "r" (sdr1) );
+	asm volatile("mfsdr1 %0" : "=r" (sdr1) );
 
 	return ((sdr1 << 16) | 0x0000ffff) + 1;
 }
@@ -107,7 +107,7 @@
 ulong
 get_ram_bottom( void )
 {
-	return OF_MALLOC_BASE;
+        return (ulong)OF_MALLOC_BASE;
 }
 
 /************************************************************************/
@@ -172,7 +172,7 @@
 	if( !ptr )
 		return;
 
-	d = (alloc_desc_t*)(ptr - sizeof(alloc_desc_t));
+        d = (alloc_desc_t*)((char *)ptr - sizeof(alloc_desc_t));
 	d->next = ofmem->mfree;
 
 	/* insert in the (sorted) freelist */
@@ -185,7 +185,7 @@
 void *
 realloc( void *ptr, size_t size )
 {
-	alloc_desc_t *d = (alloc_desc_t*)(ptr - sizeof(alloc_desc_t));
+        alloc_desc_t *d = (alloc_desc_t*)((char *)ptr - sizeof(alloc_desc_t));
 	char *p;
 
 	if( !ptr )
@@ -665,8 +665,7 @@
 {
 	ofmem_t *ofmem = OFMEM;
 	ulong sdr1, sr_base, msr;
-	ulong hash_base, page;
-	ulong data_size, bss_size;
+	ulong hash_base;
 	int i;
 
 	memset(ofmem, 0, sizeof(ofmem_t));
@@ -675,7 +674,7 @@
 	/* SDR1: Storage Description Register 1 */
 
 	hash_base = (ramsize - 0x00100000 - HASH_SIZE) & 0xffff0000;
-	memset(hash_base, 0, HASH_SIZE);
+        memset((void *)hash_base, 0, HASH_SIZE);
 	sdr1 = hash_base | ((HASH_SIZE-1) >> 16);
 	asm volatile("mtsdr1 %0" :: "r" (sdr1) );
 
@@ -687,7 +686,7 @@
 		asm volatile("mtsrin %0,%1" :: "r" (sr_base + i), "r" (j) );
 	}
 
-	memcpy(get_rom_base(), 0xfff00000, 0x00100000);
+	memcpy((void *)get_rom_base(), (void *)0xfff00000, 0x00100000);
 
 	/* Enable MMU */
 
@@ -699,8 +698,6 @@
 void
 ofmem_init( void )
 {
-	ulong top;
-
 	ofmem_claim_phys( 0, get_ram_bottom(), 0 );
 	ofmem_claim_virt( 0, get_ram_bottom(), 0 );
 	ofmem_claim_phys( get_ram_top(), get_ram_size() - get_ram_top(), 0);

Modified: openbios-devel/fs/hfs/block.c
===================================================================
--- openbios-devel/fs/hfs/block.c	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/fs/hfs/block.c	2008-12-21 09:15:57 UTC (rev 302)
@@ -41,8 +41,8 @@
   ASSERT(vol->cache == 0);
 
   cache = ALLOC(bcache, 1);
-  if (cache == 0)
-    ERROR(ENOMEM, 0);
+  if (cache == NULL)
+    ERROR(ENOMEM, NULL);
 
   vol->cache = cache;
 
@@ -65,15 +65,15 @@
       b->cnext = b + 1;
       b->cprev = b - 1;
 
-      b->hnext = 0;
-      b->hprev = 0;
+      b->hnext = NULL;
+      b->hprev = NULL;
     }
 
   cache->chain[0].cprev = cache->tail;
   cache->tail->cnext    = &cache->chain[0];
 
   for (i = 0; i < HFS_HASHSZ; ++i)
-    cache->hash[i] = 0;
+    cache->hash[i] = NULL;
 
   return 0;
 
@@ -259,7 +259,7 @@
 {
   int result = 0;
 
-  if (vol->cache == 0)
+  if (vol->cache == NULL)
     goto done;
 
 # ifdef DEBUG
@@ -267,7 +267,7 @@
 # endif
 
   FREE(vol->cache);
-  vol->cache = 0;
+  vol->cache = NULL;
 
 done:
   return result;
@@ -469,7 +469,7 @@
   return b;
 
 fail:
-  return 0;
+  return NULL;
 }
 
 /*
@@ -524,7 +524,7 @@
       bucket *b;
 
       b = getbucket(vol->cache, bnum, 1);
-      if (b == 0)
+      if (b == NULL)
 	goto fail;
 
       memcpy(bp, b->data, HFS_BLOCKSZ);

Modified: openbios-devel/fs/hfs/btree.c
===================================================================
--- openbios-devel/fs/hfs/btree.c	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/fs/hfs/btree.c	2008-12-21 09:15:57 UTC (rev 302)
@@ -89,7 +89,7 @@
 int bt_readhdr(btree *bt)
 {
   const byte *ptr;
-  byte *map = 0;
+  byte *map = NULL;
   int i;
   unsigned long nnum;
 
@@ -128,8 +128,8 @@
   /* don't set bt->map until we're done, since getnode() checks it */
 
   map = ALLOC(byte, HFS_MAP1SZ);
-  if (map == 0)
-    ERROR(ENOMEM, 0);
+  if (map == NULL)
+    ERROR(ENOMEM, NULL);
 
   memcpy(map, HFS_NODEREC(bt->hdrnd, 2), HFS_MAP1SZ);
   bt->mapsz = HFS_MAP1SZ;
@@ -153,8 +153,8 @@
 	ERROR(EIO, "malformed b*-tree map node");
 
       newmap = REALLOC(map, byte, bt->mapsz + HFS_MAPXSZ);
-      if (newmap == 0)
-	ERROR(ENOMEM, 0);
+      if (newmap == NULL)
+	ERROR(ENOMEM, NULL);
 
       map = newmap;
 
@@ -186,7 +186,7 @@
   nnum = bt->hdr.bthRoot;
 
   if (nnum == 0)
-    ERROR(ENOENT, 0);
+    ERROR(ENOENT, NULL);
 
   while (1)
     {
@@ -204,7 +204,7 @@
 	{
 	case ndIndxNode:
 	  if (np->rnum == -1)
-	    ERROR(ENOENT, 0);
+            ERROR(ENOENT, NULL);
 
 	  rec  = HFS_NODEREC(*np, np->rnum);
 	  nnum = d_getul(HFS_RECDATA(rec));
@@ -213,7 +213,7 @@
 
 	case ndLeafNode:
 	  if (! found)
-	    ERROR(ENOENT, 0);
+            ERROR(ENOENT, NULL);
 
 	  goto done;
 

Modified: openbios-devel/fs/hfs/data.c
===================================================================
--- openbios-devel/fs/hfs/data.c	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/fs/hfs/data.c	2008-12-21 09:15:57 UTC (rev 302)
@@ -27,7 +27,7 @@
 static
 time_t tzdiff = -1;
 
-const
+static const
 unsigned char hfs_charorder[256] = {
   0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
   0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,

Modified: openbios-devel/fs/hfs/file.c
===================================================================
--- openbios-devel/fs/hfs/file.c	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/fs/hfs/file.c	2008-12-21 09:15:57 UTC (rev 302)
@@ -86,8 +86,8 @@
 
   file->flags = 0;
 
-  file->prev  = 0;
-  file->next  = 0;
+  file->prev  = NULL;
+  file->next  = NULL;
 }
 
 /*
@@ -156,7 +156,7 @@
     {
       ExtDataRec *extrec;
 
-      f_getptrs(file, &extrec, 0, 0);
+      f_getptrs(file, &extrec, NULL, NULL);
 
       fabn = file->fabn = 0;
       memcpy(&file->ext, extrec, sizeof(ExtDataRec));
@@ -179,7 +179,7 @@
 	  abnum -= n;
 	}
 
-      if (v_extsearch(file, fabn, &file->ext, 0) <= 0)
+      if (v_extsearch(file, fabn, &file->ext, NULL) <= 0)
 	goto fail;
 
       file->fabn = fabn;

Modified: openbios-devel/fs/hfs/hfs.c
===================================================================
--- openbios-devel/fs/hfs/hfs.c	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/fs/hfs/hfs.c	2008-12-21 09:15:57 UTC (rev 302)
@@ -45,9 +45,9 @@
 static
 int getvol(hfsvol **vol)
 {
-  if (*vol == 0)
+  if (*vol == NULL)
     {
-      if (curvol == 0)
+      if (curvol == NULL)
 	ERROR(EINVAL, "no volume is current");
 
       *vol = curvol;
@@ -81,8 +81,8 @@
     }
 
   vol = ALLOC(hfsvol, 1);
-  if (vol == 0)
-    ERROR(ENOMEM, 0);
+  if (vol == NULL)
+    ERROR(ENOMEM, NULL);
 
   v_init(vol, mode);
 
@@ -98,7 +98,7 @@
 
   /* add to linked list of volumes */
 
-  vol->prev = 0;
+  vol->prev = NULL;
   vol->next = hfs_mounts;
 
   if (hfs_mounts)
@@ -119,7 +119,7 @@
       FREE(vol);
     }
 
-  return 0;
+  return NULL;
 }
 
 
@@ -168,7 +168,7 @@
   if (vol == hfs_mounts)
     hfs_mounts = vol->next;
   if (vol == curvol)
-    curvol = 0;
+    curvol = NULL;
 
   FREE(vol);
 
@@ -197,7 +197,7 @@
 {
   hfsvol *vol;
 
-  if (name == 0)
+  if (name == NULL)
     return curvol;
 
   for (vol = hfs_mounts; vol; vol = vol->next)
@@ -206,7 +206,7 @@
 	return vol;
     }
 
-  return 0;
+  return NULL;
 }
 
 /*
@@ -264,11 +264,11 @@
   CatDataRec data;
 
   if (getvol(&vol) == -1 ||
-      v_resolve(&vol, path, &data, 0, 0, 0) <= 0)
+      v_resolve(&vol, path, &data, NULL, NULL, NULL) <= 0)
     goto fail;
 
   if (data.cdrType != cdrDirRec)
-    ERROR(ENOTDIR, 0);
+    ERROR(ENOTDIR, NULL);
 
   vol->cwd = data.u.dir.dirDirID;
 
@@ -304,7 +304,7 @@
 
   /* make sure the directory exists */
 
-  if (v_getdthread(vol, id, 0, 0) <= 0)
+  if (v_getdthread(vol, id, NULL, NULL) <= 0)
     goto fail;
 
   vol->cwd = id;
@@ -325,7 +325,7 @@
   CatDataRec thread;
 
   if (getvol(&vol) == -1 ||
-      v_getdthread(vol, *id, &thread, 0) <= 0)
+      v_getdthread(vol, *id, &thread, NULL) <= 0)
     goto fail;
 
   *id = thread.u.dthd.thdParID;
@@ -345,7 +345,7 @@
  */
 hfsdir *hfs_opendir(hfsvol *vol, const char *path)
 {
-  hfsdir *dir = 0;
+  hfsdir *dir = NULL;
   CatKeyRec key;
   CatDataRec data;
   byte pkey[HFS_CATKEYLEN];
@@ -354,8 +354,8 @@
     goto fail;
 
   dir = ALLOC(hfsdir, 1);
-  if (dir == 0)
-    ERROR(ENOMEM, 0);
+  if (dir == NULL)
+    ERROR(ENOMEM, NULL);
 
   dir->vol = vol;
 
@@ -368,23 +368,23 @@
     }
   else
     {
-      if (v_resolve(&vol, path, &data, 0, 0, 0) <= 0)
+      if (v_resolve(&vol, path, &data, NULL, NULL, NULL) <= 0)
 	goto fail;
 
       if (data.cdrType != cdrDirRec)
-	ERROR(ENOTDIR, 0);
+        ERROR(ENOTDIR, NULL);
 
       dir->dirid = data.u.dir.dirDirID;
-      dir->vptr  = 0;
+      dir->vptr  = NULL;
 
       r_makecatkey(&key, dir->dirid, "");
-      r_packcatkey(&key, pkey, 0);
+      r_packcatkey(&key, pkey, NULL);
 
       if (bt_search(&vol->cat, pkey, &dir->n) <= 0)
 	goto fail;
     }
 
-  dir->prev = 0;
+  dir->prev = NULL;
   dir->next = vol->dirs;
 
   if (vol->dirs)
@@ -396,7 +396,7 @@
 
 fail:
   FREE(dir);
-  return 0;
+  return NULL;
 }
 
 /*
@@ -420,12 +420,12 @@
 	    break;
 	}
 
-      if (vol == 0)
+      if (vol == NULL)
 	ERROR(ENOENT, "no more entries");
 
-      if (v_getdthread(vol, HFS_CNID_ROOTDIR, &data, 0) <= 0 ||
+      if (v_getdthread(vol, HFS_CNID_ROOTDIR, &data, NULL) <= 0 ||
 	  v_catsearch(vol, HFS_CNID_ROOTPAR, data.u.dthd.thdCName,
-		      &data, cname, 0) <= 0)
+                      &data, cname, NULL) <= 0)
 	goto fail;
 
       r_unpackdirent(HFS_CNID_ROOTPAR, cname, &data, ent);
@@ -523,20 +523,20 @@
  */
 hfsfile *hfs_open(hfsvol *vol, const char *path)
 {
-  hfsfile *file = 0;
+  hfsfile *file = NULL;
 
   if (getvol(&vol) == -1)
     goto fail;
 
   file = ALLOC(hfsfile, 1);
-  if (file == 0)
-    ERROR(ENOMEM, 0);
+  if (file == NULL)
+    ERROR(ENOMEM, NULL);
 
-  if (v_resolve(&vol, path, &file->cat, &file->parid, file->name, 0) <= 0)
+  if (v_resolve(&vol, path, &file->cat, &file->parid, file->name, NULL) <= 0)
     goto fail;
 
   if (file->cat.cdrType != cdrFilRec)
-    ERROR(EISDIR, 0);
+    ERROR(EISDIR, NULL);
 
   /* package file handle for user */
 
@@ -545,7 +545,7 @@
 
   f_selectfork(file, fkData);
 
-  file->prev = 0;
+  file->prev = NULL;
   file->next = vol->files;
 
   if (vol->files)
@@ -557,7 +557,7 @@
 
 fail:
   FREE(file);
-  return 0;
+  return NULL;
 }
 
 /*
@@ -591,7 +591,7 @@
   unsigned long *lglen, count;
   byte *ptr = buf;
 
-  f_getptrs(file, 0, &lglen, 0);
+  f_getptrs(file, NULL, &lglen, NULL);
 
   if (file->pos + len > *lglen)
     len = *lglen - file->pos;
@@ -643,7 +643,7 @@
 {
   unsigned long *lglen, newpos;
 
-  f_getptrs(file, 0, &lglen, 0);
+  f_getptrs(file, NULL, &lglen, NULL);
 
   switch (from)
     {
@@ -666,7 +666,7 @@
       break;
 
     default:
-      ERROR(EINVAL, 0);
+      ERROR(EINVAL, NULL);
     }
 
   if (newpos > *lglen)
@@ -714,7 +714,7 @@
   char name[HFS_MAX_FLEN + 1];
 
   if (getvol(&vol) == -1 ||
-      v_resolve(&vol, path, &data, &parid, name, 0) <= 0)
+      v_resolve(&vol, path, &data, &parid, name, NULL) <= 0)
     goto fail;
 
   r_unpackdirent(parid, name, &data, ent);

Modified: openbios-devel/fs/hfs/hfs_fs.c
===================================================================
--- openbios-devel/fs/hfs/hfs_fs.c	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/fs/hfs/hfs_fs.c	2008-12-21 09:15:57 UTC (rev 302)
@@ -288,7 +288,7 @@
 	/* callers responsibility to call free(fs) */
 }
 
-static char *
+static const char *
 get_fstype( fs_ops_t *fs )
 {
 	return ("HFS");

Modified: openbios-devel/fs/hfs/include/data.h
===================================================================
--- openbios-devel/fs/hfs/include/data.h	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/fs/hfs/include/data.h	2008-12-21 09:15:57 UTC (rev 302)
@@ -19,8 +19,6 @@
  * $Id: data.h,v 1.7 1998/11/02 22:08:58 rob Exp $
  */
 
-extern const unsigned char hfs_charorder[];
-
   signed  char d_getsb(register const unsigned char *);
 unsigned  char d_getub(register const unsigned char *);
   signed short d_getsw(register const unsigned char *);

Modified: openbios-devel/fs/hfs/include/libhfs.h
===================================================================
--- openbios-devel/fs/hfs/include/libhfs.h	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/fs/hfs/include/libhfs.h	2008-12-21 09:15:57 UTC (rev 302)
@@ -22,8 +22,6 @@
 # include "hfs.h"
 # include "apple.h"
 
-extern int errno;
-
 # define ERROR(code, str)  \
     do { hfs_error = (str), errno = (code); goto fail; } while (0)
 

Modified: openbios-devel/fs/hfs/include/volume.h
===================================================================
--- openbios-devel/fs/hfs/include/volume.h	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/fs/hfs/include/volume.h	2008-12-21 09:15:57 UTC (rev 302)
@@ -57,7 +57,8 @@
 int v_allocblocks(hfsvol *, ExtDescriptor *);
 int v_freeblocks(hfsvol *, const ExtDescriptor *);
 
-int v_resolve(hfsvol **, const char *, CatDataRec *, long *, char *, node *);
+int v_resolve(hfsvol **vol, const char *path,
+              CatDataRec *data, unsigned long *parid, char *fname, node *np);
 
 int v_adjvalence(hfsvol *, unsigned long, int, int);
 int v_mkdir(hfsvol *, unsigned long, const char *);

Modified: openbios-devel/fs/hfs/volume.c
===================================================================
--- openbios-devel/fs/hfs/volume.c	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/fs/hfs/volume.c	2008-12-21 09:15:57 UTC (rev 302)
@@ -48,14 +48,14 @@
   vol->vlen       = 0;
   vol->lpa        = 0;
 
-  vol->cache      = 0;
+  vol->cache      = NULL;
 
-  vol->vbm        = 0;
+  vol->vbm        = NULL;
   vol->vbmsz      = 0;
 
   f_init(&ext->f, vol, HFS_CNID_EXT, "extents overflow");
 
-  ext->map        = 0;
+  ext->map        = NULL;
   ext->mapsz      = 0;
   ext->flags      = 0;
 
@@ -64,7 +64,7 @@
 
   f_init(&cat->f, vol, HFS_CNID_CAT, "catalog");
 
-  cat->map        = 0;
+  cat->map        = NULL;
   cat->mapsz      = 0;
   cat->flags      = 0;
 
@@ -74,11 +74,11 @@
   vol->cwd        = HFS_CNID_ROOTDIR;
 
   vol->refs       = 0;
-  vol->files      = 0;
-  vol->dirs       = 0;
+  vol->files      = NULL;
+  vol->dirs       = NULL;
 
-  vol->prev       = 0;
-  vol->next       = 0;
+  vol->prev       = NULL;
+  vol->next       = NULL;
 }
 
 /*
@@ -126,14 +126,14 @@
 
   FREE(vol->vbm);
 
-  vol->vbm   = 0;
+  vol->vbm   = NULL;
   vol->vbmsz = 0;
 
   FREE(vol->ext.map);
   FREE(vol->cat.map);
 
-  vol->ext.map = 0;
-  vol->cat.map = 0;
+  vol->ext.map = NULL;
+  vol->cat.map = NULL;
 
 done:
   return result;
@@ -275,8 +275,8 @@
     ERROR(EIO, "volume bitmap collides with volume data");
 
   vol->vbm = ALLOC(block, vbmsz);
-  if (vol->vbm == 0)
-    ERROR(ENOMEM, 0);
+  if (vol->vbm == NULL)
+    ERROR(ENOMEM, NULL);
 
   vol->vbmsz = vbmsz;
 
@@ -291,7 +291,7 @@
 fail:
   FREE(vol->vbm);
 
-  vol->vbm   = 0;
+  vol->vbm   = NULL;
   vol->vbmsz = 0;
 
   return -1;
@@ -339,11 +339,11 @@
   node n;
   int found;
 
-  if (np == 0)
+  if (np == NULL)
     np = &n;
 
   r_makecatkey(&key, parid, name);
-  r_packcatkey(&key, pkey, 0);
+  r_packcatkey(&key, pkey, NULL);
 
   found = bt_search(&vol->cat, pkey, np);
   if (found <= 0)
@@ -378,11 +378,11 @@
   node n;
   int found;
 
-  if (np == 0)
+  if (np == NULL)
     np = &n;
 
   r_makeextkey(&key, file->fork, file->cat.u.fil.filFlNum, fabn);
-  r_packextkey(&key, pkey, 0);
+  r_packextkey(&key, pkey, NULL);
 
   /* in case bt_search() clobbers these */
 
@@ -416,10 +416,10 @@
   CatDataRec rec;
   int found;
 
-  if (thread == 0)
+  if (thread == NULL)
     thread = &rec;
 
-  found = v_catsearch(vol, id, "", thread, 0, np);
+  found = v_catsearch(vol, id, "", thread, NULL, np);
   if (found == 1 && thread->cdrType != type)
     ERROR(EIO, "bad thread record");
 
@@ -435,7 +435,7 @@
  * DESCRIPTION:	translate a pathname; return catalog information
  */
 int v_resolve(hfsvol **vol, const char *path,
-	      CatDataRec *data, long *parid, char *fname, node *np)
+              CatDataRec *data, unsigned long *parid, char *fname, node *np)
 {
   unsigned long dirid;
   char name[HFS_MAX_FLEN + 1], *nptr;
@@ -449,7 +449,7 @@
 
   nptr = strchr(path, ':');
 
-  if (*path == ':' || nptr == 0)
+  if (*path == ':' || nptr == NULL)
     {
       dirid = (*vol)->cwd;  /* relative path */
 
@@ -458,7 +458,7 @@
 
       if (*path == 0)
 	{
-	  found = v_getdthread(*vol, dirid, data, 0);
+          found = v_getdthread(*vol, dirid, data, NULL);
 	  if (found == -1)
 	    goto fail;
 
@@ -483,7 +483,7 @@
       dirid = HFS_CNID_ROOTPAR;  /* absolute path */
 
       if (nptr - path > HFS_MAX_VLEN)
-	ERROR(ENAMETOOLONG, 0);
+        ERROR(ENAMETOOLONG, NULL);
 
       strncpy(name, path, nptr - path);
       name[nptr - path] = 0;
@@ -504,7 +504,7 @@
 	{
 	  ++path;
 
-	  found = v_getdthread(*vol, dirid, data, 0);
+          found = v_getdthread(*vol, dirid, data, NULL);
 	  if (found == -1)
 	    goto fail;
 	  else if (! found)
@@ -515,7 +515,7 @@
 
       if (*path == 0)
 	{
-	  found = v_getdthread(*vol, dirid, data, 0);
+          found = v_getdthread(*vol, dirid, data, NULL);
 	  if (found == -1)
 	    goto fail;
 
@@ -538,7 +538,7 @@
 	*nptr++ = *path++;
 
       if (*path && *path != ':')
-	ERROR(ENAMETOOLONG, 0);
+        ERROR(ENAMETOOLONG, NULL);
 
       *nptr = 0;
       if (*path == ':')

Modified: openbios-devel/include/ofmem.h
===================================================================
--- openbios-devel/include/ofmem.h	2008-12-21 08:30:42 UTC (rev 301)
+++ openbios-devel/include/ofmem.h	2008-12-21 09:15:57 UTC (rev 302)
@@ -29,4 +29,13 @@
 extern void  	ofmem_release( ulong virt, ulong size );
 extern ulong 	ofmem_translate( ulong virt, int *ret_mode );
 
+#ifdef CONFIG_PPC
+ulong get_ram_size( void );
+ulong get_ram_top( void );
+ulong get_ram_bottom( void );
+void dsi_exception( void );
+void isi_exception( void );
+void setup_mmu( ulong ramsize );
+#endif
+
 #endif   /* _H_OFMEM */




More information about the OpenBIOS mailing list