Merge branch 'master' of ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2
authorCharles Manning <cdhmanning@gmail.com>
Sun, 28 Nov 2010 21:57:40 +0000 (10:57 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Sun, 28 Nov 2010 21:57:40 +0000 (10:57 +1300)
direct/basic-test/Makefile
direct/basic-test/yaffs_osglue.c [new file with mode: 0644]
direct/basic-test/yaffscfg2k.c
direct/basic-test/yaffsnewcfg.c
direct/python/Makefile
direct/tests/Makefile
direct/timothy_tests/quick_tests/Makefile
direct/yaffs_osglue.h [moved from direct/yaffs_malloc.h with 64% similarity]
direct/yaffscfg.h
direct/ydirectenv.h

index 2c558f0732a5e253a76d6d8e0bb3f6e83d150cae..a4207aac9beaadc1c3a88baa5ce35d9758665482 100644 (file)
@@ -30,7 +30,8 @@ CFLAGS+=   -Werror=strict-prototypes -Werror=missing-parameter-type
 CFLAGS+=   -Werror=redundant-decls -Werror=nested-externs -Winline
 CFLAGS+=   -Werror=undef
 
-COMMONTESTOBJS = yaffscfg2k.o yaffs_ecc.o yaffs_fileem.o yaffs_fileem2k.o yaffsfs.o yaffs_guts.o \
+COMMONTESTOBJS = yaffscfg2k.o yaffs_osglue.o \
+                yaffs_ecc.o yaffs_fileem.o yaffs_fileem2k.o yaffsfs.o yaffs_guts.o \
                 yaffs_packedtags1.o yaffs_ramdisk.o yaffs_ramem2k.o \
                 yaffs_tagscompat.o yaffs_packedtags2.o yaffs_tagsvalidity.o yaffs_nand.o \
                 yaffs_checkptrw.o  yaffs_qsort.o\
@@ -58,7 +59,7 @@ YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscomp
           yaffs_verify.c yaffs_verify.h
 
 YAFFSDIRECTSYMLINKS =  yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\
-                      yaffsfs.h yaffs_malloc.h ydirectenv.h \
+                      yaffsfs.h yaffs_osglue.h ydirectenv.h \
                       yaffs_flashif.c yaffscfg.h yaffs_list.h \
                       yaffs_qsort.c yportenv.h yaffs_attribs.c \
                       yaffs_nandif.c yaffs_nandif.h yaffs_nandemul2k.h
diff --git a/direct/basic-test/yaffs_osglue.c b/direct/basic-test/yaffs_osglue.c
new file mode 100644 (file)
index 0000000..1496383
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
+ *
+ * Copyright (C) 2002-2010 Aleph One Ltd.
+ *   for Toby Churchill Ltd and Brightstar Engineering
+ *
+ * Created by Charles Manning <charles@aleph1.co.uk>
+ *
+ * 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.
+ */
+
+
+#include "yaffscfg.h"
+#include "yaffs_guts.h"
+#include "yaffsfs.h"
+#include "yaffs_fileem2k.h"
+#include "yaffs_nandemul2k.h"
+#include "yaffs_norif1.h"
+#include "yaffs_trace.h"
+
+
+#include <errno.h>
+
+
+static int yaffsfs_lastError;
+
+void yaffsfs_SetError(int err)
+{
+       //Do whatever to set error
+       yaffsfs_lastError = err;
+}
+
+int yaffsfs_GetLastError(void)
+{
+       return yaffsfs_lastError;
+}
+
+
+#ifdef CONFIG_YAFFS_USE_PTHREADS
+#include <pthreads.h>
+static pthread_mutex_t mutex1;
+
+
+void yaffsfs_Lock(void)
+{
+       pthread_mutex_lock( &mutex1 );
+}
+
+void yaffsfs_Unlock(void)
+{
+       pthread_mutex_unlock( &mutex1 );
+}
+
+void yaffsfs_LockInit(void)
+{
+       pthread_mutex_init( &mutex, NULL);
+}
+
+#else
+
+void yaffsfs_Lock(void)
+{
+}
+
+void yaffsfs_Unlock(void)
+{
+}
+
+void yaffsfs_LockInit(void)
+{
+}
+#endif
+
+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)
+{
+       void * 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_OSInitialisation(void)
+{
+       yaffsfs_LockInit();
+}
+
+
index 6f7d2125d6f8ded3eb70890deb1665a2e28f2805..f83aad11e69ad789879193823c9ded641de5aa71 100644 (file)
@@ -25,6 +25,7 @@
 #include "yaffs_nandemul2k.h"
 #include "yaffs_norif1.h"
 #include "yaffs_trace.h"
+#include "yaffs_osglue.h"
 
 
 #include <errno.h>
@@ -43,61 +44,6 @@ unsigned yaffs_trace_mask =
        0;
         
 
-static int yaffsfs_lastError;
-
-void yaffsfs_SetError(int err)
-{
-       //Do whatever to set error
-       yaffsfs_lastError = err;
-}
-
-
-int yaffsfs_GetLastError(void)
-{
-       return yaffsfs_lastError;
-}
-
-void yaffsfs_Lock(void)
-{
-}
-
-void yaffsfs_Unlock(void)
-{
-}
-
-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)
-{
-       void * 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.
-}
 
 // Configuration
 
