yaffs: More clean up.
[yaffs2.git] / yaffs_yaffs2.c
index 5162f15fc6e1b183173f2e29e389f369b11203c9..d5b167ffcee942820405576590319bf35e685975 100644 (file)
@@ -17,7 +17,6 @@
 #include "yaffs_yaffs2.h"
 #include "yaffs_checkptrw.h"
 #include "yaffs_bitmap.h"
-#include "yaffs_qsort.h"
 #include "yaffs_nand.h"
 #include "yaffs_getblockinfo.h"
 #include "yaffs_verify.h"
@@ -547,7 +546,7 @@ static int yaffs2_wr_checkpt_objs(struct yaffs_dev *dev)
        struct yaffs_checkpt_obj cp;
        int i;
        int ok = 1;
-       struct ylist_head *lh;
+       struct list_head *lh;
 
 
        /* Iterate through the objects in each hash entry,
@@ -555,9 +554,9 @@ static int yaffs2_wr_checkpt_objs(struct yaffs_dev *dev)
         */
 
        for (i = 0; ok &&  i <  YAFFS_NOBJECT_BUCKETS; i++) {
-               ylist_for_each(lh, &dev->obj_bucket[i].list) {
+               list_for_each(lh, &dev->obj_bucket[i].list) {
                        if (lh) {
-                               obj = ylist_entry(lh, struct yaffs_obj, hash_link);
+                               obj = list_entry(lh, struct yaffs_obj, hash_link);
                                if (!obj->defered_free) {
                                        yaffs2_obj_checkpt_obj(&cp, obj);
                                        cp.struct_type = sizeof(cp);
@@ -616,7 +615,7 @@ static int yaffs2_rd_checkpt_objs(struct yaffs_dev *dev)
                                        ok = yaffs2_rd_checkpt_tnodes(obj);
                                } else if (obj->variant_type == YAFFS_OBJECT_TYPE_HARDLINK) {
                                        obj->hard_links.next =
-                                               (struct ylist_head *) hard_list;
+                                               (struct list_head *) hard_list;
                                        hard_list = obj;
                                }
                        } else
@@ -892,18 +891,18 @@ int yaffs2_handle_hole(struct yaffs_obj *obj, loff_t new_size)
 }
 
 
-typedef struct {
+struct yaffs_block_index{
        int seq;
        int block;
-} yaffs_block_index;
+};
 
 
 static int yaffs2_ybicmp(const void *a, const void *b)
 {
-       register int aseq = ((yaffs_block_index *)a)->seq;
-       register int bseq = ((yaffs_block_index *)b)->seq;
-       register int ablock = ((yaffs_block_index *)a)->block;
-       register int bblock = ((yaffs_block_index *)b)->block;
+       int aseq = ((struct yaffs_block_index *)a)->seq;
+       int bseq = ((struct yaffs_block_index *)b)->seq;
+       int ablock = ((struct yaffs_block_index *)a)->block;
+       int bblock = ((struct yaffs_block_index *)b)->block;
        if (aseq == bseq)
                return ablock - bblock;
        else
@@ -941,7 +940,7 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev)
        int alloc_failed = 0;
 
 
-       yaffs_block_index *block_index = NULL;
+       struct yaffs_block_index *block_index = NULL;
        int alt_block_index = 0;
 
        T(YAFFS_TRACE_SCAN,
@@ -952,10 +951,10 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev)
 
        dev->seq_number = YAFFS_LOWEST_SEQUENCE_NUMBER;
 
-       block_index = YMALLOC(n_blocks * sizeof(yaffs_block_index));
+       block_index = YMALLOC(n_blocks * sizeof(struct yaffs_block_index));
 
        if (!block_index) {
-               block_index = YMALLOC_ALT(n_blocks * sizeof(yaffs_block_index));
+               block_index = YMALLOC_ALT(n_blocks * sizeof(struct yaffs_block_index));
                alt_block_index = 1;
        }
 
@@ -1035,7 +1034,7 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev)
        YYIELD();
 
        /* Sort the blocks by sequence number*/
-       yaffs_qsort(block_index, n_to_scan, sizeof(yaffs_block_index), yaffs2_ybicmp);
+       yaffs_sort(block_index, n_to_scan, sizeof(struct yaffs_block_index), yaffs2_ybicmp);
 
        YYIELD();
 
@@ -1412,7 +1411,7 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev)
                                                /* Set up as a directory */
                                                parent->variant_type =
                                                        YAFFS_OBJECT_TYPE_DIRECTORY;
-                                               YINIT_LIST_HEAD(&parent->variant.
+                                               INIT_LIST_HEAD(&parent->variant.
                                                        dir_variant.
                                                        children);
                                        } else if (!parent || parent->variant_type !=
@@ -1472,7 +1471,7 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev)
                                                        in->variant.hardlink_variant.equiv_id =
                                                                equiv_id;
                                                        in->hard_links.next =
-                                                               (struct ylist_head *) hard_list;
+                                                               (struct list_head *) hard_list;
                                                        hard_list = in;
                                                }
                                                break;