diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2012-05-03 07:08:43 +0200 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2012-05-08 13:00:14 +0200 |
commit | 10829b2f78de91f66c7da5f7a2a2fe6d252eb38d (patch) | |
tree | 4c7a94d4143d1bff2602fd02cc21d46115ee2111 /firmware | |
parent | dae7a29b35db0ac4911007180389cdc0e98d5af5 (diff) | |
download | rockbox-10829b2f78de91f66c7da5f7a2a2fe6d252eb38d.tar.gz rockbox-10829b2f78de91f66c7da5f7a2a2fe6d252eb38d.zip |
Fix fat test program not compiling (FS#12646).
This changes the way creat() is wrapped around in native builds
so more experienced devs should look at it.
This patch forces to compile fat test in 32bit mode. Building
natively on x86-64 works just fine but our fat code apparently
can't deal with 64bit pointers/ints correctly.
Change-Id: I000015094f7db957ce826c22672608cd419908b0
Reviewed-on: http://gerrit.rockbox.org/228
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/include/file.h | 12 | ||||
-rw-r--r-- | firmware/test/fat/Makefile | 17 | ||||
-rw-r--r-- | firmware/test/fat/main.c | 5 |
3 files changed, 14 insertions, 20 deletions
diff --git a/firmware/include/file.h b/firmware/include/file.h index 198fccbc7b..0ff94a8168 100644 --- a/firmware/include/file.h +++ b/firmware/include/file.h | |||
@@ -82,17 +82,15 @@ extern int fsync(int fd); | |||
82 | extern ssize_t read(int fd, void *buf, size_t count); | 82 | extern ssize_t read(int fd, void *buf, size_t count); |
83 | extern off_t lseek(int fildes, off_t offset, int whence); | 83 | extern off_t lseek(int fildes, off_t offset, int whence); |
84 | extern int file_creat(const char *pathname); | 84 | extern int file_creat(const char *pathname); |
85 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(__PCTOOL__) | 85 | #if ((CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(__PCTOOL__)) || \ |
86 | /* posix compatibility function */ | 86 | defined(TEST_FAT) |
87 | static inline int creat(const char *pathname, mode_t mode) | 87 | #define creat(x, y) file_creat(x) |
88 | { | 88 | |
89 | (void)mode; | ||
90 | return file_creat(pathname); | ||
91 | } | ||
92 | #if !defined(CODEC) && !defined(PLUGIN) | 89 | #if !defined(CODEC) && !defined(PLUGIN) |
93 | #define open(x, y, ...) file_open(x,y) | 90 | #define open(x, y, ...) file_open(x,y) |
94 | #endif | 91 | #endif |
95 | #endif | 92 | #endif |
93 | |||
96 | extern ssize_t write(int fd, const void *buf, size_t count); | 94 | extern ssize_t write(int fd, const void *buf, size_t count); |
97 | extern int remove(const char* pathname); | 95 | extern int remove(const char* pathname); |
98 | extern int rename(const char* path, const char* newname); | 96 | extern int rename(const char* path, const char* newname); |
diff --git a/firmware/test/fat/Makefile b/firmware/test/fat/Makefile index 74d2628ab7..3e04724f67 100644 --- a/firmware/test/fat/Makefile +++ b/firmware/test/fat/Makefile | |||
@@ -1,26 +1,21 @@ | |||
1 | FIRMWARE = ../.. | 1 | FIRMWARE = ../.. |
2 | 2 | ||
3 | export BUILDDATE=$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d') | ||
4 | export CPU=arm | ||
5 | export TARGET=-DIPOD_VIDEO | ||
6 | export TARGET_INC=-I$(FIRMWARE)/target/arm/ipod/video -I$(FIRMWARE)/target/arm/ipod -I$(FIRMWARE)/target/arm | ||
7 | |||
8 | DRIVERS = ../../drivers | 3 | DRIVERS = ../../drivers |
9 | EXPORT = ../../export | 4 | EXPORT = ../../export |
10 | 5 | ||
11 | INCLUDE = -I$(EXPORT) -I$(FIRMWARE)/include | 6 | BUILDDATE=$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d') |
12 | 7 | INCLUDE = -I$(EXPORT) -I$(FIRMWARE)/include -I$(FIRMWARE)/target/hosted -I$(FIRMWARE)/target/hosted/sdl | |
13 | DEFINES = -DTEST_FAT -DDEBUG -DCRT_DISPLAY -DDISK_WRITE -DHAVE_FAT16SUPPORT -D__PCTOOL__ | 8 | DEFINES = -DTEST_FAT -DDEBUG -DDISK_WRITE -DHAVE_FAT16SUPPORT -D__PCTOOL__ |
14 | 9 | ||
15 | CFLAGS = -g -Wall -std=gnu99 -Wno-pointer-sign $(DEFINES) -I. $(INCLUDE) $(BUILDDATE) -I$(FIRMWARE)/libc/include | 10 | CFLAGS = -g -m32 -Wall -std=gnu99 -Wno-pointer-sign $(DEFINES) $(BUILDDATE) -I. $(INCLUDE) -I$(FIRMWARE)/libc/include |
16 | SIMFLAGS = -g -Wall -std=gnu99 -Wno-pointer-sign $(DEFINES) -I. $(INCLUDE) | 11 | SIMFLAGS = -g -m32 -Wall -std=gnu99 -Wno-pointer-sign $(DEFINES) -I. $(INCLUDE) |
17 | 12 | ||
18 | TARGET = fat | 13 | TARGET = fat |
19 | 14 | ||
20 | all: $(TARGET) | 15 | all: $(TARGET) |
21 | 16 | ||
22 | $(TARGET): fat.o ata-sim.o main.o disk.o dir.o file.o ctype.o unicode.o strlcpy.o | 17 | $(TARGET): fat.o ata-sim.o main.o disk.o dir.o file.o ctype.o unicode.o strlcpy.o |
23 | gcc -g -o fat $+ -lfl | 18 | gcc -g -m32 -o fat $+ |
24 | 19 | ||
25 | fat.o: $(DRIVERS)/fat.c $(EXPORT)/fat.h $(EXPORT)/ata.h | 20 | fat.o: $(DRIVERS)/fat.c $(EXPORT)/fat.h $(EXPORT)/ata.h |
26 | $(CC) $(CFLAGS) -c $< -o $@ | 21 | $(CC) $(CFLAGS) -c $< -o $@ |
diff --git a/firmware/test/fat/main.c b/firmware/test/fat/main.c index a9220d15b7..756f326bb3 100644 --- a/firmware/test/fat/main.c +++ b/firmware/test/fat/main.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include "dir.h" | 9 | #include "dir.h" |
10 | #include "file.h" | 10 | #include "file.h" |
11 | #include "ata.h" | 11 | #include "ata.h" |
12 | #include "storage.h" | ||
12 | 13 | ||
13 | void dbg_dump_sector(int sec); | 14 | void dbg_dump_sector(int sec); |
14 | void dbg_dump_buffer(unsigned char *buf, int len, int offset); | 15 | void dbg_dump_buffer(unsigned char *buf, int len, int offset); |
@@ -432,7 +433,7 @@ void dbg_tail(char* name) | |||
432 | if( rc > 0 ) | 433 | if( rc > 0 ) |
433 | { | 434 | { |
434 | buf[rc]=0; | 435 | buf[rc]=0; |
435 | printf("%d:\n%s\n", strlen(buf), buf); | 436 | printf("%d:\n%s\n", (int)strlen(buf), buf); |
436 | } | 437 | } |
437 | else if ( rc == 0 ) { | 438 | else if ( rc == 0 ) { |
438 | DEBUGF("EOF\n"); | 439 | DEBUGF("EOF\n"); |
@@ -463,7 +464,7 @@ int dbg_head(char* name) | |||
463 | if( rc > 0 ) | 464 | if( rc > 0 ) |
464 | { | 465 | { |
465 | buf[rc]=0; | 466 | buf[rc]=0; |
466 | printf("%d:\n%s\n", strlen(buf), buf); | 467 | printf("%d:\n%s\n", (int)strlen(buf), buf); |
467 | } | 468 | } |
468 | else if ( rc == 0 ) { | 469 | else if ( rc == 0 ) { |
469 | DEBUGF("EOF\n"); | 470 | DEBUGF("EOF\n"); |