yaffs: More name changes
authorCharles Manning <cdhmanning@gmail.com>
Mon, 1 Nov 2010 18:56:43 +0000 (07:56 +1300)
committerCharles Manning <cdhmanning@gmail.com>
Mon, 1 Nov 2010 18:56:43 +0000 (07:56 +1300)
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
12 files changed:
Makefile
Makefile.kernel
patch-ker.sh
patches/yaffs_linux_allocator.c [moved from yaffs_linux_allocator.c with 100% similarity]
yaffs_allocator.c
yaffs_guts.c
yaffs_guts.h
yaffs_mtd1f1_single.c [moved from yaffs_mtdif1.c with 87% similarity]
yaffs_mtd1f2_single.c [moved from yaffs_mtdif2.c with 85% similarity]
yaffs_tagscompat.c
yaffs_verify.c
yaffs_vfs_single.c [moved from yaffs_vfs.c with 99% similarity]

index a6b5d14..1be1ab9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,9 +26,9 @@ ifneq ($(KERNELRELEASE),)
 
        obj-m := $(YAFFS_O)
 
-       yaffs2-objs := yaffs_mtdif.o yaffs_mtdif2.o
-       yaffs2-objs += yaffs_mtdif1.o yaffs_packedtags1.o
-       yaffs2-objs += yaffs_ecc.o yaffs_vfs.o yaffs_guts.o
+       yaffs2-objs := yaffs_mtdif.o yaffs_mtdif2_single.o
+       yaffs2-objs += yaffs_mtdif1_single.o yaffs_packedtags1.o
+       yaffs2-objs += yaffs_ecc.o yaffs_vfs_single.o yaffs_guts.o
        yaffs2-objs += yaffs_packedtags2.o
        yaffs2-objs += yaffs_tagscompat.o yaffs_tagsvalidity.o
        yaffs2-objs += yaffs_checkptrw.o yaffs_nand.o
@@ -38,8 +38,8 @@ ifneq ($(KERNELRELEASE),)
        yaffs2-objs += yaffs_yaffs2.o
        yaffs2-objs += yaffs_verify.o
 
-       yaffs2multi-objs := yaffs_mtdif.o yaffs_mtdif2.o
-       yaffs2multi-objs += yaffs_mtdif1.o yaffs_packedtags1.o
+       yaffs2multi-objs := yaffs_mtdif.o yaffs_mtdif2_multi.o
+       yaffs2multi-objs += yaffs_mtdif1_multi.o yaffs_packedtags1.o
        yaffs2multi-objs += yaffs_ecc.o yaffs_vfs_multi.o yaffs_guts.o
        yaffs2multi-objs += yaffs_packedtags2.o
        yaffs2multi-objs += yaffs_tagscompat.o yaffs_tagsvalidity.o
index fbdbd4a..9011f70 100644 (file)
@@ -4,7 +4,7 @@
 
 obj-$(CONFIG_YAFFS_FS) += yaffs.o
 
-yaffs-y := yaffs_ecc.o yaffs_vfs_glue.o yaffs_guts.o yaffs_checkptrw.o
+yaffs-y := yaffs_ecc.o yaffs_vfs.o yaffs_guts.o yaffs_checkptrw.o
 yaffs-y += yaffs_packedtags1.o yaffs_packedtags2.o yaffs_nand.o
 yaffs-y += yaffs_tagscompat.o yaffs_tagsvalidity.o
 yaffs-y += yaffs_mtdif.o yaffs_mtdif1.o yaffs_mtdif2.o
index 5894087..c57c637 100755 (executable)
@@ -53,9 +53,14 @@ else
 fi
 
 if [ $MULTIORSINGLE = m ]; then
-   VFSGLUE="yaffs_vfs_multi.c"
+   VFS_CODE="yaffs_vfs_multi.c"
+   MTD1_CODE="yaffs_mtdif1_multi.c"
+   MTD2_CODE="yaffs_mtdif2_multi.c"
 elif [ $MULTIORSINGLE = s ]; then
-   VFSGLUE="yaffs_vfs.c"
+   VFSGLUE="yaffs_vfs_single.c"
+   MTD1_CODE="yaffs_mtdif1_single.c"
+   MTD2_CODE="yaffs_mtdif2_single.c"
+
    echo ""
    echo "*** Warning ***"
    echo "You have chosen to use the single kernel variant of the yaffs VFS glue code"
@@ -139,6 +144,8 @@ else
    $CPY  $PWD/Makefile.kernel $LINUXDIR/fs/yaffs2/Makefile
    $CPY $PWD/Kconfig $LINUXDIR/fs/yaffs2
    $CPY $PWD/*.c $PWD/*.h  $LINUXDIR/fs/yaffs2
-   rm $LINUXDIR/fs/yaffs2/yaffs_vfs.c $LINUXDIR/fs/yaffs2/yaffs_vfs_multi.c
-   $CPY $PWD/$VFSGLUE $LINUXDIR/fs/yaffs2/yaffs_vfs_glue.c
+   rm $LINUXDIR/fs/yaffs2/yaffs_vfs*.c $LINUXDIR/fs/yaffs2/yaffs_mtdif[12]*.c
+   $CPY $PWD/$VFS_CODE $LINUXDIR/fs/yaffs2/yaffs_vfs.c
+   $CPY $PWD/$MTD1_CODE $LINUXDIR/fs/yaffs2/yaffs_mtdif1.c
+   $CPY $PWD/$MTD2_CODE $LINUXDIR/fs/yaffs2/yaffs_mtdif2.c
 fi
index 024ee2a..66ba5a6 100644 (file)
@@ -82,26 +82,24 @@ struct yaffs_obj_list_struct {
 typedef struct yaffs_obj_list_struct yaffs_obj_list;
 
 
-struct yaffs_AllocatorStruct {
-       int n_tnodesCreated;
-       yaffs_tnode_t *freeTnodes;
-       int nFreeTnodes;
-       yaffs_tnodelist_t *allocatedTnodeList;
+struct yaffs_allocator {
+       int n_tnodes_created;
+       yaffs_tnode_t *free_tnodes;
+       int n_free_tnodes;
+       yaffs_tnodelist_t *alloc_tnode_list;
 
-       int n_objCreated;
-       yaffs_obj_t *freeObjects;
-       int nFreeObjects;
+       int n_obj_created;
+       yaffs_obj_t *free_objs;
+       int n_free_objects;
 
-       yaffs_obj_list *allocated_list;
+       yaffs_obj_list *allocated_obj_list;
 };
 
-typedef struct yaffs_AllocatorStruct yaffs_Allocator;
-
 
 static void yaffs_deinit_raw_tnodes(yaffs_dev_t *dev)
 {
 
-       yaffs_Allocator *allocator = (yaffs_Allocator *)dev->allocator;
+       struct yaffs_allocator *allocator = (struct yaffs_allocator *)dev->allocator;
 
        yaffs_tnodelist_t *tmp;
 
@@ -110,38 +108,38 @@ static void yaffs_deinit_raw_tnodes(yaffs_dev_t *dev)
                return;
        }
 
-       while (allocator->allocatedTnodeList) {
-               tmp = allocator->allocatedTnodeList->next;
+       while (allocator->alloc_tnode_list) {
+               tmp = allocator->alloc_tnode_list->next;
 
-               YFREE(allocator->allocatedTnodeList->tnodes);
-               YFREE(allocator->allocatedTnodeList);
-               allocator->allocatedTnodeList = tmp;
+               YFREE(allocator->alloc_tnode_list->tnodes);
+               YFREE(allocator->alloc_tnode_list);
+               allocator->alloc_tnode_list = tmp;
 
        }
 
-       allocator->freeTnodes = NULL;
-       allocator->nFreeTnodes = 0;
-       allocator->n_tnodesCreated = 0;
+       allocator->free_tnodes = NULL;
+       allocator->n_free_tnodes = 0;
+       allocator->n_tnodes_created = 0;
 }
 
 static void yaffs_init_raw_tnodes(yaffs_dev_t *dev)
 {
-       yaffs_Allocator *allocator = dev->allocator;
+       struct yaffs_allocator *allocator = dev->allocator;
 
        if(allocator){
-               allocator->allocatedTnodeList = NULL;
-               allocator->freeTnodes = NULL;
-               allocator->nFreeTnodes = 0;
-               allocator->n_tnodesCreated = 0;
+               allocator->alloc_tnode_list = NULL;
+               allocator->free_tnodes = NULL;
+               allocator->n_free_tnodes = 0;
+               allocator->n_tnodes_created = 0;
        } else
                YBUG();
 }
 
 static int yaffs_create_tnodes(yaffs_dev_t *dev, int n_tnodes)
 {
-       yaffs_Allocator *allocator = (yaffs_Allocator *)dev->allocator;
+       struct yaffs_allocator *allocator = (struct yaffs_allocator *)dev->allocator;
        int i;
-       yaffs_tnode_t *newTnodes;
+       yaffs_tnode_t *new_tnodes;
        __u8 *mem;
        yaffs_tnode_t *curr;
        yaffs_tnode_t *next;
@@ -158,10 +156,10 @@ static int yaffs_create_tnodes(yaffs_dev_t *dev, int n_tnodes)
 
        /* make these things */
 
-       newTnodes = YMALLOC(n_tnodes * dev->tnode_size);
-       mem = (__u8 *)newTnodes;
+       new_tnodes = YMALLOC(n_tnodes * dev->tnode_size);
+       mem = (__u8 *)new_tnodes;
 
