mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-07 05:35:02 -05:00
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
This commit is contained in:
parent
930278bcc0
commit
011a325e32
20 changed files with 255 additions and 301 deletions
|
|
@ -38,7 +38,6 @@
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "rolo.h"
|
#include "rolo.h"
|
||||||
#include "sprintf.h"
|
#include "sprintf.h"
|
||||||
#include "dircache.h"
|
|
||||||
#include "splash.h"
|
#include "splash.h"
|
||||||
#include "yesno.h"
|
#include "yesno.h"
|
||||||
#include "cuesheet.h"
|
#include "cuesheet.h"
|
||||||
|
|
@ -84,11 +83,11 @@ int ft_build_playlist(struct tree_context* c, int start_index)
|
||||||
static void check_file_thumbnails(struct tree_context* c)
|
static void check_file_thumbnails(struct tree_context* c)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct dircache_entry *entry;
|
struct dirent *entry;
|
||||||
struct entry* dircache = c->dircache;
|
struct entry* dircache = c->dircache;
|
||||||
DIRCACHED *dir;
|
DIR *dir;
|
||||||
|
|
||||||
dir = opendir_cached(c->currdir);
|
dir = opendir(c->currdir);
|
||||||
if(!dir)
|
if(!dir)
|
||||||
return;
|
return;
|
||||||
/* mark all files as non talking, except the .talk ones */
|
/* mark all files as non talking, except the .talk ones */
|
||||||
|
|
@ -109,7 +108,7 @@ static void check_file_thumbnails(struct tree_context* c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while((entry = readdir_cached(dir)) != 0) /* walk directory */
|
while((entry = readdir(dir)) != 0) /* walk directory */
|
||||||
{
|
{
|
||||||
int ext_pos;
|
int ext_pos;
|
||||||
|
|
||||||
|
|
@ -135,7 +134,7 @@ static void check_file_thumbnails(struct tree_context* c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir_cached(dir);
|
closedir(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* support function for qsort() */
|
/* support function for qsort() */
|
||||||
|
|
@ -209,12 +208,12 @@ int ft_load(struct tree_context* c, const char* tempdir)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int name_buffer_used = 0;
|
int name_buffer_used = 0;
|
||||||
DIRCACHED *dir;
|
DIR *dir;
|
||||||
|
|
||||||
if (tempdir)
|
if (tempdir)
|
||||||
dir = opendir_cached(tempdir);
|
dir = opendir(tempdir);
|
||||||
else
|
else
|
||||||
dir = opendir_cached(c->currdir);
|
dir = opendir(c->currdir);
|
||||||
if(!dir)
|
if(!dir)
|
||||||
return -1; /* not a directory */
|
return -1; /* not a directory */
|
||||||
|
|
||||||
|
|
@ -223,7 +222,7 @@ int ft_load(struct tree_context* c, const char* tempdir)
|
||||||
|
|
||||||
for ( i=0; i < global_settings.max_files_in_dir; i++ ) {
|
for ( i=0; i < global_settings.max_files_in_dir; i++ ) {
|
||||||
int len;
|
int len;
|
||||||
struct dircache_entry *entry = readdir_cached(dir);
|
struct dirent *entry = readdir(dir);
|
||||||
struct entry* dptr =
|
struct entry* dptr =
|
||||||
(struct entry*)(c->dircache + i * sizeof(struct entry));
|
(struct entry*)(c->dircache + i * sizeof(struct entry));
|
||||||
if (!entry)
|
if (!entry)
|
||||||
|
|
@ -301,7 +300,7 @@ int ft_load(struct tree_context* c, const char* tempdir)
|
||||||
}
|
}
|
||||||
c->filesindir = i;
|
c->filesindir = i;
|
||||||
c->dirlength = i;
|
c->dirlength = i;
|
||||||
closedir_cached(dir);
|
closedir(dir);
|
||||||
|
|
||||||
qsort(c->dircache,i,sizeof(struct entry),compare);
|
qsort(c->dircache,i,sizeof(struct entry),compare);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,6 @@
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#include "filetree.h"
|
#include "filetree.h"
|
||||||
#include "abrepeat.h"
|
#include "abrepeat.h"
|
||||||
#include "dircache.h"
|
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#include "filetypes.h"
|
#include "filetypes.h"
|
||||||
|
|
|
||||||
|
|
@ -222,18 +222,11 @@ static const struct plugin_api rockbox_api = {
|
||||||
create_numbered_filename,
|
create_numbered_filename,
|
||||||
|
|
||||||
/* dir */
|
/* dir */
|
||||||
PREFIX(opendir),
|
opendir,
|
||||||
PREFIX(closedir),
|
closedir,
|
||||||
PREFIX(readdir),
|
readdir,
|
||||||
PREFIX(mkdir),
|
mkdir,
|
||||||
PREFIX(rmdir),
|
rmdir,
|
||||||
|
|
||||||
/* dir, cached */
|
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
opendir_cached,
|
|
||||||
readdir_cached,
|
|
||||||
closedir_cached,
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* kernel/ system */
|
/* kernel/ system */
|
||||||
PREFIX(sleep),
|
PREFIX(sleep),
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
#ifndef SIMULATOR
|
|
||||||
#include "dircache.h"
|
|
||||||
#endif
|
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
|
|
@ -115,12 +112,12 @@
|
||||||
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
||||||
|
|
||||||
/* increase this every time the api struct changes */
|
/* increase this every time the api struct changes */
|
||||||
#define PLUGIN_API_VERSION 62
|
#define PLUGIN_API_VERSION 63
|
||||||
|
|
||||||
/* update this to latest version if a change to the api struct breaks
|
/* update this to latest version if a change to the api struct breaks
|
||||||
backwards compatibility (and please take the opportunity to sort in any
|
backwards compatibility (and please take the opportunity to sort in any
|
||||||
new function which are "waiting" at the end of the function table) */
|
new function which are "waiting" at the end of the function table) */
|
||||||
#define PLUGIN_MIN_API_VERSION 62
|
#define PLUGIN_MIN_API_VERSION 63
|
||||||
|
|
||||||
/* plugin return codes */
|
/* plugin return codes */
|
||||||
enum plugin_status {
|
enum plugin_status {
|
||||||
|
|
@ -316,17 +313,11 @@ struct plugin_api {
|
||||||
int numberlen IF_CNFN_NUM_(, int *num));
|
int numberlen IF_CNFN_NUM_(, int *num));
|
||||||
|
|
||||||
/* dir */
|
/* dir */
|
||||||
DIR* (*PREFIX(opendir))(const char* name);
|
DIR* (*opendir)(const char* name);
|
||||||
int (*PREFIX(closedir))(DIR* dir);
|
int (*closedir)(DIR* dir);
|
||||||
struct dirent* (*PREFIX(readdir))(DIR* dir);
|
struct dirent* (*readdir)(DIR* dir);
|
||||||
int (*PREFIX(mkdir))(const char *name);
|
int (*mkdir)(const char *name);
|
||||||
int (*PREFIX(rmdir))(const char *name);
|
int (*rmdir)(const char *name);
|
||||||
/* dir, cached */
|
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
DIRCACHED* (*opendir_cached)(const char* name);
|
|
||||||
struct dircache_entry* (*readdir_cached)(DIRCACHED* dir);
|
|
||||||
int (*closedir_cached)(DIRCACHED* dir);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* kernel/ system */
|
/* kernel/ system */
|
||||||
void (*PREFIX(sleep))(int ticks);
|
void (*PREFIX(sleep))(int ticks);
|
||||||
|
|
|
||||||
|
|
@ -329,7 +329,7 @@ int Dbuild_filelistm(struct menu_item **names, char *firstentry, char *directory
|
||||||
char *startpt;
|
char *startpt;
|
||||||
struct menu_item *temp;
|
struct menu_item *temp;
|
||||||
|
|
||||||
filedir=opendir(directory);
|
filedir=rb->opendir(directory);
|
||||||
|
|
||||||
if(filedir==NULL)
|
if(filedir==NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -345,8 +345,8 @@ int Dbuild_filelistm(struct menu_item **names, char *firstentry, char *directory
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
// Reset the directory
|
// Reset the directory
|
||||||
closedir(filedir);
|
rb->closedir(filedir);
|
||||||
filedir=opendir(directory);
|
filedir=rb->opendir(directory);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
temp=malloc(i*sizeof(struct opt_items));
|
temp=malloc(i*sizeof(struct opt_items));
|
||||||
|
|
@ -365,7 +365,7 @@ int Dbuild_filelistm(struct menu_item **names, char *firstentry, char *directory
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(filedir);
|
rb->closedir(filedir);
|
||||||
*names=temp;
|
*names=temp;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,26 +40,17 @@ char *my_strtok( char * s, const char * delim );
|
||||||
#define read_line(a,b,c) rb->read_line((a),(b),(c))
|
#define read_line(a,b,c) rb->read_line((a),(b),(c))
|
||||||
|
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
#undef opendir
|
|
||||||
#undef closedir
|
|
||||||
#undef mkdir
|
|
||||||
#undef open
|
#undef open
|
||||||
#undef lseek
|
#undef lseek
|
||||||
#undef filesize
|
#undef filesize
|
||||||
#define opendir(a) rb->sim_opendir((a))
|
|
||||||
#define closedir(a) rb->sim_closedir((a))
|
|
||||||
#define mkdir(a) rb->sim_mkdir((a))
|
|
||||||
#define open(a,b) rb->sim_open((a),(b))
|
#define open(a,b) rb->sim_open((a),(b))
|
||||||
#define lseek(a,b,c) rb->sim_lseek((a),(b),(c))
|
#define lseek(a,b,c) rb->sim_lseek((a),(b),(c))
|
||||||
#define filesize(a) rb->sim_filesize((a))
|
#define filesize(a) rb->sim_filesize((a))
|
||||||
#else /* !SIMULATOR */
|
#else /* !SIMULATOR */
|
||||||
#define opendir(a) rb->opendir((a))
|
|
||||||
#define closedir(a) rb->closedir((a))
|
|
||||||
#define filesize(a) rb->filesize((a))
|
|
||||||
#define mkdir(a) rb->mkdir((a))
|
|
||||||
#define open(a,b) my_open((a),(b))
|
#define open(a,b) my_open((a),(b))
|
||||||
#define close(a) my_close((a))
|
#define close(a) my_close((a))
|
||||||
#define lseek(a,b,c) rb->lseek((a),(b),(c))
|
#define lseek(a,b,c) rb->lseek((a),(b),(c))
|
||||||
|
#define filesize(a) rb->filesize((a))
|
||||||
#endif /* !SIMULATOR */
|
#endif /* !SIMULATOR */
|
||||||
|
|
||||||
#define strtok(a,b) my_strtok((a),(b))
|
#define strtok(a,b) my_strtok((a),(b))
|
||||||
|
|
|
||||||
|
|
@ -59,30 +59,18 @@ static bool file_properties(char* selected_file)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
char tstr[MAX_PATH];
|
char tstr[MAX_PATH];
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
DIRCACHED* dir;
|
|
||||||
struct dircache_entry* entry;
|
|
||||||
#else
|
|
||||||
DIR* dir;
|
DIR* dir;
|
||||||
struct dirent* entry;
|
struct dirent* entry;
|
||||||
#endif
|
|
||||||
char* ptr = rb->strrchr(selected_file, '/') + 1;
|
char* ptr = rb->strrchr(selected_file, '/') + 1;
|
||||||
int dirlen = (ptr - selected_file);
|
int dirlen = (ptr - selected_file);
|
||||||
rb->strncpy(tstr, selected_file, dirlen);
|
rb->strncpy(tstr, selected_file, dirlen);
|
||||||
tstr[dirlen] = 0;
|
tstr[dirlen] = 0;
|
||||||
|
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
dir = rb->opendir_cached(tstr);
|
|
||||||
#else
|
|
||||||
dir = rb->opendir(tstr);
|
dir = rb->opendir(tstr);
|
||||||
#endif
|
|
||||||
if (dir)
|
if (dir)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
while(0 != (entry = rb->readdir_cached(dir)))
|
|
||||||
#else
|
|
||||||
while(0 != (entry = rb->readdir(dir)))
|
while(0 != (entry = rb->readdir(dir)))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if(!rb->strcmp(entry->d_name, selected_file+dirlen))
|
if(!rb->strcmp(entry->d_name, selected_file+dirlen))
|
||||||
{
|
{
|
||||||
|
|
@ -103,11 +91,7 @@ static bool file_properties(char* selected_file)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
rb->closedir_cached(dir);
|
|
||||||
#else
|
|
||||||
rb->closedir(dir);
|
rb->closedir(dir);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
@ -128,30 +112,17 @@ static bool _dir_properties(DPS* dps)
|
||||||
and informs the user of the progress */
|
and informs the user of the progress */
|
||||||
bool result;
|
bool result;
|
||||||
int dirlen;
|
int dirlen;
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
DIRCACHED* dir;
|
|
||||||
struct dircache_entry* entry;
|
|
||||||
#else
|
|
||||||
DIR* dir;
|
DIR* dir;
|
||||||
struct dirent* entry;
|
struct dirent* entry;
|
||||||
#endif
|
|
||||||
|
|
||||||
result = true;
|
result = true;
|
||||||
dirlen = rb->strlen(dps->dirname);
|
dirlen = rb->strlen(dps->dirname);
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
dir = rb->opendir_cached(dps->dirname);
|
|
||||||
#else
|
|
||||||
dir = rb->opendir(dps->dirname);
|
dir = rb->opendir(dps->dirname);
|
||||||
#endif
|
|
||||||
if (!dir)
|
if (!dir)
|
||||||
return false; /* open error */
|
return false; /* open error */
|
||||||
|
|
||||||
/* walk through the directory content */
|
/* walk through the directory content */
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
while(result && (0 != (entry = rb->readdir_cached(dir))))
|
|
||||||
#else
|
|
||||||
while(result && (0 != (entry = rb->readdir(dir))))
|
while(result && (0 != (entry = rb->readdir(dir))))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
/* append name to current directory */
|
/* append name to current directory */
|
||||||
rb->snprintf(dps->dirname+dirlen, dps->len-dirlen, "/%s",
|
rb->snprintf(dps->dirname+dirlen, dps->len-dirlen, "/%s",
|
||||||
|
|
@ -189,12 +160,7 @@ static bool _dir_properties(DPS* dps)
|
||||||
result = false;
|
result = false;
|
||||||
rb->yield();
|
rb->yield();
|
||||||
}
|
}
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
rb->closedir_cached(dir);
|
|
||||||
#else
|
|
||||||
rb->closedir(dir);
|
rb->closedir(dir);
|
||||||
#endif
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -256,30 +222,17 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
|
||||||
|
|
||||||
/* determine if it's a file or a directory */
|
/* determine if it's a file or a directory */
|
||||||
bool found = false;
|
bool found = false;
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
DIRCACHED* dir;
|
|
||||||
struct dircache_entry* entry;
|
|
||||||
#else
|
|
||||||
DIR* dir;
|
DIR* dir;
|
||||||
struct dirent* entry;
|
struct dirent* entry;
|
||||||
#endif
|
|
||||||
char* ptr = rb->strrchr((char*)file, '/') + 1;
|
char* ptr = rb->strrchr((char*)file, '/') + 1;
|
||||||
int dirlen = (ptr - (char*)file);
|
int dirlen = (ptr - (char*)file);
|
||||||
rb->strncpy(str_dirname, (char*)file, dirlen);
|
rb->strncpy(str_dirname, (char*)file, dirlen);
|
||||||
str_dirname[dirlen] = 0;
|
str_dirname[dirlen] = 0;
|
||||||
|
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
dir = rb->opendir_cached(str_dirname);
|
|
||||||
#else
|
|
||||||
dir = rb->opendir(str_dirname);
|
dir = rb->opendir(str_dirname);
|
||||||
#endif
|
|
||||||
if (dir)
|
if (dir)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
while(0 != (entry = rb->readdir_cached(dir)))
|
|
||||||
#else
|
|
||||||
while(0 != (entry = rb->readdir(dir)))
|
while(0 != (entry = rb->readdir(dir)))
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
if(!rb->strcmp(entry->d_name, file+dirlen))
|
if(!rb->strcmp(entry->d_name, file+dirlen))
|
||||||
{
|
{
|
||||||
|
|
@ -288,11 +241,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
rb->closedir_cached(dir);
|
|
||||||
#else
|
|
||||||
rb->closedir(dir);
|
rb->closedir(dir);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
/* now we know if it's a file or a dir or maybe something failed */
|
/* now we know if it's a file or a dir or maybe something failed */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,11 +71,11 @@ void setoptions (void)
|
||||||
DIR* dir;
|
DIR* dir;
|
||||||
char optionsave[sizeof(savedir)+sizeof(optionname)];
|
char optionsave[sizeof(savedir)+sizeof(optionname)];
|
||||||
|
|
||||||
dir=opendir(savedir);
|
dir=rb->opendir(savedir);
|
||||||
if(!dir)
|
if(!dir)
|
||||||
mkdir(savedir);
|
rb->mkdir(savedir);
|
||||||
else
|
else
|
||||||
closedir(dir);
|
rb->closedir(dir);
|
||||||
|
|
||||||
snprintf(optionsave, sizeof(optionsave), "%s/%s", savedir, optionname);
|
snprintf(optionsave, sizeof(optionsave), "%s/%s", savedir, optionname);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,22 +71,13 @@ void dynamic_recompile (struct dynarec_block *newblock);
|
||||||
#define isalnum(c) (isdigit(c) || (isalpha(c)))
|
#define isalnum(c) (isdigit(c) || (isalpha(c)))
|
||||||
|
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
#undef opendir
|
|
||||||
#define opendir(a) rb->sim_opendir((a))
|
|
||||||
#undef closedir
|
|
||||||
#define closedir(a) rb->sim_closedir((a))
|
|
||||||
#undef mkdir
|
|
||||||
#define mkdir(a) rb->sim_mkdir((a))
|
|
||||||
#undef open
|
#undef open
|
||||||
#define open(a,b) rb->sim_open((a),(b))
|
#define open(a,b) rb->sim_open((a),(b))
|
||||||
#undef close
|
|
||||||
#define close(a) rb->close((a))
|
|
||||||
#undef lseek
|
#undef lseek
|
||||||
#define lseek(a,b,c) rb->sim_lseek((a),(b),(c))
|
#define lseek(a,b,c) rb->sim_lseek((a),(b),(c))
|
||||||
|
#undef close
|
||||||
|
#define close(a) rb->close((a))
|
||||||
#else /* !SIMULATOR */
|
#else /* !SIMULATOR */
|
||||||
#define opendir(a) rb->opendir((a))
|
|
||||||
#define closedir(a) rb->closedir((a))
|
|
||||||
#define mkdir(a) rb->mkdir((a))
|
|
||||||
#define open(a,b) rb->open((a),(b))
|
#define open(a,b) rb->open((a),(b))
|
||||||
#define lseek(a,b,c) rb->lseek((a),(b),(c))
|
#define lseek(a,b,c) rb->lseek((a),(b),(c))
|
||||||
#define close(a) rb->close((a))
|
#define close(a) rb->close((a))
|
||||||
|
|
|
||||||
|
|
@ -688,7 +688,7 @@ static bool browse( char *dst, int dst_size, const char *start )
|
||||||
|
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
d = rb->PREFIX(opendir)( bbuf );
|
d = rb->opendir( bbuf );
|
||||||
if( !d )
|
if( !d )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
|
@ -702,7 +702,7 @@ static bool browse( char *dst, int dst_size, const char *start )
|
||||||
else if( errno == EACCES || errno == ENOENT )
|
else if( errno == EACCES || errno == ENOENT )
|
||||||
{
|
{
|
||||||
bbuf[0] = '/'; bbuf[1] = '\0';
|
bbuf[0] = '/'; bbuf[1] = '\0';
|
||||||
d = rb->PREFIX(opendir)( "/" );
|
d = rb->opendir( "/" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -714,12 +714,12 @@ static bool browse( char *dst, int dst_size, const char *start )
|
||||||
li = -1;
|
li = -1;
|
||||||
while( i < fvi )
|
while( i < fvi )
|
||||||
{
|
{
|
||||||
rb->PREFIX(readdir)( d );
|
rb->readdir( d );
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
while( top_inside+(i-fvi)*(fh+LINE_SPACE) < HEIGHT )
|
while( top_inside+(i-fvi)*(fh+LINE_SPACE) < HEIGHT )
|
||||||
{
|
{
|
||||||
de = rb->PREFIX(readdir)( d );
|
de = rb->readdir( d );
|
||||||
if( !de )
|
if( !de )
|
||||||
{
|
{
|
||||||
li = i-1;
|
li = i-1;
|
||||||
|
|
@ -737,12 +737,12 @@ static bool browse( char *dst, int dst_size, const char *start )
|
||||||
lvi = i-1;
|
lvi = i-1;
|
||||||
if( li == -1 )
|
if( li == -1 )
|
||||||
{
|
{
|
||||||
if( !rb->PREFIX(readdir)( d ) )
|
if( !rb->readdir( d ) )
|
||||||
{
|
{
|
||||||
li = lvi;
|
li = lvi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rb->PREFIX(closedir)( d );
|
rb->closedir( d );
|
||||||
|
|
||||||
rb->lcd_update();
|
rb->lcd_update();
|
||||||
|
|
||||||
|
|
@ -863,7 +863,7 @@ static bool browse_fonts( char *dst, int dst_size )
|
||||||
{
|
{
|
||||||
b_need_redraw = 0;
|
b_need_redraw = 0;
|
||||||
|
|
||||||
d = rb->PREFIX(opendir)( FONT_DIR "/" );
|
d = rb->opendir( FONT_DIR "/" );
|
||||||
if( !d )
|
if( !d )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -873,7 +873,7 @@ static bool browse_fonts( char *dst, int dst_size )
|
||||||
li = -1;
|
li = -1;
|
||||||
while( i < fvi )
|
while( i < fvi )
|
||||||
{
|
{
|
||||||
rb->PREFIX(readdir)( d );
|
rb->readdir( d );
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
cp = top_inside+LINE_SPACE;
|
cp = top_inside+LINE_SPACE;
|
||||||
|
|
@ -883,7 +883,7 @@ static bool browse_fonts( char *dst, int dst_size )
|
||||||
|
|
||||||
while( cp < top+HEIGHT )
|
while( cp < top+HEIGHT )
|
||||||
{
|
{
|
||||||
de = rb->PREFIX(readdir)( d );
|
de = rb->readdir( d );
|
||||||
if( !de )
|
if( !de )
|
||||||
{
|
{
|
||||||
li = i-1;
|
li = i-1;
|
||||||
|
|
@ -920,7 +920,7 @@ static bool browse_fonts( char *dst, int dst_size )
|
||||||
lvi = i-1;
|
lvi = i-1;
|
||||||
if( li == -1 )
|
if( li == -1 )
|
||||||
{
|
{
|
||||||
if( !(de = rb->PREFIX(readdir)( d ) ) )
|
if( !(de = rb->readdir( d ) ) )
|
||||||
{
|
{
|
||||||
li = lvi;
|
li = lvi;
|
||||||
}
|
}
|
||||||
|
|
@ -936,7 +936,7 @@ static bool browse_fonts( char *dst, int dst_size )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rb->font_load( old_font );
|
rb->font_load( old_font );
|
||||||
rb->PREFIX(closedir)( d );
|
rb->closedir( d );
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
|
rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@
|
||||||
#include "crc32.h"
|
#include "crc32.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "dircache.h"
|
#include "dir.h"
|
||||||
#include "structec.h"
|
#include "structec.h"
|
||||||
#ifndef __PCTOOL__
|
#ifndef __PCTOOL__
|
||||||
#include "atoi.h"
|
#include "atoi.h"
|
||||||
|
|
@ -327,7 +327,7 @@ static bool do_timed_yield(void)
|
||||||
|
|
||||||
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
|
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
|
||||||
static long find_entry_ram(const char *filename,
|
static long find_entry_ram(const char *filename,
|
||||||
const struct dircache_entry *dc)
|
const struct dirent *dc)
|
||||||
{
|
{
|
||||||
static long last_pos = 0;
|
static long last_pos = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -626,7 +626,7 @@ static bool retrieve(struct tagcache_search *tcs, struct index_entry *idx,
|
||||||
# ifdef HAVE_DIRCACHE
|
# ifdef HAVE_DIRCACHE
|
||||||
if (tag == tag_filename && idx->flag & FLAG_DIRCACHE)
|
if (tag == tag_filename && idx->flag & FLAG_DIRCACHE)
|
||||||
{
|
{
|
||||||
dircache_copy_path((struct dircache_entry *)seek,
|
dircache_copy_path((struct dirent *)seek,
|
||||||
buf, size);
|
buf, size);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -1329,7 +1329,7 @@ static bool get_next(struct tagcache_search *tcs)
|
||||||
# ifdef HAVE_DIRCACHE
|
# ifdef HAVE_DIRCACHE
|
||||||
if (tcs->type == tag_filename)
|
if (tcs->type == tag_filename)
|
||||||
{
|
{
|
||||||
dircache_copy_path((struct dircache_entry *)tcs->position,
|
dircache_copy_path((struct dirent *)tcs->position,
|
||||||
buf, sizeof buf);
|
buf, sizeof buf);
|
||||||
tcs->result = buf;
|
tcs->result = buf;
|
||||||
tcs->result_len = strlen(buf) + 1;
|
tcs->result_len = strlen(buf) + 1;
|
||||||
|
|
@ -1583,7 +1583,7 @@ static int check_if_empty(char **tag)
|
||||||
offset += entry.tag_length[tag]
|
offset += entry.tag_length[tag]
|
||||||
|
|
||||||
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
|
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
|
||||||
static void add_tagcache(char *path, const struct dircache_entry *dc)
|
static void add_tagcache(char *path, const struct dirent *dc)
|
||||||
#else
|
#else
|
||||||
static void add_tagcache(char *path)
|
static void add_tagcache(char *path)
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -3464,7 +3464,7 @@ static bool load_tagcache(void)
|
||||||
if (tag == tag_filename)
|
if (tag == tag_filename)
|
||||||
{
|
{
|
||||||
# ifdef HAVE_DIRCACHE
|
# ifdef HAVE_DIRCACHE
|
||||||
const struct dircache_entry *dc;
|
const struct dirent *dc;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
// FIXME: This is wrong!
|
// FIXME: This is wrong!
|
||||||
|
|
@ -3647,14 +3647,14 @@ static bool check_deleted_files(void)
|
||||||
|
|
||||||
static bool check_dir(const char *dirname)
|
static bool check_dir(const char *dirname)
|
||||||
{
|
{
|
||||||
DIRCACHED *dir;
|
DIR *dir;
|
||||||
int len;
|
int len;
|
||||||
int success = false;
|
int success = false;
|
||||||
|
|
||||||
dir = opendir_cached(dirname);
|
dir = opendir(dirname);
|
||||||
if (!dir)
|
if (!dir)
|
||||||
{
|
{
|
||||||
logf("tagcache: opendir_cached() failed");
|
logf("tagcache: opendir() failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3665,9 +3665,9 @@ static bool check_dir(const char *dirname)
|
||||||
while (!check_event_queue())
|
while (!check_event_queue())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
struct dircache_entry *entry;
|
struct dirent *entry;
|
||||||
|
|
||||||
entry = readdir_cached(dir);
|
entry = readdir(dir);
|
||||||
|
|
||||||
if (entry == NULL)
|
if (entry == NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -3698,7 +3698,7 @@ static bool check_dir(const char *dirname)
|
||||||
curpath[len] = '\0';
|
curpath[len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir_cached(dir);
|
closedir(dir);
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
apps/tree.c
10
apps/tree.c
|
|
@ -931,20 +931,20 @@ static long pltick;
|
||||||
static bool add_dir(char* dirname, int len, int fd)
|
static bool add_dir(char* dirname, int len, int fd)
|
||||||
{
|
{
|
||||||
bool abort = false;
|
bool abort = false;
|
||||||
DIRCACHED* dir;
|
DIR* dir;
|
||||||
|
|
||||||
/* check for user abort */
|
/* check for user abort */
|
||||||
if (action_userabort(TIMEOUT_NOBLOCK))
|
if (action_userabort(TIMEOUT_NOBLOCK))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
dir = opendir_cached(dirname);
|
dir = opendir(dirname);
|
||||||
if(!dir)
|
if(!dir)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
struct dircache_entry *entry;
|
struct dirent *entry;
|
||||||
|
|
||||||
entry = readdir_cached(dir);
|
entry = readdir(dir);
|
||||||
if (!entry)
|
if (!entry)
|
||||||
break;
|
break;
|
||||||
if (entry->attribute & ATTR_DIRECTORY) {
|
if (entry->attribute & ATTR_DIRECTORY) {
|
||||||
|
|
@ -1021,7 +1021,7 @@ static bool add_dir(char* dirname, int len, int fd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir_cached(dir);
|
closedir(dir);
|
||||||
|
|
||||||
return abort;
|
return abort;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ common/crc32-mi4.c
|
||||||
#endif
|
#endif
|
||||||
common/ctype.c
|
common/ctype.c
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
common/dir.c
|
common/dir_uncached.c
|
||||||
common/file.c
|
common/file.c
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
#ifdef HAVE_DIRCACHE
|
#ifdef HAVE_DIRCACHE
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
* \/ \/ \/ \/ \/
|
* \/ \/ \/ \/ \/
|
||||||
* $Id$
|
* $Id: dir.c 13741 2007-06-30 02:08:27Z jethead71 $
|
||||||
*
|
*
|
||||||
* Copyright (C) 2002 by Björn Stenberg
|
* Copyright (C) 2002 by Björn Stenberg
|
||||||
*
|
*
|
||||||
|
|
@ -24,11 +24,11 @@
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "atoi.h"
|
#include "atoi.h"
|
||||||
#include "dircache.h"
|
//#include "dircache.h"
|
||||||
|
|
||||||
#define MAX_OPEN_DIRS 8
|
#define MAX_OPEN_DIRS 8
|
||||||
|
|
||||||
static DIR opendirs[MAX_OPEN_DIRS];
|
static DIR_UNCACHED opendirs[MAX_OPEN_DIRS];
|
||||||
|
|
||||||
#ifdef HAVE_MULTIVOLUME
|
#ifdef HAVE_MULTIVOLUME
|
||||||
|
|
||||||
|
|
@ -78,7 +78,7 @@ static int strip_volume(const char* name, char* namecopy)
|
||||||
// release all dir handles on a given volume "by force", to avoid leaks
|
// release all dir handles on a given volume "by force", to avoid leaks
|
||||||
int release_dirs(int volume)
|
int release_dirs(int volume)
|
||||||
{
|
{
|
||||||
DIR* pdir = opendirs;
|
DIR_UNCACHED* pdir = opendirs;
|
||||||
int dd;
|
int dd;
|
||||||
int closed = 0;
|
int closed = 0;
|
||||||
for ( dd=0; dd<MAX_OPEN_DIRS; dd++, pdir++)
|
for ( dd=0; dd<MAX_OPEN_DIRS; dd++, pdir++)
|
||||||
|
|
@ -93,14 +93,14 @@ int release_dirs(int volume)
|
||||||
}
|
}
|
||||||
#endif /* #ifdef HAVE_HOTSWAP */
|
#endif /* #ifdef HAVE_HOTSWAP */
|
||||||
|
|
||||||
DIR* opendir(const char* name)
|
DIR_UNCACHED* opendir_uncached(const char* name)
|
||||||
{
|
{
|
||||||
char namecopy[MAX_PATH];
|
char namecopy[MAX_PATH];
|
||||||
char* part;
|
char* part;
|
||||||
char* end;
|
char* end;
|
||||||
struct fat_direntry entry;
|
struct fat_direntry entry;
|
||||||
int dd;
|
int dd;
|
||||||
DIR* pdir = opendirs;
|
DIR_UNCACHED* pdir = opendirs;
|
||||||
#ifdef HAVE_MULTIVOLUME
|
#ifdef HAVE_MULTIVOLUME
|
||||||
int volume;
|
int volume;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -170,16 +170,16 @@ DIR* opendir(const char* name)
|
||||||
return pdir;
|
return pdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
int closedir(DIR* dir)
|
int closedir_uncached(DIR_UNCACHED* dir)
|
||||||
{
|
{
|
||||||
dir->busy=false;
|
dir->busy=false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dirent* readdir(DIR* dir)
|
struct dirent_uncached* readdir_uncached(DIR_UNCACHED* dir)
|
||||||
{
|
{
|
||||||
struct fat_direntry entry;
|
struct fat_direntry entry;
|
||||||
struct dirent* theent = &(dir->theent);
|
struct dirent_uncached* theent = &(dir->theent);
|
||||||
|
|
||||||
if (!dir->busy)
|
if (!dir->busy)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -191,7 +191,7 @@ struct dirent* readdir(DIR* dir)
|
||||||
&& dir->volumecounter < NUM_VOLUMES /* in range */
|
&& dir->volumecounter < NUM_VOLUMES /* in range */
|
||||||
&& dir->fatdir.file.volume == 0) /* at volume 0 */
|
&& dir->fatdir.file.volume == 0) /* at volume 0 */
|
||||||
{ /* fake special directories, which don't really exist, but
|
{ /* fake special directories, which don't really exist, but
|
||||||
will get redirected upon opendir() */
|
will get redirected upon opendir_uncached() */
|
||||||
while (++dir->volumecounter < NUM_VOLUMES)
|
while (++dir->volumecounter < NUM_VOLUMES)
|
||||||
{
|
{
|
||||||
if (fat_ismounted(dir->volumecounter))
|
if (fat_ismounted(dir->volumecounter))
|
||||||
|
|
@ -222,14 +222,14 @@ struct dirent* readdir(DIR* dir)
|
||||||
return theent;
|
return theent;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mkdir(const char *name)
|
int mkdir_uncached(const char *name)
|
||||||
{
|
{
|
||||||
DIR *dir;
|
DIR_UNCACHED *dir;
|
||||||
char namecopy[MAX_PATH];
|
char namecopy[MAX_PATH];
|
||||||
char* end;
|
char* end;
|
||||||
char *basename;
|
char *basename;
|
||||||
char *parent;
|
char *parent;
|
||||||
struct dirent *entry;
|
struct dirent_uncached *entry;
|
||||||
struct fat_dir newdir;
|
struct fat_dir newdir;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
|
@ -253,7 +253,7 @@ int mkdir(const char *name)
|
||||||
|
|
||||||
DEBUGF("mkdir: parent: %s, name: %s\n", parent, basename);
|
DEBUGF("mkdir: parent: %s, name: %s\n", parent, basename);
|
||||||
|
|
||||||
dir = opendir(parent);
|
dir = opendir_uncached(parent);
|
||||||
|
|
||||||
if(!dir) {
|
if(!dir) {
|
||||||
DEBUGF("mkdir: can't open parent dir\n");
|
DEBUGF("mkdir: can't open parent dir\n");
|
||||||
|
|
@ -267,11 +267,11 @@ int mkdir(const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now check if the name already exists */
|
/* Now check if the name already exists */
|
||||||
while ((entry = readdir(dir))) {
|
while ((entry = readdir_uncached(dir))) {
|
||||||
if ( !strcasecmp(basename, entry->d_name) ) {
|
if ( !strcasecmp(basename, entry->d_name) ) {
|
||||||
DEBUGF("mkdir error: file exists\n");
|
DEBUGF("mkdir error: file exists\n");
|
||||||
errno = EEXIST;
|
errno = EEXIST;
|
||||||
closedir(dir);
|
closedir_uncached(dir);
|
||||||
return - 4;
|
return - 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -279,23 +279,18 @@ int mkdir(const char *name)
|
||||||
memset(&newdir, sizeof(struct fat_dir), 0);
|
memset(&newdir, sizeof(struct fat_dir), 0);
|
||||||
|
|
||||||
rc = fat_create_dir(basename, &newdir, &(dir->fatdir));
|
rc = fat_create_dir(basename, &newdir, &(dir->fatdir));
|
||||||
#ifdef HAVE_DIRCACHE
|
closedir_uncached(dir);
|
||||||
if (rc >= 0)
|
|
||||||
dircache_mkdir(name);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
closedir(dir);
|
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rmdir(const char* name)
|
int rmdir_uncached(const char* name)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
DIR* dir;
|
DIR_UNCACHED* dir;
|
||||||
struct dirent* entry;
|
struct dirent_uncached* entry;
|
||||||
|
|
||||||
dir = opendir(name);
|
dir = opendir_uncached(name);
|
||||||
if (!dir)
|
if (!dir)
|
||||||
{
|
{
|
||||||
errno = ENOENT; /* open error */
|
errno = ENOENT; /* open error */
|
||||||
|
|
@ -303,14 +298,14 @@ int rmdir(const char* name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if the directory is empty */
|
/* check if the directory is empty */
|
||||||
while ((entry = readdir(dir)))
|
while ((entry = readdir_uncached(dir)))
|
||||||
{
|
{
|
||||||
if (strcmp(entry->d_name, ".") &&
|
if (strcmp(entry->d_name, ".") &&
|
||||||
strcmp(entry->d_name, ".."))
|
strcmp(entry->d_name, ".."))
|
||||||
{
|
{
|
||||||
DEBUGF("rmdir error: not empty\n");
|
DEBUGF("rmdir error: not empty\n");
|
||||||
errno = ENOTEMPTY;
|
errno = ENOTEMPTY;
|
||||||
closedir(dir);
|
closedir_uncached(dir);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -321,14 +316,7 @@ int rmdir(const char* name)
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
rc = rc * 10 - 3;
|
rc = rc * 10 - 3;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_DIRCACHE
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dircache_rmdir(name);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
closedir(dir);
|
closedir_uncached(dir);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "dir.h"
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "atoi.h"
|
#include "atoi.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
@ -44,7 +43,7 @@
|
||||||
#define DIRCACHE_STOP 2
|
#define DIRCACHE_STOP 2
|
||||||
|
|
||||||
#define MAX_OPEN_DIRS 8
|
#define MAX_OPEN_DIRS 8
|
||||||
DIRCACHED opendirs[MAX_OPEN_DIRS];
|
DIR_CACHED opendirs[MAX_OPEN_DIRS];
|
||||||
|
|
||||||
static struct dircache_entry *fd_bindings[MAX_OPEN_FILES];
|
static struct dircache_entry *fd_bindings[MAX_OPEN_FILES];
|
||||||
static struct dircache_entry *dircache_root;
|
static struct dircache_entry *dircache_root;
|
||||||
|
|
@ -165,7 +164,7 @@ static bool check_event_queue(void)
|
||||||
static int dircache_scan(struct travel_data *td)
|
static int dircache_scan(struct travel_data *td)
|
||||||
{
|
{
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
while ( ( td->entry = readdir(td->dir) ) )
|
while ( ( td->entry = readdir_uncached(td->dir) ) )
|
||||||
#else
|
#else
|
||||||
while ( (fat_getnext(td->dir, &td->entry) >= 0) && (td->entry.name[0]))
|
while ( (fat_getnext(td->dir, &td->entry) >= 0) && (td->entry.name[0]))
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -221,10 +220,10 @@ static int dircache_scan(struct travel_data *td)
|
||||||
strncpy(&dircache_cur_path[td->pathpos+1], td->entry->d_name,
|
strncpy(&dircache_cur_path[td->pathpos+1], td->entry->d_name,
|
||||||
sizeof(dircache_cur_path) - td->pathpos - 2);
|
sizeof(dircache_cur_path) - td->pathpos - 2);
|
||||||
|
|
||||||
td->newdir = opendir(dircache_cur_path);
|
td->newdir = opendir_uncached(dircache_cur_path);
|
||||||
if (td->newdir == NULL)
|
if (td->newdir == NULL)
|
||||||
{
|
{
|
||||||
logf("Failed to opendir(): %s", dircache_cur_path);
|
logf("Failed to opendir_uncached(): %s", dircache_cur_path);
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
@ -269,7 +268,7 @@ static int dircache_scan(struct travel_data *td)
|
||||||
* Recursively scan the hard disk and build the cache.
|
* Recursively scan the hard disk and build the cache.
|
||||||
*/
|
*/
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
static int dircache_travel(DIR *dir, struct dircache_entry *ce)
|
static int dircache_travel(DIR_UNCACHED *dir, struct dircache_entry *ce)
|
||||||
#else
|
#else
|
||||||
static int dircache_travel(struct fat_dir *dir, struct dircache_entry *ce)
|
static int dircache_travel(struct fat_dir *dir, struct dircache_entry *ce)
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -292,7 +291,7 @@ static int dircache_travel(struct fat_dir *dir, struct dircache_entry *ce)
|
||||||
ce->d_name = ".";
|
ce->d_name = ".";
|
||||||
ce->name_len = 2;
|
ce->name_len = 2;
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
closedir(dir_recursion[depth].dir);
|
closedir_uncached(dir_recursion[depth].dir);
|
||||||
ce->attribute = ATTR_DIRECTORY;
|
ce->attribute = ATTR_DIRECTORY;
|
||||||
#else
|
#else
|
||||||
ce->attribute = FAT_ATTR_DIRECTORY;
|
ce->attribute = FAT_ATTR_DIRECTORY;
|
||||||
|
|
@ -519,7 +518,7 @@ int dircache_save(void)
|
||||||
static int dircache_do_rebuild(void)
|
static int dircache_do_rebuild(void)
|
||||||
{
|
{
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
DIR *pdir;
|
DIR_UNCACHED *pdir;
|
||||||
#else
|
#else
|
||||||
struct fat_dir dir, *pdir;
|
struct fat_dir dir, *pdir;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -532,7 +531,7 @@ static int dircache_do_rebuild(void)
|
||||||
dircache_initializing = true;
|
dircache_initializing = true;
|
||||||
|
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
pdir = opendir("/");
|
pdir = opendir_uncached("/");
|
||||||
if (pdir == NULL)
|
if (pdir == NULL)
|
||||||
{
|
{
|
||||||
logf("Failed to open rootdir");
|
logf("Failed to open rootdir");
|
||||||
|
|
@ -1082,11 +1081,11 @@ void dircache_add_file(const char *path, long startcluster)
|
||||||
entry->startcluster = startcluster;
|
entry->startcluster = startcluster;
|
||||||
}
|
}
|
||||||
|
|
||||||
DIRCACHED* opendir_cached(const char* name)
|
DIR_CACHED* opendir_cached(const char* name)
|
||||||
{
|
{
|
||||||
struct dircache_entry *cache_entry;
|
struct dircache_entry *cache_entry;
|
||||||
int dd;
|
int dd;
|
||||||
DIRCACHED* pdir = opendirs;
|
DIR_CACHED* pdir = opendirs;
|
||||||
|
|
||||||
if ( name[0] != '/' )
|
if ( name[0] != '/' )
|
||||||
{
|
{
|
||||||
|
|
@ -1108,7 +1107,7 @@ DIRCACHED* opendir_cached(const char* name)
|
||||||
|
|
||||||
if (!dircache_initialized)
|
if (!dircache_initialized)
|
||||||
{
|
{
|
||||||
pdir->regulardir = opendir(name);
|
pdir->regulardir = opendir_uncached(name);
|
||||||
if (!pdir->regulardir)
|
if (!pdir->regulardir)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
@ -1130,9 +1129,9 @@ DIRCACHED* opendir_cached(const char* name)
|
||||||
return pdir;
|
return pdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct dircache_entry* readdir_cached(DIRCACHED* dir)
|
struct dircache_entry* readdir_cached(DIR_CACHED* dir)
|
||||||
{
|
{
|
||||||
struct dirent *regentry;
|
struct dirent_uncached *regentry;
|
||||||
struct dircache_entry *ce;
|
struct dircache_entry *ce;
|
||||||
|
|
||||||
if (!dir->busy)
|
if (!dir->busy)
|
||||||
|
|
@ -1140,7 +1139,7 @@ struct dircache_entry* readdir_cached(DIRCACHED* dir)
|
||||||
|
|
||||||
if (dir->regulardir != NULL)
|
if (dir->regulardir != NULL)
|
||||||
{
|
{
|
||||||
regentry = readdir(dir->regulardir);
|
regentry = readdir_uncached(dir->regulardir);
|
||||||
if (regentry == NULL)
|
if (regentry == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
@ -1181,15 +1180,30 @@ struct dircache_entry* readdir_cached(DIRCACHED* dir)
|
||||||
return &dir->secondary_entry;
|
return &dir->secondary_entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
int closedir_cached(DIRCACHED* dir)
|
int closedir_cached(DIR_CACHED* dir)
|
||||||
{
|
{
|
||||||
if (!dir->busy)
|
if (!dir->busy)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
dir->busy=false;
|
dir->busy=false;
|
||||||
if (dir->regulardir != NULL)
|
if (dir->regulardir != NULL)
|
||||||
return closedir(dir->regulardir);
|
return closedir_uncached(dir->regulardir);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int mkdir_cached(const char *name)
|
||||||
|
{
|
||||||
|
int rc=mkdir_uncached(name);
|
||||||
|
if (rc >= 0)
|
||||||
|
dircache_mkdir(name);
|
||||||
|
return(rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
int rmdir_cached(const char* name)
|
||||||
|
{
|
||||||
|
int rc=rmdir_uncached(name);
|
||||||
|
if(rc>=0)
|
||||||
|
dircache_rmdir(name);
|
||||||
|
return(rc);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@
|
||||||
#include "fat.h"
|
#include "fat.h"
|
||||||
#ifdef HAVE_HOTSWAP
|
#ifdef HAVE_HOTSWAP
|
||||||
#include "hotswap.h"
|
#include "hotswap.h"
|
||||||
|
#include "dir.h" /* for release_dirs() */
|
||||||
|
#include "file.h" /* for release_files() */
|
||||||
#endif
|
#endif
|
||||||
#include "file.h" /* for release_dirs() */
|
|
||||||
#include "dir.h" /* for release_files() */
|
|
||||||
#include "disk.h"
|
#include "disk.h"
|
||||||
|
|
||||||
/* Partition table entry layout:
|
/* Partition table entry layout:
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "fat.h"
|
#include "fat.h"
|
||||||
#include "dir.h"
|
#include "dir_uncached.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "dircache.h"
|
#include "dircache.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
@ -59,8 +59,8 @@ int creat(const char *pathname)
|
||||||
|
|
||||||
static int open_internal(const char* pathname, int flags, bool use_cache)
|
static int open_internal(const char* pathname, int flags, bool use_cache)
|
||||||
{
|
{
|
||||||
DIR* dir;
|
DIR_UNCACHED* dir;
|
||||||
struct dirent* entry;
|
struct dirent_uncached* entry;
|
||||||
int fd;
|
int fd;
|
||||||
char pathnamecopy[MAX_PATH];
|
char pathnamecopy[MAX_PATH];
|
||||||
char* name;
|
char* name;
|
||||||
|
|
@ -134,12 +134,12 @@ static int open_internal(const char* pathname, int flags, bool use_cache)
|
||||||
name=strrchr(pathnamecopy+1,'/');
|
name=strrchr(pathnamecopy+1,'/');
|
||||||
if ( name ) {
|
if ( name ) {
|
||||||
*name = 0;
|
*name = 0;
|
||||||
dir = opendir(pathnamecopy);
|
dir = opendir_uncached(pathnamecopy);
|
||||||
*name = '/';
|
*name = '/';
|
||||||
name++;
|
name++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dir = opendir("/");
|
dir = opendir_uncached("/");
|
||||||
name = pathnamecopy+1;
|
name = pathnamecopy+1;
|
||||||
}
|
}
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
|
|
@ -153,12 +153,12 @@ static int open_internal(const char* pathname, int flags, bool use_cache)
|
||||||
DEBUGF("Empty file name\n");
|
DEBUGF("Empty file name\n");
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
file->busy = false;
|
file->busy = false;
|
||||||
closedir(dir);
|
closedir_uncached(dir);
|
||||||
return -5;
|
return -5;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* scan dir for name */
|
/* scan dir for name */
|
||||||
while ((entry = readdir(dir))) {
|
while ((entry = readdir_uncached(dir))) {
|
||||||
if ( !strcasecmp(name, entry->d_name) ) {
|
if ( !strcasecmp(name, entry->d_name) ) {
|
||||||
fat_open(IF_MV2(dir->fatdir.file.volume,)
|
fat_open(IF_MV2(dir->fatdir.file.volume,)
|
||||||
entry->startcluster,
|
entry->startcluster,
|
||||||
|
|
@ -180,7 +180,7 @@ static int open_internal(const char* pathname, int flags, bool use_cache)
|
||||||
DEBUGF("Couldn't create %s in %s\n",name,pathnamecopy);
|
DEBUGF("Couldn't create %s in %s\n",name,pathnamecopy);
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
file->busy = false;
|
file->busy = false;
|
||||||
closedir(dir);
|
closedir_uncached(dir);
|
||||||
return rc * 10 - 6;
|
return rc * 10 - 6;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_DIRCACHE
|
#ifdef HAVE_DIRCACHE
|
||||||
|
|
@ -193,18 +193,18 @@ static int open_internal(const char* pathname, int flags, bool use_cache)
|
||||||
DEBUGF("Couldn't find %s in %s\n",name,pathnamecopy);
|
DEBUGF("Couldn't find %s in %s\n",name,pathnamecopy);
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
file->busy = false;
|
file->busy = false;
|
||||||
closedir(dir);
|
closedir_uncached(dir);
|
||||||
return -7;
|
return -7;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(file->write && (file->attr & FAT_ATTR_DIRECTORY)) {
|
if(file->write && (file->attr & FAT_ATTR_DIRECTORY)) {
|
||||||
errno = EISDIR;
|
errno = EISDIR;
|
||||||
file->busy = false;
|
file->busy = false;
|
||||||
closedir(dir);
|
closedir_uncached(dir);
|
||||||
return -8;
|
return -8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir_uncached(dir);
|
||||||
|
|
||||||
file->cacheoffset = -1;
|
file->cacheoffset = -1;
|
||||||
file->fileoffset = 0;
|
file->fileoffset = 0;
|
||||||
|
|
@ -327,7 +327,7 @@ int remove(const char* name)
|
||||||
int rename(const char* path, const char* newpath)
|
int rename(const char* path, const char* newpath)
|
||||||
{
|
{
|
||||||
int rc, fd;
|
int rc, fd;
|
||||||
DIR* dir;
|
DIR_UNCACHED* dir;
|
||||||
char* nameptr;
|
char* nameptr;
|
||||||
char* dirptr;
|
char* dirptr;
|
||||||
struct filedesc* file;
|
struct filedesc* file;
|
||||||
|
|
@ -371,7 +371,7 @@ int rename(const char* path, const char* newpath)
|
||||||
dirptr = "/";
|
dirptr = "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
dir = opendir(dirptr);
|
dir = opendir_uncached(dirptr);
|
||||||
if(!dir)
|
if(!dir)
|
||||||
return - 5;
|
return - 5;
|
||||||
|
|
||||||
|
|
@ -401,7 +401,7 @@ int rename(const char* path, const char* newpath)
|
||||||
return rc * 10 - 8;
|
return rc * 10 - 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = closedir(dir);
|
rc = closedir_uncached(dir);
|
||||||
if (rc<0) {
|
if (rc<0) {
|
||||||
errno = EIO;
|
errno = EIO;
|
||||||
return rc * 10 - 9;
|
return rc * 10 - 9;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
* \/ \/ \/ \/ \/
|
* \/ \/ \/ \/ \/
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* Copyright (C) 2002 by Björn Stenberg
|
* Copyright (C) 2007 by Kévin Ferrare
|
||||||
*
|
*
|
||||||
* All files in this archive are subject to the GNU General Public License.
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
* See the file COPYING in the source tree root for full license agreement.
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
|
@ -16,76 +16,30 @@
|
||||||
* KIND, either express or implied.
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef _DIR_H_
|
#ifndef _DIR_H_
|
||||||
#define _DIR_H_
|
#define _DIR_H_
|
||||||
|
|
||||||
#include <stdbool.h>
|
#ifdef HAVE_DIRCACHE
|
||||||
#include "file.h"
|
# include "dircache.h"
|
||||||
|
# define DIR DIR_CACHED
|
||||||
#define ATTR_READ_ONLY 0x01
|
# define dirent dircache_entry
|
||||||
#define ATTR_HIDDEN 0x02
|
# define opendir opendir_cached
|
||||||
#define ATTR_SYSTEM 0x04
|
# define closedir closedir_cached
|
||||||
#define ATTR_VOLUME_ID 0x08
|
# define readdir readdir_cached
|
||||||
#define ATTR_DIRECTORY 0x10
|
# define closedir closedir_cached
|
||||||
#define ATTR_ARCHIVE 0x20
|
# define mkdir mkdir_cached
|
||||||
#define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */
|
# define rmdir rmdir_cached
|
||||||
|
|
||||||
#ifdef SIMULATOR
|
|
||||||
#define dirent sim_dirent
|
|
||||||
#define DIR SIM_DIR
|
|
||||||
#define opendir(x) sim_opendir(x)
|
|
||||||
#define readdir(x) sim_readdir(x)
|
|
||||||
#define closedir(x) sim_closedir(x)
|
|
||||||
#define mkdir(x) sim_mkdir(x)
|
|
||||||
#define rmdir(x) sim_rmdir(x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DIRENT_DEFINED
|
|
||||||
|
|
||||||
struct dirent {
|
|
||||||
unsigned char d_name[MAX_PATH];
|
|
||||||
int attribute;
|
|
||||||
long size;
|
|
||||||
long startcluster;
|
|
||||||
unsigned short wrtdate; /* Last write date */
|
|
||||||
unsigned short wrttime; /* Last write time */
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "fat.h"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
#ifndef SIMULATOR
|
|
||||||
bool busy;
|
|
||||||
long startcluster;
|
|
||||||
struct fat_dir fatdir;
|
|
||||||
struct fat_dir parent_dir;
|
|
||||||
struct dirent theent;
|
|
||||||
#ifdef HAVE_MULTIVOLUME
|
|
||||||
int volumecounter; /* running counter for faked volume entries */
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
/* simulator: */
|
#include "dir_uncached.h"
|
||||||
void *dir; /* actually a DIR* dir */
|
# define DIR DIR_UNCACHED
|
||||||
char *name;
|
# define dirent dirent_uncached
|
||||||
#endif
|
# define opendir opendir_uncached
|
||||||
} DIR;
|
# define closedir closedir_uncached
|
||||||
|
# define readdir readdir_uncached
|
||||||
#ifdef HAVE_HOTSWAP
|
# define closedir closedir_uncached
|
||||||
char *get_volume_name(int volume);
|
# define mkdir mkdir_uncached
|
||||||
|
# define rmdir rmdir_uncached
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DIRFUNCTIONS_DEFINED
|
|
||||||
|
|
||||||
extern DIR* opendir(const char* name);
|
|
||||||
extern int closedir(DIR* dir);
|
|
||||||
extern int mkdir(const char* name);
|
|
||||||
extern int rmdir(const char* name);
|
|
||||||
|
|
||||||
extern struct dirent* readdir(DIR* dir);
|
|
||||||
|
|
||||||
extern int release_dirs(int volume);
|
|
||||||
|
|
||||||
#endif /* DIRFUNCTIONS_DEFINED */
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
91
firmware/include/dir_uncached.h
Normal file
91
firmware/include/dir_uncached.h
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id: dir.h 13741 2007-06-30 02:08:27Z jethead71 $
|
||||||
|
*
|
||||||
|
* Copyright (C) 2002 by Björn Stenberg
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#ifndef _DIR_UNCACHED_H_
|
||||||
|
#define _DIR_UNCACHED_H_
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "file.h"
|
||||||
|
|
||||||
|
#define ATTR_READ_ONLY 0x01
|
||||||
|
#define ATTR_HIDDEN 0x02
|
||||||
|
#define ATTR_SYSTEM 0x04
|
||||||
|
#define ATTR_VOLUME_ID 0x08
|
||||||
|
#define ATTR_DIRECTORY 0x10
|
||||||
|
#define ATTR_ARCHIVE 0x20
|
||||||
|
#define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */
|
||||||
|
|
||||||
|
#ifdef SIMULATOR
|
||||||
|
#define dirent_uncached sim_dirent
|
||||||
|
#define DIR_UNCACHED SIM_DIR
|
||||||
|
#define opendir_uncached sim_opendir
|
||||||
|
#define readdir_uncached sim_readdir
|
||||||
|
#define closedir_uncached sim_closedir
|
||||||
|
#define mkdir_uncached sim_mkdir
|
||||||
|
#define rmdir_uncached sim_rmdir
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DIRENT_DEFINED
|
||||||
|
|
||||||
|
struct dirent_uncached {
|
||||||
|
unsigned char d_name[MAX_PATH];
|
||||||
|
int attribute;
|
||||||
|
long size;
|
||||||
|
long startcluster;
|
||||||
|
unsigned short wrtdate; /* Last write date */
|
||||||
|
unsigned short wrttime; /* Last write time */
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "fat.h"
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
#ifndef SIMULATOR
|
||||||
|
bool busy;
|
||||||
|
long startcluster;
|
||||||
|
struct fat_dir fatdir;
|
||||||
|
struct fat_dir parent_dir;
|
||||||
|
struct dirent_uncached theent;
|
||||||
|
#ifdef HAVE_MULTIVOLUME
|
||||||
|
int volumecounter; /* running counter for faked volume entries */
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
/* simulator: */
|
||||||
|
void *dir; /* actually a DIR* dir */
|
||||||
|
char *name;
|
||||||
|
#endif
|
||||||
|
} DIR_UNCACHED;
|
||||||
|
|
||||||
|
#ifdef HAVE_HOTSWAP
|
||||||
|
char *get_volume_name(int volume);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DIRFUNCTIONS_DEFINED
|
||||||
|
|
||||||
|
extern DIR_UNCACHED* opendir_uncached(const char* name);
|
||||||
|
extern int closedir_uncached(DIR_UNCACHED* dir);
|
||||||
|
extern int mkdir_uncached(const char* name);
|
||||||
|
extern int rmdir_uncached(const char* name);
|
||||||
|
|
||||||
|
extern struct dirent_uncached* readdir_uncached(DIR_UNCACHED* dir);
|
||||||
|
|
||||||
|
extern int release_dirs(int volume);
|
||||||
|
|
||||||
|
#endif /* DIRFUNCTIONS_DEFINED */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#ifndef _DIRCACHE_H
|
#ifndef _DIRCACHE_H
|
||||||
#define _DIRCACHE_H
|
#define _DIRCACHE_H
|
||||||
|
|
||||||
#include "dir.h"
|
#include "dir_uncached.h"
|
||||||
|
|
||||||
#ifdef HAVE_DIRCACHE
|
#ifdef HAVE_DIRCACHE
|
||||||
|
|
||||||
|
|
@ -34,8 +34,8 @@ struct travel_data {
|
||||||
struct dircache_entry *ce;
|
struct dircache_entry *ce;
|
||||||
struct dircache_entry *down_entry;
|
struct dircache_entry *down_entry;
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
DIR *dir, *newdir;
|
DIR_UNCACHED *dir, *newdir;
|
||||||
struct dirent *entry;
|
struct dirent_uncached *entry;
|
||||||
#else
|
#else
|
||||||
struct fat_dir *dir;
|
struct fat_dir *dir;
|
||||||
struct fat_dir newdir;
|
struct fat_dir newdir;
|
||||||
|
|
@ -77,8 +77,8 @@ typedef struct {
|
||||||
struct dircache_entry *entry;
|
struct dircache_entry *entry;
|
||||||
struct dircache_entry *internal_entry;
|
struct dircache_entry *internal_entry;
|
||||||
struct dircache_entry secondary_entry;
|
struct dircache_entry secondary_entry;
|
||||||
DIR *regulardir;
|
DIR_UNCACHED *regulardir;
|
||||||
} DIRCACHED;
|
} DIR_CACHED;
|
||||||
|
|
||||||
void dircache_init(void);
|
void dircache_init(void);
|
||||||
int dircache_load(void);
|
int dircache_load(void);
|
||||||
|
|
@ -103,17 +103,11 @@ void dircache_remove(const char *name);
|
||||||
void dircache_rename(const char *oldpath, const char *newpath);
|
void dircache_rename(const char *oldpath, const char *newpath);
|
||||||
void dircache_add_file(const char *path, long startcluster);
|
void dircache_add_file(const char *path, long startcluster);
|
||||||
|
|
||||||
DIRCACHED* opendir_cached(const char* name);
|
DIR_CACHED* opendir_cached(const char* name);
|
||||||
struct dircache_entry* readdir_cached(DIRCACHED* dir);
|
struct dircache_entry* readdir_cached(DIR_CACHED* dir);
|
||||||
int closedir_cached(DIRCACHED *dir);
|
int closedir_cached(DIR_CACHED *dir);
|
||||||
|
int mkdir_cached(const char *name);
|
||||||
#else /* HAVE_DIRCACHE */
|
int rmdir_cached(const char* name);
|
||||||
# define DIRCACHED DIR
|
|
||||||
# define dircache_entry dirent
|
|
||||||
# define opendir_cached opendir
|
|
||||||
# define closedir_cached closedir
|
|
||||||
# define readdir_cached readdir
|
|
||||||
# define closedir_cached closedir
|
|
||||||
#endif /* !HAVE_DIRCACHE */
|
#endif /* !HAVE_DIRCACHE */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue