diff options
Diffstat (limited to 'firmware/include/dir.h')
-rw-r--r-- | firmware/include/dir.h | 91 |
1 files changed, 58 insertions, 33 deletions
diff --git a/firmware/include/dir.h b/firmware/include/dir.h index 6e8b70588e..f7719823a9 100644 --- a/firmware/include/dir.h +++ b/firmware/include/dir.h | |||
@@ -18,46 +18,71 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | |||
22 | #ifndef _DIR_H_ | 21 | #ifndef _DIR_H_ |
23 | #define _DIR_H_ | 22 | #define _DIR_H_ |
24 | 23 | ||
24 | #include <sys/types.h> | ||
25 | #include <fcntl.h> | ||
26 | #include <time.h> | ||
25 | #include "config.h" | 27 | #include "config.h" |
28 | #include "fs_attr.h" | ||
26 | 29 | ||
27 | #define ATTR_READ_ONLY 0x01 | 30 | #if defined (APPLICATION) |
28 | #define ATTR_HIDDEN 0x02 | 31 | #include "filesystem-app.h" |
29 | #define ATTR_SYSTEM 0x04 | 32 | #elif defined(SIMULATOR) || defined(__PCTOOL__) |
30 | #define ATTR_VOLUME_ID 0x08 | 33 | #include "../../uisimulator/common/filesystem-sim.h" |
31 | #define ATTR_DIRECTORY 0x10 | ||
32 | #define ATTR_ARCHIVE 0x20 | ||
33 | #define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */ | ||
34 | #define ATTR_LINK 0x80 | ||
35 | |||
36 | #ifdef HAVE_DIRCACHE | ||
37 | # include "dircache.h" | ||
38 | # define DIR DIR_CACHED | ||
39 | # define dirent dirent_cached | ||
40 | # define opendir opendir_cached | ||
41 | # define closedir closedir_cached | ||
42 | # define readdir readdir_cached | ||
43 | # define closedir closedir_cached | ||
44 | # define mkdir mkdir_cached | ||
45 | # define rmdir rmdir_cached | ||
46 | #else | 34 | #else |
47 | # include "dir_uncached.h" | 35 | #include "filesystem-native.h" |
48 | # define DIR DIR_UNCACHED | 36 | #endif |
49 | # define dirent dirent_uncached | 37 | |
50 | # define opendir opendir_uncached | 38 | #ifndef DIRFUNCTIONS_DEFINED |
51 | # define closedir closedir_uncached | 39 | #ifndef opendir |
52 | # define readdir readdir_uncached | 40 | #define opendir FS_PREFIX(opendir) |
53 | # define closedir closedir_uncached | 41 | #endif |
54 | # define mkdir mkdir_uncached | 42 | #ifndef readdir |
55 | # define rmdir rmdir_uncached | 43 | #define readdir FS_PREFIX(readdir) |
44 | #endif | ||
45 | #ifndef readdir_r | ||
46 | #define readdir_r FS_PREFIX(readdir_r) | ||
47 | #endif | ||
48 | #ifndef rewinddir | ||
49 | #define rewinddir FS_PREFIX(rewinddir) | ||
56 | #endif | 50 | #endif |
51 | #ifndef closedir | ||
52 | #define closedir FS_PREFIX(closedir) | ||
53 | #endif | ||
54 | #ifndef mkdir | ||
55 | #define mkdir FS_PREFIX(mkdir) | ||
56 | #endif | ||
57 | #ifndef rmdir | ||
58 | #define rmdir FS_PREFIX(rmdir) | ||
59 | #endif | ||
60 | #ifndef samedir | ||
61 | #define samedir FS_PREFIX(samedir) | ||
62 | #endif | ||
63 | #ifndef dir_exists | ||
64 | #define dir_exists FS_PREFIX(dir_exists) | ||
65 | #endif | ||
66 | #endif /* !DIRFUNCTIONS_DEFINED */ | ||
57 | 67 | ||
68 | #ifndef DIRENT_DEFINED | ||
69 | struct DIRENT | ||
70 | { | ||
71 | struct dirinfo_native info; /* platform extra info */ | ||
72 | char d_name[MAX_PATH]; /* UTF-8 name of entry (last!) */ | ||
73 | }; | ||
74 | #endif /* DIRENT_DEFINED */ | ||
58 | 75 | ||
59 | typedef DIR* (*opendir_func)(const char* name); | 76 | struct dirinfo |
60 | typedef int (*closedir_func)(DIR* dir); | 77 | { |
61 | typedef struct dirent* (*readdir_func)(DIR* dir); | 78 | unsigned int attribute; /* attribute bits of file */ |
79 | off_t size; /* binary size of file */ | ||
80 | time_t mtime; /* local file time */ | ||
81 | }; | ||
62 | 82 | ||
63 | #endif | 83 | #ifndef DIRFUNCTIONS_DECLARED |
84 | /* TIP: set errno to zero before calling to see if anything failed */ | ||
85 | struct dirinfo dir_get_info(DIR *dirp, struct DIRENT *entry); | ||
86 | #endif /* !DIRFUNCTIONS_DECLARED */ | ||
87 | |||
88 | #endif /* _DIR_H_ */ | ||