summaryrefslogtreecommitdiff
path: root/firmware/include/dircache.h
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-06-20 20:12:42 +0000
committerThomas Martitz <kugel@rockbox.org>2011-06-20 20:12:42 +0000
commitaf7aaae478b5c7382ae5505abab233a97aa3e658 (patch)
tree566d2e728aefb9f0e6b19edfd3519bf2826339e3 /firmware/include/dircache.h
parent0b9c57d33e59a26b1f341632b990aff0dffd0fcb (diff)
downloadrockbox-af7aaae478b5c7382ae5505abab233a97aa3e658.tar.gz
rockbox-af7aaae478b5c7382ae5505abab233a97aa3e658.zip
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
Diffstat (limited to 'firmware/include/dircache.h')
-rw-r--r--firmware/include/dircache.h26
1 files changed, 7 insertions, 19 deletions
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 {
47 int pathpos; 47 int pathpos;
48}; 48};
49 49
50#define MAX_PENDING_BINDINGS 2
51struct fdbind_queue {
52 char path[MAX_PATH];
53 int fd;
54};
55
56/* Exported structures. */
57struct dircache_entry {
58 struct dirinfo info;
59 struct dircache_entry *next;
60 struct dircache_entry *up;
61 struct dircache_entry *down;
62 long startcluster;
63 char *d_name;
64};
65
66struct dirent_cached { 50struct dirent_cached {
67 struct dirinfo info; 51 struct dirinfo info;
68 char *d_name; 52 char *d_name;
@@ -72,7 +56,7 @@ struct dirent_cached {
72typedef struct { 56typedef struct {
73 bool busy; 57 bool busy;
74 struct dirent_cached theent; /* .attribute is set to -1 on init(opendir) */ 58 struct dirent_cached theent; /* .attribute is set to -1 on init(opendir) */
75 struct dircache_entry *internal_entry; /* the current entry in the directory */ 59 int internal_entry; /* the current entry in the directory */
76 DIR_UNCACHED *regulardir; 60 DIR_UNCACHED *regulardir;
77} DIR_CACHED; 61} DIR_CACHED;
78 62
@@ -90,8 +74,12 @@ int dircache_get_cache_size(void);
90int dircache_get_reserve_used(void); 74int dircache_get_reserve_used(void);
91int dircache_get_build_ticks(void); 75int dircache_get_build_ticks(void);
92void dircache_disable(void); 76void dircache_disable(void);
93const struct dircache_entry *dircache_get_entry_ptr(const char *filename); 77int dircache_get_entry_id(const char *filename);
94size_t dircache_copy_path(const struct dircache_entry *entry, char *buf, size_t size); 78size_t dircache_copy_path(int index, char *buf, size_t size);
79
80/* the next two are internal for file.c */
81long _dircache_get_entry_startcluster(int id);
82struct dirinfo* _dircache_get_entry_dirinfo(int id);
95 83
96void dircache_bind(int fd, const char *path); 84void dircache_bind(int fd, const char *path);
97void dircache_update_filesize(int fd, long newsize, long startcluster); 85void dircache_update_filesize(int fd, long newsize, long startcluster);