1
0
Fork 0
forked from len0rd/rockbox

Partition table is no longer global

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@831 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2002-05-30 19:41:35 +00:00
parent 6f9e35df28
commit 6573d6d4b4
3 changed files with 12 additions and 11 deletions

View file

@ -53,6 +53,7 @@ extern int poolend[];
int init(void) int init(void)
{ {
int rc; int rc;
struct partinfo* pinfo;
system_init(); system_init();
@ -73,11 +74,11 @@ int init(void)
if(rc) if(rc)
panicf("ata: %d",rc); panicf("ata: %d",rc);
rc = disk_init(); pinfo = disk_init();
if (rc) if (!pinfo)
panicf("disk: %d",rc); panicf("disk: NULL");
rc = fat_mount(part[0].start); rc = fat_mount(pinfo[0].start);
if(rc) if(rc)
panicf("mount: %d",rc); panicf("mount: %d",rc);

View file

@ -16,6 +16,7 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
****************************************************************************/ ****************************************************************************/
#include <stdio.h>
#include "ata.h" #include "ata.h"
#include "debug.h" #include "debug.h"
#include "disk.h" #include "disk.h"
@ -38,9 +39,9 @@
(array[pos] | (array[pos+1] << 8 ) | \ (array[pos] | (array[pos+1] << 8 ) | \
(array[pos+2] << 16 ) | (array[pos+3] << 24 )) (array[pos+2] << 16 ) | (array[pos+3] << 24 ))
struct partinfo part[8]; static struct partinfo part[8];
int disk_init(void) struct partinfo* disk_init(void)
{ {
int i; int i;
unsigned char sector[512]; unsigned char sector[512];
@ -51,7 +52,7 @@ int disk_init(void)
if ( (sector[510] != 0x55) || if ( (sector[510] != 0x55) ||
(sector[511] != 0xaa)) { (sector[511] != 0xaa)) {
DEBUGF("Bad boot sector signature\n"); DEBUGF("Bad boot sector signature\n");
return -1; return NULL;
} }
/* parse partitions */ /* parse partitions */
@ -70,5 +71,5 @@ int disk_init(void)
} }
} }
return 0; return part;
} }

View file

@ -25,8 +25,7 @@ struct partinfo {
unsigned char type; unsigned char type;
}; };
extern struct partinfo part[8]; /* returns a pointer to an array of 8 partinfo structs */
struct partinfo* disk_init(void);
int disk_init(void);
#endif #endif