X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=yaffs_guts.c;fp=yaffs_guts.c;h=8507c2d94a7b128af414c7c0ad572716d73b163d;hp=ed5a005ebc1873e5a30d7691db730386e9c0bd1a;hb=6af811eebaf8da9dbb58be70fbb283ecd95f8a32;hpb=ab9a00dce3929c4c8cc1f01db34b23ba64a850ce diff --git a/yaffs_guts.c b/yaffs_guts.c index ed5a005..8507c2d 100644 --- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -980,7 +980,7 @@ static int yaffs_find_chunk_in_group(struct yaffs_dev *dev, int the_chunk, return -1; } -static int yaffs_find_chunk_in_file(struct yaffs_obj *in, int inode_chunk, +int yaffs_find_chunk_in_file(struct yaffs_obj *in, int inode_chunk, struct yaffs_ext_tags *tags) { /*Get the Tnode, then get the level 0 offset chunk offset */ @@ -5072,3 +5072,23 @@ loff_t yaffs_oh_to_size(struct yaffs_obj_hdr *oh) return retval; } + + +void yaffs_count_blocks_by_state(struct yaffs_dev *dev, int bs[10]) +{ + int i; + struct yaffs_block_info *bi; + int s; + + for(i = 0; i < 10; i++) + bs[i] = 0; + + for(i = dev->internal_start_block; i <= dev->internal_end_block; i++) { + bi = yaffs_get_block_info(dev, i); + s = bi->block_state; + if(s > YAFFS_BLOCK_STATE_DEAD || s < YAFFS_BLOCK_STATE_UNKNOWN) + bs[0]++; + else + bs[s]++; + } +}