From af7aaae478b5c7382ae5505abab233a97aa3e658 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 20 Jun 2011 20:12:42 +0000 Subject: Dircache: Don't expose struct dircache_entry and pointers into the cache, use IDs instead. Only integer IDs are exposed from dircache with this. This way the cache is isolated from other modules. This is needed for my buflib gsoc project. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30038 a1c6a512-1295-4272-9138-f99709370657 --- firmware/include/dircache.h | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'firmware/include/dircache.h') diff --git a/firmware/include/dircache.h b/firmware/include/dircache.h index 908165cf3c..585bb10fbc 100644 --- a/firmware/include/dircache.h +++ b/firmware/include/dircache.h @@ -47,22 +47,6 @@ struct travel_data { int pathpos; }; -#define MAX_PENDING_BINDINGS 2 -struct fdbind_queue { - char path[MAX_PATH]; - int fd; -}; - -/* Exported structures. */ -struct dircache_entry { - struct dirinfo info; - struct dircache_entry *next; - struct dircache_entry *up; - struct dircache_entry *down; - long startcluster; - char *d_name; -}; - struct dirent_cached { struct dirinfo info; char *d_name; @@ -72,7 +56,7 @@ struct dirent_cached { typedef struct { bool busy; struct dirent_cached theent; /* .attribute is set to -1 on init(opendir) */ - struct dircache_entry *internal_entry; /* the current entry in the directory */ + int internal_entry; /* the current entry in the directory */ DIR_UNCACHED *regulardir; } DIR_CACHED; @@ -90,8 +74,12 @@ int dircache_get_cache_size(void); int dircache_get_reserve_used(void); int dircache_get_build_ticks(void); void dircache_disable(void); -const struct dircache_entry *dircache_get_entry_ptr(const char *filename); -size_t dircache_copy_path(const struct dircache_entry *entry, char *buf, size_t size); +int dircache_get_entry_id(const char *filename); +size_t dircache_copy_path(int index, char *buf, size_t size); + +/* the next two are internal for file.c */ +long _dircache_get_entry_startcluster(int id); +struct dirinfo* _dircache_get_entry_dirinfo(int id); void dircache_bind(int fd, const char *path); void dircache_update_filesize(int fd, long newsize, long startcluster); -- cgit v1.2.3