From 730de7a7ad94a0b8211e9d2c20d10a7415b2528f Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 1 Aug 2011 21:59:39 +0200 Subject: [PATCH] Adapt dircache hibernation to core_alloc --- firmware/common/dircache.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c index fad559fae..e73730064 100644 --- a/firmware/common/dircache.c +++ b/firmware/common/dircache.c @@ -573,7 +573,8 @@ int dircache_load(void) } allocated_size = maindata.size + DIRCACHE_RESERVE; - dircache_root = buffer_alloc(allocated_size); + int handle = core_alloc("dircache", allocated_size); + dircache_root = core_get_data(handle); /* needs to be struct-size aligned so that the pointer arithmetic below works */ ALIGN_BUFFER(dircache_root, allocated_size, sizeof(struct dircache_entry)); entry_count = maindata.entry_count; @@ -817,18 +818,6 @@ static void generate_dot_d_names(void) strcpy(dotdot, ".."); } -static int move_callback(int handle, void* current, void* new) -{ - /* TODO */ - (void)handle;(void)current;(void)new; - return BUFLIB_CB_OK; -} - -static struct buflib_callbacks ops = { - .move_callback = move_callback, - .shrink_callback = NULL, -}; - /** * Start scanning the disk to build the dircache. * Either transparent or non-transparent build method is used. @@ -861,7 +850,7 @@ int dircache_build(int last_size) { int handle; allocated_size = last_size + DIRCACHE_RESERVE; - handle = core_alloc_ex("dircache", allocated_size, &ops); + handle = core_alloc("dircache", allocated_size); dircache_root = core_get_data(handle); ALIGN_BUFFER(dircache_root, allocated_size, sizeof(struct dircache_entry)); d_names_start = d_names_end = ((char*)dircache_root)+allocated_size-1; @@ -880,7 +869,7 @@ int dircache_build(int last_size) * after generation the buffer will be compacted with DIRCACHE_RESERVE * free bytes inbetween */ size_t got_size; - int handle = core_alloc_maximum("dircache", &got_size, &ops); + int handle = core_alloc_maximum("dircache", &got_size, NULL); dircache_root = core_get_data(handle); ALIGN_BUFFER(dircache_root, got_size, sizeof(struct dircache_entry)); d_names_start = d_names_end = (char*)dircache_root + got_size - 1; -- 2.11.4.GIT