X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=direct%2Fyaffscfg2k.c;h=6d5f542fc4b0d0754a959a86b523fcde770a0453;hb=2f1bf981f055716660bbd10cfdd391b69f074f5e;hp=abc6a21dcbdd1bc667e4642c1c7bedf9f9222a57;hpb=170ea32c52fd2d9b7cbda9b169ad44038b1d15cf;p=yaffs2.git diff --git a/direct/yaffscfg2k.c b/direct/yaffscfg2k.c index abc6a21..6d5f542 100644 --- a/direct/yaffscfg2k.c +++ b/direct/yaffscfg2k.c @@ -9,7 +9,6 @@ * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. - * */ /* @@ -30,11 +29,14 @@ unsigned yaffs_traceMask = YAFFS_TRACE_SCAN | YAFFS_TRACE_GC | YAFFS_TRACE_GC_DETAIL | - YAFFS_TRACE_WRITE | YAFFS_TRACE_ERASE | + YAFFS_TRACE_ERASE | YAFFS_TRACE_TRACING | YAFFS_TRACE_ALLOCATE | YAFFS_TRACE_CHECKPOINT | YAFFS_TRACE_BAD_BLOCKS | + YAFFS_TRACE_VERIFY | + YAFFS_TRACE_VERIFY_NAND | + YAFFS_TRACE_VERIFY_FULL | // (~0) | 0; @@ -60,6 +62,30 @@ __u32 yaffsfs_CurrentTime(void) return 0; } + +static int yaffs_kill_alloc = 0; +static size_t total_malloced = 0; +static size_t malloc_limit = 0 & 6000000; + +void *yaffs_malloc(size_t size) +{ + size_t this; + if(yaffs_kill_alloc) + return NULL; + if(malloc_limit && malloc_limit <(total_malloced + size) ) + return NULL; + + this = malloc(size); + if(this) + total_malloced += size; + return this; +} + +void yaffs_free(void *ptr) +{ + free(ptr); +} + void yaffsfs_LocalInitialisation(void) { // Define locking semaphore.