summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCástor Muñoz <cmvidal@gmail.com>2015-10-09 20:45:01 +0200
committerCástor Muñoz <cmvidal@gmail.com>2015-10-09 20:45:01 +0200
commitc7fc5ca6eb2995e3af6cb553ce24136b0c1070db (patch)
tree7141ed0704646381d667590f2e42e871e240d4dd
parentd20185ac96c4b50ed4de7098a101a31f2b140b82 (diff)
downloadrockbox-c7fc5ca6eb2995e3af6cb553ce24136b0c1070db.tar.gz
rockbox-c7fc5ca6eb2995e3af6cb553ce24136b0c1070db.zip
Fix (D)EBUG compilation errors on targets using FAT
Change-Id: I9517f9b470076a6febeafae76d735c2436812e7c
-rw-r--r--firmware/common/file.c24
-rw-r--r--firmware/common/file_internal.c4
-rw-r--r--firmware/drivers/fat.c17
3 files changed, 24 insertions, 21 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c
index 7d3b5092ae..6444918f1b 100644
--- a/firmware/common/file.c
+++ b/firmware/common/file.c
@@ -595,8 +595,8 @@ static inline ssize_t readwrite_partial(struct filestr_desc *file,
595static ssize_t readwrite(struct filestr_desc *file, void *buf, size_t nbyte, 595static ssize_t readwrite(struct filestr_desc *file, void *buf, size_t nbyte,
596 bool write) 596 bool write)
597{ 597{
598 DEBUGF("readwrite(%p,%lx,%ld,%s)\n", 598 DEBUGF("readwrite(%p,%lx,%lu,%s)\n",
599 file, (long)buf, nbyte, write ? "write" : "read"); 599 file, (long)buf, (unsigned long)nbyte, write ? "write" : "read");
600 600
601 const file_size_t size = *file->sizep; 601 const file_size_t size = *file->sizep;
602 file_size_t filerem; 602 file_size_t filerem;
@@ -705,8 +705,8 @@ static ssize_t readwrite(struct filestr_desc *file, void *buf, size_t nbyte,
705 rc = fat_readwrite(&file->stream.fatstr, runlen, buf, write); 705 rc = fat_readwrite(&file->stream.fatstr, runlen, buf, write);
706 if (rc < 0) 706 if (rc < 0)
707 { 707 {
708 DEBUGF("I/O error %sing %ld sectors\n", sectors, 708 DEBUGF("I/O error %sing %ld sectors\n",
709 write ? "writ" : "read"); 709 write ? "writ" : "read", runlen);
710 FILE_ERROR(rc == FAT_RC_ENOSPC ? ENOSPC : EIO, 710 FILE_ERROR(rc == FAT_RC_ENOSPC ? ENOSPC : EIO,
711 rc * 10 - 6); 711 rc * 10 - 6);
712 } 712 }
@@ -874,7 +874,7 @@ int fsync(int fildes)
874 874
875 if (!(file->stream.flags & FD_WRITE)) 875 if (!(file->stream.flags & FD_WRITE))
876 { 876 {
877 DEBUGF("Descriptor is read-only mode\n", fd); 877 DEBUGF("Descriptor is read-only mode\n");
878 FILE_ERROR(EINVAL, -2); 878 FILE_ERROR(EINVAL, -2);
879 } 879 }
880 880
@@ -917,7 +917,8 @@ ssize_t read(int fildes, void *buf, size_t nbyte)
917 if (file->stream.flags & FD_WRONLY) 917 if (file->stream.flags & FD_WRONLY)
918 { 918 {
919 DEBUGF("read(fd=%d,buf=%p,nb=%lu) - " 919 DEBUGF("read(fd=%d,buf=%p,nb=%lu) - "
920 "descriptor is write-only mode\n", fildes, buf, nbyte); 920 "descriptor is write-only mode\n",
921 fildes, buf, (unsigned long)nbyte);
921 FILE_ERROR(EBADF, -2); 922 FILE_ERROR(EBADF, -2);
922 } 923 }
923 924
@@ -942,7 +943,8 @@ ssize_t write(int fildes, const void *buf, size_t nbyte)
942 if (!(file->stream.flags & FD_WRITE)) 943 if (!(file->stream.flags & FD_WRITE))
943 { 944 {
944 DEBUGF("write(fd=%d,buf=%p,nb=%lu) - " 945 DEBUGF("write(fd=%d,buf=%p,nb=%lu) - "
945 "descriptor is read-only mode\n", fildes, buf, nbyte); 946 "descriptor is read-only mode\n",
947 fildes, buf, (unsigned long)nbyte);
946 FILE_ERROR(EBADF, -2); 948 FILE_ERROR(EBADF, -2);
947 } 949 }
948 950
@@ -981,7 +983,7 @@ int rename(const char *old, const char *new)
981 open1rc = open_stream_internal(old, FF_ANYTYPE, &oldstr, &oldinfo); 983 open1rc = open_stream_internal(old, FF_ANYTYPE, &oldstr, &oldinfo);
982 if (open1rc <= 0) 984 if (open1rc <= 0)
983 { 985 {
984 DEBUGF("Failed opening old: %d\n", rc); 986 DEBUGF("Failed opening old: %d\n", open1rc);
985 if (open1rc == 0) 987 if (open1rc == 0)
986 FILE_ERROR(ENOENT, -1); 988 FILE_ERROR(ENOENT, -1);
987 else 989 else
@@ -1006,7 +1008,7 @@ int rename(const char *old, const char *new)
1006 open2rc = open_stream_internal(new, callflags, &newstr, &newinfo); 1008 open2rc = open_stream_internal(new, callflags, &newstr, &newinfo);
1007 if (open2rc < 0) 1009 if (open2rc < 0)
1008 { 1010 {
1009 DEBUGF("Failed opening new file: %d\n", rc); 1011 DEBUGF("Failed opening new file: %d\n", open2rc);
1010 FILE_ERROR(ERRNO, open2rc * 10 - 2); 1012 FILE_ERROR(ERRNO, open2rc * 10 - 2);
1011 } 1013 }
1012 1014
@@ -1165,7 +1167,7 @@ int relate(const char *path1, const char *path2)
1165 open1rc = open_stream_internal(path1, FF_ANYTYPE, &str1, &info1); 1167 open1rc = open_stream_internal(path1, FF_ANYTYPE, &str1, &info1);
1166 if (open1rc <= 0) 1168 if (open1rc <= 0)
1167 { 1169 {
1168 DEBUGF("Failed opening path1: %d\n", rc); 1170 DEBUGF("Failed opening path1: %d\n", open1rc);
1169 if (open1rc < 0) 1171 if (open1rc < 0)
1170 FILE_ERROR(ERRNO, open1rc * 10 - 1); 1172 FILE_ERROR(ERRNO, open1rc * 10 - 1);
1171 else 1173 else
@@ -1177,7 +1179,7 @@ int relate(const char *path1, const char *path2)
1177 &str2, &info2); 1179 &str2, &info2);
1178 if (open2rc < 0) 1180 if (open2rc < 0)
1179 { 1181 {
1180 DEBUGF("Failed opening path2: %d\n", rc); 1182 DEBUGF("Failed opening path2: %d\n", open2rc);
1181 FILE_ERROR(ERRNO, open2rc * 10 - 2); 1183 FILE_ERROR(ERRNO, open2rc * 10 - 2);
1182 } 1184 }
1183 1185
diff --git a/firmware/common/file_internal.c b/firmware/common/file_internal.c
index 58cb8830d1..f9c6bfb570 100644
--- a/firmware/common/file_internal.c
+++ b/firmware/common/file_internal.c
@@ -546,8 +546,8 @@ int open_stream_internal(const char *path, unsigned int callflags,
546 struct filestr_base *stream, 546 struct filestr_base *stream,
547 struct path_component_info *compinfo) 547 struct path_component_info *compinfo)
548{ 548{
549 DEBUGF("%s(path=\"%s\",flg=%X,str=%p,compinfo=%p)\n", path, callflags, 549 DEBUGF("%s(path=\"%s\",flg=%X,str=%p,compinfo=%p)\n", __func__,
550 stream, compinfo); 550 path, callflags, stream, compinfo);
551 int rc; 551 int rc;
552 552
553 filestr_base_init(stream); 553 filestr_base_init(stream);
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index e89a5ce98d..424e2ba640 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -950,8 +950,7 @@ static void update_fsinfo32(struct bpb *fat_bpb)
950 uint8_t *fsinfo = cache_sector(fat_bpb, fat_bpb->bpb_fsinfo); 950 uint8_t *fsinfo = cache_sector(fat_bpb, fat_bpb->bpb_fsinfo);
951 if (!fsinfo) 951 if (!fsinfo)
952 { 952 {
953 DEBUGF("%s() - Couldn't read FSInfo" 953 DEBUGF("%s() - Couldn't read FSInfo", __func__);
954 " (err code %d)", __func__, rc);
955 return; 954 return;
956 } 955 }
957 956
@@ -972,7 +971,7 @@ static long get_next_cluster32(struct bpb *fat_bpb, long startcluster)
972 if (!sec) 971 if (!sec)
973 { 972 {
974 dc_unlock_cache(); 973 dc_unlock_cache();
975 DEBUGF("%s: Could not cache sector %d\n", __func__, sector); 974 DEBUGF("%s: Could not cache sector %lu\n", __func__, sector);
976 return -1; 975 return -1;
977 } 976 }
978 977
@@ -1045,7 +1044,7 @@ static int update_fat_entry32(struct bpb *fat_bpb, unsigned long entry,
1045 if (!sec) 1044 if (!sec)
1046 { 1045 {
1047 dc_unlock_cache(); 1046 dc_unlock_cache();
1048 DEBUGF("Could not cache sector %u\n", sector); 1047 DEBUGF("Could not cache sector %lu\n", sector);
1049 return -1; 1048 return -1;
1050 } 1049 }
1051 1050
@@ -1544,7 +1543,8 @@ static int write_longname(struct bpb *fat_bpb, struct fat_filestr *parentstr,
1544 unsigned int flags) 1543 unsigned int flags)
1545{ 1544{
1546 DEBUGF("%s(file:%lx, first:%d, num:%d, name:%s)\n", __func__, 1545 DEBUGF("%s(file:%lx, first:%d, num:%d, name:%s)\n", __func__,
1547 parent->info->firstcluster, firstentry, numentries, name); 1546 file->firstcluster, file->e.entry - file->e.entries + 1,
1547 file->e.entries, name);
1548 1548
1549 int rc; 1549 int rc;
1550 union raw_dirent *ent; 1550 union raw_dirent *ent;
@@ -1901,7 +1901,8 @@ static int free_direntries(struct bpb *fat_bpb, struct fat_file *file)
1901 entries; entries--, entry++) 1901 entries; entries--, entry++)
1902 { 1902 {
1903 DEBUGF("Clearing dir entry %d (%d/%d)\n", 1903 DEBUGF("Clearing dir entry %d (%d/%d)\n",
1904 entry, entry - numentries + 1, numentries); 1904 entry, entries - file->e.entries + 1, file->e.entries);
1905
1905 1906
1906 dc_lock_cache(); 1907 dc_lock_cache();
1907 1908
@@ -2374,7 +2375,7 @@ static long transfer(struct bpb *fat_bpb, unsigned long start, long count,
2374 2375
2375 if (rc < 0) 2376 if (rc < 0)
2376 { 2377 {
2377 DEBUGF("Couldn't %s sector %lx (err %d)\n", 2378 DEBUGF("Couldn't %s sector %lx (err %ld)\n",
2378 write ? "write":"read", start, rc); 2379 write ? "write":"read", start, rc);
2379 return rc; 2380 return rc;
2380 } 2381 }
@@ -2803,7 +2804,7 @@ int fat_mount(IF_MV(int volume,) IF_MD(int drive,) unsigned long startsector)
2803 DEBUGF("Freecount: %ld\n", (unsigned long)fat_bpb->fsinfo.freecount); 2804 DEBUGF("Freecount: %ld\n", (unsigned long)fat_bpb->fsinfo.freecount);
2804 DEBUGF("Nextfree: 0x%lx\n", (unsigned long)fat_bpb->fsinfo.nextfree); 2805 DEBUGF("Nextfree: 0x%lx\n", (unsigned long)fat_bpb->fsinfo.nextfree);
2805 DEBUGF("Cluster count: 0x%lx\n", fat_bpb->dataclusters); 2806 DEBUGF("Cluster count: 0x%lx\n", fat_bpb->dataclusters);
2806 DEBUGF("Sectors per cluster: %d\n", fat_bpb->bpb_secperclus); 2807 DEBUGF("Sectors per cluster: %lu\n", fat_bpb->bpb_secperclus);
2807 DEBUGF("FAT sectors: 0x%lx\n", fat_bpb->fatsize); 2808 DEBUGF("FAT sectors: 0x%lx\n", fat_bpb->fatsize);
2808 2809
2809 rc = 0; 2810 rc = 0;