From d8ac6074184ffc21c4da8c594df72ee42aa23df2 Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Wed, 2 Aug 2006 17:39:34 +0000 Subject: Tagcache: Fixed runtime stats not being gathered when tagcache is kept on disk. Initial attempt to make tagcache thread safe. Replaced a few direct buffer allocations with buffer_alloc from tagcache and dircache where possible. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10415 a1c6a512-1295-4272-9138-f99709370657 --- firmware/common/dircache.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'firmware') diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c index 7599c1b6c5..6167aa3933 100644 --- a/firmware/common/dircache.c +++ b/firmware/common/dircache.c @@ -623,14 +623,10 @@ int dircache_build(int last_size) return 2; } - dircache_root = (struct dircache_entry *)(((long)audiobuf & ~0x03) + 0x04); - if (last_size > DIRCACHE_RESERVE && last_size < DIRCACHE_LIMIT ) { allocated_size = last_size + DIRCACHE_RESERVE; - - /* We have to long align the audiobuf to keep the buffer access fast. */ - audiobuf += (long)((allocated_size & ~0x03) + 0x04); + dircache_root = (struct dircache_entry *)buffer_alloc(allocated_size); thread_enabled = true; /* Start a transparent rebuild. */ @@ -638,6 +634,8 @@ int dircache_build(int last_size) return 3; } + dircache_root = (struct dircache_entry *)(((long)audiobuf & ~0x03) + 0x04); + /* Start a non-transparent rebuild. */ return dircache_do_rebuild(); } @@ -672,8 +670,7 @@ void dircache_init(void) memset(opendirs, 0, sizeof(opendirs)); for (i = 0; i < MAX_OPEN_DIRS; i++) { - opendirs[i].secondary_entry.d_name = audiobuf; - audiobuf += MAX_PATH; + opendirs[i].secondary_entry.d_name = buffer_alloc(MAX_PATH); } queue_init(&dircache_queue); -- cgit v1.2.3