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_fileem2k.h"
19 #include "yaffs_nandemul2k.h"
20 #include "yaffs_norif1.h"
21 #include "yaffs_trace.h"
27 static int yaffsfs_lastError;
29 void yaffsfs_SetError(int err)
31 //Do whatever to set error
32 yaffsfs_lastError = err;
35 int yaffsfs_GetLastError(void)
37 return yaffsfs_lastError;
40 int yaffsfs_CheckMemRegion(const void *addr, size_t size, int writeable)
48 #ifdef CONFIG_YAFFS_USE_PTHREADS
50 static pthread_mutex_t mutex1;
53 void yaffsfs_Lock(void)
55 pthread_mutex_lock( &mutex1 );
58 void yaffsfs_Unlock(void)
60 pthread_mutex_unlock( &mutex1 );
63 void yaffsfs_LockInit(void)
65 pthread_mutex_init( &mutex1, NULL);
70 void yaffsfs_Lock(void)
74 void yaffsfs_Unlock(void)
78 void yaffsfs_LockInit(void)
83 u32 yaffsfs_CurrentTime(void)
89 static int yaffs_kill_alloc = 0;
90 static size_t total_malloced = 0;
91 static size_t malloc_limit = 0 & 6000000;
93 void *yaffsfs_malloc(size_t size)
98 if(malloc_limit && malloc_limit <(total_malloced + size) )
103 total_malloced += size;
107 void yaffsfs_free(void *ptr)
112 void yaffsfs_OSInitialisation(void)
118 void yaffs_bug_fn(const char *file_name, int line_no)
120 printf("yaffs bug detected %s:%d\n",