1
0
Fork 0
forked from len0rd/rockbox

Dircache: Change internal cache layout.

The dircache_entry structs are now allocated subsequently from the front, allowing to treat them as an array.  The d_names are allocated from the back (in reverse order, growing downwards).
This allows the cache to be moved around (needed for my buflib gsoc project). It is utilized when loading the cache from disk (on the h100), now the pointer to the cache begin doesn't need to be the same across reboots anymore.

This should save a bit memory usage, since there's no need for aligning padding bytes after d_names anymore.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30036 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2011-06-20 20:12:30 +00:00
parent b67f4a1824
commit 52abbb186d
2 changed files with 170 additions and 64 deletions

View file

@ -47,13 +47,14 @@ struct travel_data {
int pathpos;
};
#define DIRCACHE_MAGIC 0x00d0c0a0
#define DIRCACHE_MAGIC 0x00d0c0a1
struct dircache_maindata {
long magic;
long size;
long entry_count;
long appflags;
struct dircache_entry *root_entry;
char *d_names_start;
};
#define MAX_PENDING_BINDINGS 2