2 * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
4 * Copyright (C) 2002-2011 Aleph One Ltd.
5 * for Toby Churchill Ltd and Brightstar Engineering
7 * Created by Charles Manning <charles@aleph1.co.uk>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
16 #include "yaffs_guts.h"
18 #include "yaffs_trace.h"
24 static int yaffsfs_lastError;
26 void yaffsfs_SetError(int err)
28 //Do whatever to set error
29 yaffsfs_lastError = err;
32 int yaffsfs_GetLastError(void)
34 return yaffsfs_lastError;
37 int yaffsfs_CheckMemRegion(const void *addr, size_t size, int writeable)
45 #ifdef CONFIG_YAFFS_USE_PTHREADS
47 static pthread_mutex_t mutex1;
50 void yaffsfs_Lock(void)
52 pthread_mutex_lock( &mutex1 );
55 void yaffsfs_Unlock(void)
57 pthread_mutex_unlock( &mutex1 );
60 void yaffsfs_LockInit(void)
62 pthread_mutex_init( &mutex1, NULL);
67 void yaffsfs_Lock(void)
71 void yaffsfs_Unlock(void)
75 void yaffsfs_LockInit(void)
80 u32 yaffsfs_CurrentTime(void)
86 static int yaffs_kill_alloc = 0;
87 static size_t total_malloced = 0;
88 static size_t malloc_limit = 0 & 6000000;
90 void *yaffsfs_malloc(size_t size)
95 if(malloc_limit && malloc_limit <(total_malloced + size) )
100 total_malloced += size;
104 void yaffsfs_free(void *ptr)
109 void yaffsfs_OSInitialisation(void)
115 void yaffs_bug_fn(const char *file_name, int line_no)
117 printf("yaffs bug detected %s:%d\n",