diff options
Diffstat (limited to 'firmware/include/filesystem-native.h')
-rw-r--r-- | firmware/include/filesystem-native.h | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/firmware/include/filesystem-native.h b/firmware/include/filesystem-native.h new file mode 100644 index 0000000000..640e179890 --- /dev/null +++ b/firmware/include/filesystem-native.h | |||
@@ -0,0 +1,107 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Björn Stenberg | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef _FILESYSTEM_NATIVE_H_ | ||
22 | #define _FILESYSTEM_NATIVE_H_ | ||
23 | |||
24 | #if defined(PLUGIN) || defined(CODEC) | ||
25 | #define FILEFUNCTIONS_DECLARED | ||
26 | #define FILEFUNCTIONS_DEFINED | ||
27 | #define DIRFUNCTIONS_DECLARED | ||
28 | #define DIRFUNCTIONS_DEFINED | ||
29 | #endif /* PLUGIN || CODEC */ | ||
30 | |||
31 | #define FS_PREFIX(_x_) _x_ | ||
32 | #endif /* _FILESYSTEM_NATIVE_H_ */ | ||
33 | |||
34 | #ifdef _FILE_H_ | ||
35 | #ifndef _FILESYSTEM_NATIVE__FILE_H_ | ||
36 | #define _FILESYSTEM_NATIVE__FILE_H_ | ||
37 | |||
38 | #ifdef RB_FILESYSTEM_OS | ||
39 | #define FILEFUNCTIONS_DEFINED | ||
40 | #endif | ||
41 | |||
42 | #ifndef FILEFUNCTIONS_DECLARED | ||
43 | #define __OPEN_MODE_ARG | ||
44 | #define __CREAT_MODE_ARG | ||
45 | |||
46 | int open(const char *name, int oflag); | ||
47 | int creat(const char *name); | ||
48 | int close(int fildes); | ||
49 | int ftruncate(int fildes, off_t length); | ||
50 | int fsync(int fildes); | ||
51 | off_t lseek(int fildes, off_t offset, int whence); | ||
52 | ssize_t read(int fildes, void *buf, size_t nbyte); | ||
53 | ssize_t write(int fildes, const void *buf, size_t nbyte); | ||
54 | int remove(const char *path); | ||
55 | int rename(const char *old, const char *new); | ||
56 | off_t filesize(int fildes); | ||
57 | int fsamefile(int fildes1, int fildes2); | ||
58 | int relate(const char *path1, const char *path2); | ||
59 | bool file_exists(const char *path); | ||
60 | #endif /* !FILEFUNCTIONS_DECLARED */ | ||
61 | |||
62 | #if !defined(RB_FILESYSTEM_OS) && !defined (FILEFUNCTIONS_DEFINED) | ||
63 | #define open(path, oflag, ...) open(path, oflag) | ||
64 | #define creat(path, mode) creat(path) | ||
65 | #endif /* FILEFUNCTIONS_DEFINED */ | ||
66 | |||
67 | #endif /* _FILESYSTEM_NATIVE__FILE_H_ */ | ||
68 | #endif /* _FILE_H_ */ | ||
69 | |||
70 | #ifdef _DIR_H_ | ||
71 | #ifndef _FILESYSTEM_NATIVE__DIR_H_ | ||
72 | #define _FILESYSTEM_NATIVE__DIR_H_ | ||
73 | |||
74 | #define DIRENT dirent | ||
75 | struct dirent; | ||
76 | |||
77 | struct dirinfo_native | ||
78 | { | ||
79 | unsigned int attr; | ||
80 | off_t size; | ||
81 | uint16_t wrtdate; | ||
82 | uint16_t wrttime; | ||
83 | }; | ||
84 | |||
85 | typedef struct {} DIR; | ||
86 | |||
87 | #ifndef DIRFUNCTIONS_DECLARED | ||
88 | #define __MKDIR_MODE_ARG | ||
89 | |||
90 | #ifdef RB_FILESYSTEM_OS | ||
91 | #define DIRFUNCTIONS_DEFINED | ||
92 | #endif | ||
93 | |||
94 | DIR * opendir(const char *dirname); | ||
95 | struct dirent * readdir(DIR *dirp); | ||
96 | int readdir_r(DIR *dirp, struct dirent *entry, | ||
97 | struct dirent **result); | ||
98 | void rewinddir(DIR *dirp); | ||
99 | int closedir(DIR *dirp); | ||
100 | int mkdir(const char *path); | ||
101 | int rmdir(const char *path); | ||
102 | int samedir(DIR *dirp1, DIR *dirp2); | ||
103 | bool dir_exists(const char *dirname); | ||
104 | #endif /* !DIRFUNCTIONS_DECLARED */ | ||
105 | |||
106 | #endif /* _FILESYSTEM_NATIVE__DIR_H_ */ | ||
107 | #endif /* _DIR_H_ */ | ||