@@ -114,7 +60,7 @@ int yaffs_start_up(void)
 {
        // Stuff to configure YAFFS
        // Stuff to initialise anything special (eg lock semaphore).
-       yaffsfs_LocalInitialisation();
+       yaffsfs_OSInitialisation();
        
        // Set up devices
        // /ram1   ram, yaffs1
index 60dcf022de6d682c0a242501ad46566896615c3a..5add1e686dd9c249e83a524a4f01628520dbcfe7 100644 (file)
@@ -37,61 +37,6 @@ unsigned yaffs_trace_mask =
        0;
         
 
-static int yaffsfs_lastError;
-
-void yaffsfs_SetError(int err)
-{
-       //Do whatever to set error
-       yaffsfs_lastError = err;
-}
-
-
-int yaffsfs_GetLastError(void)
-{
-       return yaffsfs_lastError;
-}
-
-void yaffsfs_Lock(void)
-{
-}
-
-void yaffsfs_Unlock(void)
-{
-}
-
-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)
-{
-       void * 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.
-}
 
 // Configuration
 
@@ -100,7 +45,7 @@ int yaffs_start_up(void)
 {
        // Stuff to configure YAFFS
        // Stuff to initialise anything special (eg lock semaphore).
-       yaffsfs_LocalInitialisation();
+       yaffsfs_OSInitialisation();
        yramsim_CreateRamSim("yaffs2",1,1000,0,0);
        yramsim_CreateRamSim("p0",0,0x400,1,0xff);
        yramsim_CreateRamSim("p1",0,0x400,1,0);
index 38f8b11420bcd1f957661bfae02811e03f436ad2..ad5b47f5d51b1c468321d3ca91ca55a1a9311af0 100644 (file)
@@ -29,7 +29,8 @@ CFLAGS +=    -O0 -fPIC
 #CFLAGS+=   -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline
 
 
-COMMONTESTOBJS = yaffscfg2k.o yramsim.o yaffs_fileem2k.o\
+COMMONTESTOBJS = yaffscfg2k.o yaffs_osglue.o \
+                yramsim.o yaffs_fileem2k.o\
                 yaffs_nandif.o yaffs_attribs.o \
                 yaffsfs.o  yaffs_ecc.o yaffs_guts.o \
                 yaffs_packedtags1.o yaffs_ramdisk.o yaffs_ramem2k.o \
@@ -60,7 +61,7 @@ YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscomp
           yaffs_verify.c yaffs_verify.h
           
 
-YAFFSDIRECTSYMLINKS =  yaffsfs.c yaffsfs.h yaffscfg.h yaffs_malloc.h ydirectenv.h \
+YAFFSDIRECTSYMLINKS =  yaffsfs.c yaffsfs.h yaffscfg.h yaffs_osglue.h  ydirectenv.h \
                       yaffs_flashif.c yaffs_flashif.h yaffs_flashif2.h yaffs_list.h \
                       yaffs_nandif.c yaffs_nandif.h yaffs_qsort.c yaffs_nandemul2k.h \
                       yportenv.h yaffs_attribs.c
@@ -69,7 +70,7 @@ DIRECTEXTRASYMLINKS =   yaffscfg2k.c yaffs_fileem2k.c yaffs_fileem2k.h\
                         yaffs_fileem.c yaffs_norif1.c yaffs_norif1.h \
                         yaffs_ramdisk.c yaffs_ramdisk.h yaffs_ramem2k.c \
                         yaffsnewcfg.c yramsim.c yramsim.h \
-                        ynorsim.h ynorsim.c
+                        ynorsim.h ynorsim.c yaffs_osglue.c
                                                                         
 SYMLINKS = $(YAFFSSYMLINKS) $(YAFFSDIRECTSYMLINKS) $(DIRECTEXTRASYMLINKS)
 
index 956e34fadf68c9543e3cfbcd354353212c4413e8..bbeb8de68e2d76308b702c57edfda34fe53a0903 100644 (file)
@@ -30,7 +30,8 @@ CFLAGS +=    -Wextra -Wpointer-arith
 #CFLAGS+=   -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline
 
 
-COMMONTESTOBJS = yaffscfg2k.o yaffs_ecc.o yaffs_fileem.o yaffs_fileem2k.o yaffsfs.o yaffs_guts.o \
+COMMONTESTOBJS = yaffscfg2k.o yaffs_osglue.o \
+                yaffs_ecc.o yaffs_fileem.o yaffs_fileem2k.o yaffsfs.o yaffs_guts.o \
                 yaffs_packedtags1.o yaffs_ramdisk.o yaffs_ramem2k.o \
                 yaffs_tagscompat.o yaffs_packedtags2.o yaffs_tagsvalidity.o yaffs_nand.o \
                 yaffs_checkptrw.o  yaffs_qsort.o\
@@ -50,7 +51,7 @@ YAFFSTESTOBJS  = $(COMMONTESTOBJS) yaffs_test.o
 ALLOBJS = $(sort $(YAFFSTESTOBJS))
 
 YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscompat.c yaffs_tagscompat.h \
-          yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h  yaffs_nandemul2k.h \
+          yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h  \
           yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h \
           yaffs_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \
           yaffs_nameval.c yaffs_nameval.h \
@@ -62,7 +63,7 @@ YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscomp
           yaffs_verify.c yaffs_verify.h
 
 YAFFSDIRECTSYMLINKS =  yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\
-                      yaffsfs.h yaffs_malloc.h ydirectenv.h \
+                      yaffsfs.h yaffs_osglue.h ydirectenv.h \
                       yaffs_flashif.c yaffscfg.h yaffs_qsort.c \
                       yaffs_nandemul2k.h yaffs_list.h \
                       yaffs_attribs.c \
@@ -72,7 +73,7 @@ YAFFSDIRECTSYMLINKS =  yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\
 DIRECTEXTRASYMLINKS =  yaffscfg2k.c yaffs_fileem2k.c yaffs_fileem2k.h\
                        yaffs_fileem.c yaffs_norif1.c yaffs_norif1.h \
                        yaffs_ramdisk.c yaffs_ramdisk.h yaffs_ramem2k.c \
-                       ynorsim.h ynorsim.c
+                       ynorsim.h ynorsim.c yaffs_osglue.c
 
 SYMLINKS = $(YAFFSSYMLINKS) $(YAFFSDIRECTSYMLINKS) $(DIRECTEXTRASYMLINKS)
 #all: directtest2k boottest
index 12462b6e8291314563eb00aa3c5218a26a245d66..a6148379c812f49158a9b0194610a3f1a4e5402a 100644 (file)
@@ -30,7 +30,8 @@ CFLAGS +=    -Wextra -Wpointer-arith
 #CFLAGS+=   -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline
 
 
-COMMONTESTOBJS = yaffscfg2k.o yaffs_ecc.o yaffs_fileem.o yaffs_fileem2k.o yaffsfs.o yaffs_guts.o \
+COMMONTESTOBJS = yaffscfg2k.o yaffs_osglue.o \
+                yaffs_ecc.o yaffs_fileem.o yaffs_fileem2k.o yaffsfs.o yaffs_guts.o \
                 yaffs_packedtags1.o yaffs_ramdisk.o yaffs_ramem2k.o \
                 yaffs_tagscompat.o yaffs_packedtags2.o yaffs_tagsvalidity.o yaffs_nand.o \
                 yaffs_checkptrw.o  yaffs_qsort.o\
@@ -107,7 +108,7 @@ PYTHONOBJS = yaffs_error_converter.o
 ALLOBJS = $(sort $(YAFFSTESTOBJS)) $(PYTHONOBJS)
 
 YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscompat.c yaffs_tagscompat.h \
-          yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h  yaffs_nandemul2k.h \
+          yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h \
           yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h \
           yaffs_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \
           yaffs_nameval.c yaffs_nameval.h \
@@ -119,17 +120,17 @@ YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscomp
           yaffs_verify.c yaffs_verify.h
 
 YAFFSDIRECTSYMLINKS =  yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\
-                      yaffsfs.h yaffs_malloc.h ydirectenv.h \
+                      yaffsfs.h ydirectenv.h \
                       yaffs_flashif.c yaffscfg.h yaffs_qsort.c \
                       yaffs_nandemul2k.h yaffs_list.h \
-                      yaffs_attribs.c \
+                      yaffs_attribs.c yaffs_osglue.h \
                       yaffs_nandif.c yaffs_nandif.h yportenv.h
 
 
 DIRECTEXTRASYMLINKS =  yaffscfg2k.c yaffs_fileem2k.c yaffs_fileem2k.h\
                        yaffs_fileem.c yaffs_norif1.c yaffs_norif1.h \
                        yaffs_ramdisk.c yaffs_ramdisk.h yaffs_ramem2k.c \
-                       ynorsim.h ynorsim.c
+                       ynorsim.h ynorsim.c yaffs_osglue.c
 
 SYMLINKS = $(YAFFSSYMLINKS) $(YAFFSDIRECTSYMLINKS) $(DIRECTEXTRASYMLINKS) $(PYTONOSYMLINKS)
 #all: directtest2k boottest
similarity index 64%
rename from direct/yaffs_malloc.h
rename to direct/yaffs_osglue.h
index d0c23479aaada25837d5f6d0d8378fcb08577936..ab05fd4fb0903b535474ebf6c9f243b6bb8c5bad 100644 (file)
  *
  * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
  */
-#ifndef __YAFFS_MALLOC_H__
-#define __YAFFS_MALLOC_H__
 
-#include <stdlib.h>
+/*
+ * Header file for using yaffs in an application via
+ * a direct interface.
+ */
+
+
+#ifndef __YAFFS_OSGLUE_H__
+#define __YAFFS_OSGLUE_H__
+
+
+#include "yportenv.h"
+
+void yaffsfs_Lock(void);
+void yaffsfs_Unlock(void);
+
+u32 yaffsfs_CurrentTime(void);
+
+void yaffsfs_SetError(int err);
+
 void *yaffs_malloc(size_t size); 
 void yaffs_free(void *ptr);
+
+void yaffsfs_OSInitialisation(void);
  
+
 #endif
 
index 42fd78cc9c60d90dba19987d8a868d3399262d32..9157b829095d870c7dc8eee68c1582a971602f1b 100644 (file)
@@ -34,12 +34,5 @@ typedef struct yaffsfs_DeviceConfigurationStruct {
 } yaffsfs_DeviceConfiguration;
 
 
-void yaffsfs_Lock(void);
-void yaffsfs_Unlock(void);
-
-u32 yaffsfs_CurrentTime(void);
-
-void yaffsfs_SetError(int err);
-
 #endif
 
index ee6e8f5a2912d3d56713a1eed42828ee5390c7fa..be80e68c9eec74d2d1653681821db87a3da88b10 100644 (file)
@@ -25,7 +25,7 @@
 #include "stdlib.h"
 #include "stdio.h"
 #include "string.h"
-#include "yaffs_malloc.h"
+#include "yaffs_osglue.h"
 
 #include "assert.h"
 #define YBUG() assert(0)