diff --git a/arch/ppc/qemu/init.c b/arch/ppc/qemu/init.c index d46dbef..e61c8b0 100644 --- a/arch/ppc/qemu/init.c +++ b/arch/ppc/qemu/init.c @@ -32,11 +32,6 @@ extern void unexpected_excep( int vector ); 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 @@ entry( void ) ; } -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(); diff --git a/arch/ppc/qemu/kernel.c b/arch/ppc/qemu/kernel.c index ccd98a3..0eece95 100644 --- a/arch/ppc/qemu/kernel.c +++ b/arch/ppc/qemu/kernel.c @@ -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; /************************************************************************/ diff --git a/arch/ppc/qemu/kernel.h b/arch/ppc/qemu/kernel.h index 20cda48..605bf1f 100644 --- a/arch/ppc/qemu/kernel.h +++ b/arch/ppc/qemu/kernel.h @@ -22,6 +22,7 @@ extern void exit( int status ); /* 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 ); diff --git a/arch/ppc/qemu/main.c b/arch/ppc/qemu/main.c index 78a1b4e..ee7a10e 100644 --- a/arch/ppc/qemu/main.c +++ b/arch/ppc/qemu/main.c @@ -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 @@ do { printk("ELF - %s: " fmt, __func__ , ##args); } while (0) #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 @@ static int 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; diff --git a/arch/ppc/qemu/methods.c b/arch/ppc/qemu/methods.c index 125c5b4..3f7f683 100644 --- a/arch/ppc/qemu/methods.c +++ b/arch/ppc/qemu/methods.c @@ -232,7 +232,7 @@ mmu_unmap( void ) static void mmu_translate( void ) { - ulong mode; + int mode; int virt = POP(); int phys = ofmem_translate( virt, &mode ); @@ -240,7 +240,7 @@ mmu_translate( void ) PUSH( 0 ); } else { PUSH( phys ); - PUSH( (int)mode ); + PUSH( mode ); PUSH( -1 ); } } diff --git a/arch/ppc/qemu/ofmem.c b/arch/ppc/qemu/ofmem.c index eb84f96..6227e50 100644 --- a/arch/ppc/qemu/ofmem.c +++ b/arch/ppc/qemu/ofmem.c @@ -70,7 +70,7 @@ get_hash_base( void ) { ulong sdr1; - asm volatile("mfsdr1 %0" :: "r" (sdr1) ); + asm volatile("mfsdr1 %0" : "=r" (sdr1) ); return (sdr1 & 0xffff0000); } @@ -80,7 +80,7 @@ get_hash_size( void ) { ulong sdr1; - asm volatile("mfsdr1 %0" :: "r" (sdr1) ); + asm volatile("mfsdr1 %0" : "=r" (sdr1) ); return ((sdr1 << 16) | 0x0000ffff) + 1; } @@ -107,7 +107,7 @@ get_ram_top( void ) ulong get_ram_bottom( void ) { - return OF_MALLOC_BASE; + return (ulong)OF_MALLOC_BASE; } /************************************************************************/ @@ -172,7 +172,7 @@ free( void *ptr ) 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 @@ free( void *ptr ) 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 @@ setup_mmu( ulong ramsize ) { 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 @@ setup_mmu( ulong ramsize ) /* 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 @@ setup_mmu( ulong ramsize ) 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 @@ setup_mmu( ulong ramsize ) 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); diff --git a/fs/hfs/block.c b/fs/hfs/block.c index 223dbe8..ab8f74e 100644 --- a/fs/hfs/block.c +++ b/fs/hfs/block.c @@ -41,8 +41,8 @@ int b_init(hfsvol *vol) 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 @@ int b_init(hfsvol *vol) 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 b_finish(hfsvol *vol) { int result = 0; - if (vol->cache == 0) + if (vol->cache == NULL) goto done; # ifdef DEBUG @@ -267,7 +267,7 @@ int b_finish(hfsvol *vol) # endif FREE(vol->cache); - vol->cache = 0; + vol->cache = NULL; done: return result; @@ -469,7 +469,7 @@ bucket *getbucket(bcache *cache, unsigned long bnum, int fill) return b; fail: - return 0; + return NULL; } /* @@ -524,7 +524,7 @@ int b_readlb(hfsvol *vol, unsigned long bnum, block *bp) bucket *b; b = getbucket(vol->cache, bnum, 1); - if (b == 0) + if (b == NULL) goto fail; memcpy(bp, b->data, HFS_BLOCKSZ); diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c index 1e0a029..595c16f 100644 --- a/fs/hfs/btree.c +++ b/fs/hfs/btree.c @@ -89,7 +89,7 @@ fail: int bt_readhdr(btree *bt) { const byte *ptr; - byte *map = 0; + byte *map = NULL; int i; unsigned long nnum; @@ -128,8 +128,8 @@ int bt_readhdr(btree *bt) /* 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 @@ int bt_readhdr(btree *bt) 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 @@ int bt_search(btree *bt, const byte *key, node *np) nnum = bt->hdr.bthRoot; if (nnum == 0) - ERROR(ENOENT, 0); + ERROR(ENOENT, NULL); while (1) { @@ -204,7 +204,7 @@ int bt_search(btree *bt, const byte *key, node *np) { 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 @@ int bt_search(btree *bt, const byte *key, node *np) case ndLeafNode: if (! found) - ERROR(ENOENT, 0); + ERROR(ENOENT, NULL); goto done; diff --git a/fs/hfs/data.c b/fs/hfs/data.c index 91c6c3d..a8a9e8d 100644 --- a/fs/hfs/data.c +++ b/fs/hfs/data.c @@ -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, diff --git a/fs/hfs/file.c b/fs/hfs/file.c index 8146bc9..a3daec3 100644 --- a/fs/hfs/file.c +++ b/fs/hfs/file.c @@ -86,8 +86,8 @@ void f_init(hfsfile *file, hfsvol *vol, long cnid, const char *name) file->flags = 0; - file->prev = 0; - file->next = 0; + file->prev = NULL; + file->next = NULL; } /* @@ -156,7 +156,7 @@ int f_doblock(hfsfile *file, unsigned long num, block *bp, { 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 @@ int f_doblock(hfsfile *file, unsigned long num, block *bp, 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; diff --git a/fs/hfs/hfs.c b/fs/hfs/hfs.c index 994a2fa..51188a7 100644 --- a/fs/hfs/hfs.c +++ b/fs/hfs/hfs.c @@ -45,9 +45,9 @@ hfsvol *curvol; /* current volume */ 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 @@ hfsvol *hfs_mount( int os_fd, int pnum) } vol = ALLOC(hfsvol, 1); - if (vol == 0) - ERROR(ENOMEM, 0); + if (vol == NULL) + ERROR(ENOMEM, NULL); v_init(vol, mode); @@ -98,7 +98,7 @@ hfsvol *hfs_mount( int os_fd, int pnum) /* add to linked list of volumes */ - vol->prev = 0; + vol->prev = NULL; vol->next = hfs_mounts; if (hfs_mounts) @@ -119,7 +119,7 @@ fail: FREE(vol); } - return 0; + return NULL; } @@ -168,7 +168,7 @@ int hfs_umount(hfsvol *vol) if (vol == hfs_mounts) hfs_mounts = vol->next; if (vol == curvol) - curvol = 0; + curvol = NULL; FREE(vol); @@ -197,7 +197,7 @@ hfsvol *hfs_getvol(const char *name) { hfsvol *vol; - if (name == 0) + if (name == NULL) return curvol; for (vol = hfs_mounts; vol; vol = vol->next) @@ -206,7 +206,7 @@ hfsvol *hfs_getvol(const char *name) return vol; } - return 0; + return NULL; } /* @@ -264,11 +264,11 @@ int hfs_chdir(hfsvol *vol, const char *path) 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 @@ int hfs_setcwd(hfsvol *vol, unsigned long id) /* 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 @@ int hfs_dirinfo(hfsvol *vol, unsigned long *id, char *name) 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 @@ fail: */ 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 @@ hfsdir *hfs_opendir(hfsvol *vol, const char *path) 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 @@ hfsdir *hfs_opendir(hfsvol *vol, const char *path) } 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 @@ hfsdir *hfs_opendir(hfsvol *vol, const char *path) fail: FREE(dir); - return 0; + return NULL; } /* @@ -420,12 +420,12 @@ int hfs_readdir(hfsdir *dir, hfsdirent *ent) 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 @@ int hfs_closedir(hfsdir *dir) */ 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 @@ hfsfile *hfs_open(hfsvol *vol, const char *path) f_selectfork(file, fkData); - file->prev = 0; + file->prev = NULL; file->next = vol->files; if (vol->files) @@ -557,7 +557,7 @@ hfsfile *hfs_open(hfsvol *vol, const char *path) fail: FREE(file); - return 0; + return NULL; } /* @@ -591,7 +591,7 @@ unsigned long hfs_read(hfsfile *file, void *buf, unsigned long len) 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 hfs_seek(hfsfile *file, long offset, int from) { unsigned long *lglen, newpos; - f_getptrs(file, 0, &lglen, 0); + f_getptrs(file, NULL, &lglen, NULL); switch (from) { @@ -666,7 +666,7 @@ unsigned long hfs_seek(hfsfile *file, long offset, int from) break; default: - ERROR(EINVAL, 0); + ERROR(EINVAL, NULL); } if (newpos > *lglen) @@ -714,7 +714,7 @@ int hfs_stat(hfsvol *vol, const char *path, hfsdirent *ent) 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); diff --git a/fs/hfs/hfs_fs.c b/fs/hfs/hfs_fs.c index 295bf08..b2f0d8a 100644 --- a/fs/hfs/hfs_fs.c +++ b/fs/hfs/hfs_fs.c @@ -288,7 +288,7 @@ close_fs( fs_ops_t *fs ) /* callers responsibility to call free(fs) */ } -static char * +static const char * get_fstype( fs_ops_t *fs ) { return ("HFS"); diff --git a/fs/hfs/include/data.h b/fs/hfs/include/data.h index fd38e75..068ba15 100644 --- a/fs/hfs/include/data.h +++ b/fs/hfs/include/data.h @@ -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 *); diff --git a/fs/hfs/include/libhfs.h b/fs/hfs/include/libhfs.h index 5fdc471..6b5587c 100644 --- a/fs/hfs/include/libhfs.h +++ b/fs/hfs/include/libhfs.h @@ -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) diff --git a/fs/hfs/include/volume.h b/fs/hfs/include/volume.h index 2ac41d1..aa677fd 100644 --- a/fs/hfs/include/volume.h +++ b/fs/hfs/include/volume.h @@ -57,7 +57,8 @@ int v_putextrec(const ExtDataRec *, node *); 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 *); diff --git a/fs/hfs/volume.c b/fs/hfs/volume.c index 4558c4a..f357ef7 100644 --- a/fs/hfs/volume.c +++ b/fs/hfs/volume.c @@ -48,14 +48,14 @@ void v_init(hfsvol *vol, int flags) 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 @@ void v_init(hfsvol *vol, int flags) 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 @@ void v_init(hfsvol *vol, int flags) 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 @@ int v_close(hfsvol *vol) 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 @@ int v_readvbm(hfsvol *vol) 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 @@ int v_readvbm(hfsvol *vol) fail: FREE(vol->vbm); - vol->vbm = 0; + vol->vbm = NULL; vol->vbmsz = 0; return -1; @@ -339,11 +339,11 @@ int v_catsearch(hfsvol *vol, unsigned long parid, const char *name, 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 @@ int v_extsearch(hfsfile *file, unsigned int fabn, 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 @@ int v_getthread(hfsvol *vol, unsigned long id, 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 @@ fail: * 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 @@ int v_resolve(hfsvol **vol, const char *path, nptr = strchr(path, ':'); - if (*path == ':' || nptr == 0) + if (*path == ':' || nptr == NULL) { dirid = (*vol)->cwd; /* relative path */ @@ -458,7 +458,7 @@ int v_resolve(hfsvol **vol, const char *path, 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 @@ int v_resolve(hfsvol **vol, const char *path, 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 @@ int v_resolve(hfsvol **vol, const char *path, { ++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 @@ int v_resolve(hfsvol **vol, const char *path, 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 @@ int v_resolve(hfsvol **vol, const char *path, *nptr++ = *path++; if (*path && *path != ':') - ERROR(ENAMETOOLONG, 0); + ERROR(ENAMETOOLONG, NULL); *nptr = 0; if (*path == ':') diff --git a/include/ofmem.h b/include/ofmem.h index a010a77..64057b6 100644 --- a/include/ofmem.h +++ b/include/ofmem.h @@ -29,4 +29,13 @@ extern int ofmem_map( ulong phys, ulong virt, ulong size, int mode ); 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 */