2 * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
4 * Copyright (C) 2002-2010 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;
41 #ifdef CONFIG_YAFFS_USE_PTHREADS
43 static pthread_mutex_t mutex1;
46 void yaffsfs_Lock(void)
48 pthread_mutex_lock( &mutex1 );
51 void yaffsfs_Unlock(void)
53 pthread_mutex_unlock( &mutex1 );
56 void yaffsfs_LockInit(void)
58 pthread_mutex_init( &mutex1, NULL);
63 void yaffsfs_Lock(void)
67 void yaffsfs_Unlock(void)
71 void yaffsfs_LockInit(void)
76 u32 yaffsfs_CurrentTime(void)
82 static int yaffs_kill_alloc = 0;
83 static size_t total_malloced = 0;
84 static size_t malloc_limit = 0 & 6000000;
86 void *yaffs_malloc(size_t size)
91 if(malloc_limit && malloc_limit <(total_malloced + size) )
96 total_malloced += size;
100 void yaffs_free(void *ptr)
105 void yaffsfs_OSInitialisation(void)