-       if (!newTnodes) {
+       if (!new_tnodes) {
                T(YAFFS_TRACE_ERROR,
                        (TSTR("yaffs: Could not allocate Tnodes" TENDSTR)));
                return YAFFS_FAIL;
@@ -175,11 +173,11 @@ static int yaffs_create_tnodes(yaffs_dev_t *dev, int n_tnodes)
        }
 
        curr = (yaffs_tnode_t *) &mem[(n_tnodes - 1) * dev->tnode_size];
-       curr->internal[0] = allocator->freeTnodes;
-       allocator->freeTnodes = (yaffs_tnode_t *)mem;
+       curr->internal[0] = allocator->free_tnodes;
+       allocator->free_tnodes = (yaffs_tnode_t *)mem;
 
-       allocator->nFreeTnodes += n_tnodes;
-       allocator->n_tnodesCreated += n_tnodes;
+       allocator->n_free_tnodes += n_tnodes;
+       allocator->n_tnodes_created += n_tnodes;
 
        /* Now add this bunch of tnodes to a list for freeing up.
         * NB If we can't add this to the management list it isn't fatal
@@ -193,9 +191,9 @@ static int yaffs_create_tnodes(yaffs_dev_t *dev, int n_tnodes)
                   ("yaffs: Could not add tnodes to management list" TENDSTR)));
                   return YAFFS_FAIL;
        } else {
-               tnl->tnodes = newTnodes;
-               tnl->next = allocator->allocatedTnodeList;
-               allocator->allocatedTnodeList = tnl;
+               tnl->tnodes = new_tnodes;
+               tnl->next = allocator->alloc_tnode_list;
+               allocator->alloc_tnode_list = tnl;
        }
 
        T(YAFFS_TRACE_ALLOCATE, (TSTR("yaffs: Tnodes added" TENDSTR)));
@@ -206,7 +204,7 @@ static int yaffs_create_tnodes(yaffs_dev_t *dev, int n_tnodes)
 
 yaffs_tnode_t *yaffs_alloc_raw_tnode(yaffs_dev_t *dev)
 {
-       yaffs_Allocator *allocator = (yaffs_Allocator *)dev->allocator;
+       struct yaffs_allocator *allocator = (struct yaffs_allocator *)dev->allocator;
        yaffs_tnode_t *tn = NULL;
 
        if(!allocator){
@@ -215,13 +213,13 @@ yaffs_tnode_t *yaffs_alloc_raw_tnode(yaffs_dev_t *dev)
        }
 
        /* If there are none left make more */
-       if (!allocator->freeTnodes)
+       if (!allocator->free_tnodes)
                yaffs_create_tnodes(dev, YAFFS_ALLOCATION_NTNODES);
 
-       if (allocator->freeTnodes) {
-               tn = allocator->freeTnodes;
-               allocator->freeTnodes = allocator->freeTnodes->internal[0];
-               allocator->nFreeTnodes--;
+       if (allocator->free_tnodes) {
+               tn = allocator->free_tnodes;
+               allocator->free_tnodes = allocator->free_tnodes->internal[0];
+               allocator->n_free_tnodes--;
        }
 
        return tn;
@@ -230,7 +228,7 @@ yaffs_tnode_t *yaffs_alloc_raw_tnode(yaffs_dev_t *dev)
 /* FreeTnode frees up a tnode and puts it back on the free list */
 void yaffs_free_raw_tnode(yaffs_dev_t *dev, yaffs_tnode_t *tn)
 {
-       yaffs_Allocator *allocator = dev->allocator;
+       struct yaffs_allocator *allocator = dev->allocator;
 
        if(!allocator){
                YBUG();
@@ -238,9 +236,9 @@ void yaffs_free_raw_tnode(yaffs_dev_t *dev, yaffs_tnode_t *tn)
        }
 
        if (tn) {
-               tn->internal[0] = allocator->freeTnodes;
-               allocator->freeTnodes = tn;
-               allocator->nFreeTnodes++;
+               tn->internal[0] = allocator->free_tnodes;
+               allocator->free_tnodes = tn;
+               allocator->n_free_tnodes++;
        }
        dev->checkpoint_blocks_required = 0; /* force recalculation*/
 }
@@ -249,19 +247,19 @@ void yaffs_free_raw_tnode(yaffs_dev_t *dev, yaffs_tnode_t *tn)
 
 static void yaffs_init_raw_objs(yaffs_dev_t *dev)
 {
-       yaffs_Allocator *allocator = dev->allocator;
+       struct yaffs_allocator *allocator = dev->allocator;
 
        if(allocator) {
-               allocator->allocated_list = NULL;
-               allocator->freeObjects = NULL;
-               allocator->nFreeObjects = 0;
+               allocator->allocated_obj_list = NULL;
+               allocator->free_objs = NULL;
+               allocator->n_free_objects = 0;
        } else
                YBUG();
 }
 
 static void yaffs_deinit_raw_objs(yaffs_dev_t *dev)
 {
-       yaffs_Allocator *allocator = dev->allocator;
+       struct yaffs_allocator *allocator = dev->allocator;
        yaffs_obj_list *tmp;
 
        if(!allocator){
@@ -269,26 +267,26 @@ static void yaffs_deinit_raw_objs(yaffs_dev_t *dev)
                return;
        }
 
-       while (allocator->allocated_list) {
-               tmp = allocator->allocated_list->next;
-               YFREE(allocator->allocated_list->objects);
-               YFREE(allocator->allocated_list);
+       while (allocator->allocated_obj_list) {
+               tmp = allocator->allocated_obj_list->next;
+               YFREE(allocator->allocated_obj_list->objects);
+               YFREE(allocator->allocated_obj_list);
 
-               allocator->allocated_list = tmp;
+               allocator->allocated_obj_list = tmp;
        }
 
-       allocator->freeObjects = NULL;
-       allocator->nFreeObjects = 0;
-       allocator->n_objCreated = 0;
+       allocator->free_objs = NULL;
+       allocator->n_free_objects = 0;
+       allocator->n_obj_created = 0;
 }
 
 
 static int yaffs_create_free_objs(yaffs_dev_t *dev, int n_obj)
 {
-       yaffs_Allocator *allocator = dev->allocator;
+       struct yaffs_allocator *allocator = dev->allocator;
 
        int i;
-       yaffs_obj_t *newObjects;
+       yaffs_obj_t *new_objs;
        yaffs_obj_list *list;
 
        if(!allocator){
@@ -300,13 +298,13 @@ static int yaffs_create_free_objs(yaffs_dev_t *dev, int n_obj)
                return YAFFS_OK;
 
        /* make these things */
-       newObjects = YMALLOC(n_obj * sizeof(yaffs_obj_t));
+       new_objs = YMALLOC(n_obj * sizeof(yaffs_obj_t));
        list = YMALLOC(sizeof(yaffs_obj_list));
 
-       if (!newObjects || !list) {
-               if (newObjects){
-                       YFREE(newObjects);
-                       newObjects = NULL;
+       if (!new_objs || !list) {
+               if (new_objs){
+                       YFREE(new_objs);
+                       new_objs = NULL;
                }
                if (list){
                        YFREE(list);
@@ -319,20 +317,20 @@ static int yaffs_create_free_objs(yaffs_dev_t *dev, int n_obj)
 
        /* Hook them into the free list */
        for (i = 0; i < n_obj - 1; i++) {
-               newObjects[i].siblings.next =
-                               (struct ylist_head *)(&newObjects[i + 1]);
+               new_objs[i].siblings.next =
+                               (struct ylist_head *)(&new_objs[i + 1]);
        }
 
-       newObjects[n_obj - 1].siblings.next = (void *)allocator->freeObjects;
-       allocator->freeObjects = newObjects;
-       allocator->nFreeObjects += n_obj;
-       allocator->n_objCreated += n_obj;
+       new_objs[n_obj - 1].siblings.next = (void *)allocator->free_objs;
+       allocator->free_objs = new_objs;
+       allocator->n_free_objects += n_obj;
+       allocator->n_obj_created += n_obj;
 
        /* Now add this bunch of Objects to a list for freeing up. */
 
-       list->objects = newObjects;
-       list->next = allocator->allocated_list;
-       allocator->allocated_list = list;
+       list->objects = new_objs;
+       list->next = allocator->allocated_obj_list;
+       allocator->allocated_obj_list = list;
 
        return YAFFS_OK;
 }
@@ -340,7 +338,7 @@ static int yaffs_create_free_objs(yaffs_dev_t *dev, int n_obj)
 yaffs_obj_t *yaffs_alloc_raw_obj(yaffs_dev_t *dev)
 {
        yaffs_obj_t *obj = NULL;
-       yaffs_Allocator *allocator = dev->allocator;
+       struct yaffs_allocator *allocator = dev->allocator;
 
        if(!allocator) {
                YBUG();
@@ -348,14 +346,14 @@ yaffs_obj_t *yaffs_alloc_raw_obj(yaffs_dev_t *dev)
        }
 
        /* If there are none left make more */
-       if (!allocator->freeObjects)
+       if (!allocator->free_objs)
                yaffs_create_free_objs(dev, YAFFS_ALLOCATION_NOBJECTS);
 
-       if (allocator->freeObjects) {
-               obj = allocator->freeObjects;
-               allocator->freeObjects =
-                       (yaffs_obj_t *) (allocator->freeObjects->siblings.next);
-               allocator->nFreeObjects--;
+       if (allocator->free_objs) {
+               obj = allocator->free_objs;
+               allocator->free_objs =
+                       (yaffs_obj_t *) (allocator->free_objs->siblings.next);
+               allocator->n_free_objects--;
        }
 
        return obj;
@@ -365,15 +363,15 @@ yaffs_obj_t *yaffs_alloc_raw_obj(yaffs_dev_t *dev)
 void yaffs_free_raw_obj(yaffs_dev_t *dev, yaffs_obj_t *obj)
 {
 
-       yaffs_Allocator *allocator = dev->allocator;
+       struct yaffs_allocator *allocator = dev->allocator;
 
        if(!allocator)
                YBUG();
        else {
                /* Link into the free list. */
-               obj->siblings.next = (struct ylist_head *)(allocator->freeObjects);
-               allocator->freeObjects = obj;
-               allocator->nFreeObjects++;
+               obj->siblings.next = (struct ylist_head *)(allocator->free_objs);
+               allocator->free_objs = obj;
+               allocator->n_free_objects++;
        }
 }
 
@@ -391,10 +389,10 @@ void yaffs_deinit_raw_tnodes_and_objs(yaffs_dev_t *dev)
 
 void yaffs_init_raw_tnodes_and_objs(yaffs_dev_t *dev)
 {
-       yaffs_Allocator *allocator;
+       struct yaffs_allocator *allocator;
 
        if(!dev->allocator){
-               allocator = YMALLOC(sizeof(yaffs_Allocator));
+               allocator = YMALLOC(sizeof(struct yaffs_allocator));
                if(allocator){
                        dev->allocator = allocator;
                        yaffs_init_raw_tnodes(dev);
index eea828a..7a4081d 100644 (file)
@@ -600,11 +600,8 @@ static __u16 yaffs_calc_name_sum(const YCHAR *name)
        if (bname) {
                while ((*bname) && (i < (YAFFS_MAX_NAME_LENGTH/2))) {
 
-#ifdef CONFIG_YAFFS_CASE_INSENSITIVE
-                       sum += yaffs_toupper(*bname) * i;
-#else
-                       sum += (*bname) * i;
-#endif
+                       /* 0x1f mask is case insensitive */
+                       sum += ((*bname) & 0x1f) * i;
                        i++;
                        bname++;
                }
@@ -916,102 +913,6 @@ static int yaffs_find_chunk_in_group(yaffs_dev_t *dev, int the_chunk,
        return -1;
 }
 
-#if 0
-/* Experimental code not being used yet. Might speed up file deletion */
-/* DeleteWorker scans backwards through the tnode tree and deletes all the
- * chunks and tnodes in the file.
- * Returns 1 if the tree was deleted.
- * Returns 0 if it stopped early due to hitting the limit and the delete is incomplete.
- */
-
-static int yaffs_del_worker(yaffs_obj_t *in, yaffs_tnode_t *tn, __u32 level,
-                             int chunk_offset, int *limit)
-{
-       int i;
-       int inode_chunk;
-       int the_chunk;
-       yaffs_ext_tags tags;
-       int found_chunk;
-       yaffs_dev_t *dev = in->my_dev;
-
-       int all_done = 1;
-
-       if (tn) {
-               if (level > 0) {
-                       for (i = YAFFS_NTNODES_INTERNAL - 1; all_done && i >= 0;
-                            i--) {
-                               if (tn->internal[i]) {
-                                       if (limit && (*limit) < 0) {
-                                               all_done = 0;
-                                       } else {
-                                               all_done =
-                                                       yaffs_del_worker(in,
-                                                               tn->
-                                                               internal
-                                                               [i],
-                                                               level -
-                                                               1,
-                                                               (chunk_offset
-                                                                       <<
-                                                                       YAFFS_TNODES_INTERNAL_BITS)
-                                                               + i,
-                                                               limit);
-                                       }
-                                       if (all_done) {
-                                               yaffs_free_tnode(dev,
-                                                               tn->
-                                                               internal[i]);
-                                               tn->internal[i] = NULL;
-                                       }
-                               }
-                       }
-                       return (all_done) ? 1 : 0;
-               } else if (level == 0) {
-                       int hit_limit = 0;
-
-                       for (i = YAFFS_NTNODES_LEVEL0 - 1; i >= 0 && !hit_limit;
-                                       i--) {
-                               the_chunk = yaffs_get_group_base(dev, tn, i);
-                               if (the_chunk) {
-
-                                       inode_chunk = (chunk_offset <<
-                                               YAFFS_TNODES_LEVEL0_BITS) + i;
-
-                                       found_chunk =
-                                               yaffs_find_chunk_in_group(dev,
-                                                               the_chunk,
-                                                               &tags,
-                                                               in->obj_id,
-                                                               inode_chunk);
-
-                                       if (found_chunk > 0) {
-                                               yaffs_chunk_del(dev,
-                                                                 found_chunk, 1,
-                                                                 __LINE__);
-                                               in->n_data_chunks--;
-                                               if (limit) {
-                                                       *limit = *limit - 1;
-                                                       if (*limit <= 0)
-                                                               hit_limit = 1;
-                                               }
-
-                                       }
-
-                                       yaffs_load_tnode_0(dev, tn, i, 0);
-                               }
-
-                       }
-                       return (i < 0) ? 1 : 0;
-
-               }
-
-       }
-
-       return 1;
-
-}
-
-#endif
 
 static void yaffs_soft_del_chunk(yaffs_dev_t *dev, int chunk)
 {
@@ -4356,12 +4257,6 @@ static void yaffs_check_obj_details_loaded(yaffs_obj_t *in)
 
        dev = in->my_dev;
 
-#if 0
-       T(YAFFS_TRACE_SCAN, (TSTR("details for object %d %s loaded" TENDSTR),
-               in->obj_id,
-               in->lazy_loaded ? "not yet" : "already"));
-#endif
-
        if (in->lazy_loaded && in->hdr_chunk > 0) {
                in->lazy_loaded = 0;
                chunk_data = yaffs_get_temp_buffer(dev, __LINE__);
@@ -4588,42 +4483,6 @@ yaffs_obj_t *yaffs_find_by_name(yaffs_obj_t *directory,
 }
 
 
-#if 0
-int yaffs_ApplyToDirectoryChildren(yaffs_obj_t *the_dir,
-                                       int (*fn) (yaffs_obj_t *))
-{
-       struct ylist_head *i;
-       yaffs_obj_t *l;
-
-       if (!the_dir) {
-               T(YAFFS_TRACE_ALWAYS,
-                 (TSTR
-                  ("tragedy: yaffs_find_by_name: null pointer directory"
-                   TENDSTR)));
-               YBUG();
-               return YAFFS_FAIL;
-       }
-       if (the_dir->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY) {
-               T(YAFFS_TRACE_ALWAYS,
-                 (TSTR
-                  ("tragedy: yaffs_find_by_name: non-directory" TENDSTR)));
-               YBUG();
-               return YAFFS_FAIL;
-       }
-
-       ylist_for_each(i, &the_dir->variant.dir_variant.children) {
-               if (i) {
-                       l = ylist_entry(i, yaffs_obj_t, siblings);
-                       if (l && !fn(l))
-                               return YAFFS_FAIL;
-               }
-       }
-
-       return YAFFS_OK;
-
-}
-#endif
-
 /* GetEquivalentObject dereferences any hard links to get to the
  * actual object.
  */
@@ -5029,30 +4888,9 @@ int yaffs_list_xattrib(yaffs_obj_t *obj, char *buffer, int size)
        return yaffs_do_xattrib_fetch(obj, NULL, buffer,size);
 }
 
-
-
-#if 0
-int yaffs_dump_obj(yaffs_obj_t *obj)
-{
-       YCHAR name[257];
-
-       yaffs_get_obj_name(obj, name, YAFFS_MAX_NAME_LENGTH + 1);
-
-       T(YAFFS_TRACE_ALWAYS,
-         (TSTR
-          ("Object %d, inode %d \"%s\"\n dirty %d valid %d serial %d sum %d"
-           " chunk %d type %d size %d\n"
-           TENDSTR), obj->obj_id, yaffs_get_obj_inode(obj), name,
-          obj->dirty, obj->valid, obj->serial, obj->sum, obj->hdr_chunk,
-          yaffs_get_obj_type(obj), yaffs_get_obj_length(obj)));
-
-       return YAFFS_OK;
-}
-#endif
-
 /*---------------------------- Initialisation code -------------------------------------- */
 
-static int yaffs_cehck_dev_fns(const yaffs_dev_t *dev)
+static int yaffs_check_dev_fns(const yaffs_dev_t *dev)
 {
 
        /* Common functions, gotta have */
@@ -5173,7 +5011,7 @@ int yaffs_guts_initialise(yaffs_dev_t *dev)
                dev->data_bytes_per_chunk = dev->param.total_bytes_per_chunk;
 
        /* Got the right mix of functions? */
-       if (!yaffs_cehck_dev_fns(dev)) {
+       if (!yaffs_check_dev_fns(dev)) {
                /* Function missing */
                T(YAFFS_TRACE_ALWAYS,
                  (TSTR
@@ -5487,12 +5325,7 @@ int yaffs_get_n_free_chunks(yaffs_dev_t *dev)
        int blocks_for_checkpt;
        int i;
 
-#if 1
        n_free = dev->n_free_chunks;
-#else
-       n_free = yaffs_count_free_chunks(dev);
-#endif
-
        n_free += dev->n_deleted_files;
 
        /* Now count the number of dirty chunks in the cache and subtract those */
index 2668b99..3a819ab 100644 (file)
@@ -874,9 +874,6 @@ int yaffs_checkpoint_restore(yaffs_dev_t *dev);
 yaffs_obj_t *yaffs_create_dir(yaffs_obj_t *parent, const YCHAR *name,
                                __u32 mode, __u32 uid, __u32 gid);
 yaffs_obj_t *yaffs_find_by_name(yaffs_obj_t *the_dir, const YCHAR *name);
-int yaffs_ApplyToDirectoryChildren(yaffs_obj_t *the_dir,
-                                  int (*fn) (yaffs_obj_t *));
-
 yaffs_obj_t *yaffs_find_by_number(yaffs_dev_t *dev, __u32 number);
 
 /* Link operations */
similarity index 87%
rename from yaffs_mtdif1.c
rename to yaffs_mtd1f1_single.c
index 6380999..698e083 100644 (file)
@@ -19,7 +19,7 @@
  *
  * These functions are invoked via function pointers in yaffs_nand.c.
  * This replaces functionality provided by functions in yaffs_mtdif.c
- * and the yaffs_tags_tCompatability functions in yaffs_tagscompat.c that are
+ * and the yaffs_tags compatability functions in yaffs_tagscompat.c that are
  * called in yaffs_mtdif.c when the function pointers are NULL.
  * We assume the MTD layer is performing ECC (use_nand_ecc is true).
  */
 #include "linux/types.h"
 #include "linux/mtd/mtd.h"
 
-/* Don't compile this module if we don't have MTD's mtd_oob_ops interface */
-#if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17))
-
 #ifndef CONFIG_YAFFS_9BYTE_TAGS
 # define YTAG1_SIZE 8
 #else
 # define YTAG1_SIZE 9
 #endif
 
-#if 0
-/* Use the following nand_ecclayout with MTD when using
- * CONFIG_YAFFS_9BYTE_TAGS and the older on-NAND tags layout.
- * If you have existing Yaffs images and the byte order differs from this,
- * adjust 'oobfree' to match your existing Yaffs data.
- *
- * This nand_ecclayout scatters/gathers to/from the old-yaffs layout with the
- * page_status byte (at NAND spare offset 4) scattered/gathered from/to
- * the 9th byte.
- *
- * Old-style on-NAND format: T0,T1,T2,T3,P,B,T4,T5,E0,E1,E2,T6,T7,E3,E4,E5
- * We have/need packed_tags1 plus page_status: T0,T1,T2,T3,T4,T5,T6,T7,P
- * where Tn are the tag bytes, En are MTD's ECC bytes, P is the page_status
- * byte and B is the small-page bad-block indicator byte.
- */
-static struct nand_ecclayout nand_oob_16 = {
-       .eccbytes = 6,
-       .eccpos = { 8, 9, 10, 13, 14, 15 },
-       .oobavail = 9,
-       .oobfree = { { 0, 4 }, { 6, 2 }, { 11, 2 }, { 4, 1 } }
-};
-#endif
 
 /* Write a chunk (page) of data to NAND.
  *
@@ -186,12 +161,6 @@ int nandmtd1_read_chunk_tags(yaffs_dev_t *dev,
        ops.datbuf = data;
        ops.oobbuf = (__u8 *)&pt1;
 
-#if (MTD_VERSION_CODE < MTD_VERSION(2, 6, 20))
-       /* In MTD 2.6.18 to 2.6.19 nand_base.c:nand_do_read_oob() has a bug;
-        * help it out with ops.len = ops.ooblen when ops.datbuf == NULL.
-        */
-       ops.len = (ops.datbuf) ? ops.len : ops.ooblen;
-#endif
        /* Read page and oob using MTD.
         * Check status and determine ECC result.
         */
@@ -358,5 +327,3 @@ int nandmtd1_query_block(struct yaffs_dev_s *dev, int block_no,
        /* query always succeeds */
        return YAFFS_OK;
 }
-
-#endif /*MTD_VERSION*/
similarity index 85%
rename from yaffs_mtdif2.c
rename to yaffs_mtd1f2_single.c
index 1c60a44..af54c18 100644 (file)
@@ -35,11 +35,7 @@ int nandmtd2_write_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
                                      const yaffs_ext_tags *tags)
 {
        struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
-#if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17))
        struct mtd_oob_ops ops;
-#else
-       size_t dummy;
-#endif
        int retval = 0;
 
        loff_t addr;
@@ -70,7 +66,6 @@ int nandmtd2_write_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
        } else
                yaffs_pack_tags2(&pt, tags, !dev->param.no_tags_ecc);
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
        ops.mode = MTD_OOB_AUTO;
        ops.ooblen = (dev->param.inband_tags) ? 0 : packed_tags_size;
        ops.len = dev->param.total_bytes_per_chunk;
@@ -79,17 +74,6 @@ int nandmtd2_write_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
        ops.oobbuf = (dev->param.inband_tags) ? NULL : packed_tags_ptr;
        retval = mtd->write_oob(mtd, addr, &ops);
 
-#else
-       if (!dev->param.inband_tags) {
-               retval =
-                   mtd->write_ecc(mtd, addr, dev->data_bytes_per_chunk,
-                                  &dummy, data, (__u8 *) packed_tags_ptr, NULL);
-       } else {
-               retval =
-                   mtd->write(mtd, addr, dev->param.total_bytes_per_chunk, &dummy,
-                              data);
-       }
-#endif
 
        if (retval == 0)
                return YAFFS_OK;
@@ -101,9 +85,8 @@ int nandmtd2_read_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
                                       __u8 *data, yaffs_ext_tags *tags)
 {
        struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
-#if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17))
        struct mtd_oob_ops ops;
-#endif
+
        size_t dummy;
        int retval = 0;
        int local_data = 0;
@@ -131,7 +114,6 @@ int nandmtd2_read_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
        }
 
 
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
        if (dev->param.inband_tags || (data && !tags))
                retval = mtd->read(mtd, addr, dev->param.total_bytes_per_chunk,
                                &dummy, data);
@@ -144,24 +126,6 @@ int nandmtd2_read_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
                ops.oobbuf = yaffs_dev_to_lc(dev)->spare_buffer;
                retval = mtd->read_oob(mtd, addr, &ops);
        }
-#else
-       if (!dev->param.inband_tags && data && tags) {
-
-               retval = mtd->read_ecc(mtd, addr, dev->data_bytes_per_chunk,
-                                         &dummy, data, dev->spare_buffer,
-                                         NULL);
-       } else {
-               if (data)
-                       retval =
-                           mtd->read(mtd, addr, dev->data_bytes_per_chunk, &dummy,
-                                     data);
-               if (!dev->param.inband_tags && tags)
-                       retval =
-                           mtd->read_oob(mtd, addr, mtd->oobsize, &dummy,
-                                         dev->spare_buffer);
-       }
-#endif
-
 
        if (dev->param.inband_tags) {
                if (tags) {
@@ -253,4 +217,3 @@ int nandmtd2_query_block(struct yaffs_dev_s *dev, int block_no,
        else
                return YAFFS_FAIL;
 }
-
index 1e910f2..9d2472d 100644 (file)
 #include "yaffs_trace.h"
 
 static void yaffs_handle_rd_data_error(yaffs_dev_t *dev, int nand_chunk);
-#ifdef NOTYET
-static void yaffs_check_written_block(yaffs_dev_t *dev, int nand_chunk);
-static void yaffs_handle_chunk_wr_ok(yaffs_dev_t *dev, int nand_chunk,
-                                    const __u8 *data,
-                                    const yaffs_spare *spare);
-static void yaffs_handle_chunk_update(yaffs_dev_t *dev, int nand_chunk,
-                                   const yaffs_spare *spare);
-static void yaffs_handle_chunk_wr_error(yaffs_dev_t *dev, int nand_chunk);
-#endif
+
 
 static const char yaffs_count_bits_table[256] = {
        0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
@@ -297,33 +289,6 @@ static int yaffs_rd_chunk_nand(struct yaffs_dev_s *dev,
        return ret_val;
 }
 
-#ifdef NOTYET
-static int yaffs_check_chunk_erased(struct yaffs_dev_s *dev,
-                                 int nand_chunk)
-{
-       static int init;
-       static __u8 cmpbuf[YAFFS_BYTES_PER_CHUNK];
-       static __u8 data[YAFFS_BYTES_PER_CHUNK];
-       /* Might as well always allocate the larger size for */
-       /* dev->param.use_nand_ecc == true; */
-       static __u8 spare[sizeof(struct yaffs_nand_spare)];
-
-       dev->param.read_chunk_fn(dev, nand_chunk, data, (yaffs_spare *) spare);
-
-       if (!init) {
-               memset(cmpbuf, 0xff, YAFFS_BYTES_PER_CHUNK);
-               init = 1;
-       }
-
-       if (memcmp(cmpbuf, data, YAFFS_BYTES_PER_CHUNK))
-               return YAFFS_FAIL;
-       if (memcmp(cmpbuf, spare, 16))
-               return YAFFS_FAIL;
-
-       return YAFFS_OK;
-
-}
-#endif
 
 /*
  * Functions for robustisizing
@@ -345,56 +310,6 @@ static void yaffs_handle_rd_data_error(yaffs_dev_t *dev, int nand_chunk)
         */
 }
 
-#ifdef NOTYET
-static void yaffs_check_written_block(yaffs_dev_t *dev, int nand_chunk)
-{
-}
-
-static void yaffs_handle_chunk_wr_ok(yaffs_dev_t *dev, int nand_chunk,
-                                    const __u8 *data,
-                                    const yaffs_spare *spare)
-{
-}
-
-static void yaffs_handle_chunk_update(yaffs_dev_t *dev, int nand_chunk,
-                                   const yaffs_spare *spare)
-{
-}
-
-static void yaffs_handle_chunk_wr_error(yaffs_dev_t *dev, int nand_chunk)
-{
-       int flash_block = nand_chunk / dev->param.chunks_per_block;
-
-       /* Mark the block for retirement */
-       yaffs_get_block_info(dev, flash_block)->needs_retiring = 1;
-       /* Delete the chunk */
-       yaffs_chunk_del(dev, nand_chunk, 1, __LINE__);
-}
-
-static int yaffs_verify_cmp(const __u8 *d0, const __u8 *d1,
-                              const yaffs_spare *s0, const yaffs_spare *s1)
-{
-
-       if (memcmp(d0, d1, YAFFS_BYTES_PER_CHUNK) != 0 ||
-           s0->tb0 != s1->tb0 ||
-           s0->tb1 != s1->tb1 ||
-           s0->tb2 != s1->tb2 ||
-           s0->tb3 != s1->tb3 ||
-           s0->tb4 != s1->tb4 ||
-           s0->tb5 != s1->tb5 ||
-           s0->tb6 != s1->tb6 ||
-           s0->tb7 != s1->tb7 ||
-           s0->ecc1[0] != s1->ecc1[0] ||
-           s0->ecc1[1] != s1->ecc1[1] ||
-           s0->ecc1[2] != s1->ecc1[2] ||
-           s0->ecc2[0] != s1->ecc2[0] ||
-           s0->ecc2[1] != s1->ecc2[1] || s0->ecc2[2] != s1->ecc2[2]) {
-               return 0;
-       }
-
-       return 1;
-}
-#endif                         /* NOTYET */
 
 int yaffs_tags_compat_wr(yaffs_dev_t *dev,
                                                int nand_chunk,
index 89e730b..32aaadc 100644 (file)
@@ -216,54 +216,6 @@ void yaffs_verify_oh(yaffs_obj_t *obj, yaffs_obj_header *oh, yaffs_ext_tags *tag
 }
 
 
-#if 0
-/* Not being used, but don't want to throw away yet */
-int yaffs_verify_tnode_worker(yaffs_obj_t *obj, yaffs_tnode_t *tn,
-                                       __u32 level, int chunk_offset)
-{
-       int i;
-       yaffs_dev_t *dev = obj->my_dev;
-       int ok = 1;
-
-       if (tn) {
-               if (level > 0) {
-
-                       for (i = 0; i < YAFFS_NTNODES_INTERNAL && ok; i++) {
-                               if (tn->internal[i]) {
-                                       ok = yaffs_verify_tnode_worker(obj,
-                                                       tn->internal[i],
-                                                       level - 1,
-                                                       (chunk_offset<<YAFFS_TNODES_INTERNAL_BITS) + i);
-                               }
-                       }
-               } else if (level == 0) {
-                       yaffs_ext_tags tags;
-                       __u32 obj_id = obj->obj_id;
-
-                       chunk_offset <<=  YAFFS_TNODES_LEVEL0_BITS;
-
-                       for (i = 0; i < YAFFS_NTNODES_LEVEL0; i++) {
-                               __u32 the_chunk = yaffs_get_group_base(dev, tn, i);
-
-                               if (the_chunk > 0) {
-                                       /* T(~0,(TSTR("verifying (%d:%d) %d"TENDSTR),tags.obj_id,tags.chunk_id,the_chunk)); */
-                                       yaffs_rd_chunk_tags_nand(dev, the_chunk, NULL, &tags);
-                                       if (tags.obj_id != obj_id || tags.chunk_id != chunk_offset) {
-                                               T(~0, (TSTR("Object %d chunk_id %d NAND mismatch chunk %d tags (%d:%d)"TENDSTR),
-                                                       obj_id, chunk_offset, the_chunk,
-                                                       tags.obj_id, tags.chunk_id));
-                                       }
-                               }
-                               chunk_offset++;
-                       }
-               }
-       }
-
-       return ok;
-
-}
-
-#endif
 
 void yaffs_verify_file(yaffs_obj_t *obj)
 {
@@ -573,59 +525,6 @@ void yaffs_verify_free_chunks(yaffs_dev_t *dev)
 
 int yaffs_verify_file_sane(yaffs_obj_t *in)
 {
-#if 0
-       int chunk;
-       int n_chunks;
-       int file_size;
-       int failed = 0;
-       int obj_id;
-       yaffs_tnode_t *tn;
-       yaffs_tags_t local_tags;
-       yaffs_tags_t *tags = &local_tags;
-       int the_chunk;
-       int is_deleted;
-
-       if (in->variant_type != YAFFS_OBJECT_TYPE_FILE)
-               return YAFFS_FAIL;
-
-       obj_id = in->obj_id;
-       file_size = in->variant.file_variant.file_size;
-       n_chunks =
-           (file_size + in->my_dev->data_bytes_per_chunk - 1) / in->my_dev->data_bytes_per_chunk;
-
-       for (chunk = 1; chunk <= n_chunks; chunk++) {
-               tn = yaffs_find_tnode_0(in->my_dev, &in->variant.file_variant,
-                                          chunk);
-
-               if (tn) {
-
-                       the_chunk = yaffs_get_group_base(dev, tn, chunk);
-
-                       if (yaffs_check_chunk_bits
-                           (dev, the_chunk / dev->param.chunks_per_block,
-                            the_chunk % dev->param.chunks_per_block)) {
-
-                               yaffs_rd_chunk_tags_nand(in->my_dev, the_chunk,
-                                                           tags,
-                                                           &is_deleted);
-                               if (yaffs_tags_match
-                                   (tags, in->obj_id, chunk, is_deleted)) {
-                                       /* found it; */
-
-                               }
-                       } else {
-
-                               failed = 1;
-                       }
-
-               } else {
-                       /* T(("No level 0 found for %d\n", chunk)); */
-               }
-       }
-
-       return failed ? YAFFS_FAIL : YAFFS_OK;
-#else
        in=in;
        return YAFFS_OK;
-#endif
 }
similarity index 99%
rename from yaffs_vfs.c
rename to yaffs_vfs_single.c
index b1b6840..63f0e3d 100644 (file)
@@ -575,15 +575,9 @@ static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
                if (inode) {
                        T(YAFFS_TRACE_OS,
                                (TSTR("yaffs_loookup dentry \n")));
-/* #if 0 asserted by NCB for 2.5/6 compatability - falls through to
- * d_add even if NULL inode */
-#if 0
-                       /*dget(dentry); // try to solve directory bug */
                        d_add(dentry, inode);
-
                        /* return dentry; */
                        return NULL;
-#endif
                }
 
        } else {
@@ -591,8 +585,6 @@ static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
 
        }
 
-/* added NCB for 2.5/6 compatability - forces add even if inode is
- * NULL which creates dentry hash */
        d_add(dentry, inode);
 
        return NULL;
@@ -2200,7 +2192,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
                                                struct super_block *sb,
                                                void *data, int silent)
 {
-       int nBlocks;
+       int n_blocks;
        struct inode *inode = NULL;
        struct dentry *root;
        yaffs_dev_t *dev = 0;
@@ -2407,10 +2399,10 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
 
        /* Set up the memory size parameters.... */
 
-       nBlocks = YCALCBLOCKS(mtd->size, (YAFFS_CHUNKS_PER_BLOCK * YAFFS_BYTES_PER_CHUNK));
+       n_blocks = YCALCBLOCKS(mtd->size, (YAFFS_CHUNKS_PER_BLOCK * YAFFS_BYTES_PER_CHUNK));
 
        param->start_block = 0;
-       param->end_block = nBlocks - 1;
+       param->end_block = n_blocks - 1;
        param->chunks_per_block = YAFFS_CHUNKS_PER_BLOCK;
        param->total_bytes_per_chunk = YAFFS_BYTES_PER_CHUNK;
        param->n_reserved_blocks = 5;
@@ -2467,10 +2459,10 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
                param->is_yaffs2 = 1;
                param->total_bytes_per_chunk = mtd->writesize;
                param->chunks_per_block = mtd->erasesize / mtd->writesize;
-               nBlocks = YCALCBLOCKS(mtd->size, mtd->erasesize);
+               n_blocks = YCALCBLOCKS(mtd->size, mtd->erasesize);
 
                param->start_block = 0;
-               param->end_block = nBlocks - 1;
+               param->end_block = n_blocks - 1;
        } else {
                /* use the MTD interface in yaffs_mtdif1.c */
                param->write_chunk_tags_fn =