1
0
Fork 0
forked from len0rd/rockbox

test code portable now

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5145 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jörg Hohensohn 2004-10-01 19:19:09 +00:00
parent 65bee608f6
commit b2c2738f09
2 changed files with 8 additions and 7 deletions

View file

@ -56,7 +56,7 @@ int ata_init(char* filename)
if (!filename) if (!filename)
filename = "disk.img"; filename = "disk.img";
/* check disk size */ /* check disk size */
file=fopen(filename,"r+"); file=fopen(filename,"rb+");
if(!file) { if(!file) {
fprintf(stderr, "read_disk() - Could not find \"%s\"\n",filename); fprintf(stderr, "read_disk() - Could not find \"%s\"\n",filename);
return -1; return -1;

View file

@ -3,7 +3,6 @@
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <time.h> #include <time.h>
#include <sys/time.h>
#include "fat.h" #include "fat.h"
#include "debug.h" #include "debug.h"
#include "disk.h" #include "disk.h"
@ -266,7 +265,7 @@ int dbg_wrtest(char* name)
void dbg_type(char* name) void dbg_type(char* name)
{ {
const int size = SECTOR_SIZE*5; const int size = SECTOR_SIZE*5;
unsigned char buf[size+1]; unsigned char buf[SECTOR_SIZE*5+1];
int fd,rc; int fd,rc;
fd = open(name,O_RDONLY); fd = open(name,O_RDONLY);
@ -658,10 +657,8 @@ int main(int argc, char *argv[])
{ {
int rc,i; int rc,i;
struct partinfo* pinfo; struct partinfo* pinfo;
struct timeval tv;
gettimeofday(&tv, NULL); srand(clock());
srand(tv.tv_usec);
if(ata_init("disk.img")) { if(ata_init("disk.img")) {
DEBUGF("*** Warning! The disk is uninitialized\n"); DEBUGF("*** Warning! The disk is uninitialized\n");
@ -674,7 +671,11 @@ int main(int argc, char *argv[])
} }
for ( i=0; i<4; i++ ) { for ( i=0; i<4; i++ ) {
if ( pinfo[i].type == PARTITION_TYPE_FAT32 ) { if ( pinfo[i].type == PARTITION_TYPE_FAT32
#ifdef HAVE_FAT16SUPPORT
|| pinfo[i].type == PARTITION_TYPE_FAT16
#endif
) {
DEBUGF("*** Mounting at block %ld\n",pinfo[i].start); DEBUGF("*** Mounting at block %ld\n",pinfo[i].start);
rc = fat_mount(pinfo[i].start); rc = fat_mount(pinfo[i].start);
if(rc) { if(rc) {