mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-10 08:03:04 -04:00
Add "rbfs" prefix to native filesystem functions
Most of the churn here occurs because 'filesize' is one of the redefined filesystem functions, but some of the structs used by the native FS code also include a 'filesize' member variable which gets renamed by the macro in some but not all source files. It's easier to rename 'filesize()' to 'ffilesize()' rather than try to clean up the macro mess or renaming the struct members. There is weirdness with root_realpath() which now breaks on native builds because it was assumed to be unprefixed there. dir_get_info() was unprefixed everywhere but this just seems inconsistent; make it follow the FS_PREFIX() convention too. Change-Id: Ic3700c6234ea45f32679c1a8429d70fdb8f4088a
This commit is contained in:
parent
6958f6638e
commit
3a57f2f721
105 changed files with 188 additions and 182 deletions
|
|
@ -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_ */
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 <time.h>
|
||||
|
||||
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_ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue