X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=yaffs_yaffs2.c;h=debb56d98bd931b15c8309a0532ca3e273cb87d4;hb=a233a8fc212a32a50cc5f572cd4946e91cc9ca93;hp=5162f15fc6e1b183173f2e29e389f369b11203c9;hpb=9131fecc79ad4e5fbdb775cdc067bc80aae5adb8;p=yaffs2.git diff --git a/yaffs_yaffs2.c b/yaffs_yaffs2.c index 5162f15..debb56d 100644 --- a/yaffs_yaffs2.c +++ b/yaffs_yaffs2.c @@ -17,10 +17,10 @@ #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" +#include "yaffs_attribs.h" /* * Checkpoints are really no benefit on very small partitions. @@ -547,7 +547,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 +555,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 +616,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 +892,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 +941,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 +952,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 +1035,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(); @@ -1319,24 +1319,8 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev) if (oh) { in->yst_mode = oh->yst_mode; -#ifdef CONFIG_YAFFS_WINCE - in->win_atime[0] = oh->win_atime[0]; - in->win_ctime[0] = oh->win_ctime[0]; - in->win_mtime[0] = oh->win_mtime[0]; - in->win_atime[1] = oh->win_atime[1]; - in->win_ctime[1] = oh->win_ctime[1]; - in->win_mtime[1] = oh->win_mtime[1]; -#else - in->yst_uid = oh->yst_uid; - in->yst_gid = oh->yst_gid; - in->yst_atime = oh->yst_atime; - in->yst_mtime = oh->yst_mtime; - in->yst_ctime = oh->yst_ctime; - in->yst_rdev = oh->yst_rdev; - + yaffs_load_attribs(in, oh); in->lazy_loaded = 0; - -#endif } else in->lazy_loaded = 1; @@ -1352,21 +1336,7 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev) in->variant_type = oh->type; in->yst_mode = oh->yst_mode; -#ifdef CONFIG_YAFFS_WINCE - in->win_atime[0] = oh->win_atime[0]; - in->win_ctime[0] = oh->win_ctime[0]; - in->win_mtime[0] = oh->win_mtime[0]; - in->win_atime[1] = oh->win_atime[1]; - in->win_ctime[1] = oh->win_ctime[1]; - in->win_mtime[1] = oh->win_mtime[1]; -#else - in->yst_uid = oh->yst_uid; - in->yst_gid = oh->yst_gid; - in->yst_atime = oh->yst_atime; - in->yst_mtime = oh->yst_mtime; - in->yst_ctime = oh->yst_ctime; - in->yst_rdev = oh->yst_rdev; -#endif + yaffs_load_attribs(in, oh); if (oh->shadows_obj > 0) yaffs_handle_shadowed_obj(dev, @@ -1412,7 +1382,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 +1442,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;