diff options
author | Kevin Ferrare <kevin@rockbox.org> | 2007-07-20 17:06:55 +0000 |
---|---|---|
committer | Kevin Ferrare <kevin@rockbox.org> | 2007-07-20 17:06:55 +0000 |
commit | 011a325e32c05f6e4817dcdc555615e6b7b6c102 (patch) | |
tree | ab22ab91b99524dba823cda861b17520db030911 /apps | |
parent | 930278bcc0fd944ec50f30074b53b4c7cf0e3ccf (diff) | |
download | rockbox-011a325e32c05f6e4817dcdc555615e6b7b6c102.tar.gz rockbox-011a325e32c05f6e4817dcdc555615e6b7b6c102.zip |
Makes apps and plugins interract with directories using a posix-like api instead of calling dircache / simulator functions (no additionnal layer added, only a cosmetic change)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13943 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/filetree.c | 21 | ||||
-rw-r--r-- | apps/playlist.c | 1 | ||||
-rw-r--r-- | apps/plugin.c | 17 | ||||
-rw-r--r-- | apps/plugin.h | 23 | ||||
-rw-r--r-- | apps/plugins/doom/rockdoom.c | 8 | ||||
-rw-r--r-- | apps/plugins/doom/rockmacros.h | 11 | ||||
-rw-r--r-- | apps/plugins/properties.c | 53 | ||||
-rw-r--r-- | apps/plugins/rockboy/rockboy.c | 6 | ||||
-rw-r--r-- | apps/plugins/rockboy/rockmacros.h | 13 | ||||
-rw-r--r-- | apps/plugins/rockpaint.c | 22 | ||||
-rw-r--r-- | apps/tagcache.c | 24 | ||||
-rw-r--r-- | apps/tree.c | 10 |
12 files changed, 61 insertions, 148 deletions
diff --git a/apps/filetree.c b/apps/filetree.c index 90b234a605..bc4709baab 100644 --- a/apps/filetree.c +++ b/apps/filetree.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include "plugin.h" | 38 | #include "plugin.h" |
39 | #include "rolo.h" | 39 | #include "rolo.h" |
40 | #include "sprintf.h" | 40 | #include "sprintf.h" |
41 | #include "dircache.h" | ||
42 | #include "splash.h" | 41 | #include "splash.h" |
43 | #include "yesno.h" | 42 | #include "yesno.h" |
44 | #include "cuesheet.h" | 43 | #include "cuesheet.h" |
@@ -84,11 +83,11 @@ int ft_build_playlist(struct tree_context* c, int start_index) | |||
84 | static void check_file_thumbnails(struct tree_context* c) | 83 | static void check_file_thumbnails(struct tree_context* c) |
85 | { | 84 | { |
86 | int i; | 85 | int i; |
87 | struct dircache_entry *entry; | 86 | struct dirent *entry; |
88 | struct entry* dircache = c->dircache; | 87 | struct entry* dircache = c->dircache; |
89 | DIRCACHED *dir; | 88 | DIR *dir; |
90 | 89 | ||
91 | dir = opendir_cached(c->currdir); | 90 | dir = opendir(c->currdir); |
92 | if(!dir) | 91 | if(!dir) |
93 | return; | 92 | return; |
94 | /* mark all files as non talking, except the .talk ones */ | 93 | /* mark all files as non talking, except the .talk ones */ |
@@ -109,7 +108,7 @@ static void check_file_thumbnails(struct tree_context* c) | |||
109 | } | 108 | } |
110 | } | 109 | } |
111 | 110 | ||
112 | while((entry = readdir_cached(dir)) != 0) /* walk directory */ | 111 | while((entry = readdir(dir)) != 0) /* walk directory */ |
113 | { | 112 | { |
114 | int ext_pos; | 113 | int ext_pos; |
115 | 114 | ||
@@ -135,7 +134,7 @@ static void check_file_thumbnails(struct tree_context* c) | |||
135 | } | 134 | } |
136 | } | 135 | } |
137 | } | 136 | } |
138 | closedir_cached(dir); | 137 | closedir(dir); |
139 | } | 138 | } |
140 | 139 | ||
141 | /* support function for qsort() */ | 140 | /* support function for qsort() */ |
@@ -209,12 +208,12 @@ int ft_load(struct tree_context* c, const char* tempdir) | |||
209 | { | 208 | { |
210 | int i; | 209 | int i; |
211 | int name_buffer_used = 0; | 210 | int name_buffer_used = 0; |
212 | DIRCACHED *dir; | 211 | DIR *dir; |
213 | 212 | ||
214 | if (tempdir) | 213 | if (tempdir) |
215 | dir = opendir_cached(tempdir); | 214 | dir = opendir(tempdir); |
216 | else | 215 | else |
217 | dir = opendir_cached(c->currdir); | 216 | dir = opendir(c->currdir); |
218 | if(!dir) | 217 | if(!dir) |
219 | return -1; /* not a directory */ | 218 | return -1; /* not a directory */ |
220 | 219 | ||
@@ -223,7 +222,7 @@ int ft_load(struct tree_context* c, const char* tempdir) | |||
223 | 222 | ||
224 | for ( i=0; i < global_settings.max_files_in_dir; i++ ) { | 223 | for ( i=0; i < global_settings.max_files_in_dir; i++ ) { |
225 | int len; | 224 | int len; |
226 | struct dircache_entry *entry = readdir_cached(dir); | 225 | struct dirent *entry = readdir(dir); |
227 | struct entry* dptr = | 226 | struct entry* dptr = |
228 | (struct entry*)(c->dircache + i * sizeof(struct entry)); | 227 | (struct entry*)(c->dircache + i * sizeof(struct entry)); |
229 | if (!entry) | 228 | if (!entry) |
@@ -301,7 +300,7 @@ int ft_load(struct tree_context* c, const char* tempdir) | |||
301 | } | 300 | } |
302 | c->filesindir = i; | 301 | c->filesindir = i; |
303 | c->dirlength = i; | 302 | c->dirlength = i; |
304 | closedir_cached(dir); | 303 | closedir(dir); |
305 | 304 | ||
306 | qsort(c->dircache,i,sizeof(struct entry),compare); | 305 | qsort(c->dircache,i,sizeof(struct entry),compare); |
307 | 306 | ||
diff --git a/apps/playlist.c b/apps/playlist.c index 7b1b91e123..f0ac29d1ef 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -88,7 +88,6 @@ | |||
88 | #include "button.h" | 88 | #include "button.h" |
89 | #include "filetree.h" | 89 | #include "filetree.h" |
90 | #include "abrepeat.h" | 90 | #include "abrepeat.h" |
91 | #include "dircache.h" | ||
92 | #include "thread.h" | 91 | #include "thread.h" |
93 | #include "usb.h" | 92 | #include "usb.h" |
94 | #include "filetypes.h" | 93 | #include "filetypes.h" |
diff --git a/apps/plugin.c b/apps/plugin.c index aff24e0059..68b430d2f3 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -222,18 +222,11 @@ static const struct plugin_api rockbox_api = { | |||
222 | create_numbered_filename, | 222 | create_numbered_filename, |
223 | 223 | ||
224 | /* dir */ | 224 | /* dir */ |
225 | PREFIX(opendir), | 225 | opendir, |
226 | PREFIX(closedir), | 226 | closedir, |
227 | PREFIX(readdir), | 227 | readdir, |
228 | PREFIX(mkdir), | 228 | mkdir, |
229 | PREFIX(rmdir), | 229 | rmdir, |
230 | |||
231 | /* dir, cached */ | ||
232 | #ifdef HAVE_DIRCACHE | ||
233 | opendir_cached, | ||
234 | readdir_cached, | ||
235 | closedir_cached, | ||
236 | #endif | ||
237 | 230 | ||
238 | /* kernel/ system */ | 231 | /* kernel/ system */ |
239 | PREFIX(sleep), | 232 | PREFIX(sleep), |
diff --git a/apps/plugin.h b/apps/plugin.h index 920d804ab5..ac6988152a 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -37,9 +37,6 @@ | |||
37 | #include "config.h" | 37 | #include "config.h" |
38 | #include "system.h" | 38 | #include "system.h" |
39 | #include "dir.h" | 39 | #include "dir.h" |
40 | #ifndef SIMULATOR | ||
41 | #include "dircache.h" | ||
42 | #endif | ||
43 | #include "kernel.h" | 40 | #include "kernel.h" |
44 | #include "thread.h" | 41 | #include "thread.h" |
45 | #include "button.h" | 42 | #include "button.h" |
@@ -115,12 +112,12 @@ | |||
115 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 112 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
116 | 113 | ||
117 | /* increase this every time the api struct changes */ | 114 | /* increase this every time the api struct changes */ |
118 | #define PLUGIN_API_VERSION 62 | 115 | #define PLUGIN_API_VERSION 63 |
119 | 116 | ||
120 | /* update this to latest version if a change to the api struct breaks | 117 | /* update this to latest version if a change to the api struct breaks |
121 | backwards compatibility (and please take the opportunity to sort in any | 118 | backwards compatibility (and please take the opportunity to sort in any |
122 | new function which are "waiting" at the end of the function table) */ | 119 | new function which are "waiting" at the end of the function table) */ |
123 | #define PLUGIN_MIN_API_VERSION 62 | 120 | #define PLUGIN_MIN_API_VERSION 63 |
124 | 121 | ||
125 | /* plugin return codes */ | 122 | /* plugin return codes */ |
126 | enum plugin_status { | 123 | enum plugin_status { |
@@ -316,17 +313,11 @@ struct plugin_api { | |||
316 | int numberlen IF_CNFN_NUM_(, int *num)); | 313 | int numberlen IF_CNFN_NUM_(, int *num)); |
317 | 314 | ||
318 | /* dir */ | 315 | /* dir */ |
319 | DIR* (*PREFIX(opendir))(const char* name); | 316 | DIR* (*opendir)(const char* name); |
320 | int (*PREFIX(closedir))(DIR* dir); | 317 | int (*closedir)(DIR* dir); |
321 | struct dirent* (*PREFIX(readdir))(DIR* dir); | 318 | struct dirent* (*readdir)(DIR* dir); |
322 | int (*PREFIX(mkdir))(const char *name); | 319 | int (*mkdir)(const char *name); |
323 | int (*PREFIX(rmdir))(const char *name); | 320 | int (*rmdir)(const char *name); |
324 | /* dir, cached */ | ||
325 | #ifdef HAVE_DIRCACHE | ||
326 | DIRCACHED* (*opendir_cached)(const char* name); | ||
327 | struct dircache_entry* (*readdir_cached)(DIRCACHED* dir); | ||
328 | int (*closedir_cached)(DIRCACHED* dir); | ||
329 | #endif | ||
330 | 321 | ||
331 | /* kernel/ system */ | 322 | /* kernel/ system */ |
332 | void (*PREFIX(sleep))(int ticks); | 323 | void (*PREFIX(sleep))(int ticks); |
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c index 90c446b9eb..a9e348160f 100644 --- a/apps/plugins/doom/rockdoom.c +++ b/apps/plugins/doom/rockdoom.c | |||
@@ -329,7 +329,7 @@ int Dbuild_filelistm(struct menu_item **names, char *firstentry, char *directory | |||
329 | char *startpt; | 329 | char *startpt; |
330 | struct menu_item *temp; | 330 | struct menu_item *temp; |
331 | 331 | ||
332 | filedir=opendir(directory); | 332 | filedir=rb->opendir(directory); |
333 | 333 | ||
334 | if(filedir==NULL) | 334 | if(filedir==NULL) |
335 | { | 335 | { |
@@ -345,8 +345,8 @@ int Dbuild_filelistm(struct menu_item **names, char *firstentry, char *directory | |||
345 | i++; | 345 | i++; |
346 | 346 | ||
347 | // Reset the directory | 347 | // Reset the directory |
348 | closedir(filedir); | 348 | rb->closedir(filedir); |
349 | filedir=opendir(directory); | 349 | filedir=rb->opendir(directory); |
350 | 350 | ||
351 | i++; | 351 | i++; |
352 | temp=malloc(i*sizeof(struct opt_items)); | 352 | temp=malloc(i*sizeof(struct opt_items)); |
@@ -365,7 +365,7 @@ int Dbuild_filelistm(struct menu_item **names, char *firstentry, char *directory | |||
365 | i++; | 365 | i++; |
366 | } | 366 | } |
367 | } | 367 | } |
368 | closedir(filedir); | 368 | rb->closedir(filedir); |
369 | *names=temp; | 369 | *names=temp; |
370 | return i; | 370 | return i; |
371 | } | 371 | } |
diff --git a/apps/plugins/doom/rockmacros.h b/apps/plugins/doom/rockmacros.h index 86de4cbe13..1541ef48fd 100644 --- a/apps/plugins/doom/rockmacros.h +++ b/apps/plugins/doom/rockmacros.h | |||
@@ -40,26 +40,17 @@ char *my_strtok( char * s, const char * delim ); | |||
40 | #define read_line(a,b,c) rb->read_line((a),(b),(c)) | 40 | #define read_line(a,b,c) rb->read_line((a),(b),(c)) |
41 | 41 | ||
42 | #ifdef SIMULATOR | 42 | #ifdef SIMULATOR |
43 | #undef opendir | ||
44 | #undef closedir | ||
45 | #undef mkdir | ||
46 | #undef open | 43 | #undef open |
47 | #undef lseek | 44 | #undef lseek |
48 | #undef filesize | 45 | #undef filesize |
49 | #define opendir(a) rb->sim_opendir((a)) | ||
50 | #define closedir(a) rb->sim_closedir((a)) | ||
51 | #define mkdir(a) rb->sim_mkdir((a)) | ||
52 | #define open(a,b) rb->sim_open((a),(b)) | 46 | #define open(a,b) rb->sim_open((a),(b)) |
53 | #define lseek(a,b,c) rb->sim_lseek((a),(b),(c)) | 47 | #define lseek(a,b,c) rb->sim_lseek((a),(b),(c)) |
54 | #define filesize(a) rb->sim_filesize((a)) | 48 | #define filesize(a) rb->sim_filesize((a)) |
55 | #else /* !SIMULATOR */ | 49 | #else /* !SIMULATOR */ |
56 | #define opendir(a) rb->opendir((a)) | ||
57 | #define closedir(a) rb->closedir((a)) | ||
58 | #define filesize(a) rb->filesize((a)) | ||
59 | #define mkdir(a) rb->mkdir((a)) | ||
60 | #define open(a,b) my_open((a),(b)) | 50 | #define open(a,b) my_open((a),(b)) |
61 | #define close(a) my_close((a)) | 51 | #define close(a) my_close((a)) |
62 | #define lseek(a,b,c) rb->lseek((a),(b),(c)) | 52 | #define lseek(a,b,c) rb->lseek((a),(b),(c)) |
53 | #define filesize(a) rb->filesize((a)) | ||
63 | #endif /* !SIMULATOR */ | 54 | #endif /* !SIMULATOR */ |
64 | 55 | ||
65 | #define strtok(a,b) my_strtok((a),(b)) | 56 | #define strtok(a,b) my_strtok((a),(b)) |
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c index 3b4f2797af..86817e2cc7 100644 --- a/apps/plugins/properties.c +++ b/apps/plugins/properties.c | |||
@@ -59,30 +59,18 @@ static bool file_properties(char* selected_file) | |||
59 | { | 59 | { |
60 | bool found = false; | 60 | bool found = false; |
61 | char tstr[MAX_PATH]; | 61 | char tstr[MAX_PATH]; |
62 | #ifdef HAVE_DIRCACHE | ||
63 | DIRCACHED* dir; | ||
64 | struct dircache_entry* entry; | ||
65 | #else | ||
66 | DIR* dir; | 62 | DIR* dir; |
67 | struct dirent* entry; | 63 | struct dirent* entry; |
68 | #endif | 64 | |
69 | char* ptr = rb->strrchr(selected_file, '/') + 1; | 65 | char* ptr = rb->strrchr(selected_file, '/') + 1; |
70 | int dirlen = (ptr - selected_file); | 66 | int dirlen = (ptr - selected_file); |
71 | rb->strncpy(tstr, selected_file, dirlen); | 67 | rb->strncpy(tstr, selected_file, dirlen); |
72 | tstr[dirlen] = 0; | 68 | tstr[dirlen] = 0; |
73 | 69 | ||
74 | #ifdef HAVE_DIRCACHE | ||
75 | dir = rb->opendir_cached(tstr); | ||
76 | #else | ||
77 | dir = rb->opendir(tstr); | 70 | dir = rb->opendir(tstr); |
78 | #endif | ||
79 | if (dir) | 71 | if (dir) |
80 | { | 72 | { |
81 | #ifdef HAVE_DIRCACHE | ||
82 | while(0 != (entry = rb->readdir_cached(dir))) | ||
83 | #else | ||
84 | while(0 != (entry = rb->readdir(dir))) | 73 | while(0 != (entry = rb->readdir(dir))) |
85 | #endif | ||
86 | { | 74 | { |
87 | if(!rb->strcmp(entry->d_name, selected_file+dirlen)) | 75 | if(!rb->strcmp(entry->d_name, selected_file+dirlen)) |
88 | { | 76 | { |
@@ -103,11 +91,7 @@ static bool file_properties(char* selected_file) | |||
103 | break; | 91 | break; |
104 | } | 92 | } |
105 | } | 93 | } |
106 | #ifdef HAVE_DIRCACHE | ||
107 | rb->closedir_cached(dir); | ||
108 | #else | ||
109 | rb->closedir(dir); | 94 | rb->closedir(dir); |
110 | #endif | ||
111 | } | 95 | } |
112 | return found; | 96 | return found; |
113 | } | 97 | } |
@@ -128,30 +112,17 @@ static bool _dir_properties(DPS* dps) | |||
128 | and informs the user of the progress */ | 112 | and informs the user of the progress */ |
129 | bool result; | 113 | bool result; |
130 | int dirlen; | 114 | int dirlen; |
131 | #ifdef HAVE_DIRCACHE | ||
132 | DIRCACHED* dir; | ||
133 | struct dircache_entry* entry; | ||
134 | #else | ||
135 | DIR* dir; | 115 | DIR* dir; |
136 | struct dirent* entry; | 116 | struct dirent* entry; |
137 | #endif | ||
138 | 117 | ||
139 | result = true; | 118 | result = true; |
140 | dirlen = rb->strlen(dps->dirname); | 119 | dirlen = rb->strlen(dps->dirname); |
141 | #ifdef HAVE_DIRCACHE | ||
142 | dir = rb->opendir_cached(dps->dirname); | ||
143 | #else | ||
144 | dir = rb->opendir(dps->dirname); | 120 | dir = rb->opendir(dps->dirname); |
145 | #endif | ||
146 | if (!dir) | 121 | if (!dir) |
147 | return false; /* open error */ | 122 | return false; /* open error */ |
148 | 123 | ||
149 | /* walk through the directory content */ | 124 | /* walk through the directory content */ |
150 | #ifdef HAVE_DIRCACHE | ||
151 | while(result && (0 != (entry = rb->readdir_cached(dir)))) | ||
152 | #else | ||
153 | while(result && (0 != (entry = rb->readdir(dir)))) | 125 | while(result && (0 != (entry = rb->readdir(dir)))) |
154 | #endif | ||
155 | { | 126 | { |
156 | /* append name to current directory */ | 127 | /* append name to current directory */ |
157 | rb->snprintf(dps->dirname+dirlen, dps->len-dirlen, "/%s", | 128 | rb->snprintf(dps->dirname+dirlen, dps->len-dirlen, "/%s", |
@@ -189,12 +160,7 @@ static bool _dir_properties(DPS* dps) | |||
189 | result = false; | 160 | result = false; |
190 | rb->yield(); | 161 | rb->yield(); |
191 | } | 162 | } |
192 | #ifdef HAVE_DIRCACHE | ||
193 | rb->closedir_cached(dir); | ||
194 | #else | ||
195 | rb->closedir(dir); | 163 | rb->closedir(dir); |
196 | #endif | ||
197 | |||
198 | return result; | 164 | return result; |
199 | } | 165 | } |
200 | 166 | ||
@@ -256,30 +222,17 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file) | |||
256 | 222 | ||
257 | /* determine if it's a file or a directory */ | 223 | /* determine if it's a file or a directory */ |
258 | bool found = false; | 224 | bool found = false; |
259 | #ifdef HAVE_DIRCACHE | ||
260 | DIRCACHED* dir; | ||
261 | struct dircache_entry* entry; | ||
262 | #else | ||
263 | DIR* dir; | 225 | DIR* dir; |
264 | struct dirent* entry; | 226 | struct dirent* entry; |
265 | #endif | ||
266 | char* ptr = rb->strrchr((char*)file, '/') + 1; | 227 | char* ptr = rb->strrchr((char*)file, '/') + 1; |
267 | int dirlen = (ptr - (char*)file); | 228 | int dirlen = (ptr - (char*)file); |
268 | rb->strncpy(str_dirname, (char*)file, dirlen); | 229 | rb->strncpy(str_dirname, (char*)file, dirlen); |
269 | str_dirname[dirlen] = 0; | 230 | str_dirname[dirlen] = 0; |
270 | 231 | ||
271 | #ifdef HAVE_DIRCACHE | ||
272 | dir = rb->opendir_cached(str_dirname); | ||
273 | #else | ||
274 | dir = rb->opendir(str_dirname); | 232 | dir = rb->opendir(str_dirname); |
275 | #endif | ||
276 | if (dir) | 233 | if (dir) |
277 | { | 234 | { |
278 | #ifdef HAVE_DIRCACHE | ||
279 | while(0 != (entry = rb->readdir_cached(dir))) | ||
280 | #else | ||
281 | while(0 != (entry = rb->readdir(dir))) | 235 | while(0 != (entry = rb->readdir(dir))) |
282 | #endif | ||
283 | { | 236 | { |
284 | if(!rb->strcmp(entry->d_name, file+dirlen)) | 237 | if(!rb->strcmp(entry->d_name, file+dirlen)) |
285 | { | 238 | { |
@@ -288,11 +241,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file) | |||
288 | break; | 241 | break; |
289 | } | 242 | } |
290 | } | 243 | } |
291 | #ifdef HAVE_DIRCACHE | ||
292 | rb->closedir_cached(dir); | ||
293 | #else | ||
294 | rb->closedir(dir); | 244 | rb->closedir(dir); |
295 | #endif | ||
296 | } | 245 | } |
297 | /* now we know if it's a file or a dir or maybe something failed */ | 246 | /* now we know if it's a file or a dir or maybe something failed */ |
298 | 247 | ||
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c index 46a0aa56c3..93bd98ca78 100644 --- a/apps/plugins/rockboy/rockboy.c +++ b/apps/plugins/rockboy/rockboy.c | |||
@@ -71,11 +71,11 @@ void setoptions (void) | |||
71 | DIR* dir; | 71 | DIR* dir; |
72 | char optionsave[sizeof(savedir)+sizeof(optionname)]; | 72 | char optionsave[sizeof(savedir)+sizeof(optionname)]; |
73 | 73 | ||
74 | dir=opendir(savedir); | 74 | dir=rb->opendir(savedir); |
75 | if(!dir) | 75 | if(!dir) |
76 | mkdir(savedir); | 76 | rb->mkdir(savedir); |
77 | else | 77 | else |
78 | closedir(dir); | 78 | rb->closedir(dir); |
79 | 79 | ||
80 | snprintf(optionsave, sizeof(optionsave), "%s/%s", savedir, optionname); | 80 | snprintf(optionsave, sizeof(optionsave), "%s/%s", savedir, optionname); |
81 | 81 | ||
diff --git a/apps/plugins/rockboy/rockmacros.h b/apps/plugins/rockboy/rockmacros.h index ecf8a1ef6a..5d60d3f3e3 100644 --- a/apps/plugins/rockboy/rockmacros.h +++ b/apps/plugins/rockboy/rockmacros.h | |||
@@ -71,22 +71,13 @@ void dynamic_recompile (struct dynarec_block *newblock); | |||
71 | #define isalnum(c) (isdigit(c) || (isalpha(c))) | 71 | #define isalnum(c) (isdigit(c) || (isalpha(c))) |
72 | 72 | ||
73 | #ifdef SIMULATOR | 73 | #ifdef SIMULATOR |
74 | #undef opendir | ||
75 | #define opendir(a) rb->sim_opendir((a)) | ||
76 | #undef closedir | ||
77 | #define closedir(a) rb->sim_closedir((a)) | ||
78 | #undef mkdir | ||
79 | #define mkdir(a) rb->sim_mkdir((a)) | ||
80 | #undef open | 74 | #undef open |
81 | #define open(a,b) rb->sim_open((a),(b)) | 75 | #define open(a,b) rb->sim_open((a),(b)) |
82 | #undef close | ||
83 | #define close(a) rb->close((a)) | ||
84 | #undef lseek | 76 | #undef lseek |
85 | #define lseek(a,b,c) rb->sim_lseek((a),(b),(c)) | 77 | #define lseek(a,b,c) rb->sim_lseek((a),(b),(c)) |
78 | #undef close | ||
79 | #define close(a) rb->close((a)) | ||
86 | #else /* !SIMULATOR */ | 80 | #else /* !SIMULATOR */ |
87 | #define opendir(a) rb->opendir((a)) | ||
88 | #define closedir(a) rb->closedir((a)) | ||
89 | #define mkdir(a) rb->mkdir((a)) | ||
90 | #define open(a,b) rb->open((a),(b)) | 81 | #define open(a,b) rb->open((a),(b)) |
91 | #define lseek(a,b,c) rb->lseek((a),(b),(c)) | 82 | #define lseek(a,b,c) rb->lseek((a),(b),(c)) |
92 | #define close(a) rb->close((a)) | 83 | #define close(a) rb->close((a)) |
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c index d478bf9947..a273e4ca37 100644 --- a/apps/plugins/rockpaint.c +++ b/apps/plugins/rockpaint.c | |||
@@ -688,7 +688,7 @@ static bool browse( char *dst, int dst_size, const char *start ) | |||
688 | 688 | ||
689 | while( 1 ) | 689 | while( 1 ) |
690 | { | 690 | { |
691 | d = rb->PREFIX(opendir)( bbuf ); | 691 | d = rb->opendir( bbuf ); |
692 | if( !d ) | 692 | if( !d ) |
693 | { | 693 | { |
694 | /* | 694 | /* |
@@ -702,7 +702,7 @@ static bool browse( char *dst, int dst_size, const char *start ) | |||
702 | else if( errno == EACCES || errno == ENOENT ) | 702 | else if( errno == EACCES || errno == ENOENT ) |
703 | { | 703 | { |
704 | bbuf[0] = '/'; bbuf[1] = '\0'; | 704 | bbuf[0] = '/'; bbuf[1] = '\0'; |
705 | d = rb->PREFIX(opendir)( "/" ); | 705 | d = rb->opendir( "/" ); |
706 | } | 706 | } |
707 | else | 707 | else |
708 | { | 708 | { |
@@ -714,12 +714,12 @@ static bool browse( char *dst, int dst_size, const char *start ) | |||
714 | li = -1; | 714 | li = -1; |
715 | while( i < fvi ) | 715 | while( i < fvi ) |
716 | { | 716 | { |
717 | rb->PREFIX(readdir)( d ); | 717 | rb->readdir( d ); |
718 | i++; | 718 | i++; |
719 | } | 719 | } |
720 | while( top_inside+(i-fvi)*(fh+LINE_SPACE) < HEIGHT ) | 720 | while( top_inside+(i-fvi)*(fh+LINE_SPACE) < HEIGHT ) |
721 | { | 721 | { |
722 | de = rb->PREFIX(readdir)( d ); | 722 | de = rb->readdir( d ); |
723 | if( !de ) | 723 | if( !de ) |
724 | { | 724 | { |
725 | li = i-1; | 725 | li = i-1; |
@@ -737,12 +737,12 @@ static bool browse( char *dst, int dst_size, const char *start ) | |||
737 | lvi = i-1; | 737 | lvi = i-1; |
738 | if( li == -1 ) | 738 | if( li == -1 ) |
739 | { | 739 | { |
740 | if( !rb->PREFIX(readdir)( d ) ) | 740 | if( !rb->readdir( d ) ) |
741 | { | 741 | { |
742 | li = lvi; | 742 | li = lvi; |
743 | } | 743 | } |
744 | } | 744 | } |
745 | rb->PREFIX(closedir)( d ); | 745 | rb->closedir( d ); |
746 | 746 | ||
747 | rb->lcd_update(); | 747 | rb->lcd_update(); |
748 | 748 | ||
@@ -863,7 +863,7 @@ static bool browse_fonts( char *dst, int dst_size ) | |||
863 | { | 863 | { |
864 | b_need_redraw = 0; | 864 | b_need_redraw = 0; |
865 | 865 | ||
866 | d = rb->PREFIX(opendir)( FONT_DIR "/" ); | 866 | d = rb->opendir( FONT_DIR "/" ); |
867 | if( !d ) | 867 | if( !d ) |
868 | { | 868 | { |
869 | return false; | 869 | return false; |
@@ -873,7 +873,7 @@ static bool browse_fonts( char *dst, int dst_size ) | |||
873 | li = -1; | 873 | li = -1; |
874 | while( i < fvi ) | 874 | while( i < fvi ) |
875 | { | 875 | { |
876 | rb->PREFIX(readdir)( d ); | 876 | rb->readdir( d ); |
877 | i++; | 877 | i++; |
878 | } | 878 | } |
879 | cp = top_inside+LINE_SPACE; | 879 | cp = top_inside+LINE_SPACE; |
@@ -883,7 +883,7 @@ static bool browse_fonts( char *dst, int dst_size ) | |||
883 | 883 | ||
884 | while( cp < top+HEIGHT ) | 884 | while( cp < top+HEIGHT ) |
885 | { | 885 | { |
886 | de = rb->PREFIX(readdir)( d ); | 886 | de = rb->readdir( d ); |
887 | if( !de ) | 887 | if( !de ) |
888 | { | 888 | { |
889 | li = i-1; | 889 | li = i-1; |
@@ -920,7 +920,7 @@ static bool browse_fonts( char *dst, int dst_size ) | |||
920 | lvi = i-1; | 920 | lvi = i-1; |
921 | if( li == -1 ) | 921 | if( li == -1 ) |
922 | { | 922 | { |
923 | if( !(de = rb->PREFIX(readdir)( d ) ) ) | 923 | if( !(de = rb->readdir( d ) ) ) |
924 | { | 924 | { |
925 | li = lvi; | 925 | li = lvi; |
926 | } | 926 | } |
@@ -936,7 +936,7 @@ static bool browse_fonts( char *dst, int dst_size ) | |||
936 | } | 936 | } |
937 | } | 937 | } |
938 | rb->font_load( old_font ); | 938 | rb->font_load( old_font ); |
939 | rb->PREFIX(closedir)( d ); | 939 | rb->closedir( d ); |
940 | } | 940 | } |
941 | 941 | ||
942 | rb->lcd_set_drawmode(DRMODE_COMPLEMENT); | 942 | rb->lcd_set_drawmode(DRMODE_COMPLEMENT); |
diff --git a/apps/tagcache.c b/apps/tagcache.c index 41138ddf2c..f832f1e543 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -70,7 +70,7 @@ | |||
70 | #include "crc32.h" | 70 | #include "crc32.h" |
71 | #include "misc.h" | 71 | #include "misc.h" |
72 | #include "settings.h" | 72 | #include "settings.h" |
73 | #include "dircache.h" | 73 | #include "dir.h" |
74 | #include "structec.h" | 74 | #include "structec.h" |
75 | #ifndef __PCTOOL__ | 75 | #ifndef __PCTOOL__ |
76 | #include "atoi.h" | 76 | #include "atoi.h" |
@@ -327,7 +327,7 @@ static bool do_timed_yield(void) | |||
327 | 327 | ||
328 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) | 328 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) |
329 | static long find_entry_ram(const char *filename, | 329 | static long find_entry_ram(const char *filename, |
330 | const struct dircache_entry *dc) | 330 | const struct dirent *dc) |
331 | { | 331 | { |
332 | static long last_pos = 0; | 332 | static long last_pos = 0; |
333 | int i; | 333 | int i; |
@@ -626,7 +626,7 @@ static bool retrieve(struct tagcache_search *tcs, struct index_entry *idx, | |||
626 | # ifdef HAVE_DIRCACHE | 626 | # ifdef HAVE_DIRCACHE |
627 | if (tag == tag_filename && idx->flag & FLAG_DIRCACHE) | 627 | if (tag == tag_filename && idx->flag & FLAG_DIRCACHE) |
628 | { | 628 | { |
629 | dircache_copy_path((struct dircache_entry *)seek, | 629 | dircache_copy_path((struct dirent *)seek, |
630 | buf, size); | 630 | buf, size); |
631 | return true; | 631 | return true; |
632 | } | 632 | } |
@@ -1329,7 +1329,7 @@ static bool get_next(struct tagcache_search *tcs) | |||
1329 | # ifdef HAVE_DIRCACHE | 1329 | # ifdef HAVE_DIRCACHE |
1330 | if (tcs->type == tag_filename) | 1330 | if (tcs->type == tag_filename) |
1331 | { | 1331 | { |
1332 | dircache_copy_path((struct dircache_entry *)tcs->position, | 1332 | dircache_copy_path((struct dirent *)tcs->position, |
1333 | buf, sizeof buf); | 1333 | buf, sizeof buf); |
1334 | tcs->result = buf; | 1334 | tcs->result = buf; |
1335 | tcs->result_len = strlen(buf) + 1; | 1335 | tcs->result_len = strlen(buf) + 1; |
@@ -1583,7 +1583,7 @@ static int check_if_empty(char **tag) | |||
1583 | offset += entry.tag_length[tag] | 1583 | offset += entry.tag_length[tag] |
1584 | 1584 | ||
1585 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) | 1585 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) |
1586 | static void add_tagcache(char *path, const struct dircache_entry *dc) | 1586 | static void add_tagcache(char *path, const struct dirent *dc) |
1587 | #else | 1587 | #else |
1588 | static void add_tagcache(char *path) | 1588 | static void add_tagcache(char *path) |
1589 | #endif | 1589 | #endif |
@@ -3464,7 +3464,7 @@ static bool load_tagcache(void) | |||
3464 | if (tag == tag_filename) | 3464 | if (tag == tag_filename) |
3465 | { | 3465 | { |
3466 | # ifdef HAVE_DIRCACHE | 3466 | # ifdef HAVE_DIRCACHE |
3467 | const struct dircache_entry *dc; | 3467 | const struct dirent *dc; |
3468 | # endif | 3468 | # endif |
3469 | 3469 | ||
3470 | // FIXME: This is wrong! | 3470 | // FIXME: This is wrong! |
@@ -3647,14 +3647,14 @@ static bool check_deleted_files(void) | |||
3647 | 3647 | ||
3648 | static bool check_dir(const char *dirname) | 3648 | static bool check_dir(const char *dirname) |
3649 | { | 3649 | { |
3650 | DIRCACHED *dir; | 3650 | DIR *dir; |
3651 | int len; | 3651 | int len; |
3652 | int success = false; | 3652 | int success = false; |
3653 | 3653 | ||
3654 | dir = opendir_cached(dirname); | 3654 | dir = opendir(dirname); |
3655 | if (!dir) | 3655 | if (!dir) |
3656 | { | 3656 | { |
3657 | logf("tagcache: opendir_cached() failed"); | 3657 | logf("tagcache: opendir() failed"); |
3658 | return false; | 3658 | return false; |
3659 | } | 3659 | } |
3660 | 3660 | ||
@@ -3665,9 +3665,9 @@ static bool check_dir(const char *dirname) | |||
3665 | while (!check_event_queue()) | 3665 | while (!check_event_queue()) |
3666 | #endif | 3666 | #endif |
3667 | { | 3667 | { |
3668 | struct dircache_entry *entry; | 3668 | struct dirent *entry; |
3669 | 3669 | ||
3670 | entry = readdir_cached(dir); | 3670 | entry = readdir(dir); |
3671 | 3671 | ||
3672 | if (entry == NULL) | 3672 | if (entry == NULL) |
3673 | { | 3673 | { |
@@ -3698,7 +3698,7 @@ static bool check_dir(const char *dirname) | |||
3698 | curpath[len] = '\0'; | 3698 | curpath[len] = '\0'; |
3699 | } | 3699 | } |
3700 | 3700 | ||
3701 | closedir_cached(dir); | 3701 | closedir(dir); |
3702 | 3702 | ||
3703 | return success; | 3703 | return success; |
3704 | } | 3704 | } |
diff --git a/apps/tree.c b/apps/tree.c index b54238b08c..ccdbd69d0a 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -931,20 +931,20 @@ static long pltick; | |||
931 | static bool add_dir(char* dirname, int len, int fd) | 931 | static bool add_dir(char* dirname, int len, int fd) |
932 | { | 932 | { |
933 | bool abort = false; | 933 | bool abort = false; |
934 | DIRCACHED* dir; | 934 | DIR* dir; |
935 | 935 | ||
936 | /* check for user abort */ | 936 | /* check for user abort */ |
937 | if (action_userabort(TIMEOUT_NOBLOCK)) | 937 | if (action_userabort(TIMEOUT_NOBLOCK)) |
938 | return true; | 938 | return true; |
939 | 939 | ||
940 | dir = opendir_cached(dirname); | 940 | dir = opendir(dirname); |
941 | if(!dir) | 941 | if(!dir) |
942 | return true; | 942 | return true; |
943 | 943 | ||
944 | while (true) { | 944 | while (true) { |
945 | struct dircache_entry *entry; | 945 | struct dirent *entry; |
946 | 946 | ||
947 | entry = readdir_cached(dir); | 947 | entry = readdir(dir); |
948 | if (!entry) | 948 | if (!entry) |
949 | break; | 949 | break; |
950 | if (entry->attribute & ATTR_DIRECTORY) { | 950 | if (entry->attribute & ATTR_DIRECTORY) { |
@@ -1021,7 +1021,7 @@ static bool add_dir(char* dirname, int len, int fd) | |||
1021 | } | 1021 | } |
1022 | } | 1022 | } |
1023 | } | 1023 | } |
1024 | closedir_cached(dir); | 1024 | closedir(dir); |
1025 | 1025 | ||
1026 | return abort; | 1026 | return abort; |
1027 | } | 1027 | } |