diff options
Diffstat (limited to 'firmware/include')
-rw-r--r-- | firmware/include/dircache.h | 11 | ||||
-rw-r--r-- | firmware/include/file_internal.h | 27 |
2 files changed, 24 insertions, 14 deletions
diff --git a/firmware/include/dircache.h b/firmware/include/dircache.h index d73c6f6e81..2cf838e539 100644 --- a/firmware/include/dircache.h +++ b/firmware/include/dircache.h | |||
@@ -69,6 +69,9 @@ typedef uint32_t dc_serial_t; | |||
69 | /** | 69 | /** |
70 | ****************************************************************************/ | 70 | ****************************************************************************/ |
71 | 71 | ||
72 | #define IF_DIRCACHE(...) __VA_ARGS__ | ||
73 | #define IFN_DIRCACHE(...) | ||
74 | |||
72 | #if CONFIG_PLATFORM & PLATFORM_NATIVE | 75 | #if CONFIG_PLATFORM & PLATFORM_NATIVE |
73 | /* native dircache is lower-level than on a hosted target */ | 76 | /* native dircache is lower-level than on a hosted target */ |
74 | #define DIRCACHE_NATIVE | 77 | #define DIRCACHE_NATIVE |
@@ -169,6 +172,9 @@ enum dircache_search_flags | |||
169 | int dircache_search(unsigned int flags, struct dircache_fileref *dcfrefp, | 172 | int dircache_search(unsigned int flags, struct dircache_fileref *dcfrefp, |
170 | const char *path); | 173 | const char *path); |
171 | 174 | ||
175 | int dircache_fileref_cmp(const struct dircache_fileref *dcfrefp1, | ||
176 | const struct dircache_fileref *dcfrefp2); | ||
177 | |||
172 | 178 | ||
173 | /** Debug screen/info stuff **/ | 179 | /** Debug screen/info stuff **/ |
174 | 180 | ||
@@ -202,6 +208,11 @@ int dircache_save(void); | |||
202 | 208 | ||
203 | void dircache_init(size_t last_size) INIT_ATTR; | 209 | void dircache_init(size_t last_size) INIT_ATTR; |
204 | 210 | ||
211 | #else /* !HAVE_DIRCACHE */ | ||
212 | |||
213 | #define IF_DIRCACHE(...) | ||
214 | #define IFN_DIRCACHE(...) __VA_ARGS__ | ||
215 | |||
205 | #endif /* HAVE_DIRCACHE */ | 216 | #endif /* HAVE_DIRCACHE */ |
206 | 217 | ||
207 | #endif /* _DIRCACHE_H */ | 218 | #endif /* _DIRCACHE_H */ |
diff --git a/firmware/include/file_internal.h b/firmware/include/file_internal.h index acec81206e..e7edb3a441 100644 --- a/firmware/include/file_internal.h +++ b/firmware/include/file_internal.h | |||
@@ -136,8 +136,9 @@ enum fildes_and_obj_flags | |||
136 | FF_NOISO = 0x00200000, /* do not decode ISO filenames to UTF-8 */ | 136 | FF_NOISO = 0x00200000, /* do not decode ISO filenames to UTF-8 */ |
137 | FF_PROBE = 0x00400000, /* only test existence; don't open */ | 137 | FF_PROBE = 0x00400000, /* only test existence; don't open */ |
138 | FF_CACHEONLY = 0x00800000, /* succeed only if in dircache */ | 138 | FF_CACHEONLY = 0x00800000, /* succeed only if in dircache */ |
139 | FF_SELFINFO = 0x01000000, /* return info on self as well */ | 139 | FF_INFO = 0x01000000, /* return info on self */ |
140 | FF_MASK = 0x01ff0000, | 140 | FF_PARENTINFO = 0x02000000, /* return info on parent */ |
141 | FF_MASK = 0x03ff0000, | ||
141 | }; | 142 | }; |
142 | 143 | ||
143 | /** Common data structures used throughout **/ | 144 | /** Common data structures used throughout **/ |
@@ -244,18 +245,16 @@ static inline void filestr_unlock(struct filestr_base *stream) | |||
244 | /* structure to return detailed information about what you opened */ | 245 | /* structure to return detailed information about what you opened */ |
245 | struct path_component_info | 246 | struct path_component_info |
246 | { | 247 | { |
247 | const char *name; /* pointer to name within 'path' (OUT) */ | 248 | const char *name; /* OUT: pointer to name within 'path' */ |
248 | size_t length; /* length of component within 'path' */ | 249 | size_t length; /* OUT: length of component within 'path' */ |
249 | file_size_t filesize; /* size of the opened file (0 if dir) */ | 250 | file_size_t filesize; /* OUT: size of the opened file (0 if dir) */ |
250 | unsigned int attr; /* attributes of this component */ | 251 | unsigned int attr; /* OUT: attributes of this component */ |
251 | struct file_base_info *prefixp; /* base info to check as prefix | 252 | struct file_base_info info; /* OUT: base info on file |
252 | (IN if FF_CHECKPREFIX) */ | 253 | (FF_INFO) */ |
253 | union { | 254 | struct file_base_info parentinfo; /* OUT: base parent directory info |
254 | struct file_base_info parentinfo; /* parent directory base info of file | 255 | (FF_PARENTINFO) */ |
255 | (if not FF_SELFINFO) */ | 256 | struct file_base_info *prefixp; /* IN: base info to check as prefix |
256 | struct file_base_info info; /* base info of file itself | 257 | (FF_CHECKPREFIX) */ |
257 | (if FF_SELFINFO) */ | ||
258 | }; | ||
259 | }; | 258 | }; |
260 | 259 | ||
261 | int open_stream_internal(const char *path, unsigned int callflags, | 260 | int open_stream_internal(const char *path, unsigned int callflags, |