mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
Fix (D)EBUG compilation errors on targets using FAT
Change-Id: I9517f9b470076a6febeafae76d735c2436812e7c
This commit is contained in:
parent
d20185ac96
commit
c7fc5ca6eb
3 changed files with 24 additions and 21 deletions
|
@ -595,8 +595,8 @@ static inline ssize_t readwrite_partial(struct filestr_desc *file,
|
|||
static ssize_t readwrite(struct filestr_desc *file, void *buf, size_t nbyte,
|
||||
bool write)
|
||||
{
|
||||
DEBUGF("readwrite(%p,%lx,%ld,%s)\n",
|
||||
file, (long)buf, nbyte, write ? "write" : "read");
|
||||
DEBUGF("readwrite(%p,%lx,%lu,%s)\n",
|
||||
file, (long)buf, (unsigned long)nbyte, write ? "write" : "read");
|
||||
|
||||
const file_size_t size = *file->sizep;
|
||||
file_size_t filerem;
|
||||
|
@ -705,8 +705,8 @@ static ssize_t readwrite(struct filestr_desc *file, void *buf, size_t nbyte,
|
|||
rc = fat_readwrite(&file->stream.fatstr, runlen, buf, write);
|
||||
if (rc < 0)
|
||||
{
|
||||
DEBUGF("I/O error %sing %ld sectors\n", sectors,
|
||||
write ? "writ" : "read");
|
||||
DEBUGF("I/O error %sing %ld sectors\n",
|
||||
write ? "writ" : "read", runlen);
|
||||
FILE_ERROR(rc == FAT_RC_ENOSPC ? ENOSPC : EIO,
|
||||
rc * 10 - 6);
|
||||
}
|
||||
|
@ -874,7 +874,7 @@ int fsync(int fildes)
|
|||
|
||||
if (!(file->stream.flags & FD_WRITE))
|
||||
{
|
||||
DEBUGF("Descriptor is read-only mode\n", fd);
|
||||
DEBUGF("Descriptor is read-only mode\n");
|
||||
FILE_ERROR(EINVAL, -2);
|
||||
}
|
||||
|
||||
|
@ -917,7 +917,8 @@ ssize_t read(int fildes, void *buf, size_t nbyte)
|
|||
if (file->stream.flags & FD_WRONLY)
|
||||
{
|
||||
DEBUGF("read(fd=%d,buf=%p,nb=%lu) - "
|
||||
"descriptor is write-only mode\n", fildes, buf, nbyte);
|
||||
"descriptor is write-only mode\n",
|
||||
fildes, buf, (unsigned long)nbyte);
|
||||
FILE_ERROR(EBADF, -2);
|
||||
}
|
||||
|
||||
|
@ -942,7 +943,8 @@ ssize_t write(int fildes, const void *buf, size_t nbyte)
|
|||
if (!(file->stream.flags & FD_WRITE))
|
||||
{
|
||||
DEBUGF("write(fd=%d,buf=%p,nb=%lu) - "
|
||||
"descriptor is read-only mode\n", fildes, buf, nbyte);
|
||||
"descriptor is read-only mode\n",
|
||||
fildes, buf, (unsigned long)nbyte);
|
||||
FILE_ERROR(EBADF, -2);
|
||||
}
|
||||
|
||||
|
@ -981,7 +983,7 @@ int rename(const char *old, const char *new)
|
|||
open1rc = open_stream_internal(old, FF_ANYTYPE, &oldstr, &oldinfo);
|
||||
if (open1rc <= 0)
|
||||
{
|
||||
DEBUGF("Failed opening old: %d\n", rc);
|
||||
DEBUGF("Failed opening old: %d\n", open1rc);
|
||||
if (open1rc == 0)
|
||||
FILE_ERROR(ENOENT, -1);
|
||||
else
|
||||
|
@ -1006,7 +1008,7 @@ int rename(const char *old, const char *new)
|
|||
open2rc = open_stream_internal(new, callflags, &newstr, &newinfo);
|
||||
if (open2rc < 0)
|
||||
{
|
||||
DEBUGF("Failed opening new file: %d\n", rc);
|
||||
DEBUGF("Failed opening new file: %d\n", open2rc);
|
||||
FILE_ERROR(ERRNO, open2rc * 10 - 2);
|
||||
}
|
||||
|
||||
|
@ -1165,7 +1167,7 @@ int relate(const char *path1, const char *path2)
|
|||
open1rc = open_stream_internal(path1, FF_ANYTYPE, &str1, &info1);
|
||||
if (open1rc <= 0)
|
||||
{
|
||||
DEBUGF("Failed opening path1: %d\n", rc);
|
||||
DEBUGF("Failed opening path1: %d\n", open1rc);
|
||||
if (open1rc < 0)
|
||||
FILE_ERROR(ERRNO, open1rc * 10 - 1);
|
||||
else
|
||||
|
@ -1177,7 +1179,7 @@ int relate(const char *path1, const char *path2)
|
|||
&str2, &info2);
|
||||
if (open2rc < 0)
|
||||
{
|
||||
DEBUGF("Failed opening path2: %d\n", rc);
|
||||
DEBUGF("Failed opening path2: %d\n", open2rc);
|
||||
FILE_ERROR(ERRNO, open2rc * 10 - 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -546,8 +546,8 @@ int open_stream_internal(const char *path, unsigned int callflags,
|
|||
struct filestr_base *stream,
|
||||
struct path_component_info *compinfo)
|
||||
{
|
||||
DEBUGF("%s(path=\"%s\",flg=%X,str=%p,compinfo=%p)\n", path, callflags,
|
||||
stream, compinfo);
|
||||
DEBUGF("%s(path=\"%s\",flg=%X,str=%p,compinfo=%p)\n", __func__,
|
||||
path, callflags, stream, compinfo);
|
||||
int rc;
|
||||
|
||||
filestr_base_init(stream);
|
||||
|
|
|
@ -950,8 +950,7 @@ static void update_fsinfo32(struct bpb *fat_bpb)
|
|||
uint8_t *fsinfo = cache_sector(fat_bpb, fat_bpb->bpb_fsinfo);
|
||||
if (!fsinfo)
|
||||
{
|
||||
DEBUGF("%s() - Couldn't read FSInfo"
|
||||
" (err code %d)", __func__, rc);
|
||||
DEBUGF("%s() - Couldn't read FSInfo", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -972,7 +971,7 @@ static long get_next_cluster32(struct bpb *fat_bpb, long startcluster)
|
|||
if (!sec)
|
||||
{
|
||||
dc_unlock_cache();
|
||||
DEBUGF("%s: Could not cache sector %d\n", __func__, sector);
|
||||
DEBUGF("%s: Could not cache sector %lu\n", __func__, sector);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1045,7 +1044,7 @@ static int update_fat_entry32(struct bpb *fat_bpb, unsigned long entry,
|
|||
if (!sec)
|
||||
{
|
||||
dc_unlock_cache();
|
||||
DEBUGF("Could not cache sector %u\n", sector);
|
||||
DEBUGF("Could not cache sector %lu\n", sector);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1544,7 +1543,8 @@ static int write_longname(struct bpb *fat_bpb, struct fat_filestr *parentstr,
|
|||
unsigned int flags)
|
||||
{
|
||||
DEBUGF("%s(file:%lx, first:%d, num:%d, name:%s)\n", __func__,
|
||||
parent->info->firstcluster, firstentry, numentries, name);
|
||||
file->firstcluster, file->e.entry - file->e.entries + 1,
|
||||
file->e.entries, name);
|
||||
|
||||
int rc;
|
||||
union raw_dirent *ent;
|
||||
|
@ -1901,7 +1901,8 @@ static int free_direntries(struct bpb *fat_bpb, struct fat_file *file)
|
|||
entries; entries--, entry++)
|
||||
{
|
||||
DEBUGF("Clearing dir entry %d (%d/%d)\n",
|
||||
entry, entry - numentries + 1, numentries);
|
||||
entry, entries - file->e.entries + 1, file->e.entries);
|
||||
|
||||
|
||||
dc_lock_cache();
|
||||
|
||||
|
@ -2374,7 +2375,7 @@ static long transfer(struct bpb *fat_bpb, unsigned long start, long count,
|
|||
|
||||
if (rc < 0)
|
||||
{
|
||||
DEBUGF("Couldn't %s sector %lx (err %d)\n",
|
||||
DEBUGF("Couldn't %s sector %lx (err %ld)\n",
|
||||
write ? "write":"read", start, rc);
|
||||
return rc;
|
||||
}
|
||||
|
@ -2803,7 +2804,7 @@ int fat_mount(IF_MV(int volume,) IF_MD(int drive,) unsigned long startsector)
|
|||
DEBUGF("Freecount: %ld\n", (unsigned long)fat_bpb->fsinfo.freecount);
|
||||
DEBUGF("Nextfree: 0x%lx\n", (unsigned long)fat_bpb->fsinfo.nextfree);
|
||||
DEBUGF("Cluster count: 0x%lx\n", fat_bpb->dataclusters);
|
||||
DEBUGF("Sectors per cluster: %d\n", fat_bpb->bpb_secperclus);
|
||||
DEBUGF("Sectors per cluster: %lu\n", fat_bpb->bpb_secperclus);
|
||||
DEBUGF("FAT sectors: 0x%lx\n", fat_bpb->fatsize);
|
||||
|
||||
rc = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue