X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=yaffs_tagscompat.c;h=5af3a3319f4db60a9efb81cc29f0359caaa4755f;hp=1e910f2f3c69988d6688c76c8898c72f0a9d175c;hb=cf6888f05f691aa1a357e7e94f9bf7b98174bbc3;hpb=f330fefa27f2c87f7dff414fe6227261327663b7 diff --git a/yaffs_tagscompat.c b/yaffs_tagscompat.c index 1e910f2..5af3a33 100644 --- a/yaffs_tagscompat.c +++ b/yaffs_tagscompat.c @@ -18,15 +18,7 @@ #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, @@ -47,7 +39,7 @@ static const char yaffs_count_bits_table[256] = { 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8 }; -int yaffs_count_bits(__u8 x) +int yaffs_count_bits(u8 x) { int ret_val; ret_val = yaffs_count_bits_table[x]; @@ -56,7 +48,7 @@ int yaffs_count_bits(__u8 x) /********** Tags ECC calculations *********/ -void yaffs_calc_ecc(const __u8 *data, yaffs_spare *spare) +void yaffs_calc_ecc(const u8 *data, yaffs_spare *spare) { yaffs_ecc_cacl(data, spare->ecc1); yaffs_ecc_cacl(&data[256], spare->ecc2); @@ -161,7 +153,7 @@ static void yaffs_spare_init(yaffs_spare *spare) } static int yaffs_wr_nand(struct yaffs_dev_s *dev, - int nand_chunk, const __u8 *data, + int nand_chunk, const u8 *data, yaffs_spare *spare) { if (nand_chunk < dev->param.start_block * dev->param.chunks_per_block) { @@ -176,7 +168,7 @@ static int yaffs_wr_nand(struct yaffs_dev_s *dev, static int yaffs_rd_chunk_nand(struct yaffs_dev_s *dev, int nand_chunk, - __u8 *data, + u8 *data, yaffs_spare *spare, yaffs_ecc_result *ecc_result, int correct_errors) @@ -196,7 +188,7 @@ static int yaffs_rd_chunk_nand(struct yaffs_dev_s *dev, /* Do ECC correction */ /* Todo handle any errors */ int ecc_result1, ecc_result2; - __u8 calc_ecc[3]; + u8 calc_ecc[3]; yaffs_ecc_cacl(data, calc_ecc); ecc_result1 = @@ -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,60 +310,10 @@ 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, - const __u8 *data, + const u8 *data, const yaffs_ext_tags *ext_tags) { yaffs_spare spare; @@ -434,7 +349,7 @@ int yaffs_tags_compat_wr(yaffs_dev_t *dev, int yaffs_tags_compat_rd(yaffs_dev_t *dev, int nand_chunk, - __u8 *data, + u8 *data, yaffs_ext_tags *ext_tags) { @@ -508,7 +423,7 @@ int yaffs_tags_compat_mark_bad(struct yaffs_dev_s *dev, int yaffs_tags_compat_query_block(struct yaffs_dev_s *dev, int block_no, yaffs_block_state_t *state, - __u32 *seq_number) + u32 *seq_number) { yaffs_spare spare0, spare1;