X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=yaffs_verify.c;h=1a5ed9a75362e0b06befc70195e1048f1274bbb6;hp=738c7f69a5ec1de2c10d0fcc0d77cc7d82d52917;hb=511baf572f96c689043518d443086b8dd6751089;hpb=5062df7307f71d3374da87a7c69102dc3f09da28 diff --git a/yaffs_verify.c b/yaffs_verify.c index 738c7f6..1a5ed9a 100644 --- a/yaffs_verify.c +++ b/yaffs_verify.c @@ -36,7 +36,7 @@ static int yaffs_skip_nand_verification(struct yaffs_dev *dev) return !(yaffs_trace_mask & (YAFFS_TRACE_VERIFY_NAND)); } -static const char *block_state_name[] = { +static const char * const block_state_name[] = { "Unknown", "Needs scanning", "Scanning", @@ -91,7 +91,6 @@ void yaffs_verify_blk(struct yaffs_dev *dev, struct yaffs_block_info *bi, int n) yaffs_trace(YAFFS_TRACE_VERIFY, "Block %d has inconsistent values pages_in_use %d counted chunk bits %d", n, bi->pages_in_use, in_use); - } void yaffs_verify_collected_blk(struct yaffs_dev *dev, @@ -163,8 +162,8 @@ void yaffs_verify_blocks(struct yaffs_dev *dev) } /* - * Verify the object header. oh must be valid, but obj and tags may be NULL in which - * case those tests will not be performed. + * Verify the object header. oh must be valid, but obj and tags may be NULL in + * which case those tests will not be performed. */ void yaffs_verify_oh(struct yaffs_obj *obj, struct yaffs_obj_hdr *oh, struct yaffs_ext_tags *tags, int parent_check) @@ -215,7 +214,7 @@ void yaffs_verify_oh(struct yaffs_obj *obj, struct yaffs_obj_hdr *oh, "Obj %d header name is NULL", obj->obj_id); - if (tags->obj_id > 1 && ((u8) (oh->name[0])) == 0xff) /* Trashed name */ + if (tags->obj_id > 1 && ((u8) (oh->name[0])) == 0xff) /* Junk name */ yaffs_trace(YAFFS_TRACE_VERIFY, "Obj %d header name is 0xFF", obj->obj_id); @@ -271,10 +270,10 @@ void yaffs_verify_file(struct yaffs_obj *obj) yaffs_rd_chunk_tags_nand(dev, the_chunk, NULL, &tags); if (tags.obj_id != obj_id || tags.chunk_id != i) - yaffs_trace(YAFFS_TRACE_VERIFY, - "Object %d chunk_id %d NAND mismatch chunk %d tags (%d:%d)", - obj_id, i, the_chunk, - tags.obj_id, tags.chunk_id); + yaffs_trace(YAFFS_TRACE_VERIFY, + "Object %d chunk_id %d NAND mismatch chunk %d tags (%d:%d)", + obj_id, i, the_chunk, + tags.obj_id, tags.chunk_id); } } } @@ -305,10 +304,8 @@ void yaffs_verify_special(struct yaffs_obj *obj) void yaffs_verify_obj(struct yaffs_obj *obj) { struct yaffs_dev *dev; - u32 chunk_min; u32 chunk_max; - u32 chunk_id_ok; u32 chunk_in_range; u32 chunk_wrongly_deleted; @@ -414,11 +411,8 @@ void yaffs_verify_objects(struct yaffs_dev *dev) for (i = 0; i < YAFFS_NOBJECT_BUCKETS; i++) { list_for_each(lh, &dev->obj_bucket[i].list) { - if (lh) { - obj = - list_entry(lh, struct yaffs_obj, hash_link); - yaffs_verify_obj(obj); - } + obj = list_entry(lh, struct yaffs_obj, hash_link); + yaffs_verify_obj(obj); } } } @@ -427,7 +421,6 @@ void yaffs_verify_obj_in_dir(struct yaffs_obj *obj) { struct list_head *lh; struct yaffs_obj *list_obj; - int count = 0; if (!obj) { @@ -440,7 +433,7 @@ void yaffs_verify_obj_in_dir(struct yaffs_obj *obj) return; if (!obj->parent) { - yaffs_trace(YAFFS_TRACE_ALWAYS, "Object does not have parent" ); + yaffs_trace(YAFFS_TRACE_ALWAYS, "Object does not have parent"); YBUG(); return; } @@ -453,12 +446,10 @@ void yaffs_verify_obj_in_dir(struct yaffs_obj *obj) /* Iterate through the objects in each hash entry */ list_for_each(lh, &obj->parent->variant.dir_variant.children) { - if (lh) { - list_obj = list_entry(lh, struct yaffs_obj, siblings); - yaffs_verify_obj(list_obj); - if (obj == list_obj) - count++; - } + list_obj = list_entry(lh, struct yaffs_obj, siblings); + yaffs_verify_obj(list_obj); + if (obj == list_obj) + count++; } if (count != 1) { @@ -492,16 +483,14 @@ void yaffs_verify_dir(struct yaffs_obj *directory) /* Iterate through the objects in each hash entry */ list_for_each(lh, &directory->variant.dir_variant.children) { - if (lh) { - list_obj = list_entry(lh, struct yaffs_obj, siblings); - if (list_obj->parent != directory) { - yaffs_trace(YAFFS_TRACE_ALWAYS, - "Object in directory list has wrong parent %p", - list_obj->parent); - YBUG(); - } - yaffs_verify_obj_in_dir(list_obj); + list_obj = list_entry(lh, struct yaffs_obj, siblings); + if (list_obj->parent != directory) { + yaffs_trace(YAFFS_TRACE_ALWAYS, + "Object in directory list has wrong parent %p", + list_obj->parent); + YBUG(); } + yaffs_verify_obj_in_dir(list_obj); } } @@ -521,7 +510,7 @@ void yaffs_verify_free_chunks(struct yaffs_dev *dev) if (difference) { yaffs_trace(YAFFS_TRACE_ALWAYS, - "Freechunks verification failure %d %d %d", + "Freechunks verification failure %d %d %d", dev->n_free_chunks, counted, difference); yaffs_free_verification_failures++; }