summaryrefslogtreecommitdiff
path: root/firmware/include/file.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/include/file.h')
-rw-r--r--firmware/include/file.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/firmware/include/file.h b/firmware/include/file.h
index 9a9548f8f6..b60c744549 100644
--- a/firmware/include/file.h
+++ b/firmware/include/file.h
@@ -48,9 +48,9 @@
48#define O_TRUNC 0x10 48#define O_TRUNC 0x10
49#endif 49#endif
50 50
51#if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC) 51#if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC)
52#define open(x,y) sim_open(x,y) 52#define open(x,y) sim_open(x,y)
53#define creat(x) sim_creat(x) 53#define creat(x,m) sim_creat(x,m)
54#define remove(x) sim_remove(x) 54#define remove(x) sim_remove(x)
55#define rename(x,y) sim_rename(x,y) 55#define rename(x,y) sim_rename(x,y)
56#define filesize(x) sim_filesize(x) 56#define filesize(x) sim_filesize(x)
@@ -60,11 +60,12 @@
60#define read(x,y,z) sim_read(x,y,z) 60#define read(x,y,z) sim_read(x,y,z)
61#define write(x,y,z) sim_write(x,y,z) 61#define write(x,y,z) sim_write(x,y,z)
62#define close(x) sim_close(x) 62#define close(x) sim_close(x)
63extern int sim_creat(const char *pathname, mode_t mode);
63#endif 64#endif
64 65
65typedef int (*open_func)(const char* pathname, int flags); 66typedef int (*open_func)(const char* pathname, int flags);
66typedef ssize_t (*read_func)(int fd, void *buf, size_t count); 67typedef ssize_t (*read_func)(int fd, void *buf, size_t count);
67typedef int (*creat_func)(const char *pathname); 68typedef int (*creat_func)(const char *pathname, mode_t mode);
68typedef ssize_t (*write_func)(int fd, const void *buf, size_t count); 69typedef ssize_t (*write_func)(int fd, const void *buf, size_t count);
69typedef void (*qsort_func)(void *base, size_t nmemb, size_t size, 70typedef void (*qsort_func)(void *base, size_t nmemb, size_t size,
70 int(*_compar)(const void *, const void *)); 71 int(*_compar)(const void *, const void *));
@@ -74,7 +75,15 @@ extern int close(int fd);
74extern int fsync(int fd); 75extern int fsync(int fd);
75extern ssize_t read(int fd, void *buf, size_t count); 76extern ssize_t read(int fd, void *buf, size_t count);
76extern off_t lseek(int fildes, off_t offset, int whence); 77extern off_t lseek(int fildes, off_t offset, int whence);
77extern int creat(const char *pathname); 78extern int file_creat(const char *pathname);
79#ifndef SIMULATOR
80/* posix compatibility function */
81static inline int creat(const char *pathname, mode_t mode)
82{
83 (void)mode;
84 return file_creat(pathname);
85}
86#endif
78extern ssize_t write(int fd, const void *buf, size_t count); 87extern ssize_t write(int fd, const void *buf, size_t count);
79extern int remove(const char* pathname); 88extern int remove(const char* pathname);
80extern int rename(const char* path, const char* newname); 89extern int rename(const char* path, const char* newname);