diff --git a/apps/bookmark.c b/apps/bookmark.c index 8c4cb18211..a8a0961c8a 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c @@ -692,7 +692,7 @@ static int buffer_bookmarks(struct bookmark_list* bookmarks, int first_line) return -1; } - if ((first_line != 0) && ((size_t) filesize(file) < bookmarks->buffer_size + if ((first_line != 0) && ((size_t) ffilesize(file) < bookmarks->buffer_size - sizeof(*bookmarks) - (sizeof(char*) * bookmarks->total_count))) { /* Entire file fits in buffer */ diff --git a/apps/buffering.c b/apps/buffering.c index a4c179af41..8b9617e98f 100644 --- a/apps/buffering.c +++ b/apps/buffering.c @@ -982,7 +982,7 @@ int bufopen(const char *file, off_t offset, enum data_type type, #endif /* HAVE_ALBUMART */ if (size == 0) - size = filesize(fd); + size = ffilesize(fd); unsigned int hflags = 0; if (type == TYPE_PACKET_AUDIO || type == TYPE_CODEC) diff --git a/apps/core_keymap.c b/apps/core_keymap.c index d9fa331727..cc7e00c428 100644 --- a/apps/core_keymap.c +++ b/apps/core_keymap.c @@ -37,7 +37,7 @@ static int open_key_remap(const char *filename, int *countp) if (fd < 0) return fd; - size_t fsize = filesize(fd); + size_t fsize = ffilesize(fd); int count = fsize / sizeof(struct button_mapping); if (count == 0 || (size_t)(count * sizeof(struct button_mapping)) != fsize) { diff --git a/apps/filetypes.c b/apps/filetypes.c index 4c68fc9579..5578026bbf 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c @@ -382,7 +382,7 @@ static void read_viewers_config_init(void) if(fd < 0) return; - off_t filesz = filesize(fd); + off_t filesz = ffilesize(fd); if(filesz <= 0) goto out; diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index cab4385bb9..ecf2a9a4fc 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -290,7 +290,7 @@ void wps_playlist_percent_prepare(void) if (fd >= 0) { unsigned int afmt = probe_file_format(info.filename); - off_t size = filesize(fd); + off_t size = ffilesize(fd); if (size > 0) { diff --git a/apps/playlist.c b/apps/playlist.c index 9140d25a8c..294e2093b3 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -3218,7 +3218,7 @@ int playlist_resume(void) } playlist->control_created = true; - control_file_size = filesize(playlist->control_fd); + control_file_size = ffilesize(playlist->control_fd); if (control_file_size <= 0) { notify_control_access_error(); diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index 7a7e082e21..eee746d0f9 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c @@ -325,7 +325,7 @@ int catalog_insert_into(const char* playlist, bool new_playlist, goto exit; i = lseek(f, 0, SEEK_CUR); - fs = filesize(f); + fs = ffilesize(f); while (i < fs) { int n; diff --git a/apps/plugin.c b/apps/plugin.c index 7f517fe727..83574d5ed0 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -430,7 +430,7 @@ static const struct plugin_api rockbox_api = { FS_PREFIX(remove), FS_PREFIX(rename), FS_PREFIX(ftruncate), - FS_PREFIX(filesize), + FS_PREFIX(ffilesize), fdprintf, read_line, settings_parseline, @@ -460,7 +460,7 @@ static const struct plugin_api rockbox_api = { FS_PREFIX(mkdir), FS_PREFIX(rmdir), FS_PREFIX(dir_exists), - dir_get_info, + FS_PREFIX(dir_get_info), /* browsing */ rockbox_browse, diff --git a/apps/plugin.h b/apps/plugin.h index 0cbf638444..e98c4b78a3 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -498,7 +498,7 @@ struct plugin_api { int (*remove)(const char *path); int (*rename)(const char *old, const char *new); int (*ftruncate)(int fildes, off_t length); - off_t (*filesize)(int fildes); + off_t (*ffilesize)(int fildes); int (*fdprintf)(int fildes, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); int (*read_line)(int fd, char* buffer, int buffer_size); bool (*settings_parseline)(char* line, char** name, char** value); diff --git a/apps/plugins/bench_mem_jpeg.c b/apps/plugins/bench_mem_jpeg.c index db210613b8..25db2d1923 100644 --- a/apps/plugins/bench_mem_jpeg.c +++ b/apps/plugins/bench_mem_jpeg.c @@ -89,7 +89,7 @@ enum plugin_status plugin_start(const void* parameter) lcd_printf("file open failed: %d", fd); goto wait; } - unsigned long filesize = rb->filesize(fd); + unsigned long filesize = rb->ffilesize(fd); if (filesize > plugin_buf_len) { lcd_printf("file too large"); diff --git a/apps/plugins/clock/clock_settings.c b/apps/plugins/clock/clock_settings.c index 6e6f32bd36..e5a3c61cf0 100644 --- a/apps/plugins/clock/clock_settings.c +++ b/apps/plugins/clock/clock_settings.c @@ -117,7 +117,7 @@ static enum settings_file_status clock_settings_load( if(fd >= 0) { /* basic consistency check */ - if(rb->filesize(fd) != sizeof(*settings)) + if(rb->ffilesize(fd) != sizeof(*settings)) rb->close(fd); else { diff --git a/apps/plugins/crypt_firmware.c b/apps/plugins/crypt_firmware.c index 332d18e761..945781cdea 100644 --- a/apps/plugins/crypt_firmware.c +++ b/apps/plugins/crypt_firmware.c @@ -150,7 +150,7 @@ enum plugin_status plugin_start(const void* parameter) return PLUGIN_ERROR; } - length = rb->filesize(fd); + length = rb->ffilesize(fd); if (length < 12) { rb->splash(HZ*2, "File too small"); diff --git a/apps/plugins/dict.c b/apps/plugins/dict.c index fe61229c7e..c679914b9b 100644 --- a/apps/plugins/dict.c +++ b/apps/plugins/dict.c @@ -102,7 +102,7 @@ enum plugin_status plugin_start(const void* parameter) return PLUGIN_ERROR; } - filesize = rb->filesize(fIndex); /* get filesize */ + filesize = rb->ffilesize(fIndex); /* get filesize */ DEBUGF("Filesize: %d bytes = %d words \n", filesize, (filesize / (int)sizeof(struct stWord))); diff --git a/apps/plugins/doom/d_deh.c b/apps/plugins/doom/d_deh.c index 92ea91b6ae..f8eae5af01 100644 --- a/apps/plugins/doom/d_deh.c +++ b/apps/plugins/doom/d_deh.c @@ -106,7 +106,7 @@ int dehfeof(DEHFILE *fp) { if (fp->fd >= 0) { - off_t size = filesize(fp->fd); + off_t size = ffilesize(fp->fd); off_t offset = lseek(fp->fd, 0, SEEK_CUR); return (size <= 0 || offset < 0 || offset >= size) ? 1 : 0; } diff --git a/apps/plugins/doom/m_misc.c b/apps/plugins/doom/m_misc.c index 0318c9d741..9d1d33ffcf 100644 --- a/apps/plugins/doom/m_misc.c +++ b/apps/plugins/doom/m_misc.c @@ -127,7 +127,7 @@ int M_ReadFile(char const* name,byte** buffer) if ((handle < 0)) I_Error ("M_ReadFile: Couldn't read file %s", name); - length = filesize(handle); + length = ffilesize(handle); buf = Z_Malloc (length, PU_STATIC, NULL); count = read (handle, buf, length); close (handle); diff --git a/apps/plugins/doom/rockmacros.h b/apps/plugins/doom/rockmacros.h index d46d5a22fc..7f01cf2f95 100644 --- a/apps/plugins/doom/rockmacros.h +++ b/apps/plugins/doom/rockmacros.h @@ -52,7 +52,7 @@ int my_close(int id); #endif #define lseek(a,b,c) rb->lseek((a),(b),(c)) -#define filesize(a) rb->filesize((a)) +#define ffilesize(a) rb->ffilesize((a)) #define read(a,b,c) rb->read((a),(b),(c)) #define write(a,b,c) rb->write((a),(b),(c)) #undef strtok diff --git a/apps/plugins/doom/w_wad.c b/apps/plugins/doom/w_wad.c index 48d695c3b4..3b262d62f8 100644 --- a/apps/plugins/doom/w_wad.c +++ b/apps/plugins/doom/w_wad.c @@ -87,7 +87,7 @@ static int W_Filelength(int handle) I_Error("W_Filelength: Error fstating"); return fileinfo.st_size; */ - return filesize(handle); + return ffilesize(handle); } void ExtractFileBase (const char *path, char *dest) diff --git a/apps/plugins/imageviewer/jpeg/jpeg.c b/apps/plugins/imageviewer/jpeg/jpeg.c index e8d654c00b..2436e90f68 100644 --- a/apps/plugins/imageviewer/jpeg/jpeg.c +++ b/apps/plugins/imageviewer/jpeg/jpeg.c @@ -133,7 +133,7 @@ static int load_image(char *filename, struct image_info *info, } else { - filesize = rb->filesize(fd); + filesize = rb->ffilesize(fd); } /* allocate JPEG buffer */ diff --git a/apps/plugins/imageviewer/png/png.c b/apps/plugins/imageviewer/png/png.c index 5f9aa9393c..5fb999d060 100644 --- a/apps/plugins/imageviewer/png/png.c +++ b/apps/plugins/imageviewer/png/png.c @@ -120,7 +120,7 @@ static int load_image(char *filename, struct image_info *info, } else { - file_size = rb->filesize(fd); + file_size = rb->ffilesize(fd); } DEBUGF("reading file '%s'\n", filename); diff --git a/apps/plugins/imageviewer/ppm/ppm.c b/apps/plugins/imageviewer/ppm/ppm.c index f2bdc07d68..e1ae1b278d 100644 --- a/apps/plugins/imageviewer/ppm/ppm.c +++ b/apps/plugins/imageviewer/ppm/ppm.c @@ -106,7 +106,7 @@ static int load_image(char *filename, struct image_info *info, } else { - filesize = rb->filesize(fd); + filesize = rb->ffilesize(fd); } DEBUGF("reading file '%s'\n", filename); diff --git a/apps/plugins/iriver_flash.c b/apps/plugins/iriver_flash.c index a67b793607..1ad222bf40 100644 --- a/apps/plugins/iriver_flash.c +++ b/apps/plugins/iriver_flash.c @@ -373,7 +373,7 @@ static bool load_firmware(const char* filename, enum firmware firmware, } /* get file and buffer lengths and acquire the buffer */ - fd_len = rb->filesize(fd); + fd_len = rb->ffilesize(fd); buffer = rb->plugin_get_audio_buffer(&buffer_len); /* ensure there's enough space in the buffer */ diff --git a/apps/plugins/keyremap.c b/apps/plugins/keyremap.c index a224cc292a..04ef074ff6 100644 --- a/apps/plugins/keyremap.c +++ b/apps/plugins/keyremap.c @@ -374,7 +374,7 @@ static int keyremap_open_file(const char *filename, int *fd, size_t *fsize) *fd = rb->open(filename, O_RDONLY); if (*fd) { - *fsize = rb->filesize(*fd); + *fsize = rb->ffilesize(*fd); count = *fsize / sizeof(struct button_mapping); diff --git a/apps/plugins/lastfm_scrobbler_viewer.c b/apps/plugins/lastfm_scrobbler_viewer.c index 8ce5ab8b85..c138d4976e 100644 --- a/apps/plugins/lastfm_scrobbler_viewer.c +++ b/apps/plugins/lastfm_scrobbler_viewer.c @@ -200,7 +200,7 @@ static size_t file_open(const char *filename, int *fd) *fd = rb->open(filename, O_RDONLY); if (*fd >= 0) { - fsize = rb->filesize(*fd); + fsize = rb->ffilesize(*fd); } } return fsize; diff --git a/apps/plugins/lrcplayer.c b/apps/plugins/lrcplayer.c index 8ce00fad7a..7468e24f08 100644 --- a/apps/plugins/lrcplayer.c +++ b/apps/plugins/lrcplayer.c @@ -1944,7 +1944,7 @@ static void save_changes(void) rb->write(fd, BOM, BOM_SIZE); } else - size = rb->filesize(fe); + size = rb->ffilesize(fe); while (curr < size) { /* find offset of next tag */ diff --git a/apps/plugins/lua/liolib.c b/apps/plugins/lua/liolib.c index 22213191a5..e8b3f9106f 100644 --- a/apps/plugins/lua/liolib.c +++ b/apps/plugins/lua/liolib.c @@ -267,7 +267,7 @@ static int read_number (lua_State *L, int *f) { static int test_eof (lua_State *L, int *f) { off_t s = lseek(*f, 0, SEEK_CUR); lua_pushlstring(L, NULL, 0); - return s < filesize(*f); + return s < ffilesize(*f); } diff --git a/apps/plugins/lua/rocklibc.h b/apps/plugins/lua/rocklibc.h index 3dd093d2f3..eb34e1f147 100644 --- a/apps/plugins/lua/rocklibc.h +++ b/apps/plugins/lua/rocklibc.h @@ -52,7 +52,7 @@ extern int errno; #define open(...) rb->open(__VA_ARGS__) #define close(fd) rb->close(fd) #define lseek(fd,off,w) rb->lseek(fd,off,w) -#define filesize(fd) rb->filesize(fd) +#define ffilesize(fd) rb->ffilesize(fd) #define ftruncate(fd,l) rb->ftruncate(fd,l) #define file_exists(p) rb->file_exists(p) #define remove(f) rb->remove(f) @@ -71,7 +71,7 @@ extern int errno; #define open(...) PREFIX(open)(__VA_ARGS__) #define close(fd) PREFIX(close)(fd) #define lseek(fd,off,w) PREFIX(lseek)(fd,off,w) -#define filesize(fd) PREFIX(filesize)(fd) +#define ffilesize(fd) PREFIX(ffilesize)(fd) #define ftruncate(fd,l) PREFIX(ftruncate)(fd,l) #define file_exists(p) PREFIX(file_exists)(p) #define remove(f) PREFIX(remove)(f) diff --git a/apps/plugins/mikmod/mikmod_supp.h b/apps/plugins/mikmod/mikmod_supp.h index f7d8d26d2a..a82670bf15 100644 --- a/apps/plugins/mikmod/mikmod_supp.h +++ b/apps/plugins/mikmod/mikmod_supp.h @@ -46,8 +46,8 @@ #define read(a,b,c) rb->read(a,b,c) #undef write #define write(a,b,c) rb->write(a,b,c) -#undef filesize -#define filesize(a) rb->filesize(a) +#undef ffilesize +#define ffilesize(a) rb->ffilesize(a) #endif #define malloc(x) tlsf_malloc(x) diff --git a/apps/plugins/mikmod/mmio.c b/apps/plugins/mikmod/mmio.c index 6e317ca008..ef3d44d756 100644 --- a/apps/plugins/mikmod/mmio.c +++ b/apps/plugins/mikmod/mmio.c @@ -133,7 +133,7 @@ typedef struct MFILEREADER { static int _mm_FileReader_Eof(MREADER* reader) { //return feof(((MFILEREADER*)reader)->file); - int size = filesize(((MFILEREADER*)reader)->file); + int size = ffilesize(((MFILEREADER*)reader)->file); int offset = lseek(((MFILEREADER*)reader)->file, 0, SEEK_CUR); return (size <= 0 || offset < 0 || offset >= size) ? 1 : 0; } diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c index 9a8acecf88..5d3c525e8c 100644 --- a/apps/plugins/mp3_encoder.c +++ b/apps/plugins/mp3_encoder.c @@ -906,7 +906,7 @@ static int wave_open(void) (cfg.samplerate != 44100) && (cfg.samplerate != 48000)) return -9; header_size = 0x28; - wav_size = rb->filesize(wavfile); + wav_size = rb->ffilesize(wavfile); rb->lseek(wavfile, header_size, SEEK_SET); return 0; diff --git a/apps/plugins/mpegplayer/disk_buf.c b/apps/plugins/mpegplayer/disk_buf.c index 9f55f57ee0..1d1d1695a9 100644 --- a/apps/plugins/mpegplayer/disk_buf.c +++ b/apps/plugins/mpegplayer/disk_buf.c @@ -875,7 +875,7 @@ int disk_buf_open(const char *filename) if (fd >= 0) { - ssize_t filesize = rb->filesize(fd); + ssize_t filesize = rb->ffilesize(fd); if (filesize <= 0) { diff --git a/apps/plugins/open_plugins.c b/apps/plugins/open_plugins.c index 1a10c797e9..84a2187f88 100644 --- a/apps/plugins/open_plugins.c +++ b/apps/plugins/open_plugins.c @@ -191,7 +191,7 @@ static int op_entry_read_opx(const char *path) fd_opx = rb->open(path, O_RDONLY); if (fd_opx >= 0) { - filesize = rb->filesize(fd_opx); + filesize = rb->ffilesize(fd_opx); ret = filesize; if (filesize == op_entry_sz && !op_entry_read(fd_opx, 0, op_entry_sz)) ret = 0; diff --git a/apps/plugins/pdbox/PDa/intern/sfread~.c b/apps/plugins/pdbox/PDa/intern/sfread~.c index 0a369ce3f5..1da54e07cd 100644 --- a/apps/plugins/pdbox/PDa/intern/sfread~.c +++ b/apps/plugins/pdbox/PDa/intern/sfread~.c @@ -78,7 +78,7 @@ void sfread_open(t_sfread *x,t_symbol *filename) /* get the size */ #ifdef ROCKBOX - x->x_size = rb->filesize(x->x_fd); + x->x_size = rb->ffilesize(x->x_fd); #else fstat(x->x_fd,&fstate); x->x_size = fstate.st_size; diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index 872fbaa2ac..bba1a5d70a 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c @@ -1584,7 +1584,7 @@ static int load_album_index(void){ int album_idx, artist_idx; if (fr >= 0){ - const unsigned long filesize = rb->filesize(fr); + const unsigned long filesize = rb->ffilesize(fr); if (filesize > sizeof(data)) { if (rb->read(fr, &data, sizeof(data)) == sizeof(data) && diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c index 3c4bcb829d..fb822996e3 100644 --- a/apps/plugins/rockboy/rockboy.c +++ b/apps/plugins/rockboy/rockboy.c @@ -74,7 +74,7 @@ static void setoptions (void) int optionssize = sizeof(options); int filesize = 0; if(fd >= 0) - filesize = rb->filesize(fd); + filesize = rb->ffilesize(fd); /* don't read the option file if the size * is not as expected to avoid crash */ diff --git a/apps/plugins/tagcache/tagcache.c b/apps/plugins/tagcache/tagcache.c index 58d263da7b..602e366793 100644 --- a/apps/plugins/tagcache/tagcache.c +++ b/apps/plugins/tagcache/tagcache.c @@ -54,7 +54,7 @@ static bool logdump(bool append); #define vsnprintf rb->vsnprintf #define mkdir rb->mkdir -#define filesize rb->filesize +#define ffilesize rb->ffilesize #define strtok_r rb->strtok_r #define strncasecmp rb->strncasecmp diff --git a/apps/plugins/test_codec.c b/apps/plugins/test_codec.c index ba5b264372..7bd69369cc 100644 --- a/apps/plugins/test_codec.c +++ b/apps/plugins/test_codec.c @@ -181,7 +181,7 @@ void init_wav(char* filename) void close_wav(void) { - int filesize = rb->filesize(wavinfo.fd); + int filesize = rb->ffilesize(wavinfo.fd); int channels = (wavinfo.stereomode == STEREO_MONO) ? 1 : 2; int bps = 16; /* TODO */ @@ -658,7 +658,7 @@ static enum plugin_status test_track(const char* filename) goto exit; } - track.filesize = rb->filesize(fd); + track.filesize = rb->ffilesize(fd); /* Clear the id3 struct */ rb->memset(&track.id3, 0, sizeof(struct mp3entry)); diff --git a/apps/plugins/test_mem_jpeg.c b/apps/plugins/test_mem_jpeg.c index 855bf71677..e92d9d1d72 100644 --- a/apps/plugins/test_mem_jpeg.c +++ b/apps/plugins/test_mem_jpeg.c @@ -66,7 +66,7 @@ enum plugin_status plugin_start(const void* parameter) int fd = rb->open(filename, O_RDONLY); if (fd < 0) return PLUGIN_ERROR; - unsigned long filesize = rb->filesize(fd); + unsigned long filesize = rb->ffilesize(fd); if (filesize > plugin_buf_len) return PLUGIN_ERROR; plugin_buf_len -= filesize; diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c index 2fcdb90b9a..6b7dee868f 100644 --- a/apps/plugins/text_editor.c +++ b/apps/plugins/text_editor.c @@ -413,7 +413,7 @@ enum plugin_status plugin_start(const void* parameter) if (c && !rb->strcmp(c, ".colours")) edit_colors_file = true; #endif - if (buffer_size <= (size_t)rb->filesize(fd) + 0x400) + if (buffer_size <= (size_t)rb->ffilesize(fd) + 0x400) { buffer = rb->plugin_get_audio_buffer(&buffer_size); audio_buf = true; diff --git a/apps/plugins/text_viewer/tv_reader.c b/apps/plugins/text_viewer/tv_reader.c index d4f9040609..70448582d4 100644 --- a/apps/plugins/text_viewer/tv_reader.c +++ b/apps/plugins/text_viewer/tv_reader.c @@ -144,7 +144,7 @@ static int tv_change_preferences(const struct tv_preferences *oldp) if (fd < 0) return TV_CALLBACK_ERROR; - file_size = rb->filesize(fd); + file_size = rb->ffilesize(fd); change_file = true; } diff --git a/apps/recorder/jpeg_load.c b/apps/recorder/jpeg_load.c index 3214cc9763..c85d9965b4 100644 --- a/apps/recorder/jpeg_load.c +++ b/apps/recorder/jpeg_load.c @@ -2085,7 +2085,7 @@ int clip_jpeg_fd(int fd, int flags, #else p_jpeg->fd = fd; if (p_jpeg->len == 0) - p_jpeg->len = filesize(p_jpeg->fd); + p_jpeg->len = ffilesize(p_jpeg->fd); p_jpeg->read_buf = read_buf; p_jpeg->skip_bytes_seek = skip_bytes_seek; diff --git a/apps/tagcache.c b/apps/tagcache.c index d5c8f79a7a..e33bc9330e 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -3096,7 +3096,7 @@ static int build_index(int index_type, struct tagcache_header *h, int tmpfd) */ masterfd_pos = lseek(masterfd, tcmh.tch.entry_count * sizeof(struct index_entry), SEEK_CUR); - if (masterfd_pos == filesize(masterfd)) + if (masterfd_pos == ffilesize(masterfd)) { logf("appending..."); init = true; diff --git a/apps/talk.c b/apps/talk.c index 9aaa93e70f..a353eadc6c 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -1117,7 +1117,7 @@ static int _talk_file(const char* filename, { return 0; } - size = filesize(fd); + size = ffilesize(fd); if (size > 0) { diff --git a/bootloader/common.c b/bootloader/common.c index 705441357a..b07d419861 100644 --- a/bootloader/common.c +++ b/bootloader/common.c @@ -153,7 +153,7 @@ int load_raw_firmware(unsigned char* buf, char* firmware, int buffer_size) return EFILE_NOT_FOUND; } - len = filesize(fd); + len = ffilesize(fd); if (len > buffer_size) return EFILE_TOO_BIG; diff --git a/bootloader/gigabeat-s.c b/bootloader/gigabeat-s.c index b0c9b54f4d..42943111be 100644 --- a/bootloader/gigabeat-s.c +++ b/bootloader/gigabeat-s.c @@ -151,7 +151,7 @@ static void untar(int tar_fd) char path[102]; int fd, i; int ret; - size_t size = filesize(tar_fd); + size_t size = ffilesize(tar_fd); if (size > tarbuf_size) { @@ -159,7 +159,7 @@ static void untar(int tar_fd) return; } - ret = read(tar_fd, tarbuf, filesize(tar_fd)); + ret = read(tar_fd, tarbuf, ffilesize(tar_fd)); if (ret < 0) { printf("couldn't read tar file (%d)", ret); diff --git a/bootloader/x1000/boot.c b/bootloader/x1000/boot.c index e196159617..66fd62858a 100644 --- a/bootloader/x1000/boot.c +++ b/bootloader/x1000/boot.c @@ -85,7 +85,7 @@ static int read_linux_args(const char* filename) } /* this isn't 100% correct but will be good enough */ - off_t fsize = filesize(fd); + off_t fsize = ffilesize(fd); if(fsize < 0 || fsize+1 > (off_t)max_size) { splashf(5*HZ, "Arguments too long"); ret = -4; diff --git a/firmware/common/dir.c b/firmware/common/dir.c index 1f04c4f46b..2e0878d0ab 100644 --- a/firmware/common/dir.c +++ b/firmware/common/dir.c @@ -104,7 +104,7 @@ static struct dirstr_desc * alloc_dirstr(void) /** POSIX interface **/ /* open a directory */ -DIR * opendir(const char *dirname) +DIR * rbfs_opendir(const char *dirname) { DEBUGF("opendir(dirname=\"%s\"\n", dirname); @@ -132,7 +132,7 @@ file_error: } /* close a directory stream */ -int closedir(DIR *dirp) +int rbfs_closedir(DIR *dirp) { int rc; @@ -159,7 +159,7 @@ file_error: } /* read a directory */ -struct dirent * readdir(DIR *dirp) +struct dirent * rbfs_readdir(DIR *dirp) { struct dirstr_desc * const dir = GET_DIRSTR(READER, dirp); if (!dir) @@ -184,7 +184,7 @@ file_error: #if 0 /* not included now but probably should be */ /* read a directory (reentrant) */ -int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) +int rbfs_readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) { if (!result) FILE_ERROR_RETURN(EFAULT, -2); @@ -218,7 +218,7 @@ file_error: } /* reset the position of a directory stream to the beginning of a directory */ -void rewinddir(DIR *dirp) +void rbfs_rewinddir(DIR *dirp) { struct dirstr_desc * const dir = GET_DIRSTR(READER, dirp); if (!dir) @@ -232,7 +232,7 @@ void rewinddir(DIR *dirp) #endif /* 0 */ /* make a directory */ -int mkdir(const char *path) +int rbfs_mkdir(const char *path) { DEBUGF("mkdir(path=\"%s\")\n", path); @@ -269,7 +269,7 @@ file_error: } /* remove a directory */ -int rmdir(const char *name) +int rbfs_rmdir(const char *name) { DEBUGF("rmdir(name=\"%s\")\n", name); @@ -295,7 +295,7 @@ int rmdir(const char *name) /** Extended interface **/ /* return if two directory streams refer to the same directory */ -int samedir(DIR *dirp1, DIR *dirp2) +int rbfs_samedir(DIR *dirp1, DIR *dirp2) { struct dirstr_desc * const dir1 = GET_DIRSTR(WRITER, dirp1); if (!dir1) @@ -312,7 +312,7 @@ int samedir(DIR *dirp1, DIR *dirp2) } /* test directory existence (returns 'false' if a file) */ -bool dir_exists(const char *dirname) +bool rbfs_dir_exists(const char *dirname) { file_internal_lock_WRITER(); bool rc = test_stream_exists_internal(dirname, FF_DIR) > 0; @@ -321,7 +321,7 @@ bool dir_exists(const char *dirname) } /* get the portable info from the native entry */ -struct dirinfo dir_get_info(DIR *dirp, struct dirent *entry) +struct dirinfo rbfs_dir_get_info(DIR *dirp, struct dirent *entry) { int rc; if (!dirp || !entry) @@ -344,7 +344,7 @@ file_error: return (struct dirinfo){ .attribute = 0 }; } -const char* root_realpath(void) +const char* rbfs_root_realpath(void) { /* Native only, for APP and SIM see respective filesystem-.c files */ return root_get_realpath(); /* rb_namespace.c */ diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c index 1464ffab79..6a91b6cb5d 100644 --- a/firmware/common/dircache.c +++ b/firmware/common/dircache.c @@ -3060,7 +3060,7 @@ int INIT_ATTR dircache_load(void) if (maindata.dircache.size != maindata.dircache.sizeentries + maindata.dircache.sizenames || ALIGN_DOWN(maindata.dircache.size, ENTRYSIZE) != maindata.dircache.size || - filesize(fd) - sizeof (maindata) != maindata.dircache.size) + ffilesize(fd) - sizeof (maindata) != maindata.dircache.size) { logf("dircache: file header error"); goto error_nolock; diff --git a/firmware/common/file.c b/firmware/common/file.c index 12505381fc..1139385c42 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c @@ -507,7 +507,7 @@ static int open_internal_inner1(const char *path, int oflag, file_error: if (fildes >= 0) - close(fildes); + rbfs_close(fildes); return rc; } @@ -817,21 +817,21 @@ void force_close_writer_internal(struct filestr_base *stream) /** POSIX **/ /* open a file */ -int open(const char *path, int oflag) +int rbfs_open(const char *path, int oflag) { DEBUGF("open(path=\"%s\",oflag=%X)\n", path, (unsigned)oflag); return open_internal_locked(path, oflag, FF_ANYTYPE); } /* create a new file or rewrite an existing one */ -int creat(const char *path) +int rbfs_creat(const char *path) { DEBUGF("creat(path=\"%s\")\n", path); return open_internal_locked(path, O_WRONLY|O_CREAT|O_TRUNC, FF_ANYTYPE); } /* close a file descriptor */ -int close(int fildes) +int rbfs_close(int fildes) { DEBUGF("close(fd=%d)\n", fildes); @@ -857,7 +857,7 @@ file_error: } /* truncate a file to a specified length */ -int ftruncate(int fildes, off_t length) +int rbfs_ftruncate(int fildes, off_t length) { DEBUGF("ftruncate(fd=%d,len=%ld)\n", fildes, (long)length); @@ -889,7 +889,7 @@ file_error: } /* synchronize changes to a file */ -int fsync(int fildes) +int rbfs_fsync(int fildes) { DEBUGF("fsync(fd=%d)\n", fildes); @@ -915,7 +915,7 @@ file_error: } /* move the read/write file offset */ -off_t lseek(int fildes, off_t offset, int whence) +off_t rbfs_lseek(int fildes, off_t offset, int whence) { #ifndef LOGF_ENABLE /* wipes out log before you can save it */ DEBUGF("lseek(fd=%d,ofs=%ld,wh=%d)\n", fildes, (long)offset, whence); @@ -934,7 +934,7 @@ file_error: } /* read from a file */ -ssize_t read(int fildes, void *buf, size_t nbyte) +ssize_t rbfs_read(int fildes, void *buf, size_t nbyte) { struct filestr_desc * const file = GET_FILESTR(READER, fildes); if (!file) @@ -960,7 +960,7 @@ file_error: } /* write on a file */ -ssize_t write(int fildes, const void *buf, size_t nbyte) +ssize_t rbfs_write(int fildes, const void *buf, size_t nbyte) { struct filestr_desc * const file = GET_FILESTR(READER, fildes); if (!file) @@ -986,7 +986,7 @@ file_error: } /* remove a file */ -int remove(const char *path) +int rbfs_remove(const char *path) { DEBUGF("remove(path=\"%s\")\n", path); @@ -997,7 +997,7 @@ int remove(const char *path) } /* rename a file */ -int rename(const char *old, const char *new) +int rbfs_rename(const char *old, const char *new) { DEBUGF("rename(old=\"%s\",new=\"%s\")\n", old, new); @@ -1144,7 +1144,7 @@ file_error: /** Extensions **/ -int modtime(const char *path, time_t modtime) +int rbfs_modtime(const char *path, time_t modtime) { DEBUGF("modtime(path=\"%s\",modtime=%d)\n", path, (int) modtime); @@ -1181,7 +1181,7 @@ file_error: } /* get the binary size of a file (in bytes) */ -off_t filesize(int fildes) +off_t rbfs_ffilesize(int fildes) { struct filestr_desc * const file = GET_FILESTR(READER, fildes); if (!file) @@ -1200,7 +1200,7 @@ file_error: } /* test if two file descriptors refer to the same file */ -int fsamefile(int fildes1, int fildes2) +int rbfs_fsamefile(int fildes1, int fildes2) { struct filestr_desc * const file1 = GET_FILESTR(WRITER, fildes1); if (!file1) @@ -1217,7 +1217,7 @@ int fsamefile(int fildes1, int fildes2) } /* tell the relationship of path1 to path2 */ -int relate(const char *path1, const char *path2) +int rbfs_relate(const char *path1, const char *path2) { /* this is basically what rename() does but reduced to the relationship determination */ @@ -1277,7 +1277,7 @@ file_error: } /* test file or directory existence */ -bool file_exists(const char *path) +bool rbfs_file_exists(const char *path) { file_internal_lock_WRITER(); bool rc = test_stream_exists_internal(path, FF_ANYTYPE) > 0; diff --git a/firmware/common/rb-loader.c b/firmware/common/rb-loader.c index 2f5e06e165..b8d3d5a163 100644 --- a/firmware/common/rb-loader.c +++ b/firmware/common/rb-loader.c @@ -53,7 +53,7 @@ static int load_firmware_filename(unsigned char* buf, if (fd < 0) return EFILE_NOT_FOUND; - len = filesize(fd) - 8; + len = ffilesize(fd) - 8; if (len > buffer_size) { diff --git a/firmware/common/unicode.c b/firmware/common/unicode.c index 7e5bac8d91..15abc8fde2 100644 --- a/firmware/common/unicode.c +++ b/firmware/common/unicode.c @@ -221,7 +221,7 @@ static int alloc_and_load_cp_table(int cp, void *buf) if (fd < 0) return -1; - off_t size = filesize(fd); + off_t size = ffilesize(fd); if (size > 0 && size <= MAX_CP_TABLE_SIZE*2 && !(size % (off_t)sizeof (uint16_t))) { diff --git a/firmware/common/zip.c b/firmware/common/zip.c index 345eb6cb35..3edeceae82 100644 --- a/firmware/common/zip.c +++ b/firmware/common/zip.c @@ -524,7 +524,7 @@ static off_t zip_file_seek(struct zip* zh, off_t offset, int whence) { static off_t zip_file_size(struct zip* zh) { struct zip_file* z = (struct zip_file*) zh; - return filesize(z->file); + return ffilesize(z->file); } static void zip_file_close(struct zip* zh) { @@ -721,7 +721,7 @@ struct zip* zip_open(const char* name, bool try_mem) { if ((file = open(name, O_RDONLY)) < 0) goto bail; - if (try_mem && (mem_handle = zip_core_alloc(mem_size = filesize(file))) >= 0) { + if (try_mem && (mem_handle = zip_core_alloc(mem_size = ffilesize(file))) >= 0) { if ((zip_handle = zip_core_alloc(sizeof(struct zip_mem))) < 0) goto bail; diff --git a/firmware/font.c b/firmware/font.c index 9ea194038a..f3d14c48f0 100644 --- a/firmware/font.c +++ b/firmware/font.c @@ -435,7 +435,7 @@ int font_load_ex( const char *path, size_t buf_size, int glyphs ) #endif /* load font struct f with file header */ - int file_size = filesize( fd ); + int file_size = ffilesize( fd ); struct font header; struct font f; @@ -1021,7 +1021,7 @@ static NO_INLINE void glyph_cache_load(const char *font_path, struct font *pf) if (hdr != FC_HEADER_VAL) goto latin; /* only read what fits */ - glyph_file_size = filesize( fd ); + glyph_file_size = ffilesize( fd ); if (glyph_file_size < sizeof(uint32_t)) goto latin; glyph_file_size -= sizeof(uint32_t); diff --git a/firmware/include/dir.h b/firmware/include/dir.h index 844b56ac1d..1619242cc3 100644 --- a/firmware/include/dir.h +++ b/firmware/include/dir.h @@ -65,6 +65,9 @@ #ifndef dir_exists #define dir_exists FS_PREFIX(dir_exists) #endif +#ifndef dir_get_info +#define dir_get_info FS_PREFIX(dir_get_info) +#endif #ifndef root_realpath #define root_realpath FS_PREFIX(root_realpath) #endif @@ -85,12 +88,4 @@ struct dirinfo time_t mtime; /* local file time */ }; -#ifndef DIRFUNCTIONS_DECLARED -/* TIP: set errno to zero before calling to see if anything failed */ -struct dirinfo dir_get_info(DIR *dirp, struct DIRENT *entry); -const char* root_realpath(void); -#endif /* !DIRFUNCTIONS_DECLARED */ - - - #endif /* _DIR_H_ */ diff --git a/firmware/include/dircache_redirect.h b/firmware/include/dircache_redirect.h index d7af8d78d9..329df8b3a6 100644 --- a/firmware/include/dircache_redirect.h +++ b/firmware/include/dircache_redirect.h @@ -192,7 +192,7 @@ static inline void volume_onmount_internal(IF_MV_NONVOID(int volume)) if (rtlen <= 0 || rtlen >= (int) sizeof(rtpath)) rtlen = 0; /* path too long or sprintf error */ - else if (file_exists(rtpath)) + else if (rbfs_file_exists(rtpath)) { rtlen = get_redirect_dir(rtpath, sizeof(rtpath), volume, "", ""); while (rtlen > 0 && rtpath[--rtlen] == PATH_SEPCH) diff --git a/firmware/include/file.h b/firmware/include/file.h index 470550a2a7..6a1b3795d0 100644 --- a/firmware/include/file.h +++ b/firmware/include/file.h @@ -87,8 +87,8 @@ int fdprintf(int fildes, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); #ifndef modtime #define modtime FS_PREFIX(modtime) #endif -#ifndef filesize -#define filesize FS_PREFIX(filesize) +#ifndef ffilesize +#define ffilesize FS_PREFIX(ffilesize) #endif #ifndef fsamefile #define fsamefile FS_PREFIX(fsamefile) diff --git a/firmware/include/filesystem-native.h b/firmware/include/filesystem-native.h index 0edce81ae3..aaced66429 100644 --- a/firmware/include/filesystem-native.h +++ b/firmware/include/filesystem-native.h @@ -27,7 +27,7 @@ #define DIRFUNCTIONS_DEFINED #endif /* PLUGIN || CODEC */ -#define FS_PREFIX(_x_) _x_ +#define FS_PREFIX(_x_) rbfs_ ## _x_ #endif /* _FILESYSTEM_NATIVE_H_ */ #ifdef _FILE_H_ @@ -44,26 +44,26 @@ #include -int open(const char *name, int oflag); -int creat(const char *name); -int close(int fildes); -int ftruncate(int fildes, off_t length); -int fsync(int fildes); -off_t lseek(int fildes, off_t offset, int whence); -ssize_t read(int fildes, void *buf, size_t nbyte); -ssize_t write(int fildes, const void *buf, size_t nbyte); -int remove(const char *path); -int rename(const char *old, const char *new); -int modtime(const char *path, time_t modtime); -off_t filesize(int fildes); -int fsamefile(int fildes1, int fildes2); -int relate(const char *path1, const char *path2); -bool file_exists(const char *path); +int rbfs_open(const char *name, int oflag); +int rbfs_creat(const char *name); +int rbfs_close(int fildes); +int rbfs_ftruncate(int fildes, off_t length); +int rbfs_fsync(int fildes); +off_t rbfs_lseek(int fildes, off_t offset, int whence); +ssize_t rbfs_read(int fildes, void *buf, size_t nbyte); +ssize_t rbfs_write(int fildes, const void *buf, size_t nbyte); +int rbfs_remove(const char *path); +int rbfs_rename(const char *old, const char *new); +int rbfs_modtime(const char *path, time_t modtime); +off_t rbfs_ffilesize(int fildes); +int rbfs_fsamefile(int fildes1, int fildes2); +int rbfs_relate(const char *path1, const char *path2); +bool rbfs_file_exists(const char *path); #endif /* !FILEFUNCTIONS_DECLARED */ #if !defined(RB_FILESYSTEM_OS) && !defined (FILEFUNCTIONS_DEFINED) -#define open(path, oflag, ...) open(path, oflag) -#define creat(path, mode) creat(path) +#define rbfs_open(path, oflag, ...) rbfs_open(path, oflag) +#define rbfs_creat(path, mode) rbfs_creat(path) #endif /* FILEFUNCTIONS_DEFINED */ #endif /* _FILESYSTEM_NATIVE__FILE_H_ */ @@ -93,16 +93,19 @@ typedef struct {} DIR; #define DIRFUNCTIONS_DEFINED #endif -DIR * opendir(const char *dirname); -struct dirent * readdir(DIR *dirp); -int readdir_r(DIR *dirp, struct dirent *entry, - struct dirent **result); -void rewinddir(DIR *dirp); -int closedir(DIR *dirp); -int mkdir(const char *path); -int rmdir(const char *path); -int samedir(DIR *dirp1, DIR *dirp2); -bool dir_exists(const char *dirname); +DIR * rbfs_opendir(const char *dirname); +struct dirent * rbfs_readdir(DIR *dirp); +int rbfs_readdir_r(DIR *dirp, struct dirent *entry, + struct dirent **result); +void rbfs_rewinddir(DIR *dirp); +int rbfs_closedir(DIR *dirp); +int rbfs_mkdir(const char *path); +int rbfs_rmdir(const char *path); +int rbfs_samedir(DIR *dirp1, DIR *dirp2); +bool rbfs_dir_exists(const char *dirname); + +struct dirinfo rbfs_dir_get_info(DIR *dirp, struct DIRENT *entry); +const char * rbfs_root_realpath(void); #endif /* !DIRFUNCTIONS_DECLARED */ #endif /* _FILESYSTEM_NATIVE__DIR_H_ */ diff --git a/firmware/lc-rock.c b/firmware/lc-rock.c index 73d743dfbd..23adb7f390 100644 --- a/firmware/lc-rock.c +++ b/firmware/lc-rock.c @@ -60,7 +60,7 @@ void * lc_open(const char *filename, unsigned char *buf, size_t buf_size) /* hdr.end_addr points to the end of the bss section, * but there might be idata/icode behind that so the bytes to copy * can be larger */ - copy_size = MAX(filesize(fd), hdr.end_addr - hdr.load_addr); + copy_size = MAX(ffilesize(fd), hdr.end_addr - hdr.load_addr); if (hdr.load_addr < buf || (hdr.load_addr+copy_size) > buf_end) { diff --git a/firmware/target/hosted/filesystem-app.c b/firmware/target/hosted/filesystem-app.c index 03a7bf7f18..4b0c60d962 100644 --- a/firmware/target/hosted/filesystem-app.c +++ b/firmware/target/hosted/filesystem-app.c @@ -504,7 +504,7 @@ bool app_dir_exists(const char *dirname) return true; } -struct dirinfo dir_get_info(DIR *dirp, struct dirent *entry) +struct dirinfo app_dir_get_info(DIR *dirp, struct dirent *entry) { struct __dir *this = (struct __dir *)dirp; struct dirinfo ret = { .attribute = 0, diff --git a/firmware/target/hosted/filesystem-app.h b/firmware/target/hosted/filesystem-app.h index c526a1bdcf..d03dadeb01 100644 --- a/firmware/target/hosted/filesystem-app.h +++ b/firmware/target/hosted/filesystem-app.h @@ -86,7 +86,7 @@ ssize_t app_write(int fildes, const void *buf, size_t nbyte); int app_remove(const char *path); int app_rename(const char *old, const char *new); #define app_modtime os_modtime -#define app_filesize os_filesize +#define app_ffilesize os_ffilesize #define app_fsamefile os_fsamefile int app_relate(const char *path1, const char *path2); bool app_file_exists(const char *path); @@ -115,6 +115,8 @@ int app_mkdir(const char *path); int app_rmdir(const char *path); int app_samedir(DIR *dirp1, DIR *dirp2); bool app_dir_exists(const char *dirname); +struct dirinfo app_dir_get_info(DIR *dirp, struct dirent *entry); +const char * app_root_realpath(void); #endif /* DIRFUNCTIONS_DECLARED */ #endif /* _FILESYSTEM_APP__DIR_H_ */ diff --git a/firmware/target/hosted/filesystem-console.h b/firmware/target/hosted/filesystem-console.h index ee10a725e5..9ad880f259 100644 --- a/firmware/target/hosted/filesystem-console.h +++ b/firmware/target/hosted/filesystem-console.h @@ -63,7 +63,7 @@ ssize_t console_write(int fildes, const void *buf, size_t nbyte); int console_remove(const char *path); int console_rename(const char *old, const char *new); int console_modtime(const char *path, time_t modtime); -off_t console_filesize(int fildes); +off_t console_ffilesize(int fildes); int console_fsamefile(int fildes1, int fildes2); int console_relate(const char *path1, const char *path2); bool console_file_exists(const char *path); @@ -109,6 +109,9 @@ int console_mkdir(const char *path); int console_rmdir(const char *path); int console_samedir(DIR *dirp1, DIR *dirp2); bool console_dir_exists(const char *dirname); + +struct dirinfo console_dir_get_info(DIR *dirp, struct dirent *entry); +const char* console_root_realpath(void); #endif /* !DIRFUNCTIONS_DECLARED */ #endif /* _FILESYSTEM_CONSOLE__DIR_H_ */ diff --git a/firmware/target/hosted/filesystem-hosted.h b/firmware/target/hosted/filesystem-hosted.h index 3716da76f7..38e0b73067 100644 --- a/firmware/target/hosted/filesystem-hosted.h +++ b/firmware/target/hosted/filesystem-hosted.h @@ -30,7 +30,7 @@ void * os_lc_open(const char *ospath); #ifndef OSFUNCTIONS_DECLARED int os_modtime(const char *path, time_t modtime); -off_t os_filesize(int osfd); +off_t os_ffilesize(int osfd); int os_fsamefile(int osfd1, int osfd2); int os_relate(const char *path1, const char *path2); bool os_file_exists(const char *ospath); diff --git a/firmware/target/hosted/filesystem-unix.c b/firmware/target/hosted/filesystem-unix.c index 5e4c2a7207..068c49cd6f 100644 --- a/firmware/target/hosted/filesystem-unix.c +++ b/firmware/target/hosted/filesystem-unix.c @@ -53,7 +53,7 @@ int os_modtime(const char *path, time_t modtime) return utime(path, ×); } -off_t os_filesize(int osfd) +off_t os_ffilesize(int osfd) { struct stat sb; diff --git a/firmware/target/hosted/filesystem-win32.h b/firmware/target/hosted/filesystem-win32.h index 68f77dbf98..2627d46b48 100644 --- a/firmware/target/hosted/filesystem-win32.h +++ b/firmware/target/hosted/filesystem-win32.h @@ -49,12 +49,12 @@ size_t strlcpy_utf16utf8(char *buffer, const unsigned short *utf16, #ifndef OSFUNCTIONS_DECLARED /* Wrap for off_t <=> long conversions */ -static inline off_t os_filesize_(int osfd) +static inline off_t os_ffilesize_(int osfd) { return _filelength(osfd); } static inline int os_ftruncate_(int osfd, off_t length) { return _chsize(osfd, length); } -#define os_filesize os_filesize_ +#define os_ffilesize os_ffilesize_ #define os_ftruncate os_ftruncate_ #define os_fsync _commit #define os_fstat _fstat diff --git a/firmware/target/hosted/game_console/lib/sys_dir_3ds.c b/firmware/target/hosted/game_console/lib/sys_dir_3ds.c index 91a441987f..b83d727b4b 100644 --- a/firmware/target/hosted/game_console/lib/sys_dir_3ds.c +++ b/firmware/target/hosted/game_console/lib/sys_dir_3ds.c @@ -390,7 +390,7 @@ file_error: } /* get the portable info from the native entry */ -struct dirinfo dir_get_info(DIR *dirp, struct dirent *entry) +struct dirinfo console_dir_get_info(DIR *dirp, struct dirent *entry) { int rc; if (!dirp || !entry) diff --git a/firmware/target/hosted/game_console/lib/sys_file_common.c b/firmware/target/hosted/game_console/lib/sys_file_common.c index 2eab3dd4a3..481d0fc9a5 100644 --- a/firmware/target/hosted/game_console/lib/sys_file_common.c +++ b/firmware/target/hosted/game_console/lib/sys_file_common.c @@ -325,7 +325,7 @@ file_error: /** Extensions **/ /* get the binary size of a file (in bytes) */ -off_t console_filesize(int fildes) +off_t console_ffilesize(int fildes) { struct filestr_desc * const file = GET_FILESTR(READER, fildes); if (!file) @@ -381,4 +381,4 @@ bool console_file_exists(const char *path) bool rc = test_stream_exists_internal(path) > 0; file_internal_unlock_WRITER(); return rc; -} \ No newline at end of file +} diff --git a/lib/rbcodec/codecs/librm/rm.c b/lib/rbcodec/codecs/librm/rm.c index 49ec6da0a3..e7d9bcab71 100644 --- a/lib/rbcodec/codecs/librm/rm.c +++ b/lib/rbcodec/codecs/librm/rm.c @@ -32,7 +32,7 @@ #include "inttypes.h" #include -int filesize(int fd) +int ffilesize(int fd) { struct stat buf; diff --git a/lib/rbcodec/codecs/librm/rm.h b/lib/rbcodec/codecs/librm/rm.h index 8e4d124d68..1e110a956f 100644 --- a/lib/rbcodec/codecs/librm/rm.h +++ b/lib/rbcodec/codecs/librm/rm.h @@ -95,7 +95,7 @@ int rm_get_packet(uint8_t **src,RMContext *rmctx, RMPacket *pkt); #ifdef TEST -int filesize(int fd); +int ffilesize(int fd); void advance_buffer(uint8_t **buf, int val); /* Get a (sub_packet_h*frames_per_packet) number of audio frames from a file descriptor */ diff --git a/lib/rbcodec/metadata/a52.c b/lib/rbcodec/metadata/a52.c index 2176b17a4f..9f00b8d9f3 100644 --- a/lib/rbcodec/metadata/a52.c +++ b/lib/rbcodec/metadata/a52.c @@ -70,7 +70,7 @@ bool get_a52_metadata(int fd, struct mp3entry *id3) id3->bitrate = a52_bitrates[i >> 1]; id3->vbr = false; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); switch (buf[4] & 0xc0) { diff --git a/lib/rbcodec/metadata/aac.c b/lib/rbcodec/metadata/aac.c index e7312829bd..23a430b5b6 100644 --- a/lib/rbcodec/metadata/aac.c +++ b/lib/rbcodec/metadata/aac.c @@ -72,7 +72,7 @@ bool get_aac_metadata(int fd, struct mp3entry *entry) entry->id3v1len = 0; entry->id3v2len = getid3v2len(fd); entry->first_frame_offset = entry->id3v2len; - entry->filesize = filesize(fd) - entry->first_frame_offset; + entry->filesize = ffilesize(fd) - entry->first_frame_offset; entry->needs_upsampling_correction = false; if (entry->id3v2len) diff --git a/lib/rbcodec/metadata/adx.c b/lib/rbcodec/metadata/adx.c index ce7429a259..6f9c642539 100644 --- a/lib/rbcodec/metadata/adx.c +++ b/lib/rbcodec/metadata/adx.c @@ -69,7 +69,7 @@ bool get_adx_metadata(int fd, struct mp3entry* id3) id3->bitrate = id3->frequency * channels * 18 * 8 / 32 / 1000; id3->length = get_long_be(&buf[12]) / id3->frequency * 1000; id3->vbr = false; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); /* get loop info */ if (!memcmp(buf+0x10,"\x01\xF4\x03",3)) { diff --git a/lib/rbcodec/metadata/aiff.c b/lib/rbcodec/metadata/aiff.c index 9b5f772891..2ac0fe3f02 100644 --- a/lib/rbcodec/metadata/aiff.c +++ b/lib/rbcodec/metadata/aiff.c @@ -142,7 +142,7 @@ bool get_aiff_metadata(int fd, struct mp3entry* id3) } id3->vbr = false; /* AIFF files are CBR */ - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); } else { diff --git a/lib/rbcodec/metadata/asap.c b/lib/rbcodec/metadata/asap.c index 7524d2c6f3..a5a207e8d9 100644 --- a/lib/rbcodec/metadata/asap.c +++ b/lib/rbcodec/metadata/asap.c @@ -241,7 +241,7 @@ static bool parse_sap_header(int fd, struct mp3entry* id3, int file_len) bool get_asap_metadata(int fd, struct mp3entry* id3) { - int filelength = filesize(fd); + int filelength = ffilesize(fd); if(parse_sap_header(fd, id3, filelength) == false) { diff --git a/lib/rbcodec/metadata/asf.c b/lib/rbcodec/metadata/asf.c index cf260ad752..6dadda2247 100644 --- a/lib/rbcodec/metadata/asf.c +++ b/lib/rbcodec/metadata/asf.c @@ -647,7 +647,7 @@ bool get_asf_metadata(int fd, struct mp3entry* id3) header. */ id3->first_frame_offset = lseek(fd, 0, SEEK_CUR) + 26; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); /* We copy the wfx struct to the MP3 TOC field in the id3 struct so the codec doesn't need to parse the header object again */ memcpy(id3->toc, &wfx, sizeof(wfx)); diff --git a/lib/rbcodec/metadata/au.c b/lib/rbcodec/metadata/au.c index 7cdd975c7e..52b24823ca 100644 --- a/lib/rbcodec/metadata/au.c +++ b/lib/rbcodec/metadata/au.c @@ -58,7 +58,7 @@ bool get_au_metadata(int fd, struct mp3entry* id3) int offset; id3->vbr = false; /* All Sun audio files are CBR */ - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); id3->length = 0; lseek(fd, 0, SEEK_SET); diff --git a/lib/rbcodec/metadata/ay.c b/lib/rbcodec/metadata/ay.c index 4230b44da0..d4c6cc8880 100644 --- a/lib/rbcodec/metadata/ay.c +++ b/lib/rbcodec/metadata/ay.c @@ -135,7 +135,7 @@ bool get_ay_metadata(int fd, struct mp3entry* id3) return false; id3->vbr = false; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); id3->bitrate = 706; id3->frequency = 44100; diff --git a/lib/rbcodec/metadata/flac.c b/lib/rbcodec/metadata/flac.c index 6ff69f65a5..c5d26f08e3 100644 --- a/lib/rbcodec/metadata/flac.c +++ b/lib/rbcodec/metadata/flac.c @@ -121,7 +121,7 @@ bool get_flac_metadata(int fd, struct mp3entry* id3) } id3->vbr = true; /* All FLAC files are VBR */ - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); id3->frequency = (buf[10] << 12) | (buf[11] << 4) | ((buf[12] & 0xf0) >> 4); rc = true; /* Got vital metadata */ diff --git a/lib/rbcodec/metadata/gbs.c b/lib/rbcodec/metadata/gbs.c index 9b02952e47..e83395dc34 100644 --- a/lib/rbcodec/metadata/gbs.c +++ b/lib/rbcodec/metadata/gbs.c @@ -52,7 +52,7 @@ bool get_gbs_metadata(int fd, struct mp3entry* id3) return false; id3->vbr = false; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); /* we only render 16 bits, 44.1KHz, Stereo */ id3->bitrate = 706; id3->frequency = 44100; diff --git a/lib/rbcodec/metadata/hes.c b/lib/rbcodec/metadata/hes.c index 87398461d7..f9eab6a0e7 100644 --- a/lib/rbcodec/metadata/hes.c +++ b/lib/rbcodec/metadata/hes.c @@ -26,7 +26,7 @@ bool get_hes_metadata(int fd, struct mp3entry* id3) return false; id3->vbr = false; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); /* we only render 16 bits, 44.1KHz, Stereo */ id3->bitrate = 706; id3->frequency = 44100; diff --git a/lib/rbcodec/metadata/kss.c b/lib/rbcodec/metadata/kss.c index 195e8be38d..bd85a02a4f 100644 --- a/lib/rbcodec/metadata/kss.c +++ b/lib/rbcodec/metadata/kss.c @@ -40,7 +40,7 @@ bool get_kss_metadata(int fd, struct mp3entry* id3) return false; id3->vbr = false; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); /* we only render 16 bits, 44.1KHz, Stereo */ id3->bitrate = 706; id3->frequency = 44100; diff --git a/lib/rbcodec/metadata/metadata.c b/lib/rbcodec/metadata/metadata.c index dd41fdbaa7..e2ca3662c5 100644 --- a/lib/rbcodec/metadata/metadata.c +++ b/lib/rbcodec/metadata/metadata.c @@ -41,7 +41,7 @@ static bool get_shn_metadata(int fd, struct mp3entry *id3) { /* TODO: read the id3v2 header if it exists */ id3->vbr = true; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); return skip_id3v2(fd, id3); } @@ -50,7 +50,7 @@ static bool get_other_asap_metadata(int fd, struct mp3entry *id3) id3->bitrate = 706; id3->frequency = 44100; id3->vbr = false; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); id3->genre_string = id3_get_num_genre(36); /* GAME */ return true; } diff --git a/lib/rbcodec/metadata/mod.c b/lib/rbcodec/metadata/mod.c index 746a4f6022..30f6658a2f 100644 --- a/lib/rbcodec/metadata/mod.c +++ b/lib/rbcodec/metadata/mod.c @@ -91,11 +91,11 @@ bool get_mod_metadata(int fd, struct mp3entry* id3) return false; id3->title = id3->id3v2buf; /* Point title to previous read ID3 buffer. */ - id3->bitrate = filesize(fd)/1024; /* size in kb */ id3->frequency = 44100; id3->length = 120*1000; id3->vbr = false; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); + id3->bitrate = id3->filesize / 1024; /* size in kb */ return true; } diff --git a/lib/rbcodec/metadata/monkeys.c b/lib/rbcodec/metadata/monkeys.c index 382aa65498..7ea4426b46 100644 --- a/lib/rbcodec/metadata/monkeys.c +++ b/lib/rbcodec/metadata/monkeys.c @@ -82,7 +82,7 @@ bool get_monkeys_metadata(int fd, struct mp3entry* id3) } id3->vbr = true; /* All APE files are VBR */ - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); totalsamples = finalframeblocks; if (totalframes > 1) diff --git a/lib/rbcodec/metadata/mp3.c b/lib/rbcodec/metadata/mp3.c index b2466f82a0..733dfdbee2 100644 --- a/lib/rbcodec/metadata/mp3.c +++ b/lib/rbcodec/metadata/mp3.c @@ -162,7 +162,7 @@ static int getsonglength(int fd, struct mp3entry *entry) bool get_mp3_metadata(int fd, struct mp3entry *entry) { entry->title = NULL; - entry->filesize = filesize(fd); + entry->filesize = ffilesize(fd); entry->id3v1len = getid3v1len(fd); entry->id3v2len = getid3v2len(fd); diff --git a/lib/rbcodec/metadata/mp3data.c b/lib/rbcodec/metadata/mp3data.c index 5c2db376e5..45424d92e5 100644 --- a/lib/rbcodec/metadata/mp3data.c +++ b/lib/rbcodec/metadata/mp3data.c @@ -608,7 +608,7 @@ int get_mp3file_info(int fd, struct mp3info *info) if(result) return result; - info->byte_count = filesize(fd) - getid3v1len(fd) - offset - bytecount; + info->byte_count = ffilesize(fd) - getid3v1len(fd) - offset - bytecount; } return bytecount; diff --git a/lib/rbcodec/metadata/mp4.c b/lib/rbcodec/metadata/mp4.c index f02d301077..9d6e9e4334 100644 --- a/lib/rbcodec/metadata/mp4.c +++ b/lib/rbcodec/metadata/mp4.c @@ -823,7 +823,7 @@ bool get_mp4_metadata(int fd, struct mp3entry* id3) id3->filesize = 0; errno = 0; - if (read_mp4_container(fd, id3, filesize(fd)) && (errno == 0) + if (read_mp4_container(fd, id3, ffilesize(fd)) && (errno == 0) && (id3->samples > 0) && (id3->frequency > 0) && (id3->filesize > 0)) { diff --git a/lib/rbcodec/metadata/mpc.c b/lib/rbcodec/metadata/mpc.c index 326cc471ec..5db0e0041d 100644 --- a/lib/rbcodec/metadata/mpc.c +++ b/lib/rbcodec/metadata/mpc.c @@ -211,7 +211,7 @@ bool get_musepack_metadata(int fd, struct mp3entry *id3) return false; } - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); id3->bitrate = id3->filesize * 8 / id3->length; read_ape_tags(fd, id3); diff --git a/lib/rbcodec/metadata/nsf.c b/lib/rbcodec/metadata/nsf.c index 3184897e22..5a59470163 100644 --- a/lib/rbcodec/metadata/nsf.c +++ b/lib/rbcodec/metadata/nsf.c @@ -262,7 +262,7 @@ bool get_nsf_metadata(int fd, struct mp3entry* id3) return false; id3->vbr = false; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); /* we only render 16 bits, 44.1KHz, Mono */ id3->bitrate = 706; id3->frequency = 44100; diff --git a/lib/rbcodec/metadata/ogg.c b/lib/rbcodec/metadata/ogg.c index b172877351..b6fb3ab482 100644 --- a/lib/rbcodec/metadata/ogg.c +++ b/lib/rbcodec/metadata/ogg.c @@ -133,7 +133,7 @@ bool get_ogg_metadata(int fd, struct mp3entry* id3) return false; } - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); /* We need to ensure the serial number from this page is the same as the * one from the last page (since we only support a single bitstream). diff --git a/lib/rbcodec/metadata/oma.c b/lib/rbcodec/metadata/oma.c index 3afa1aad70..42fc275412 100644 --- a/lib/rbcodec/metadata/oma.c +++ b/lib/rbcodec/metadata/oma.c @@ -179,7 +179,7 @@ bool get_oma_metadata(int fd, struct mp3entry* id3) /* Currently, there's no means of knowing the duration * * directly from the the file so we calculate it. */ - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); id3->length = ((id3->filesize - id3->first_frame_offset) * 8) / id3->bitrate; return true; } diff --git a/lib/rbcodec/metadata/rm.c b/lib/rbcodec/metadata/rm.c index 0bffe6dfdb..25f49c1880 100644 --- a/lib/rbcodec/metadata/rm.c +++ b/lib/rbcodec/metadata/rm.c @@ -266,7 +266,7 @@ static inline int rm_parse_header(int fd, RMContext *rmctx, struct mp3entry *id3 rmctx->data_offset = skipped + 8; rmctx->bit_rate = rmctx->block_align * rmctx->sample_rate / 192; if (rmctx->block_align) - rmctx->nb_packets = (filesize(fd) - rmctx->data_offset) / rmctx->block_align; + rmctx->nb_packets = (ffilesize(fd) - rmctx->data_offset) / rmctx->block_align; if (rmctx->sample_rate) rmctx->duration = (uint32_t)(256LL * 6 * 1000 * rmctx->nb_packets / rmctx->sample_rate); rmctx->flags |= RM_RAW_DATASTREAM; @@ -504,6 +504,6 @@ bool get_rm_metadata(int fd, struct mp3entry* id3) id3->bitrate = (rmctx->bit_rate + 500) / 1000; id3->frequency = rmctx->sample_rate; id3->length = rmctx->duration; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); return true; } diff --git a/lib/rbcodec/metadata/sgc.c b/lib/rbcodec/metadata/sgc.c index 11a574139f..92a7820d10 100644 --- a/lib/rbcodec/metadata/sgc.c +++ b/lib/rbcodec/metadata/sgc.c @@ -54,7 +54,7 @@ bool get_sgc_metadata(int fd, struct mp3entry* id3) return false; id3->vbr = false; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); /* we only render 16 bits, 44.1KHz, Stereo */ id3->bitrate = 706; id3->frequency = 44100; diff --git a/lib/rbcodec/metadata/sid.c b/lib/rbcodec/metadata/sid.c index 43f693e985..94bafad70d 100644 --- a/lib/rbcodec/metadata/sid.c +++ b/lib/rbcodec/metadata/sid.c @@ -82,7 +82,7 @@ bool get_sid_metadata(int fd, struct mp3entry* id3) */ id3->length = (buf[0xf]-1)*1000; id3->vbr = false; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); return true; } diff --git a/lib/rbcodec/metadata/smaf.c b/lib/rbcodec/metadata/smaf.c index 479c39032b..130edb98fa 100644 --- a/lib/rbcodec/metadata/smaf.c +++ b/lib/rbcodec/metadata/smaf.c @@ -445,7 +445,7 @@ bool get_smaf_metadata(int fd, struct mp3entry* id3) id3->composer = NULL; id3->vbr = false; /* All SMAF files are CBR */ - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); /* check File Chunk and Contents Info Chunk */ lseek(fd, 0, SEEK_SET); diff --git a/lib/rbcodec/metadata/spc.c b/lib/rbcodec/metadata/spc.c index 64e00ef830..d2a03fd0e4 100644 --- a/lib/rbcodec/metadata/spc.c +++ b/lib/rbcodec/metadata/spc.c @@ -124,7 +124,7 @@ bool get_spc_metadata(int fd, struct mp3entry* id3) id3->frequency = 32000; id3->length = length+fade; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); id3->genre_string = id3_get_num_genre(36); return true; diff --git a/lib/rbcodec/metadata/tta.c b/lib/rbcodec/metadata/tta.c index ef0f341f29..4d2cfa84a7 100644 --- a/lib/rbcodec/metadata/tta.c +++ b/lib/rbcodec/metadata/tta.c @@ -53,7 +53,7 @@ static void read_id3_tags(int fd, struct mp3entry* id3) { id3->title = NULL; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); id3->id3v2len = getid3v2len(fd); id3->vbr = false; /* All TTA files are CBR */ diff --git a/lib/rbcodec/metadata/vgm.c b/lib/rbcodec/metadata/vgm.c index 03afb15a92..28a2a07b8a 100644 --- a/lib/rbcodec/metadata/vgm.c +++ b/lib/rbcodec/metadata/vgm.c @@ -153,7 +153,7 @@ bool get_vgm_metadata(int fd, struct mp3entry* id3) } id3->vbr = false; - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); id3->bitrate = 1411; id3->frequency = 44100; diff --git a/lib/rbcodec/metadata/vox.c b/lib/rbcodec/metadata/vox.c index dcf4e057ef..22a24101c9 100644 --- a/lib/rbcodec/metadata/vox.c +++ b/lib/rbcodec/metadata/vox.c @@ -41,7 +41,7 @@ bool get_vox_metadata(int fd, struct mp3entry* id3) id3->frequency = 8000; id3->bitrate = 8000 * 4 / 1000; id3->vbr = false; /* All VOX files are CBR */ - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); id3->length = id3->filesize >> 2; return true; diff --git a/lib/rbcodec/metadata/vtx.c b/lib/rbcodec/metadata/vtx.c index 65401be8b8..e27ae170c9 100644 --- a/lib/rbcodec/metadata/vtx.c +++ b/lib/rbcodec/metadata/vtx.c @@ -102,7 +102,7 @@ bool get_vtx_metadata(int fd, struct mp3entry* id3) if (lseek(fd, 0, SEEK_SET) < 0) goto exit_bad; - if (filesize(fd) < 20) + if (ffilesize(fd) < 20) goto exit_bad; uint hdr = Reader_ReadWord(fd); @@ -142,7 +142,7 @@ bool get_vtx_metadata(int fd, struct mp3entry* id3) id3->bitrate = 706; id3->frequency = 44100; // XXX allow this to be configured? - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); id3->length = info.frames * 1000 / info.playerfreq; return true; diff --git a/lib/rbcodec/metadata/wave.c b/lib/rbcodec/metadata/wave.c index 9ecc816832..7d0b9e8e9b 100644 --- a/lib/rbcodec/metadata/wave.c +++ b/lib/rbcodec/metadata/wave.c @@ -305,7 +305,7 @@ static bool read_header(int fd, struct mp3entry* id3, const unsigned char *chunk memset(&fmt, 0, sizeof(struct wave_fmt)); id3->vbr = false; /* All Wave/Wave64 files are CBR */ - id3->filesize = filesize(fd); + id3->filesize = ffilesize(fd); /* get RIFF chunk header */ lseek(fd, 0, SEEK_SET); diff --git a/lib/rbcodec/metadata/wavpack.c b/lib/rbcodec/metadata/wavpack.c index 30be661216..18014f00e5 100644 --- a/lib/rbcodec/metadata/wavpack.c +++ b/lib/rbcodec/metadata/wavpack.c @@ -78,7 +78,7 @@ bool get_wavpack_metadata(int fd, struct mp3entry* id3) } id3->vbr = true; /* All WavPack files are VBR */ - id3->filesize = filesize (fd); + id3->filesize = ffilesize (fd); /* check up to 16 headers before we give up finding one with audio */ diff --git a/lib/rbcodec/rbcodecplatform-unix.h b/lib/rbcodec/rbcodecplatform-unix.h index 9ce01a0035..b25aee24a3 100644 --- a/lib/rbcodec/rbcodecplatform-unix.h +++ b/lib/rbcodec/rbcodecplatform-unix.h @@ -50,7 +50,7 @@ #endif /* filesize */ -off_t filesize(int fd); +off_t ffilesize(int fd); /* snprintf */ #include diff --git a/lib/rbcodec/test/file.h b/lib/rbcodec/test/file.h index ddf9a1d7a4..e37c986df9 100644 --- a/lib/rbcodec/test/file.h +++ b/lib/rbcodec/test/file.h @@ -3,4 +3,4 @@ #include #include -off_t filesize(int fd); +off_t ffilesize(int fd); diff --git a/lib/rbcodec/test/warble.c b/lib/rbcodec/test/warble.c index 75591b99dc..10bc7485a9 100644 --- a/lib/rbcodec/test/warble.c +++ b/lib/rbcodec/test/warble.c @@ -88,7 +88,7 @@ int find_first_set_bit(uint32_t value) return __builtin_ctz(value); } -off_t filesize(int fd) +off_t ffilesize(int fd) { struct stat st; fstat(fd, &st); @@ -844,7 +844,7 @@ static void decode_file(const char *input_fn) exit(1); } print_mp3entry(&id3, stderr); - ci.filesize = filesize(input_fd); + ci.filesize = ffilesize(input_fd); ci.id3 = &id3; if (use_dsp) { ci.dsp = dsp_get_config(CODEC_IDX_AUDIO); diff --git a/uisimulator/common/filesystem-sim.c b/uisimulator/common/filesystem-sim.c index 16e852901b..aa7d394346 100644 --- a/uisimulator/common/filesystem-sim.c +++ b/uisimulator/common/filesystem-sim.c @@ -467,7 +467,7 @@ int sim_ftruncate(int fildes, off_t length) if (!filestr) return -1; - off_t size = os_filesize(filestr->osfd); + off_t size = os_ffilesize(filestr->osfd); if (size < 0) return -1; @@ -582,13 +582,13 @@ int sim_modtime(const char *path, time_t modtime) return os_modtime(ospath, modtime); } -off_t sim_filesize(int fildes) +off_t sim_ffilesize(int fildes) { struct filestr_desc *filestr = get_filestr(fildes); if (!filestr) return -1; - return os_filesize(filestr->osfd); + return os_ffilesize(filestr->osfd); } int sim_fsamefile(int fildes1, int fildes2) @@ -764,7 +764,7 @@ bool sim_dir_exists(const char *dirname) return true; } -struct dirinfo dir_get_info(DIR *dirp, struct sim_dirent *entry) +struct dirinfo sim_dir_get_info(DIR *dirp, struct sim_dirent *entry) { int rc; struct dirstr_desc *dirstr = get_dirstr(dirp); diff --git a/uisimulator/common/filesystem-sim.h b/uisimulator/common/filesystem-sim.h index 38fff3bd4e..8e50709f85 100644 --- a/uisimulator/common/filesystem-sim.h +++ b/uisimulator/common/filesystem-sim.h @@ -68,7 +68,7 @@ ssize_t sim_write(int fildes, const void *buf, size_t nbyte); int sim_remove(const char *path); int sim_rename(const char *old, const char *new); int sim_modtime(const char *path, time_t modtime); -off_t sim_filesize(int fildes); +off_t sim_ffilesize(int fildes); int sim_fsamefile(int fildes1, int fildes2); int sim_relate(const char *path1, const char *path2); bool sim_file_exists(const char *path); @@ -102,6 +102,9 @@ int sim_mkdir(const char *path); int sim_rmdir(const char *path); int sim_samedir(DIR *dirp1, DIR *dirp2); bool sim_dir_exists(const char *dirname); + +struct dirinfo sim_dir_get_info(DIR *dirp, struct sim_dirent *entry); +const char* sim_root_realpath(void); #endif /* !DIRFUNCTIONS_DECLARED */ #endif /* _FILESYSTEM_SIM_H__DIR_H_ */