From 9131fecc79ad4e5fbdb775cdc067bc80aae5adb8 Mon Sep 17 00:00:00 2001 From: Charles Manning Date: Tue, 2 Nov 2010 13:39:42 +1300 Subject: [PATCH] yaffs: More clean up Signed-off-by: Charles Manning --- direct/basic-test/yaffs_fileem.c | 4 +- direct/basic-test/yaffs_fileem2k.c | 2 +- direct/basic-test/yaffs_norif1.c | 16 +- direct/basic-test/yaffs_norif1.h | 4 +- direct/basic-test/yaffs_ramdisk.h | 2 +- direct/basic-test/yaffs_ramem2k.c | 2 +- direct/yaffs_flashif.c | 2 +- direct/yaffs_flashif.h | 6 +- direct/yaffs_flashif2.h | 6 +- direct/yaffs_nandemul2k.h | 2 +- direct/yaffs_nandif.c | 2 +- direct/yaffs_nandif.h | 2 +- patch-ker.sh | 2 +- patches/yaffs_linux_allocator.c | 4 +- patches/yaffs_mtdif2.c | 2 +- utils/mkyaffs2image.c | 4 +- utils/mkyaffsimage.c | 18 +-- yaffs_allocator.c | 53 ++++--- yaffs_allocator.h | 4 +- yaffs_checkptrw.c | 8 +- yaffs_getblockinfo.h | 2 +- yaffs_guts.c | 126 ++++++++-------- yaffs_guts.h | 139 ++++++++---------- yaffs_mtdif1.h | 2 +- ...s_mtd1f1_single.c => yaffs_mtdif1_single.c | 10 +- yaffs_mtdif2.h | 2 +- ...s_mtd1f2_single.c => yaffs_mtdif2_single.c | 14 +- yaffs_nand.c | 4 +- yaffs_nand.h | 2 +- yaffs_packedtags2.c | 2 +- yaffs_tagscompat.c | 50 +++---- yaffs_tagscompat.h | 2 +- yaffs_tagsvalidity.c | 8 +- yaffs_verify.c | 8 +- yaffs_verify.h | 4 +- yaffs_vfs_single.c | 52 +++---- yaffs_yaffs1.c | 12 +- yaffs_yaffs2.c | 62 ++++---- yaffs_yaffs2.h | 6 +- 39 files changed, 318 insertions(+), 334 deletions(-) rename yaffs_mtd1f1_single.c => yaffs_mtdif1_single.c (97%) rename yaffs_mtd1f2_single.c => yaffs_mtdif2_single.c (92%) diff --git a/direct/basic-test/yaffs_fileem.c b/direct/basic-test/yaffs_fileem.c index 3a63aee..f92fa8f 100644 --- a/direct/basic-test/yaffs_fileem.c +++ b/direct/basic-test/yaffs_fileem.c @@ -118,7 +118,7 @@ static int CheckInit(struct yaffs_dev *dev) return 1; } -int yflash_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const yaffs_spare *spare) +int yflash_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const struct yaffs_spare *spare) { int written; @@ -148,7 +148,7 @@ int yflash_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, } -int yflash_ReadChunkFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 *data, yaffs_spare *spare) +int yflash_ReadChunkFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 *data, struct yaffs_spare *spare) { int nread; diff --git a/direct/basic-test/yaffs_fileem2k.c b/direct/basic-test/yaffs_fileem2k.c index 4667142..31549f0 100644 --- a/direct/basic-test/yaffs_fileem2k.c +++ b/direct/basic-test/yaffs_fileem2k.c @@ -580,7 +580,7 @@ int yflash2_InitialiseNAND(struct yaffs_dev *dev) -int yflash2_QueryNANDBlock(struct yaffs_dev *dev, int block_no, yaffs_block_state_t *state, u32 *seq_number) +int yflash2_QueryNANDBlock(struct yaffs_dev *dev, int block_no, enum yaffs_block_state *state, u32 *seq_number) { struct yaffs_ext_tags tags; int chunkNo; diff --git a/direct/basic-test/yaffs_norif1.c b/direct/basic-test/yaffs_norif1.c index 40039af..2484bec 100644 --- a/direct/basic-test/yaffs_norif1.c +++ b/direct/basic-test/yaffs_norif1.c @@ -149,12 +149,12 @@ void ynorif1_AndBytes(u8*target, const u8 *src, int nbytes) } } -int ynorif1_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const yaffs_spare *spare) +int ynorif1_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const struct yaffs_spare *spare) { u32 *dataAddr = Chunk2DataAddr(dev,nand_chunk); u32 *spareAddr = Chunk2SpareAddr(dev,nand_chunk); - yaffs_spare tmpSpare; + struct yaffs_spare tmpSpare; /* We should only be getting called for one of 3 reasons: * Writing a chunk: data and spare will not be NULL @@ -162,7 +162,7 @@ int ynorif1_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data * Writing a bad block marker: data will be NULL, spare not NULL */ - if(sizeof(yaffs_spare) != 16) + if(sizeof(struct yaffs_spare) != 16) YBUG(); if(data && spare) @@ -172,17 +172,17 @@ int ynorif1_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data /* Write a pre-marker */ memset(&tmpSpare,0xff,sizeof(tmpSpare)); tmpSpare.page_status = YNOR_PREMARKER; - ynorif1_FlashWrite32(spareAddr,(u32 *)&tmpSpare,sizeof(yaffs_spare)/4); + ynorif1_FlashWrite32(spareAddr,(u32 *)&tmpSpare,sizeof(struct yaffs_spare)/4); /* Write the data */ ynorif1_FlashWrite32(dataAddr,(u32 *)data,dev->param.total_bytes_per_chunk / 4); - memcpy(&tmpSpare,spare,sizeof(yaffs_spare)); + memcpy(&tmpSpare,spare,sizeof(struct yaffs_spare)); /* Write the real tags, but override the premarker*/ tmpSpare.page_status = YNOR_PREMARKER; - ynorif1_FlashWrite32(spareAddr,(u32 *)&tmpSpare,sizeof(yaffs_spare)/4); + ynorif1_FlashWrite32(spareAddr,(u32 *)&tmpSpare,sizeof(struct yaffs_spare)/4); /* Write a post-marker */ tmpSpare.page_status = YNOR_POSTMARKER; @@ -193,7 +193,7 @@ int ynorif1_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data ynorif1_FlashRead32(spareAddr,(u32 *)&tmpSpare,16/ 4); - ynorif1_AndBytes((u8 *)&tmpSpare,(u8 *)spare,sizeof(yaffs_spare)); + ynorif1_AndBytes((u8 *)&tmpSpare,(u8 *)spare,sizeof(struct yaffs_spare)); ynorif1_FlashWrite32(spareAddr,(u32 *)&tmpSpare,16/ 4); } @@ -206,7 +206,7 @@ int ynorif1_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data } -int ynorif1_ReadChunkFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 *data, yaffs_spare *spare) +int ynorif1_ReadChunkFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 *data, struct yaffs_spare *spare) { u32 *dataAddr = Chunk2DataAddr(dev,nand_chunk); diff --git a/direct/basic-test/yaffs_norif1.h b/direct/basic-test/yaffs_norif1.h index ad140e5..71cb51f 100644 --- a/direct/basic-test/yaffs_norif1.h +++ b/direct/basic-test/yaffs_norif1.h @@ -19,8 +19,8 @@ #include "yaffs_guts.h" -int ynorif1_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const yaffs_spare *spare); -int ynorif1_ReadChunkFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 *data, yaffs_spare *spare); +int ynorif1_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const struct yaffs_spare *spare); +int ynorif1_ReadChunkFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 *data, struct yaffs_spare *spare); int ynorif1_EraseBlockInNAND(struct yaffs_dev *dev, int blockNumber); int ynorif1_InitialiseNAND(struct yaffs_dev *dev); int ynorif1_Deinitialise_flash_fn(struct yaffs_dev *dev); diff --git a/direct/basic-test/yaffs_ramdisk.h b/direct/basic-test/yaffs_ramdisk.h index c29efbe..1749c58 100644 --- a/direct/basic-test/yaffs_ramdisk.h +++ b/direct/basic-test/yaffs_ramdisk.h @@ -27,5 +27,5 @@ int yramdisk_wr_chunk(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const int yramdisk_rd_chunk(struct yaffs_dev *dev,int nand_chunk, u8 *data, struct yaffs_ext_tags *tags); int yramdisk_initialise(struct yaffs_dev *dev); int yramdisk_mark_block_bad(struct yaffs_dev *dev,int blockNumber); -int yramdisk_query_block(struct yaffs_dev *dev, int block_no, yaffs_block_state_t *state, int *seq_number); +int yramdisk_query_block(struct yaffs_dev *dev, int block_no, enum yaffs_block_state *state, int *seq_number); #endif diff --git a/direct/basic-test/yaffs_ramem2k.c b/direct/basic-test/yaffs_ramem2k.c index bbfae31..8b3c028 100644 --- a/direct/basic-test/yaffs_ramem2k.c +++ b/direct/basic-test/yaffs_ramem2k.c @@ -327,7 +327,7 @@ int nandemul2k_MarkNANDBlockBad(struct yaffs_dev *dev, int block_no) } -int nandemul2k_QueryNANDBlock(struct yaffs_dev *dev, int block_no, yaffs_block_state_t *state, u32 *seq_number) +int nandemul2k_QueryNANDBlock(struct yaffs_dev *dev, int block_no, enum yaffs_block_state *state, u32 *seq_number) { struct yaffs_ext_tags tags; int chunkNo; diff --git a/direct/yaffs_flashif.c b/direct/yaffs_flashif.c index 5740bbe..d9c7cb1 100644 --- a/direct/yaffs_flashif.c +++ b/direct/yaffs_flashif.c @@ -215,7 +215,7 @@ int yflash_MarkNANDBlockBad(struct yaffs_dev *dev, int block_no) return YAFFS_OK; } -int yflash_QueryNANDBlock(struct yaffs_dev *dev, int block_no, yaffs_block_state_t *state, int *seq_number) +int yflash_QueryNANDBlock(struct yaffs_dev *dev, int block_no, enum yaffs_block_state *state, int *seq_number) { *state = YAFFS_BLOCK_STATE_EMPTY; *seq_number = 0; diff --git a/direct/yaffs_flashif.h b/direct/yaffs_flashif.h index a743147..b169170 100644 --- a/direct/yaffs_flashif.h +++ b/direct/yaffs_flashif.h @@ -19,12 +19,12 @@ #include "yaffs_guts.h" int yflash_EraseBlockInNAND(struct yaffs_dev *dev, int blockNumber); -int yflash_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const yaffs_spare *spare); +int yflash_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const struct yaffs_spare *spare); int yflash_WriteChunkWithTagsToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const struct yaffs_ext_tags *tags); -int yflash_ReadChunkFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 *data, yaffs_spare *spare); +int yflash_ReadChunkFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 *data, struct yaffs_spare *spare); int yflash_ReadChunkWithTagsFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 *data, struct yaffs_ext_tags *tags); int yflash_InitialiseNAND(struct yaffs_dev *dev); int yflash_MarkNANDBlockBad(struct yaffs_dev *dev, int block_no); -int yflash_QueryNANDBlock(struct yaffs_dev *dev, int block_no, yaffs_block_state_t *state, u32 *seq_number); +int yflash_QueryNANDBlock(struct yaffs_dev *dev, int block_no, enum yaffs_block_state *state, u32 *seq_number); #endif diff --git a/direct/yaffs_flashif2.h b/direct/yaffs_flashif2.h index 2c1a7b9..17d2dfa 100644 --- a/direct/yaffs_flashif2.h +++ b/direct/yaffs_flashif2.h @@ -19,13 +19,13 @@ #include "yaffs_guts.h" int yflash2_EraseBlockInNAND(struct yaffs_dev *dev, int blockNumber); -int yflash2_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const yaffs_spare *spare); +int yflash2_WriteChunkToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const struct yaffs_spare *spare); int yflash2_WriteChunkWithTagsToNAND(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const struct yaffs_ext_tags *tags); -int yflash2_ReadChunkFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 *data, yaffs_spare *spare); +int yflash2_ReadChunkFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 *data, struct yaffs_spare *spare); int yflash2_ReadChunkWithTagsFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 *data, struct yaffs_ext_tags *tags); int yflash2_EraseBlockInNAND(struct yaffs_dev *dev, int blockNumber); int yflash2_InitialiseNAND(struct yaffs_dev *dev); int yflash2_MarkNANDBlockBad(struct yaffs_dev *dev, int block_no); -int yflash2_QueryNANDBlock(struct yaffs_dev *dev, int block_no, yaffs_block_state_t *state, u32 *seq_number); +int yflash2_QueryNANDBlock(struct yaffs_dev *dev, int block_no, enum yaffs_block_state *state, u32 *seq_number); #endif diff --git a/direct/yaffs_nandemul2k.h b/direct/yaffs_nandemul2k.h index 670ef3b..739e118 100644 --- a/direct/yaffs_nandemul2k.h +++ b/direct/yaffs_nandemul2k.h @@ -28,7 +28,7 @@ int nandemul2k_ReadChunkWithTagsFromNAND(struct yaffs_dev *dev, struct yaffs_ext_tags *tags); int nandemul2k_MarkNANDBlockBad(struct yaffs_dev *dev, int block_no); int nandemul2k_QueryNANDBlock(struct yaffs_dev *dev, int block_no, - yaffs_block_state_t *state, u32 *seq_number); + enum yaffs_block_state *state, u32 *seq_number); int nandemul2k_EraseBlockInNAND(struct yaffs_dev *dev, int flash_block); int nandemul2k_InitialiseNAND(struct yaffs_dev *dev); diff --git a/direct/yaffs_nandif.c b/direct/yaffs_nandif.c index a05e901..57689f3 100644 --- a/direct/yaffs_nandif.c +++ b/direct/yaffs_nandif.c @@ -162,7 +162,7 @@ static int ynandif_IsBlockOk(struct yaffs_dev *dev, int blockId) return geometry->checkBlockOk(dev,blockId); } -int ynandif_QueryNANDBlock(struct yaffs_dev *dev, int blockId, yaffs_block_state_t *state, u32 *seq_number) +int ynandif_QueryNANDBlock(struct yaffs_dev *dev, int blockId, enum yaffs_block_state *state, u32 *seq_number) { unsigned chunkNo; struct yaffs_ext_tags tags; diff --git a/direct/yaffs_nandif.h b/direct/yaffs_nandif.h index acf7e9b..a130f3c 100644 --- a/direct/yaffs_nandif.h +++ b/direct/yaffs_nandif.h @@ -65,7 +65,7 @@ int ynandif_ReadChunkWithTagsFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 * int ynandif_EraseBlockInNAND(struct yaffs_dev *dev, int blockNumber); int ynandif_InitialiseNAND(struct yaffs_dev *dev); int ynandif_MarkNANDBlockBad(struct yaffs_dev *dev,int blockNumber); -int ynandif_QueryNANDBlock(struct yaffs_dev *dev, int block_no, yaffs_block_state_t *state, u32 *seq_number); +int ynandif_QueryNANDBlock(struct yaffs_dev *dev, int block_no, enum yaffs_block_state *state, u32 *seq_number); int ynandif_GetGeometry(struct yaffs_dev *dev, ynandif_Geometry *geometry); #endif diff --git a/patch-ker.sh b/patch-ker.sh index c57c637..caa7eae 100755 --- a/patch-ker.sh +++ b/patch-ker.sh @@ -57,7 +57,7 @@ if [ $MULTIORSINGLE = m ]; then MTD1_CODE="yaffs_mtdif1_multi.c" MTD2_CODE="yaffs_mtdif2_multi.c" elif [ $MULTIORSINGLE = s ]; then - VFSGLUE="yaffs_vfs_single.c" + VFS_CODE="yaffs_vfs_single.c" MTD1_CODE="yaffs_mtdif1_single.c" MTD2_CODE="yaffs_mtdif2_single.c" diff --git a/patches/yaffs_linux_allocator.c b/patches/yaffs_linux_allocator.c index 82ae3df..b538776 100644 --- a/patches/yaffs_linux_allocator.c +++ b/patches/yaffs_linux_allocator.c @@ -165,7 +165,7 @@ void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev) } -yaffs_tnode_t *yaffs_alloc_raw_tnode(struct yaffs_dev *dev) +struct yaffs_tnode *yaffs_alloc_raw_tnode(struct yaffs_dev *dev) { yaffs_Allocator *allocator = dev->allocator; if(!allocator || !allocator->tnode_cache){ @@ -175,7 +175,7 @@ yaffs_tnode_t *yaffs_alloc_raw_tnode(struct yaffs_dev *dev) return kmem_cache_alloc(allocator->tnode_cache, GFP_NOFS); } -void yaffs_free_raw_tnode(struct yaffs_dev *dev, yaffs_tnode_t *tn) +void yaffs_free_raw_tnode(struct yaffs_dev *dev, struct yaffs_tnode *tn) { yaffs_Allocator *allocator = dev->allocator; kmem_cache_free(allocator->tnode_cache,tn); diff --git a/patches/yaffs_mtdif2.c b/patches/yaffs_mtdif2.c index 1814843..19677ad 100644 --- a/patches/yaffs_mtdif2.c +++ b/patches/yaffs_mtdif2.c @@ -213,7 +213,7 @@ int nandmtd2_MarkNANDBlockBad(struct yaffs_dev *dev, int block_no) } int nandmtd2_QueryNANDBlock(struct yaffs_dev *dev, int block_no, - yaffs_block_state_t * state, int *seq_number) + enum yaffs_block_state * state, int *seq_number) { struct mtd_info *mtd = (struct mtd_info *)(dev->genericDevice); int retval; diff --git a/utils/mkyaffs2image.c b/utils/mkyaffs2image.c index d54bcc5..2d2da43 100644 --- a/utils/mkyaffs2image.c +++ b/utils/mkyaffs2image.c @@ -146,8 +146,8 @@ static int find_obj_in_list(dev_t dev, ino_t ino) static void little_to_big_endian(struct yaffs_ext_tags *tagsPtr) { #if 0 // FIXME NCB - yaffs_tags_union_t * tags = (yaffs_tags_union_t* )tagsPtr; // Work in bytes. - yaffs_tags_union_t temp; + union yaffs_tags_union * tags = (union yaffs_tags_union* )tagsPtr; // Work in bytes. + union yaffs_tags_union temp; memset(&temp, 0, sizeof(temp)); // Ick, I hate magic numbers. diff --git a/utils/mkyaffsimage.c b/utils/mkyaffsimage.c index ffb0b5a..02ad521 100644 --- a/utils/mkyaffsimage.c +++ b/utils/mkyaffsimage.c @@ -130,7 +130,7 @@ static u16 yaffs_calc_name_sum(const char *name) } -static void yaffs_calc_ecc(const u8 *data, yaffs_spare *spare) +static void yaffs_calc_ecc(const u8 *data, struct yaffs_spare *spare) { yaffs_ecc_cacl(data , spare->ecc1); yaffs_ecc_cacl(&data[256] , spare->ecc2); @@ -139,7 +139,7 @@ static void yaffs_calc_ecc(const u8 *data, yaffs_spare *spare) static void yaffs_calc_tags_ecc(struct yaffs_tags *tags) { // Todo don't do anything yet. Need to calculate ecc - unsigned char *b = ((yaffs_tags_union_t *)tags)->as_bytes; + unsigned char *b = ((union yaffs_tags_union *)tags)->as_bytes; unsigned i,j; unsigned ecc = 0; unsigned bit = 0; @@ -181,9 +181,9 @@ static void yaffs_calc_tags_ecc(struct yaffs_tags *tags) b[7] |= ((ecc & 0x3F) << 2); } } -static void yaffs_load_tags_to_spare(yaffs_spare *sparePtr, struct yaffs_tags *tagsPtr) +static void yaffs_load_tags_to_spare(struct yaffs_spare *sparePtr, struct yaffs_tags *tagsPtr) { - yaffs_tags_union_t *tu = (yaffs_tags_union_t *)tagsPtr; + union yaffs_tags_union *tu = (union yaffs_tags_union *)tagsPtr; //yaffs_calc_tags_ecc(tagsPtr); @@ -203,8 +203,8 @@ static void yaffs_load_tags_to_spare(yaffs_spare *sparePtr, struct yaffs_tags *t */ static void little_to_big_endian(struct yaffs_tags *tagsPtr) { - yaffs_tags_union_t * tags = (yaffs_tags_union_t* )tagsPtr; // Work in bytes. - yaffs_tags_union_t temp; + union yaffs_tags_union * tags = (union yaffs_tags_union* )tagsPtr; // Work in bytes. + union yaffs_tags_union temp; memset(&temp, 0, sizeof(temp)); // Ick, I hate magic numbers. @@ -231,13 +231,13 @@ static void little_to_big_endian(struct yaffs_tags *tagsPtr) static int write_chunk(u8 *data, u32 obj_id, u32 chunk_id, u32 n_bytes) { struct yaffs_tags t; - yaffs_spare s; + struct yaffs_spare s; error = write(outFile,data,512); if(error < 0) return error; memset(&t,0xff,sizeof (struct yaffs_tags)); - memset(&s,0xff,sizeof (yaffs_spare)); + memset(&s,0xff,sizeof (struct yaffs_spare)); t.chunk_id = chunk_id; t.serial_number = 0; @@ -255,7 +255,7 @@ static int write_chunk(u8 *data, u32 obj_id, u32 chunk_id, u32 n_bytes) nPages++; - return write(outFile,&s,sizeof(yaffs_spare)); + return write(outFile,&s,sizeof(struct yaffs_spare)); } diff --git a/yaffs_allocator.c b/yaffs_allocator.c index b304b67..586ca05 100644 --- a/yaffs_allocator.c +++ b/yaffs_allocator.c @@ -30,12 +30,12 @@ void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev) dev = dev; } -yaffs_tnode_t *yaffs_alloc_raw_tnode(struct yaffs_dev *dev) +struct yaffs_tnode *yaffs_alloc_raw_tnode(struct yaffs_dev *dev) { - return (yaffs_tnode_t *)YMALLOC(dev->tnode_size); + return (struct yaffs_tnode *)YMALLOC(dev->tnode_size); } -void yaffs_free_raw_tnode(struct yaffs_dev *dev, yaffs_tnode_t *tn) +void yaffs_free_raw_tnode(struct yaffs_dev *dev, struct yaffs_tnode *tn) { dev = dev; YFREE(tn); @@ -69,30 +69,27 @@ void yaffs_free_raw_obj(struct yaffs_dev *dev, struct yaffs_obj *obj) struct yaffs_tnode_list { struct yaffs_tnode_list *next; - yaffs_tnode_t *tnodes; + struct yaffs_tnode *tnodes; }; -typedef struct yaffs_tnode_list yaffs_tnodelist_t; -struct yaffs_obj_list_struct { +struct yaffs_obj_list { + struct yaffs_obj_list *next; struct yaffs_obj *objects; - struct yaffs_obj_list_struct *next; }; -typedef struct yaffs_obj_list_struct yaffs_obj_list; - struct yaffs_allocator { int n_tnodes_created; - yaffs_tnode_t *free_tnodes; + struct yaffs_tnode *free_tnodes; int n_free_tnodes; - yaffs_tnodelist_t *alloc_tnode_list; + struct yaffs_tnode_list *alloc_tnode_list; int n_obj_created; struct yaffs_obj *free_objs; int n_free_objects; - yaffs_obj_list *allocated_obj_list; + struct yaffs_obj_list *allocated_obj_list; }; @@ -101,7 +98,7 @@ static void yaffs_deinit_raw_tnodes(struct yaffs_dev *dev) struct yaffs_allocator *allocator = (struct yaffs_allocator *)dev->allocator; - yaffs_tnodelist_t *tmp; + struct yaffs_tnode_list *tmp; if(!allocator){ YBUG(); @@ -139,11 +136,11 @@ static int yaffs_create_tnodes(struct yaffs_dev *dev, int n_tnodes) { struct yaffs_allocator *allocator = (struct yaffs_allocator *)dev->allocator; int i; - yaffs_tnode_t *new_tnodes; + struct yaffs_tnode *new_tnodes; u8 *mem; - yaffs_tnode_t *curr; - yaffs_tnode_t *next; - yaffs_tnodelist_t *tnl; + struct yaffs_tnode *curr; + struct yaffs_tnode *next; + struct yaffs_tnode_list *tnl; if(!allocator){ YBUG(); @@ -167,14 +164,14 @@ static int yaffs_create_tnodes(struct yaffs_dev *dev, int n_tnodes) /* New hookup for wide tnodes */ for (i = 0; i < n_tnodes - 1; i++) { - curr = (yaffs_tnode_t *) &mem[i * dev->tnode_size]; - next = (yaffs_tnode_t *) &mem[(i+1) * dev->tnode_size]; + curr = (struct yaffs_tnode *) &mem[i * dev->tnode_size]; + next = (struct yaffs_tnode *) &mem[(i+1) * dev->tnode_size]; curr->internal[0] = next; } - curr = (yaffs_tnode_t *) &mem[(n_tnodes - 1) * dev->tnode_size]; + curr = (struct yaffs_tnode *) &mem[(n_tnodes - 1) * dev->tnode_size]; curr->internal[0] = allocator->free_tnodes; - allocator->free_tnodes = (yaffs_tnode_t *)mem; + allocator->free_tnodes = (struct yaffs_tnode *)mem; allocator->n_free_tnodes += n_tnodes; allocator->n_tnodes_created += n_tnodes; @@ -184,7 +181,7 @@ static int yaffs_create_tnodes(struct yaffs_dev *dev, int n_tnodes) * but it just means we can't free this bunch of tnodes later. */ - tnl = YMALLOC(sizeof(yaffs_tnodelist_t)); + tnl = YMALLOC(sizeof(struct yaffs_tnode_list)); if (!tnl) { T(YAFFS_TRACE_ERROR, (TSTR @@ -202,10 +199,10 @@ static int yaffs_create_tnodes(struct yaffs_dev *dev, int n_tnodes) } -yaffs_tnode_t *yaffs_alloc_raw_tnode(struct yaffs_dev *dev) +struct yaffs_tnode *yaffs_alloc_raw_tnode(struct yaffs_dev *dev) { struct yaffs_allocator *allocator = (struct yaffs_allocator *)dev->allocator; - yaffs_tnode_t *tn = NULL; + struct yaffs_tnode *tn = NULL; if(!allocator){ YBUG(); @@ -226,7 +223,7 @@ yaffs_tnode_t *yaffs_alloc_raw_tnode(struct yaffs_dev *dev) } /* FreeTnode frees up a tnode and puts it back on the free list */ -void yaffs_free_raw_tnode(struct yaffs_dev *dev, yaffs_tnode_t *tn) +void yaffs_free_raw_tnode(struct yaffs_dev *dev, struct yaffs_tnode *tn) { struct yaffs_allocator *allocator = dev->allocator; @@ -260,7 +257,7 @@ static void yaffs_init_raw_objs(struct yaffs_dev *dev) static void yaffs_deinit_raw_objs(struct yaffs_dev *dev) { struct yaffs_allocator *allocator = dev->allocator; - yaffs_obj_list *tmp; + struct yaffs_obj_list *tmp; if(!allocator){ YBUG(); @@ -287,7 +284,7 @@ static int yaffs_create_free_objs(struct yaffs_dev *dev, int n_obj) int i; struct yaffs_obj *new_objs; - yaffs_obj_list *list; + struct yaffs_obj_list *list; if(!allocator){ YBUG(); @@ -299,7 +296,7 @@ static int yaffs_create_free_objs(struct yaffs_dev *dev, int n_obj) /* make these things */ new_objs = YMALLOC(n_obj * sizeof(struct yaffs_obj)); - list = YMALLOC(sizeof(yaffs_obj_list)); + list = YMALLOC(sizeof(struct yaffs_obj_list)); if (!new_objs || !list) { if (new_objs){ diff --git a/yaffs_allocator.h b/yaffs_allocator.h index 5b06840..4d5f2ae 100644 --- a/yaffs_allocator.h +++ b/yaffs_allocator.h @@ -21,8 +21,8 @@ void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev); void yaffs_deinit_raw_tnodes_and_objs(struct yaffs_dev *dev); -yaffs_tnode_t *yaffs_alloc_raw_tnode(struct yaffs_dev *dev); -void yaffs_free_raw_tnode(struct yaffs_dev *dev, yaffs_tnode_t *tn); +struct yaffs_tnode *yaffs_alloc_raw_tnode(struct yaffs_dev *dev); +void yaffs_free_raw_tnode(struct yaffs_dev *dev, struct yaffs_tnode *tn); struct yaffs_obj *yaffs_alloc_raw_obj(struct yaffs_dev *dev); void yaffs_free_raw_obj(struct yaffs_dev *dev, struct yaffs_obj *obj); diff --git a/yaffs_checkptrw.c b/yaffs_checkptrw.c index 975546f..2991305 100644 --- a/yaffs_checkptrw.c +++ b/yaffs_checkptrw.c @@ -36,7 +36,7 @@ static int yaffs_checkpt_erase(struct yaffs_dev *dev) dev->internal_start_block, dev->internal_end_block)); for (i = dev->internal_start_block; i <= dev->internal_end_block; i++) { - yaffs_block_info_t *bi = yaffs_get_block_info(dev, i); + struct yaffs_block_info *bi = yaffs_get_block_info(dev, i); if (bi->block_state == YAFFS_BLOCK_STATE_CHECKPOINT) { T(YAFFS_TRACE_CHECKPOINT, (TSTR("erasing checkpt block %d"TENDSTR), i)); @@ -72,7 +72,7 @@ static void yaffs2_checkpt_find_erased_block(struct yaffs_dev *dev) blocks_avail > 0) { for (i = dev->checkpt_next_block; i <= dev->internal_end_block; i++) { - yaffs_block_info_t *bi = yaffs_get_block_info(dev, i); + struct yaffs_block_info *bi = yaffs_get_block_info(dev, i); if (bi->block_state == YAFFS_BLOCK_STATE_EMPTY) { dev->checkpt_next_block = i + 1; dev->checkpt_cur_block = i; @@ -208,7 +208,7 @@ static int yaffs2_checkpt_flush_buffer(struct yaffs_dev *dev) if (dev->checkpt_cur_chunk == 0) { /* First chunk we write for the block? Set block state to checkpoint */ - yaffs_block_info_t *bi = yaffs_get_block_info(dev, dev->checkpt_cur_block); + struct yaffs_block_info *bi = yaffs_get_block_info(dev, dev->checkpt_cur_block); bi->block_state = YAFFS_BLOCK_STATE_CHECKPOINT; dev->blocks_in_checkpt++; } @@ -357,7 +357,7 @@ int yaffs_checkpt_close(struct yaffs_dev *dev) int i; for (i = 0; i < dev->blocks_in_checkpt && dev->checkpt_block_list[i] >= 0; i++) { int blk = dev->checkpt_block_list[i]; - yaffs_block_info_t *bi = NULL; + struct yaffs_block_info *bi = NULL; if( dev->internal_start_block <= blk && blk <= dev->internal_end_block) bi = yaffs_get_block_info(dev, blk); if (bi && bi->block_state == YAFFS_BLOCK_STATE_EMPTY) diff --git a/yaffs_getblockinfo.h b/yaffs_getblockinfo.h index 5c35795..28bcd54 100644 --- a/yaffs_getblockinfo.h +++ b/yaffs_getblockinfo.h @@ -20,7 +20,7 @@ #include "yaffs_trace.h" /* Function to manipulate block info */ -static Y_INLINE yaffs_block_info_t *yaffs_get_block_info(struct yaffs_dev * dev, int blk) +static Y_INLINE struct yaffs_block_info *yaffs_get_block_info(struct yaffs_dev * dev, int blk) { if (blk < dev->internal_start_block || blk > dev->internal_end_block) { T(YAFFS_TRACE_ERROR, diff --git a/yaffs_guts.c b/yaffs_guts.c index 06bb13c..aa4b0d6 100644 --- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -66,7 +66,7 @@ static struct yaffs_obj *yaffs_new_obj(struct yaffs_dev *dev, int number, enum yaffs_obj_type type); -static int yaffs_apply_xattrib_mod(struct yaffs_obj *obj, char *buffer, yaffs_xattr_mod *xmod); +static int yaffs_apply_xattrib_mod(struct yaffs_obj *obj, char *buffer, struct yaffs_xattr_mod *xmod); static void yaffs_remove_obj_from_dir(struct yaffs_obj *obj); static int yaffs_check_structures(void); @@ -81,7 +81,7 @@ static int yaffs_tags_match(const struct yaffs_ext_tags *tags, int obj_id, int chunk_obj); static int yaffs_alloc_chunk(struct yaffs_dev *dev, int use_reserver, - yaffs_block_info_t **block_ptr); + struct yaffs_block_info **block_ptr); static void yaffs_check_obj_details_loaded(struct yaffs_obj *in); @@ -395,7 +395,7 @@ static int yaffs_write_new_chunk(struct yaffs_dev *dev, yaffs2_checkpt_invalidate(dev); do { - yaffs_block_info_t *bi = 0; + struct yaffs_block_info *bi = 0; int erased_ok = 0; chunk = yaffs_alloc_chunk(dev, use_reserver, &bi); @@ -493,7 +493,7 @@ static int yaffs_write_new_chunk(struct yaffs_dev *dev, static void yaffs_retire_block(struct yaffs_dev *dev, int flash_block) { - yaffs_block_info_t *bi = yaffs_get_block_info(dev, flash_block); + struct yaffs_block_info *bi = yaffs_get_block_info(dev, flash_block); yaffs2_checkpt_invalidate(dev); @@ -553,7 +553,7 @@ static void yaffs_handle_chunk_update(struct yaffs_dev *dev, int nand_chunk, tags=tags; } -void yaffs_handle_chunk_error(struct yaffs_dev *dev, yaffs_block_info_t *bi) +void yaffs_handle_chunk_error(struct yaffs_dev *dev, struct yaffs_block_info *bi) { if (!bi->gc_prioritise) { bi->gc_prioritise = 1; @@ -572,7 +572,7 @@ static void yaffs_handle_chunk_wr_error(struct yaffs_dev *dev, int nand_chunk, int erased_ok) { int flash_block = nand_chunk / dev->param.chunks_per_block; - yaffs_block_info_t *bi = yaffs_get_block_info(dev, flash_block); + struct yaffs_block_info *bi = yaffs_get_block_info(dev, flash_block); yaffs_handle_chunk_error(dev, bi); @@ -641,9 +641,9 @@ void yaffs_set_obj_name_from_oh(struct yaffs_obj *obj, const struct yaffs_obj_hd */ -yaffs_tnode_t *yaffs_get_tnode(struct yaffs_dev *dev) +struct yaffs_tnode *yaffs_get_tnode(struct yaffs_dev *dev) { - yaffs_tnode_t *tn = yaffs_alloc_raw_tnode(dev); + struct yaffs_tnode *tn = yaffs_alloc_raw_tnode(dev); if (tn){ memset(tn, 0, dev->tnode_size); dev->n_tnodes++; @@ -655,7 +655,7 @@ yaffs_tnode_t *yaffs_get_tnode(struct yaffs_dev *dev) } /* FreeTnode frees up a tnode and puts it back on the free list */ -static void yaffs_free_tnode(struct yaffs_dev *dev, yaffs_tnode_t *tn) +static void yaffs_free_tnode(struct yaffs_dev *dev, struct yaffs_tnode *tn) { yaffs_free_raw_tnode(dev,tn); dev->n_tnodes--; @@ -670,7 +670,7 @@ static void yaffs_deinit_tnodes_and_objs(struct yaffs_dev *dev) } -void yaffs_load_tnode_0(struct yaffs_dev *dev, yaffs_tnode_t *tn, unsigned pos, +void yaffs_load_tnode_0(struct yaffs_dev *dev, struct yaffs_tnode *tn, unsigned pos, unsigned val) { u32 *map = (u32 *)tn; @@ -700,7 +700,7 @@ void yaffs_load_tnode_0(struct yaffs_dev *dev, yaffs_tnode_t *tn, unsigned pos, } } -u32 yaffs_get_group_base(struct yaffs_dev *dev, yaffs_tnode_t *tn, +u32 yaffs_get_group_base(struct yaffs_dev *dev, struct yaffs_tnode *tn, unsigned pos) { u32 *map = (u32 *)tn; @@ -737,11 +737,11 @@ u32 yaffs_get_group_base(struct yaffs_dev *dev, yaffs_tnode_t *tn, */ /* FindLevel0Tnode finds the level 0 tnode, if one exists. */ -yaffs_tnode_t *yaffs_find_tnode_0(struct yaffs_dev *dev, - yaffs_file_s *file_struct, +struct yaffs_tnode *yaffs_find_tnode_0(struct yaffs_dev *dev, + struct yaffs_file_var *file_struct, u32 chunk_id) { - yaffs_tnode_t *tn = file_struct->top; + struct yaffs_tnode *tn = file_struct->top; u32 i; int required_depth; int level = file_struct->top_level; @@ -791,15 +791,15 @@ yaffs_tnode_t *yaffs_find_tnode_0(struct yaffs_dev *dev, * be plugged into the ttree. */ -yaffs_tnode_t *yaffs_add_find_tnode_0(struct yaffs_dev *dev, - yaffs_file_s *file_struct, +struct yaffs_tnode *yaffs_add_find_tnode_0(struct yaffs_dev *dev, + struct yaffs_file_var *file_struct, u32 chunk_id, - yaffs_tnode_t *passed_tn) + struct yaffs_tnode *passed_tn) { int required_depth; int i; int l; - yaffs_tnode_t *tn; + struct yaffs_tnode *tn; u32 x; @@ -916,7 +916,7 @@ static int yaffs_find_chunk_in_group(struct yaffs_dev *dev, int the_chunk, static void yaffs_soft_del_chunk(struct yaffs_dev *dev, int chunk) { - yaffs_block_info_t *the_block; + struct yaffs_block_info *the_block; unsigned block_no; T(YAFFS_TRACE_DELETION, (TSTR("soft delete chunk %d" TENDSTR), chunk)); @@ -936,7 +936,7 @@ static void yaffs_soft_del_chunk(struct yaffs_dev *dev, int chunk) * Thus, essentially this is the same as DeleteWorker except that the chunks are soft deleted. */ -static int yaffs_soft_del_worker(struct yaffs_obj *in, yaffs_tnode_t *tn, +static int yaffs_soft_del_worker(struct yaffs_obj *in, struct yaffs_tnode *tn, u32 level, int chunk_offset) { int i; @@ -1032,7 +1032,7 @@ static void yaffs_soft_del_file(struct yaffs_obj *obj) * If there is no data in a subtree then it is pruned. */ -static yaffs_tnode_t *yaffs_prune_worker(struct yaffs_dev *dev, yaffs_tnode_t *tn, +static struct yaffs_tnode *yaffs_prune_worker(struct yaffs_dev *dev, struct yaffs_tnode *tn, u32 level, int del0) { int i; @@ -1077,12 +1077,12 @@ static yaffs_tnode_t *yaffs_prune_worker(struct yaffs_dev *dev, yaffs_tnode_t *t } static int yaffs_prune_tree(struct yaffs_dev *dev, - yaffs_file_s *file_struct) + struct yaffs_file_var *file_struct) { int i; int has_data; int done = 0; - yaffs_tnode_t *tn; + struct yaffs_tnode *tn; if (file_struct->top_level > 0) { file_struct->top = @@ -1341,7 +1341,7 @@ struct yaffs_obj *yaffs_new_obj(struct yaffs_dev *dev, int number, enum yaffs_obj_type type) { struct yaffs_obj *the_obj=NULL; - yaffs_tnode_t *tn = NULL; + struct yaffs_tnode *tn = NULL; if (number < 0) number = yaffs_new_obj_id(dev); @@ -1727,9 +1727,9 @@ static int yaffs_init_blocks(struct yaffs_dev *dev) dev->alloc_block = -1; /* force it to get a new one */ /* If the first allocation strategy fails, thry the alternate one */ - dev->block_info = YMALLOC(n_blocks * sizeof(yaffs_block_info_t)); + dev->block_info = YMALLOC(n_blocks * sizeof(struct yaffs_block_info)); if (!dev->block_info) { - dev->block_info = YMALLOC_ALT(n_blocks * sizeof(yaffs_block_info_t)); + dev->block_info = YMALLOC_ALT(n_blocks * sizeof(struct yaffs_block_info)); dev->block_info_alt = 1; } else dev->block_info_alt = 0; @@ -1746,7 +1746,7 @@ static int yaffs_init_blocks(struct yaffs_dev *dev) } if (dev->block_info && dev->chunk_bits) { - memset(dev->block_info, 0, n_blocks * sizeof(yaffs_block_info_t)); + memset(dev->block_info, 0, n_blocks * sizeof(struct yaffs_block_info)); memset(dev->chunk_bits, 0, dev->chunk_bit_stride * n_blocks); return YAFFS_OK; } @@ -1775,7 +1775,7 @@ static void yaffs_deinit_blocks(struct yaffs_dev *dev) void yaffs_block_became_dirty(struct yaffs_dev *dev, int block_no) { - yaffs_block_info_t *bi = yaffs_get_block_info(dev, block_no); + struct yaffs_block_info *bi = yaffs_get_block_info(dev, block_no); int erased_ok = 0; @@ -1852,7 +1852,7 @@ static int yaffs_find_alloc_block(struct yaffs_dev *dev) { int i; - yaffs_block_info_t *bi; + struct yaffs_block_info *bi; if (dev->n_erased_blocks < 1) { /* Hoosterman we've got a problem. @@ -1915,10 +1915,10 @@ int yaffs_check_alloc_available(struct yaffs_dev *dev, int n_chunks) } static int yaffs_alloc_chunk(struct yaffs_dev *dev, int use_reserver, - yaffs_block_info_t **block_ptr) + struct yaffs_block_info **block_ptr) { int ret_val; - yaffs_block_info_t *bi; + struct yaffs_block_info *bi; if (dev->alloc_block < 0) { /* Get next block to allocate off */ @@ -1988,7 +1988,7 @@ static int yaffs_get_erased_chunks(struct yaffs_dev *dev) void yaffs_skip_rest_of_block(struct yaffs_dev *dev) { if(dev->alloc_block > 0){ - yaffs_block_info_t *bi = yaffs_get_block_info(dev, dev->alloc_block); + struct yaffs_block_info *bi = yaffs_get_block_info(dev, dev->alloc_block); if(bi->block_state == YAFFS_BLOCK_STATE_ALLOCATING){ bi->block_state = YAFFS_BLOCK_STATE_FULL; dev->alloc_block = -1; @@ -2014,7 +2014,7 @@ static int yaffs_gc_block(struct yaffs_dev *dev, int block, struct yaffs_ext_tags tags; - yaffs_block_info_t *bi = yaffs_get_block_info(dev, block); + struct yaffs_block_info *bi = yaffs_get_block_info(dev, block); struct yaffs_obj *object; @@ -2283,7 +2283,7 @@ static unsigned yaffs_find_gc_block(struct yaffs_dev *dev, unsigned selected = 0; int prioritised = 0; int prioritised_exist = 0; - yaffs_block_info_t *bi; + struct yaffs_block_info *bi; int threshold; /* First let's see if we need to grab a prioritised block */ @@ -2561,7 +2561,7 @@ static 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 */ - yaffs_tnode_t *tn; + struct yaffs_tnode *tn; int the_chunk = -1; struct yaffs_ext_tags local_tags; int ret_val = -1; @@ -2589,7 +2589,7 @@ static int yaffs_find_del_file_chunk(struct yaffs_obj *in, int inode_chunk, struct yaffs_ext_tags *tags) { /* Get the Tnode, then get the level 0 offset chunk offset */ - yaffs_tnode_t *tn; + struct yaffs_tnode *tn; int the_chunk = -1; struct yaffs_ext_tags local_tags; @@ -2630,7 +2630,7 @@ int yaffs_put_chunk_in_file(struct yaffs_obj *in, int inode_chunk, * nand_chunk = 0 is a dummy insert to make sure the tnodes are there. */ - yaffs_tnode_t *tn; + struct yaffs_tnode *tn; struct yaffs_dev *dev = in->my_dev; int existing_cunk; struct yaffs_ext_tags existing_tags; @@ -2772,7 +2772,7 @@ void yaffs_chunk_del(struct yaffs_dev *dev, int chunk_id, int mark_flash, int ly int block; int page; struct yaffs_ext_tags tags; - yaffs_block_info_t *bi; + struct yaffs_block_info *bi; if (chunk_id <= 0) return; @@ -2895,10 +2895,10 @@ static int yaffs_wr_data_obj(struct yaffs_obj *in, int inode_chunk, * If name is not NULL, then that new name is used. */ int yaffs_update_oh(struct yaffs_obj *in, const YCHAR *name, int force, - int is_shrink, int shadows, yaffs_xattr_mod *xmod) + int is_shrink, int shadows, struct yaffs_xattr_mod *xmod) { - yaffs_block_info_t *bi; + struct yaffs_block_info *bi; struct yaffs_dev *dev = in->my_dev; @@ -3085,7 +3085,7 @@ static int yaffs_obj_cache_dirty(struct yaffs_obj *obj) { struct yaffs_dev *dev = obj->my_dev; int i; - yaffs_cache_t *cache; + struct yaffs_cache *cache; int n_caches = obj->my_dev->param.n_caches; for (i = 0; i < n_caches; i++) { @@ -3104,7 +3104,7 @@ static void yaffs_flush_file_cache(struct yaffs_obj *obj) struct yaffs_dev *dev = obj->my_dev; int lowest = -99; /* Stop compiler whining. */ int i; - yaffs_cache_t *cache; + struct yaffs_cache *cache; int chunk_written = 0; int n_caches = obj->my_dev->param.n_caches; @@ -3185,7 +3185,7 @@ void yaffs_flush_whole_cache(struct yaffs_dev *dev) * Then look for the least recently used non-dirty one. * Then look for the least recently used dirty one...., flush and look again. */ -static yaffs_cache_t *yaffs_grab_chunk_worker(struct yaffs_dev *dev) +static struct yaffs_cache *yaffs_grab_chunk_worker(struct yaffs_dev *dev) { int i; @@ -3199,9 +3199,9 @@ static yaffs_cache_t *yaffs_grab_chunk_worker(struct yaffs_dev *dev) return NULL; } -static yaffs_cache_t *yaffs_grab_chunk_cache(struct yaffs_dev *dev) +static struct yaffs_cache *yaffs_grab_chunk_cache(struct yaffs_dev *dev) { - yaffs_cache_t *cache; + struct yaffs_cache *cache; struct yaffs_obj *the_obj; int usage; int i; @@ -3251,7 +3251,7 @@ static yaffs_cache_t *yaffs_grab_chunk_cache(struct yaffs_dev *dev) } /* Find a cached chunk */ -static yaffs_cache_t *yaffs_find_chunk_cache(const struct yaffs_obj *obj, +static struct yaffs_cache *yaffs_find_chunk_cache(const struct yaffs_obj *obj, int chunk_id) { struct yaffs_dev *dev = obj->my_dev; @@ -3270,7 +3270,7 @@ static yaffs_cache_t *yaffs_find_chunk_cache(const struct yaffs_obj *obj, } /* Mark the chunk for the least recently used algorithym */ -static void yaffs_use_cache(struct yaffs_dev *dev, yaffs_cache_t *cache, +static void yaffs_use_cache(struct yaffs_dev *dev, struct yaffs_cache *cache, int is_write) { @@ -3300,7 +3300,7 @@ static void yaffs_use_cache(struct yaffs_dev *dev, yaffs_cache_t *cache, static void yaffs_invalidate_chunk_cache(struct yaffs_obj *object, int chunk_id) { if (object->my_dev->param.n_caches > 0) { - yaffs_cache_t *cache = yaffs_find_chunk_cache(object, chunk_id); + struct yaffs_cache *cache = yaffs_find_chunk_cache(object, chunk_id); if (cache) cache->object = NULL; @@ -3344,7 +3344,7 @@ int yaffs_file_rd(struct yaffs_obj *in, u8 *buffer, loff_t offset, int n_copy; int n = n_bytes; int n_done = 0; - yaffs_cache_t *cache; + struct yaffs_cache *cache; struct yaffs_dev *dev; @@ -3497,7 +3497,7 @@ int yaffs_do_file_wr(struct yaffs_obj *in, const u8 *buffer, loff_t offset, * or we're using inband tags, so we want to use the cache buffers. */ if (dev->param.n_caches > 0) { - yaffs_cache_t *cache; + struct yaffs_cache *cache; /* If we can't find the data in the cache, then load the cache */ cache = yaffs_find_chunk_cache(in, chunk); @@ -4339,8 +4339,8 @@ void yaffs_update_dirty_dirs(struct yaffs_dev *dev) { struct ylist_head *link; struct yaffs_obj *obj; - yaffs_dir_s *d_s; - yaffs_obj_variant *o_v; + struct yaffs_dir_var *d_s; + union yaffs_obj_var *o_v; T(YAFFS_TRACE_BACKGROUND, (TSTR("Update dirty directories" TENDSTR))); @@ -4348,8 +4348,8 @@ void yaffs_update_dirty_dirs(struct yaffs_dev *dev) link = dev->dirty_dirs.next; ylist_del_init(link); - d_s=ylist_entry(link,yaffs_dir_s,dirty); - o_v = ylist_entry(d_s,yaffs_obj_variant,dir_variant); + d_s=ylist_entry(link,struct yaffs_dir_var,dirty); + o_v = ylist_entry(d_s,union yaffs_obj_var,dir_variant); obj = ylist_entry(o_v,struct yaffs_obj,variant); T(YAFFS_TRACE_BACKGROUND, (TSTR("Update directory %d" TENDSTR), obj->obj_id)); @@ -4776,7 +4776,7 @@ int yaffs_get_attribs(struct yaffs_obj *obj, struct iattr *attr) static int yaffs_do_xattrib_mod(struct yaffs_obj *obj, int set, const YCHAR *name, const void *value, int size, int flags) { - yaffs_xattr_mod xmod; + struct yaffs_xattr_mod xmod; int result; @@ -4795,7 +4795,7 @@ static int yaffs_do_xattrib_mod(struct yaffs_obj *obj, int set, const YCHAR *nam return -ENOSPC; } -static int yaffs_apply_xattrib_mod(struct yaffs_obj *obj, char *buffer, yaffs_xattr_mod *xmod) +static int yaffs_apply_xattrib_mod(struct yaffs_obj *obj, char *buffer, struct yaffs_xattr_mod *xmod) { int retval = 0; int x_offs = sizeof(struct yaffs_obj_hdr); @@ -5085,8 +5085,8 @@ int yaffs_guts_initialise(struct yaffs_dev *dev) dev->chunk_grp_bits = bits - dev->tnode_width; dev->tnode_size = (dev->tnode_width * YAFFS_NTNODES_LEVEL0)/8; - if(dev->tnode_size < sizeof(yaffs_tnode_t)) - dev->tnode_size = sizeof(yaffs_tnode_t); + if(dev->tnode_size < sizeof(struct yaffs_tnode)) + dev->tnode_size = sizeof(struct yaffs_tnode); dev->chunk_grp_size = 1 << dev->chunk_grp_bits; @@ -5138,7 +5138,7 @@ int yaffs_guts_initialise(struct yaffs_dev *dev) dev->param.n_caches > 0) { int i; void *buf; - int cache_bytes = dev->param.n_caches * sizeof(yaffs_cache_t); + int cache_bytes = dev->param.n_caches * sizeof(struct yaffs_cache); if (dev->param.n_caches > YAFFS_MAX_SHORT_OP_CACHES) dev->param.n_caches = YAFFS_MAX_SHORT_OP_CACHES; @@ -5294,7 +5294,7 @@ int yaffs_count_free_chunks(struct yaffs_dev *dev) int n_free=0; int b; - yaffs_block_info_t *blk; + struct yaffs_block_info *blk; blk = dev->block_info; for (b = dev->internal_start_block; b <= dev->internal_end_block; b++) { @@ -5366,9 +5366,9 @@ int yaffs_get_n_free_chunks(struct yaffs_dev *dev) static int yaffs_check_structures(void) { /* yaffs_check_struct(struct yaffs_tags,8,"struct yaffs_tags"); */ -/* yaffs_check_struct(yaffs_tags_union_t,8,"yaffs_tags_union_t"); */ -/* yaffs_check_struct(yaffs_spare,16,"yaffs_spare"); */ -/* yaffs_check_struct(yaffs_tnode_t, 2 * YAFFS_NTNODES_LEVEL0, "yaffs_tnode_t"); */ +/* yaffs_check_struct(union yaffs_tags_union,8,"union yaffs_tags_union"); */ +/* yaffs_check_struct(struct yaffs_spare,16,"struct yaffs_spare"); */ +/* yaffs_check_struct(struct yaffs_tnode, 2 * YAFFS_NTNODES_LEVEL0, "struct yaffs_tnode"); */ #ifndef CONFIG_YAFFS_WINCE yaffs_check_struct(struct yaffs_obj_hdr, 512, "struct yaffs_obj_hdr"); diff --git a/yaffs_guts.h b/yaffs_guts.h index 4e4e6b1..4730efc 100644 --- a/yaffs_guts.h +++ b/yaffs_guts.h @@ -112,7 +112,7 @@ #define YAFFS_SEQUENCE_BAD_BLOCK 0xFFFF0000 /* ChunkCache is used for short read/write operations.*/ -typedef struct { +struct yaffs_cache { struct yaffs_obj *object; int chunk_id; int last_use; @@ -120,7 +120,7 @@ typedef struct { int n_bytes; /* Only valid if the cache is dirty */ int locked; /* Can't push out or flush while locked. */ u8 *data; -} yaffs_cache_t; +} ; @@ -139,21 +139,21 @@ struct yaffs_tags { unsigned n_bytes_msb:2; }; -typedef union { +union yaffs_tags_union{ struct yaffs_tags as_tags; u8 as_bytes[8]; -} yaffs_tags_union_t; +} ; #endif /* Stuff used for extended tags in YAFFS2 */ -typedef enum { +enum yaffs_ecc_result { YAFFS_ECC_RESULT_UNKNOWN, YAFFS_ECC_RESULT_NO_ERROR, YAFFS_ECC_RESULT_FIXED, YAFFS_ECC_RESULT_UNFIXED -} yaffs_ecc_result; +} ; enum yaffs_obj_type { YAFFS_OBJECT_TYPE_UNKNOWN, @@ -168,14 +168,14 @@ enum yaffs_obj_type { struct yaffs_ext_tags{ - unsigned validity1; + unsigned validity0; unsigned chunk_used; /* Status of the chunk: used or unused */ unsigned obj_id; /* If 0 then this is not part of an object (unused) */ unsigned chunk_id; /* If 0 then this is a header, else a data chunk */ unsigned n_bytes; /* Only valid for data chunks */ /* The following stuff only has meaning when we read */ - yaffs_ecc_result ecc_result; + enum yaffs_ecc_result ecc_result; unsigned block_bad; /* YAFFS 1 stuff */ @@ -197,12 +197,12 @@ struct yaffs_ext_tags{ unsigned extra_length; /* Length if it is a file */ unsigned extra_equiv_id; /* Equivalent object Id if it is a hard link */ - unsigned validty1; + unsigned validity1; }; /* Spare structure for YAFFS1 */ -typedef struct { +struct yaffs_spare{ u8 tb0; u8 tb1; u8 tb2; @@ -215,18 +215,18 @@ typedef struct { u8 tb6; u8 tb7; u8 ecc2[3]; -} yaffs_spare; +} ; /*Special structure for passing through to mtd */ struct yaffs_nand_spare { - yaffs_spare spare; + struct yaffs_spare spare; int eccres1; int eccres2; }; /* Block data in RAM */ -typedef enum { +enum yaffs_block_state{ YAFFS_BLOCK_STATE_UNKNOWN = 0, YAFFS_BLOCK_STATE_SCANNING, @@ -270,12 +270,12 @@ typedef enum { YAFFS_BLOCK_STATE_DEAD /* This block has failed and is not in use */ -} yaffs_block_state_t; +}; #define YAFFS_NUMBER_OF_BLOCK_STATES (YAFFS_BLOCK_STATE_DEAD + 1) -typedef struct { +struct yaffs_block_info{ int soft_del_pages:10; /* number of soft deleted pages */ int pages_in_use:10; /* number of pages in use */ @@ -292,7 +292,7 @@ typedef struct { u32 seq_number; /* block sequence number for yaffs2 */ #endif -} yaffs_block_info_t; +} ; /* -------------------------- Object structure -------------------------------*/ /* This is the object structure as stored on NAND */ @@ -350,12 +350,10 @@ struct yaffs_obj_hdr { /*--------------------------- Tnode -------------------------- */ -union yaffs_tnode_union { - union yaffs_tnode_union *internal[YAFFS_NTNODES_INTERNAL]; - +struct yaffs_tnode { + struct yaffs_tnode *internal[YAFFS_NTNODES_INTERNAL]; }; -typedef union yaffs_tnode_union yaffs_tnode_t; /*------------------------ Object -----------------------------*/ @@ -366,34 +364,34 @@ typedef union yaffs_tnode_union yaffs_tnode_t; * - a hard link */ -typedef struct { +struct yaffs_file_var { u32 file_size; u32 scanned_size; u32 shrink_size; int top_level; - yaffs_tnode_t *top; -} yaffs_file_s; + struct yaffs_tnode *top; +} ; -typedef struct { +struct yaffs_dir_var{ struct ylist_head children; /* list of child links */ struct ylist_head dirty; /* Entry for list of dirty directories */ -} yaffs_dir_s; +}; -typedef struct { +struct yaffs_symlink_var{ YCHAR *alias; -} yaffs_symlink_t; +}; -typedef struct { +struct yaffs_hardlink_var{ struct yaffs_obj *equiv_obj; u32 equiv_id; -} yaffs_hard_link_s; +}; -typedef union { - yaffs_file_s file_variant; - yaffs_dir_s dir_variant; - yaffs_symlink_t symlink_variant; - yaffs_hard_link_s hardlink_variant; -} yaffs_obj_variant; +union yaffs_obj_var{ + struct yaffs_file_var file_variant; + struct yaffs_dir_var dir_variant; + struct yaffs_symlink_var symlink_variant; + struct yaffs_hardlink_var hardlink_variant; +}; @@ -466,7 +464,7 @@ struct yaffs_obj { enum yaffs_obj_type variant_type; - yaffs_obj_variant variant; + union yaffs_obj_var variant; }; @@ -476,11 +474,11 @@ struct yaffs_obj_bucket { } ; -/* yaffs_checkpt_obj_t holds the definition of an object as dumped +/* yaffs_checkpt_obj holds the definition of an object as dumped * by checkpointing. */ -typedef struct { +struct yaffs_checkpt_obj{ int struct_type; u32 obj_id; u32 parent_id; @@ -495,18 +493,18 @@ typedef struct { u8 serial; int n_data_chunks; u32 size_or_equiv_obj; -} yaffs_checkpt_obj_t; +}; /*--------------------- Temporary buffers ---------------- * * These are chunk-sized working buffers. Each device has a few */ -typedef struct { +struct yaffs_buffer { u8 *buffer; int line; /* track from whence this buffer was allocated */ int max_line; -} yaffs_buffer_t; +} ; /*----------------- Device ---------------------------------*/ @@ -553,10 +551,10 @@ struct yaffs_param { int (*write_chunk_fn) (struct yaffs_dev *dev, int nand_chunk, const u8 *data, - const yaffs_spare *spare); + const struct yaffs_spare *spare); int (*read_chunk_fn) (struct yaffs_dev *dev, int nand_chunk, u8 *data, - yaffs_spare *spare); + struct yaffs_spare *spare); int (*erase_fn) (struct yaffs_dev *dev, int flash_block); int (*initialise_flash_fn) (struct yaffs_dev *dev); @@ -571,7 +569,7 @@ struct yaffs_param { struct yaffs_ext_tags *tags); int (*bad_block_fn) (struct yaffs_dev *dev, int block_no); int (*query_block_fn) (struct yaffs_dev *dev, int block_no, - yaffs_block_state_t *state, u32 *seq_number); + enum yaffs_block_state *state, u32 *seq_number); #endif /* The remove_obj_fn function must be supplied by OS flavours that @@ -663,7 +661,7 @@ struct yaffs_dev { int checkpoint_blocks_required; /* Number of blocks needed to store current checkpoint set */ /* Block Info */ - yaffs_block_info_t *block_info; + struct yaffs_block_info *block_info; u8 *chunk_bits; /* bitmap of chunks in use */ unsigned block_info_alt:1; /* was allocated using alternative strategy */ unsigned chunk_bits_alt:1; /* was allocated using alternative strategy */ @@ -708,13 +706,13 @@ struct yaffs_dev { /* Buffer areas for storing data to recover from write failures TODO * u8 buffered_data[YAFFS_CHUNKS_PER_BLOCK][YAFFS_BYTES_PER_CHUNK]; - * yaffs_spare buffered_spare[YAFFS_CHUNKS_PER_BLOCK]; + * struct yaffs_spare buffered_spare[YAFFS_CHUNKS_PER_BLOCK]; */ int buffered_block; /* Which block is buffered here? */ int doing_buffered_block_rewrite; - yaffs_cache_t *cache; + struct yaffs_cache *cache; int cache_last_use; /* Stuff for background deletion and unlinked files.*/ @@ -726,7 +724,7 @@ struct yaffs_dev { int n_bg_deletions; /* Count of background deletions. */ /* Temporary buffer management */ - yaffs_buffer_t temp_buffer[YAFFS_N_TEMP_BUFFERS]; + struct yaffs_buffer temp_buffer[YAFFS_N_TEMP_BUFFERS]; int max_temp; int temp_in_use; int unmanaged_buffer_allocs; @@ -769,21 +767,10 @@ struct yaffs_dev { }; -/* The static layout of block usage etc is stored in the super block header */ -typedef struct { - int StructType; - int version; - int checkpt_start_block; - int checkpt_end_block; - int start_block; - int end_block; - int rfu[100]; -} yaffs_sb_header; - /* The CheckpointDevice structure holds the device information that changes at runtime and * must be preserved over unmount/mount cycles. */ -typedef struct { +struct yaffs_checkpt_dev{ int struct_type; int n_erased_blocks; int alloc_block; /* Current block being allocated off */ @@ -797,32 +784,32 @@ typedef struct { /* yaffs2 runtime stuff */ unsigned seq_number; /* Sequence number of currently allocating block */ -} yaffs_checkpt_dev_t; +}; -typedef struct { +struct yaffs_checkpt_validity{ int struct_type; u32 magic; u32 version; u32 head; -} yaffs_checkpt_validty_t; +}; -struct yaffs_shadow_fixer_s { +struct yaffs_shadow_fixer { int obj_id; int shadowed_id; - struct yaffs_shadow_fixer_s *next; + struct yaffs_shadow_fixer *next; }; /* Structure for doing xattr modifications */ -typedef struct { +struct yaffs_xattr_mod{ int set; /* If 0 then this is a deletion */ const YCHAR *name; const void *data; int size; int flags; int result; -}yaffs_xattr_mod; +}; /*----------------------- YAFFS Functions -----------------------*/ @@ -916,7 +903,7 @@ void yaffs_guts_test(struct yaffs_dev *dev); /* A few useful functions to be used within the core files*/ void yaffs_chunk_del(struct yaffs_dev *dev, int chunk_id, int mark_flash, int lyn); int yaffs_check_ff(u8 *buffer, int n_bytes); -void yaffs_handle_chunk_error(struct yaffs_dev *dev, yaffs_block_info_t *bi); +void yaffs_handle_chunk_error(struct yaffs_dev *dev, struct yaffs_block_info *bi); u8 *yaffs_get_temp_buffer(struct yaffs_dev *dev, int line_no); void yaffs_release_temp_buffer(struct yaffs_dev *dev, u8 *buffer, int line_no); @@ -936,15 +923,15 @@ void yaffs_link_fixup(struct yaffs_dev *dev, struct yaffs_obj *hard_list); void yaffs_block_became_dirty(struct yaffs_dev *dev, int block_no); int yaffs_update_oh(struct yaffs_obj *in, const YCHAR *name, int force, int is_shrink, int shadows, - yaffs_xattr_mod *xop); + struct yaffs_xattr_mod *xop); void yaffs_handle_shadowed_obj(struct yaffs_dev *dev, int obj_id, int backward_scanning); int yaffs_check_alloc_available(struct yaffs_dev *dev, int n_chunks); -yaffs_tnode_t *yaffs_get_tnode(struct yaffs_dev *dev); -yaffs_tnode_t *yaffs_add_find_tnode_0(struct yaffs_dev *dev, - yaffs_file_s *file_struct, +struct yaffs_tnode *yaffs_get_tnode(struct yaffs_dev *dev); +struct yaffs_tnode *yaffs_add_find_tnode_0(struct yaffs_dev *dev, + struct yaffs_file_var *file_struct, u32 chunk_id, - yaffs_tnode_t *passed_tn); + struct yaffs_tnode *passed_tn); int yaffs_do_file_wr(struct yaffs_obj *in, const u8 *buffer, loff_t offset, int n_bytes, int write_trhrough); @@ -953,10 +940,10 @@ void yaffs_skip_rest_of_block(struct yaffs_dev *dev); int yaffs_count_free_chunks(struct yaffs_dev *dev); -yaffs_tnode_t *yaffs_find_tnode_0(struct yaffs_dev *dev, - yaffs_file_s *file_struct, +struct yaffs_tnode *yaffs_find_tnode_0(struct yaffs_dev *dev, + struct yaffs_file_var *file_struct, u32 chunk_id); -u32 yaffs_get_group_base(struct yaffs_dev *dev, yaffs_tnode_t *tn, unsigned pos); +u32 yaffs_get_group_base(struct yaffs_dev *dev, struct yaffs_tnode *tn, unsigned pos); #endif diff --git a/yaffs_mtdif1.h b/yaffs_mtdif1.h index a71b2bb..4f0da74 100644 --- a/yaffs_mtdif1.h +++ b/yaffs_mtdif1.h @@ -23,6 +23,6 @@ int nandmtd1_read_chunk_tags(struct yaffs_dev *dev, int nand_chunk, int nandmtd1_mark_block_bad(struct yaffs_dev *dev, int block_no); int nandmtd1_query_block(struct yaffs_dev *dev, int block_no, - yaffs_block_state_t *state, u32 *seq_number); + enum yaffs_block_state *state, u32 *seq_number); #endif diff --git a/yaffs_mtd1f1_single.c b/yaffs_mtdif1_single.c similarity index 97% rename from yaffs_mtd1f1_single.c rename to yaffs_mtdif1_single.c index dcf504f..55b367b 100644 --- a/yaffs_mtd1f1_single.c +++ b/yaffs_mtdif1_single.c @@ -67,7 +67,7 @@ int nandmtd1_write_chunk_tags(struct yaffs_dev *dev, int nand_chunk, const u8 *data, const struct yaffs_ext_tags *etags) { - struct mtd_info *mtd = struct yaffs_devo_mtd(dev); + struct mtd_info *mtd = yaffs_dev_to_mtd(dev); int chunk_bytes = dev->data_bytes_per_chunk; loff_t addr = ((loff_t)nand_chunk) * chunk_bytes; struct mtd_oob_ops ops; @@ -145,7 +145,7 @@ static int rettags(struct yaffs_ext_tags *etags, int ecc_result, int retval) int nandmtd1_read_chunk_tags(struct yaffs_dev *dev, int nand_chunk, u8 *data, struct yaffs_ext_tags *etags) { - struct mtd_info *mtd = struct yaffs_devo_mtd(dev); + struct mtd_info *mtd = yaffs_dev_to_mtd(dev); int chunk_bytes = dev->data_bytes_per_chunk; loff_t addr = ((loff_t)nand_chunk) * chunk_bytes; int eccres = YAFFS_ECC_RESULT_NO_ERROR; @@ -250,7 +250,7 @@ int nandmtd1_read_chunk_tags(struct yaffs_dev *dev, */ int nandmtd1_mark_block_bad(struct yaffs_dev *dev, int block_no) { - struct mtd_info *mtd = struct yaffs_devo_mtd(dev); + struct mtd_info *mtd = yaffs_dev_to_mtd(dev); int blocksize = dev->param.chunks_per_block * dev->data_bytes_per_chunk; int retval; @@ -289,9 +289,9 @@ static int nandmtd1_test_prerequists(struct mtd_info *mtd) * Always returns YAFFS_OK. */ int nandmtd1_query_block(struct yaffs_dev *dev, int block_no, - yaffs_block_state_t *state_ptr, u32 *seq_ptr) + enum yaffs_block_state *state_ptr, u32 *seq_ptr) { - struct mtd_info *mtd = struct yaffs_devo_mtd(dev); + struct mtd_info *mtd = yaffs_dev_to_mtd(dev); int chunk_num = block_no * dev->param.chunks_per_block; loff_t addr = (loff_t)chunk_num * dev->data_bytes_per_chunk; struct yaffs_ext_tags etags; diff --git a/yaffs_mtdif2.h b/yaffs_mtdif2.h index 751dabb..e9759ff 100644 --- a/yaffs_mtdif2.h +++ b/yaffs_mtdif2.h @@ -24,6 +24,6 @@ int nandmtd2_read_chunk_tags(struct yaffs_dev *dev, int nand_chunk, u8 *data, struct yaffs_ext_tags *tags); int nandmtd2_mark_block_bad(struct yaffs_dev *dev, int block_no); int nandmtd2_query_block(struct yaffs_dev *dev, int block_no, - yaffs_block_state_t *state, u32 *seq_number); + enum yaffs_block_state *state, u32 *seq_number); #endif diff --git a/yaffs_mtd1f2_single.c b/yaffs_mtdif2_single.c similarity index 92% rename from yaffs_mtd1f2_single.c rename to yaffs_mtdif2_single.c index d798a1f..667d129 100644 --- a/yaffs_mtd1f2_single.c +++ b/yaffs_mtdif2_single.c @@ -34,7 +34,7 @@ int nandmtd2_write_chunk_tags(struct yaffs_dev *dev, int nand_chunk, const u8 *data, const struct yaffs_ext_tags *tags) { - struct mtd_info *mtd = struct yaffs_devo_mtd(dev); + struct mtd_info *mtd = yaffs_dev_to_mtd(dev); struct mtd_oob_ops ops; int retval = 0; @@ -84,7 +84,7 @@ int nandmtd2_write_chunk_tags(struct yaffs_dev *dev, int nand_chunk, int nandmtd2_read_chunk_tags(struct yaffs_dev *dev, int nand_chunk, u8 *data, struct yaffs_ext_tags *tags) { - struct mtd_info *mtd = struct yaffs_devo_mtd(dev); + struct mtd_info *mtd = yaffs_dev_to_mtd(dev); struct mtd_oob_ops ops; size_t dummy; @@ -123,7 +123,7 @@ int nandmtd2_read_chunk_tags(struct yaffs_dev *dev, int nand_chunk, ops.len = data ? dev->data_bytes_per_chunk : packed_tags_size; ops.ooboffs = 0; ops.datbuf = data; - ops.oobbuf = struct yaffs_devo_lc(dev)->spare_buffer; + ops.oobbuf = yaffs_dev_to_lc(dev)->spare_buffer; retval = mtd->read_oob(mtd, addr, &ops); } @@ -135,7 +135,7 @@ int nandmtd2_read_chunk_tags(struct yaffs_dev *dev, int nand_chunk, } } else { if (tags) { - memcpy(packed_tags_ptr, struct yaffs_devo_lc(dev)->spare_buffer, packed_tags_size); + memcpy(packed_tags_ptr, yaffs_dev_to_lc(dev)->spare_buffer, packed_tags_size); yaffs_unpack_tags2(tags, &pt, !dev->param.no_tags_ecc); } } @@ -159,7 +159,7 @@ int nandmtd2_read_chunk_tags(struct yaffs_dev *dev, int nand_chunk, int nandmtd2_mark_block_bad(struct yaffs_dev *dev, int block_no) { - struct mtd_info *mtd = struct yaffs_devo_mtd(dev); + struct mtd_info *mtd = yaffs_dev_to_mtd(dev); int retval; T(YAFFS_TRACE_MTD, (TSTR("nandmtd2_mark_block_bad %d" TENDSTR), block_no)); @@ -177,9 +177,9 @@ int nandmtd2_mark_block_bad(struct yaffs_dev *dev, int block_no) } int nandmtd2_query_block(struct yaffs_dev *dev, int block_no, - yaffs_block_state_t *state, u32 *seq_number) + enum yaffs_block_state *state, u32 *seq_number) { - struct mtd_info *mtd = struct yaffs_devo_mtd(dev); + struct mtd_info *mtd = yaffs_dev_to_mtd(dev); int retval; T(YAFFS_TRACE_MTD, diff --git a/yaffs_nand.c b/yaffs_nand.c index 11eec44..d45259e 100644 --- a/yaffs_nand.c +++ b/yaffs_nand.c @@ -43,7 +43,7 @@ int yaffs_rd_chunk_tags_nand(struct yaffs_dev *dev, int nand_chunk, if (tags && tags->ecc_result > YAFFS_ECC_RESULT_NO_ERROR) { - yaffs_block_info_t *bi; + struct yaffs_block_info *bi; bi = yaffs_get_block_info(dev, nand_chunk/dev->param.chunks_per_block); yaffs_handle_chunk_error(dev, bi); } @@ -101,7 +101,7 @@ int yaffs_mark_bad(struct yaffs_dev *dev, int block_no) int yaffs_query_init_block_state(struct yaffs_dev *dev, int block_no, - yaffs_block_state_t *state, + enum yaffs_block_state *state, u32 *seq_number) { block_no -= dev->block_offset; diff --git a/yaffs_nand.h b/yaffs_nand.h index 51a334b..773badb 100644 --- a/yaffs_nand.h +++ b/yaffs_nand.h @@ -32,7 +32,7 @@ int yaffs_mark_bad(struct yaffs_dev *dev, int block_no); int yaffs_query_init_block_state(struct yaffs_dev *dev, int block_no, - yaffs_block_state_t *state, + enum yaffs_block_state *state, unsigned *seq_number); int yaffs_erase_block(struct yaffs_dev *dev, diff --git a/yaffs_packedtags2.c b/yaffs_packedtags2.c index 20f0d78..12a893e 100644 --- a/yaffs_packedtags2.c +++ b/yaffs_packedtags2.c @@ -159,7 +159,7 @@ void yaffs_unpack_tags2_tags_only(struct yaffs_ext_tags *t, void yaffs_unpack_tags2(struct yaffs_ext_tags *t, yaffs_packed_tags2 *pt, int tags_ecc) { - yaffs_ecc_result ecc_result = YAFFS_ECC_RESULT_NO_ERROR; + enum yaffs_ecc_result ecc_result = YAFFS_ECC_RESULT_NO_ERROR; if (pt->t.seq_number != 0xFFFFFFFF && tags_ecc){ diff --git a/yaffs_tagscompat.c b/yaffs_tagscompat.c index f3fe9e8..57b1e54 100644 --- a/yaffs_tagscompat.c +++ b/yaffs_tagscompat.c @@ -48,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, struct yaffs_spare *spare) { yaffs_ecc_cacl(data, spare->ecc1); yaffs_ecc_cacl(&data[256], spare->ecc2); @@ -58,7 +58,7 @@ void yaffs_calc_tags_ecc(struct yaffs_tags *tags) { /* Calculate an ecc */ - unsigned char *b = ((yaffs_tags_union_t *) tags)->as_bytes; + unsigned char *b = ((union yaffs_tags_union *) tags)->as_bytes; unsigned i, j; unsigned ecc = 0; unsigned bit = 0; @@ -87,7 +87,7 @@ int yaffs_check_tags_ecc(struct yaffs_tags *tags) if (ecc && ecc <= 64) { /* TODO: Handle the failure better. Retire? */ - unsigned char *b = ((yaffs_tags_union_t *) tags)->as_bytes; + unsigned char *b = ((union yaffs_tags_union *) tags)->as_bytes; ecc--; @@ -108,10 +108,10 @@ int yaffs_check_tags_ecc(struct yaffs_tags *tags) /********** Tags **********/ -static void yaffs_load_tags_to_spare(yaffs_spare *spare_ptr, +static void yaffs_load_tags_to_spare(struct yaffs_spare *spare_ptr, struct yaffs_tags *tags_ptr) { - yaffs_tags_union_t *tu = (yaffs_tags_union_t *) tags_ptr; + union yaffs_tags_union *tu = (union yaffs_tags_union *) tags_ptr; yaffs_calc_tags_ecc(tags_ptr); @@ -125,10 +125,10 @@ static void yaffs_load_tags_to_spare(yaffs_spare *spare_ptr, spare_ptr->tb7 = tu->as_bytes[7]; } -static void yaffs_get_tags_from_spare(struct yaffs_dev *dev, yaffs_spare *spare_ptr, +static void yaffs_get_tags_from_spare(struct yaffs_dev *dev, struct yaffs_spare *spare_ptr, struct yaffs_tags *tags_ptr) { - yaffs_tags_union_t *tu = (yaffs_tags_union_t *) tags_ptr; + union yaffs_tags_union *tu = (union yaffs_tags_union *) tags_ptr; int result; tu->as_bytes[0] = spare_ptr->tb0; @@ -147,14 +147,14 @@ static void yaffs_get_tags_from_spare(struct yaffs_dev *dev, yaffs_spare *spare_ dev->n_tags_ecc_unfixed++; } -static void yaffs_spare_init(yaffs_spare *spare) +static void yaffs_spare_init(struct yaffs_spare *spare) { - memset(spare, 0xFF, sizeof(yaffs_spare)); + memset(spare, 0xFF, sizeof(struct yaffs_spare)); } static int yaffs_wr_nand(struct yaffs_dev *dev, int nand_chunk, const u8 *data, - yaffs_spare *spare) + struct yaffs_spare *spare) { if (nand_chunk < dev->param.start_block * dev->param.chunks_per_block) { T(YAFFS_TRACE_ERROR, @@ -169,12 +169,12 @@ static int yaffs_wr_nand(struct yaffs_dev *dev, static int yaffs_rd_chunk_nand(struct yaffs_dev *dev, int nand_chunk, u8 *data, - yaffs_spare *spare, - yaffs_ecc_result *ecc_result, + struct yaffs_spare *spare, + enum yaffs_ecc_result *ecc_result, int correct_errors) { int ret_val; - yaffs_spare local_spare; + struct yaffs_spare local_spare; if (!spare && data) { /* If we don't have a real spare, then we use a local one. */ @@ -245,8 +245,8 @@ static int yaffs_rd_chunk_nand(struct yaffs_dev *dev, memset(&nspare, 0, sizeof(nspare)); ret_val = dev->param.read_chunk_fn(dev, nand_chunk, data, - (yaffs_spare *) &nspare); - memcpy(spare, &nspare, sizeof(yaffs_spare)); + (struct yaffs_spare *) &nspare); + memcpy(spare, &nspare, sizeof(struct yaffs_spare)); if (data && correct_errors) { if (nspare.eccres1 > 0) { T(YAFFS_TRACE_ERROR, @@ -316,7 +316,7 @@ int yaffs_tags_compat_wr(struct yaffs_dev *dev, const u8 *data, const struct yaffs_ext_tags *ext_tags) { - yaffs_spare spare; + struct yaffs_spare spare; struct yaffs_tags tags; yaffs_spare_init(&spare); @@ -353,11 +353,11 @@ int yaffs_tags_compat_rd(struct yaffs_dev *dev, struct yaffs_ext_tags *ext_tags) { - yaffs_spare spare; + struct yaffs_spare spare; struct yaffs_tags tags; - yaffs_ecc_result ecc_result = YAFFS_ECC_RESULT_UNKNOWN; + enum yaffs_ecc_result ecc_result = YAFFS_ECC_RESULT_UNKNOWN; - static yaffs_spare spare_ff; + static struct yaffs_spare spare_ff; static int init; if (!init) { @@ -405,9 +405,9 @@ int yaffs_tags_compat_mark_bad(struct yaffs_dev *dev, int flash_block) { - yaffs_spare spare; + struct yaffs_spare spare; - memset(&spare, 0xff, sizeof(yaffs_spare)); + memset(&spare, 0xff, sizeof(struct yaffs_spare)); spare.block_status = 'Y'; @@ -422,14 +422,14 @@ int yaffs_tags_compat_mark_bad(struct yaffs_dev *dev, int yaffs_tags_compat_query_block(struct yaffs_dev *dev, int block_no, - yaffs_block_state_t *state, + enum yaffs_block_state *state, u32 *seq_number) { - yaffs_spare spare0, spare1; - static yaffs_spare spare_ff; + struct yaffs_spare spare0, spare1; + static struct yaffs_spare spare_ff; static int init; - yaffs_ecc_result dummy; + enum yaffs_ecc_result dummy; if (!init) { memset(&spare_ff, 0xFF, sizeof(spare_ff)); diff --git a/yaffs_tagscompat.h b/yaffs_tagscompat.h index c906883..cf3402d 100644 --- a/yaffs_tagscompat.h +++ b/yaffs_tagscompat.h @@ -29,7 +29,7 @@ int yaffs_tags_compat_mark_bad(struct yaffs_dev *dev, int block_no); int yaffs_tags_compat_query_block(struct yaffs_dev *dev, int block_no, - yaffs_block_state_t *state, + enum yaffs_block_state *state, u32 *seq_number); void yaffs_calc_tags_ecc(struct yaffs_tags *tags); diff --git a/yaffs_tagsvalidity.c b/yaffs_tagsvalidity.c index 67a5eaf..f86882a 100644 --- a/yaffs_tagsvalidity.c +++ b/yaffs_tagsvalidity.c @@ -16,13 +16,13 @@ void yaffs_init_tags(struct yaffs_ext_tags *tags) { memset(tags, 0, sizeof(struct yaffs_ext_tags)); - tags->validity1 = 0xAAAAAAAA; - tags->validty1 = 0x55555555; + tags->validity0 = 0xAAAAAAAA; + tags->validity1 = 0x55555555; } int yaffs_validate_tags(struct yaffs_ext_tags *tags) { - return (tags->validity1 == 0xAAAAAAAA && - tags->validty1 == 0x55555555); + return (tags->validity0 == 0xAAAAAAAA && + tags->validity1 == 0x55555555); } diff --git a/yaffs_verify.c b/yaffs_verify.c index 0e27228..95093df 100644 --- a/yaffs_verify.c +++ b/yaffs_verify.c @@ -51,7 +51,7 @@ static const char *block_state_name[] = { }; -void yaffs_verify_blk(struct yaffs_dev *dev, yaffs_block_info_t *bi, int n) +void yaffs_verify_blk(struct yaffs_dev *dev, struct yaffs_block_info *bi, int n) { int actually_used; int in_use; @@ -92,7 +92,7 @@ void yaffs_verify_blk(struct yaffs_dev *dev, yaffs_block_info_t *bi, int n) -void yaffs_verify_collected_blk(struct yaffs_dev *dev, yaffs_block_info_t *bi, int n) +void yaffs_verify_collected_blk(struct yaffs_dev *dev, struct yaffs_block_info *bi, int n) { yaffs_verify_blk(dev, bi, n); @@ -117,7 +117,7 @@ void yaffs_verify_blocks(struct yaffs_dev *dev) memset(state_count, 0, sizeof(state_count)); for (i = dev->internal_start_block; i <= dev->internal_end_block; i++) { - yaffs_block_info_t *bi = yaffs_get_block_info(dev, i); + struct yaffs_block_info *bi = yaffs_get_block_info(dev, i); yaffs_verify_blk(dev, bi, i); if (bi->block_state < YAFFS_NUMBER_OF_BLOCK_STATES) @@ -226,7 +226,7 @@ void yaffs_verify_file(struct yaffs_obj *obj) u32 i; struct yaffs_dev *dev; struct yaffs_ext_tags tags; - yaffs_tnode_t *tn; + struct yaffs_tnode *tn; u32 obj_id; if (!obj) diff --git a/yaffs_verify.h b/yaffs_verify.h index fdff0ba..88924ef 100644 --- a/yaffs_verify.h +++ b/yaffs_verify.h @@ -18,8 +18,8 @@ #include "yaffs_guts.h" -void yaffs_verify_blk(struct yaffs_dev *dev, yaffs_block_info_t *bi, int n); -void yaffs_verify_collected_blk(struct yaffs_dev *dev, yaffs_block_info_t *bi, int n); +void yaffs_verify_blk(struct yaffs_dev *dev, struct yaffs_block_info *bi, int n); +void yaffs_verify_collected_blk(struct yaffs_dev *dev, struct yaffs_block_info *bi, int n); void yaffs_verify_blocks(struct yaffs_dev *dev); void yaffs_verify_oh(struct yaffs_obj *obj, struct yaffs_obj_hdr *oh, struct yaffs_ext_tags *tags, int parent_check); diff --git a/yaffs_vfs_single.c b/yaffs_vfs_single.c index 0a7c85c..2e92c25 100644 --- a/yaffs_vfs_single.c +++ b/yaffs_vfs_single.c @@ -297,14 +297,14 @@ static unsigned yaffs_gc_control_callback(struct yaffs_dev *dev) static void yaffs_gross_lock(struct yaffs_dev *dev) { T(YAFFS_TRACE_LOCK, (TSTR("yaffs locking %p\n"), current)); - down(&(struct yaffs_devo_lc(dev)->gross_lock)); + down(&(yaffs_dev_to_lc(dev)->gross_lock)); T(YAFFS_TRACE_LOCK, (TSTR("yaffs locked %p\n"), current)); } static void yaffs_gross_unlock(struct yaffs_dev *dev) { T(YAFFS_TRACE_LOCK, (TSTR("yaffs unlocking %p\n"), current)); - up(&(struct yaffs_devo_lc(dev)->gross_lock)); + up(&(yaffs_dev_to_lc(dev)->gross_lock)); } @@ -418,7 +418,7 @@ static struct yaffs_search_context * yaffs_new_search(struct yaffs_obj *dir) dir->variant.dir_variant.children.next, struct yaffs_obj,siblings); YINIT_LIST_HEAD(&sc->others); - ylist_add(&sc->others,&(struct yaffs_devo_lc(dev)->search_contexts)); + ylist_add(&sc->others,&(yaffs_dev_to_lc(dev)->search_contexts)); } return sc; } @@ -467,7 +467,7 @@ static void yaffs_remove_obj_callback(struct yaffs_obj *obj) struct ylist_head *i; struct yaffs_search_context *sc; - struct ylist_head *search_contexts = &(struct yaffs_devo_lc(obj->my_dev)->search_contexts); + struct ylist_head *search_contexts = &(yaffs_dev_to_lc(obj->my_dev)->search_contexts); /* Iterate through the directory search contexts. @@ -550,7 +550,7 @@ static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry, struct yaffs_dev *dev = yaffs_inode_to_obj(dir)->my_dev; - if(current != struct yaffs_devo_lc(dev)->readdir_process) + if(current != yaffs_dev_to_lc(dev)->readdir_process) yaffs_gross_lock(dev); T(YAFFS_TRACE_OS, @@ -563,7 +563,7 @@ static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry, obj = yaffs_get_equivalent_obj(obj); /* in case it was a hardlink */ /* Can't hold gross lock when calling yaffs_get_inode() */ - if(current != struct yaffs_devo_lc(dev)->readdir_process) + if(current != yaffs_dev_to_lc(dev)->readdir_process) yaffs_gross_unlock(dev); if (obj) { @@ -1187,7 +1187,7 @@ static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir) yaffs_gross_lock(dev); - struct yaffs_devo_lc(dev)->readdir_process = current; + yaffs_dev_to_lc(dev)->readdir_process = current; offset = f->f_pos; @@ -1272,7 +1272,7 @@ static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir) out: yaffs_search_end(sc); - struct yaffs_devo_lc(dev)->readdir_process = NULL; + yaffs_dev_to_lc(dev)->readdir_process = NULL; yaffs_gross_unlock(dev); return ret_val; @@ -1818,7 +1818,7 @@ static void yaffs_flush_super(struct super_block *sb, int do_checkpoint) static unsigned yaffs_bg_gc_urgency(struct yaffs_dev *dev) { unsigned erased_chunks = dev->n_erased_blocks * dev->param.chunks_per_block; - struct yaffs_linux_context *context = struct yaffs_devo_lc(dev); + struct yaffs_linux_context *context = yaffs_dev_to_lc(dev); unsigned scattered = 0; /* Free chunks not in an erased block */ if(erased_chunks < dev->n_free_chunks) @@ -1889,7 +1889,7 @@ void yaffs_background_waker(unsigned long data) static int yaffs_bg_thread_fn(void *data) { struct yaffs_dev *dev = (struct yaffs_dev *)data; - struct yaffs_linux_context *context = struct yaffs_devo_lc(dev); + struct yaffs_linux_context *context = yaffs_dev_to_lc(dev); unsigned long now = jiffies; unsigned long next_dir_update = now; unsigned long next_gc = now; @@ -1963,7 +1963,7 @@ static int yaffs_bg_thread_fn(void *data) static int yaffs_bg_start(struct yaffs_dev *dev) { int retval = 0; - struct yaffs_linux_context *context = struct yaffs_devo_lc(dev); + struct yaffs_linux_context *context = yaffs_dev_to_lc(dev); if(dev->read_only) return -1; @@ -1983,7 +1983,7 @@ static int yaffs_bg_start(struct yaffs_dev *dev) static void yaffs_bg_stop(struct yaffs_dev *dev) { - struct yaffs_linux_context *ctxt = struct yaffs_devo_lc(dev); + struct yaffs_linux_context *ctxt = yaffs_dev_to_lc(dev); ctxt->bg_running = 0; @@ -2071,8 +2071,8 @@ static void yaffs_put_super(struct super_block *sb) yaffs_flush_super(sb,1); - if (struct yaffs_devo_lc(dev)->put_super_fn) - struct yaffs_devo_lc(dev)->put_super_fn(sb); + if (yaffs_dev_to_lc(dev)->put_super_fn) + yaffs_dev_to_lc(dev)->put_super_fn(sb); yaffs_deinitialise(dev); @@ -2080,12 +2080,12 @@ static void yaffs_put_super(struct super_block *sb) yaffs_gross_unlock(dev); down(&yaffs_context_lock); - ylist_del_init(&(struct yaffs_devo_lc(dev)->context_list)); + ylist_del_init(&(yaffs_dev_to_lc(dev)->context_list)); up(&yaffs_context_lock); - if (struct yaffs_devo_lc(dev)->spare_buffer) { - YFREE(struct yaffs_devo_lc(dev)->spare_buffer); - struct yaffs_devo_lc(dev)->spare_buffer = NULL; + if (yaffs_dev_to_lc(dev)->spare_buffer) { + YFREE(yaffs_dev_to_lc(dev)->spare_buffer); + yaffs_dev_to_lc(dev)->spare_buffer = NULL; } kfree(dev); @@ -2094,7 +2094,7 @@ static void yaffs_put_super(struct super_block *sb) static void yaffs_mtd_put_super(struct super_block *sb) { - struct mtd_info *mtd = struct yaffs_devo_mtd(yaffs_super_to_dev(sb)); + struct mtd_info *mtd = yaffs_dev_to_mtd(yaffs_super_to_dev(sb)); if (mtd->sync) mtd->sync(mtd); @@ -2105,7 +2105,7 @@ static void yaffs_mtd_put_super(struct super_block *sb) static void yaffs_touch_super(struct yaffs_dev *dev) { - struct super_block *sb = struct yaffs_devo_lc(dev)->super; + struct super_block *sb = yaffs_dev_to_lc(dev)->super; T(YAFFS_TRACE_OS, (TSTR("yaffs_touch_super() sb = %p\n"), sb)); if (sb) @@ -2455,7 +2455,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, nandmtd2_read_chunk_tags; param->bad_block_fn = nandmtd2_mark_block_bad; param->query_block_fn = nandmtd2_query_block; - struct yaffs_devo_lc(dev)->spare_buffer = YMALLOC(mtd->oobsize); + yaffs_dev_to_lc(dev)->spare_buffer = YMALLOC(mtd->oobsize); param->is_yaffs2 = 1; param->total_bytes_per_chunk = mtd->writesize; param->chunks_per_block = mtd->erasesize / mtd->writesize; @@ -2477,12 +2477,12 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, param->erase_fn = nandmtd_erase_block; param->initialise_flash_fn = nandmtd_initialise; - struct yaffs_devo_lc(dev)->put_super_fn = yaffs_mtd_put_super; + yaffs_dev_to_lc(dev)->put_super_fn = yaffs_mtd_put_super; param->sb_dirty_fn = yaffs_touch_super; param->gc_control = yaffs_gc_control_callback; - struct yaffs_devo_lc(dev)->super= sb; + yaffs_dev_to_lc(dev)->super= sb; #ifndef CONFIG_YAFFS_DOES_ECC @@ -2509,14 +2509,14 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, } context->mount_id = mount_id; - ylist_add_tail(&(struct yaffs_devo_lc(dev)->context_list), &yaffs_context_list); + ylist_add_tail(&(yaffs_dev_to_lc(dev)->context_list), &yaffs_context_list); up(&yaffs_context_lock); /* Directory search handling...*/ - YINIT_LIST_HEAD(&(struct yaffs_devo_lc(dev)->search_contexts)); + YINIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->search_contexts)); param->remove_obj_fn = yaffs_remove_obj_callback; - init_MUTEX(&(struct yaffs_devo_lc(dev)->gross_lock)); + init_MUTEX(&(yaffs_dev_to_lc(dev)->gross_lock)); yaffs_gross_lock(dev); diff --git a/yaffs_yaffs1.c b/yaffs_yaffs1.c index 3acb1d2..89d570e 100644 --- a/yaffs_yaffs1.c +++ b/yaffs_yaffs1.c @@ -28,9 +28,9 @@ int yaffs1_scan(struct yaffs_dev *dev) int chunk; int c; int deleted; - yaffs_block_state_t state; + enum yaffs_block_state state; struct yaffs_obj *hard_list = NULL; - yaffs_block_info_t *bi; + struct yaffs_block_info *bi; u32 seq_number; struct yaffs_obj_hdr *oh; struct yaffs_obj *in; @@ -38,7 +38,7 @@ int yaffs1_scan(struct yaffs_dev *dev) int alloc_failed = 0; - struct yaffs_shadow_fixer_s *shadow_fixers = NULL; + struct yaffs_shadow_fixer *shadow_fixers = NULL; u8 *chunk_data; @@ -216,8 +216,8 @@ int yaffs1_scan(struct yaffs_dev *dev) if (in && oh->shadows_obj > 0) { - struct yaffs_shadow_fixer_s *fixer; - fixer = YMALLOC(sizeof(struct yaffs_shadow_fixer_s)); + struct yaffs_shadow_fixer *fixer; + fixer = YMALLOC(sizeof(struct yaffs_shadow_fixer)); if (fixer) { fixer->next = shadow_fixers; shadow_fixers = fixer; @@ -422,7 +422,7 @@ int yaffs1_scan(struct yaffs_dev *dev) /* Fix up any shadowed objects */ { - struct yaffs_shadow_fixer_s *fixer; + struct yaffs_shadow_fixer *fixer; struct yaffs_obj *obj; while (shadow_fixers) { diff --git a/yaffs_yaffs2.c b/yaffs_yaffs2.c index 3df499d..5162f15 100644 --- a/yaffs_yaffs2.c +++ b/yaffs_yaffs2.c @@ -46,7 +46,7 @@ void yaffs_calc_oldest_dirty_seq(struct yaffs_dev *dev) int i; unsigned seq; unsigned block_no = 0; - yaffs_block_info_t *b; + struct yaffs_block_info *b; if(!dev->param.is_yaffs2) return; @@ -87,7 +87,7 @@ void yaffs2_find_oldest_dirty_seq(struct yaffs_dev *dev) * becomes invalid). If the value matches the oldest then we clear * dev->oldest_dirty_seq to force its recomputation. */ -void yaffs2_clear_oldest_dirty_seq(struct yaffs_dev *dev, yaffs_block_info_t *bi) +void yaffs2_clear_oldest_dirty_seq(struct yaffs_dev *dev, struct yaffs_block_info *bi) { if(!dev->param.is_yaffs2) @@ -104,7 +104,7 @@ void yaffs2_clear_oldest_dirty_seq(struct yaffs_dev *dev, yaffs_block_info_t *bi * Update the oldest dirty sequence number whenever we dirty a block. * Only do this if the oldest_dirty_seq is actually being tracked. */ -void yaffs2_update_oldest_dirty_seq(struct yaffs_dev *dev, unsigned block_no, yaffs_block_info_t *bi) +void yaffs2_update_oldest_dirty_seq(struct yaffs_dev *dev, unsigned block_no, struct yaffs_block_info *bi) { if(!dev->param.is_yaffs2) return; @@ -118,7 +118,7 @@ void yaffs2_update_oldest_dirty_seq(struct yaffs_dev *dev, unsigned block_no, ya } int yaffs_block_ok_for_gc(struct yaffs_dev *dev, - yaffs_block_info_t *bi) + struct yaffs_block_info *bi) { if (!dev->param.is_yaffs2) @@ -147,7 +147,7 @@ u32 yaffs2_find_refresh_block(struct yaffs_dev *dev) u32 oldest = 0; u32 oldest_seq = 0; - yaffs_block_info_t *bi; + struct yaffs_block_info *bi; if(!dev->param.is_yaffs2) return oldest; @@ -225,13 +225,13 @@ int yaffs_calc_checkpt_blocks_required(struct yaffs_dev *dev) int n_blocks; int dev_blocks = (dev->param.end_block - dev->param.start_block + 1); - n_bytes += sizeof(yaffs_checkpt_validty_t); - n_bytes += sizeof(yaffs_checkpt_dev_t); - n_bytes += dev_blocks * sizeof(yaffs_block_info_t); + n_bytes += sizeof(struct yaffs_checkpt_validity); + n_bytes += sizeof(struct yaffs_checkpt_dev); + n_bytes += dev_blocks * sizeof(struct yaffs_block_info); n_bytes += dev_blocks * dev->chunk_bit_stride; - n_bytes += (sizeof(yaffs_checkpt_obj_t) + sizeof(u32)) * (dev->n_obj); + n_bytes += (sizeof(struct yaffs_checkpt_obj) + sizeof(u32)) * (dev->n_obj); n_bytes += (dev->tnode_size + sizeof(u32)) * (dev->n_tnodes); - n_bytes += sizeof(yaffs_checkpt_validty_t); + n_bytes += sizeof(struct yaffs_checkpt_validity); n_bytes += sizeof(u32); /* checksum*/ /* Round up and add 2 blocks to allow for some bad blocks, so add 3 */ @@ -252,7 +252,7 @@ int yaffs_calc_checkpt_blocks_required(struct yaffs_dev *dev) static int yaffs2_wr_checkpt_validity_marker(struct yaffs_dev *dev, int head) { - yaffs_checkpt_validty_t cp; + struct yaffs_checkpt_validity cp; memset(&cp, 0, sizeof(cp)); @@ -265,9 +265,9 @@ static int yaffs2_wr_checkpt_validity_marker(struct yaffs_dev *dev, int head) 1 : 0; } -static int yaffs2_rd_checkpt_validty_marker(struct yaffs_dev *dev, int head) +static int yaffs2_rd_checkpt_validity_marker(struct yaffs_dev *dev, int head) { - yaffs_checkpt_validty_t cp; + struct yaffs_checkpt_validity cp; int ok; ok = (yaffs2_checkpt_rd(dev, &cp, sizeof(cp)) == sizeof(cp)); @@ -280,7 +280,7 @@ static int yaffs2_rd_checkpt_validty_marker(struct yaffs_dev *dev, int head) return ok ? 1 : 0; } -static void yaffs2_dev_to_checkpt_dev(yaffs_checkpt_dev_t *cp, +static void yaffs2_dev_to_checkpt_dev(struct yaffs_checkpt_dev *cp, struct yaffs_dev *dev) { cp->n_erased_blocks = dev->n_erased_blocks; @@ -296,7 +296,7 @@ static void yaffs2_dev_to_checkpt_dev(yaffs_checkpt_dev_t *cp, } static void yaffs_checkpt_dev_to_dev(struct yaffs_dev *dev, - yaffs_checkpt_dev_t *cp) + struct yaffs_checkpt_dev *cp) { dev->n_erased_blocks = cp->n_erased_blocks; dev->alloc_block = cp->alloc_block; @@ -312,7 +312,7 @@ static void yaffs_checkpt_dev_to_dev(struct yaffs_dev *dev, static int yaffs2_wr_checkpt_dev(struct yaffs_dev *dev) { - yaffs_checkpt_dev_t cp; + struct yaffs_checkpt_dev cp; u32 n_bytes; u32 n_blocks = (dev->internal_end_block - dev->internal_start_block + 1); @@ -326,7 +326,7 @@ static int yaffs2_wr_checkpt_dev(struct yaffs_dev *dev) /* Write block info */ if (ok) { - n_bytes = n_blocks * sizeof(yaffs_block_info_t); + n_bytes = n_blocks * sizeof(struct yaffs_block_info); ok = (yaffs2_checkpt_wr(dev, dev->block_info, n_bytes) == n_bytes); } @@ -341,7 +341,7 @@ static int yaffs2_wr_checkpt_dev(struct yaffs_dev *dev) static int yaffs2_rd_checkpt_dev(struct yaffs_dev *dev) { - yaffs_checkpt_dev_t cp; + struct yaffs_checkpt_dev cp; u32 n_bytes; u32 n_blocks = (dev->internal_end_block - dev->internal_start_block + 1); @@ -357,7 +357,7 @@ static int yaffs2_rd_checkpt_dev(struct yaffs_dev *dev) yaffs_checkpt_dev_to_dev(dev, &cp); - n_bytes = n_blocks * sizeof(yaffs_block_info_t); + n_bytes = n_blocks * sizeof(struct yaffs_block_info); ok = (yaffs2_checkpt_rd(dev, dev->block_info, n_bytes) == n_bytes); @@ -370,7 +370,7 @@ static int yaffs2_rd_checkpt_dev(struct yaffs_dev *dev) return ok ? 1 : 0; } -static void yaffs2_obj_checkpt_obj(yaffs_checkpt_obj_t *cp, +static void yaffs2_obj_checkpt_obj(struct yaffs_checkpt_obj *cp, struct yaffs_obj *obj) { @@ -393,7 +393,7 @@ static void yaffs2_obj_checkpt_obj(yaffs_checkpt_obj_t *cp, cp->size_or_equiv_obj = obj->variant.hardlink_variant.equiv_id; } -static int taffs2_checkpt_obj_to_obj(struct yaffs_obj *obj, yaffs_checkpt_obj_t *cp) +static int taffs2_checkpt_obj_to_obj(struct yaffs_obj *obj, struct yaffs_checkpt_obj *cp) { struct yaffs_obj *parent; @@ -451,7 +451,7 @@ static int taffs2_checkpt_obj_to_obj(struct yaffs_obj *obj, yaffs_checkpt_obj_t -static int yaffs2_checkpt_tnode_worker(struct yaffs_obj *in, yaffs_tnode_t *tn, +static int yaffs2_checkpt_tnode_worker(struct yaffs_obj *in, struct yaffs_tnode *tn, u32 level, int chunk_offset) { int i; @@ -505,8 +505,8 @@ static int yaffs2_rd_checkpt_tnodes(struct yaffs_obj *obj) u32 base_chunk; int ok = 1; struct yaffs_dev *dev = obj->my_dev; - yaffs_file_s *file_stuct_ptr = &obj->variant.file_variant; - yaffs_tnode_t *tn; + struct yaffs_file_var *file_stuct_ptr = &obj->variant.file_variant; + struct yaffs_tnode *tn; int nread = 0; ok = (yaffs2_checkpt_rd(dev, &base_chunk, sizeof(base_chunk)) == sizeof(base_chunk)); @@ -544,7 +544,7 @@ static int yaffs2_rd_checkpt_tnodes(struct yaffs_obj *obj) static int yaffs2_wr_checkpt_objs(struct yaffs_dev *dev) { struct yaffs_obj *obj; - yaffs_checkpt_obj_t cp; + struct yaffs_checkpt_obj cp; int i; int ok = 1; struct ylist_head *lh; @@ -576,7 +576,7 @@ static int yaffs2_wr_checkpt_objs(struct yaffs_dev *dev) } /* Dump end of list */ - memset(&cp, 0xFF, sizeof(yaffs_checkpt_obj_t)); + memset(&cp, 0xFF, sizeof(struct yaffs_checkpt_obj)); cp.struct_type = sizeof(cp); if (ok) @@ -588,7 +588,7 @@ static int yaffs2_wr_checkpt_objs(struct yaffs_dev *dev) static int yaffs2_rd_checkpt_objs(struct yaffs_dev *dev) { struct yaffs_obj *obj; - yaffs_checkpt_obj_t cp; + struct yaffs_checkpt_obj cp; int ok = 1; int done = 0; struct yaffs_obj *hard_list = NULL; @@ -725,7 +725,7 @@ static int yaffs2_rd_checkpt_data(struct yaffs_dev *dev) if (ok) { T(YAFFS_TRACE_CHECKPOINT, (TSTR("read checkpoint validity" TENDSTR))); - ok = yaffs2_rd_checkpt_validty_marker(dev, 1); + ok = yaffs2_rd_checkpt_validity_marker(dev, 1); } if (ok) { T(YAFFS_TRACE_CHECKPOINT, (TSTR("read checkpoint device" TENDSTR))); @@ -737,7 +737,7 @@ static int yaffs2_rd_checkpt_data(struct yaffs_dev *dev) } if (ok) { T(YAFFS_TRACE_CHECKPOINT, (TSTR("read checkpoint validity" TENDSTR))); - ok = yaffs2_rd_checkpt_validty_marker(dev, 0); + ok = yaffs2_rd_checkpt_validity_marker(dev, 0); } if (ok) { @@ -923,9 +923,9 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev) int result; int c; int deleted; - yaffs_block_state_t state; + enum yaffs_block_state state; struct yaffs_obj *hard_list = NULL; - yaffs_block_info_t *bi; + struct yaffs_block_info *bi; u32 seq_number; struct yaffs_obj_hdr *oh; struct yaffs_obj *in; diff --git a/yaffs_yaffs2.h b/yaffs_yaffs2.h index ab3865f..ceece88 100644 --- a/yaffs_yaffs2.h +++ b/yaffs_yaffs2.h @@ -20,9 +20,9 @@ void yaffs_calc_oldest_dirty_seq(struct yaffs_dev *dev); void yaffs2_find_oldest_dirty_seq(struct yaffs_dev *dev); -void yaffs2_clear_oldest_dirty_seq(struct yaffs_dev *dev, yaffs_block_info_t *bi); -void yaffs2_update_oldest_dirty_seq(struct yaffs_dev *dev, unsigned block_no, yaffs_block_info_t *bi); -int yaffs_block_ok_for_gc(struct yaffs_dev *dev, yaffs_block_info_t *bi); +void yaffs2_clear_oldest_dirty_seq(struct yaffs_dev *dev, struct yaffs_block_info *bi); +void yaffs2_update_oldest_dirty_seq(struct yaffs_dev *dev, unsigned block_no, struct yaffs_block_info *bi); +int yaffs_block_ok_for_gc(struct yaffs_dev *dev, struct yaffs_block_info *bi); u32 yaffs2_find_refresh_block(struct yaffs_dev *dev); int yaffs2_checkpt_required(struct yaffs_dev *dev); int yaffs_calc_checkpt_blocks_required(struct yaffs_dev *dev); -- 2.30.2