From 757a553001be4016e9c5d8880648d3703f34b10e Mon Sep 17 00:00:00 2001 From: Charles Manning Date: Tue, 2 Nov 2010 15:16:48 +1300 Subject: [PATCH] yaffs: More clean up Signed-off-by: Charles Manning --- direct/basic-test/Makefile | 4 +- direct/basic-test/yaffs_fileem2k.c | 16 ++-- direct/basic-test/yaffs_ramdisk.c | 4 +- direct/basic-test/yaffs_ramem2k.c | 6 +- direct/python/Makefile | 4 +- direct/tests/Makefile | 4 +- yaffs_list.h => direct/yaffs_list.h | 48 +++++------ direct/yaffs_nandif.c | 16 ++-- direct/yaffsfs.c | 42 +++++----- direct/ydirectenv.h | 3 + utils/mkyaffs2image.c | 4 +- yaffs_allocator.c | 4 +- yaffs_ecc.c | 6 +- yaffs_ecc.h | 10 +-- yaffs_guts.c | 122 ++++++++++++++-------------- yaffs_guts.h | 17 ++-- yaffs_linux.h | 4 +- yaffs_mtdif1_single.c | 6 +- yaffs_mtdif2_single.c | 12 +-- yaffs_packedtags1.c | 6 +- yaffs_packedtags1.h | 8 +- yaffs_packedtags2.c | 20 ++--- yaffs_packedtags2.h | 20 ++--- yaffs_verify.c | 18 ++-- yaffs_vfs_multi.c | 64 +++++++-------- yaffs_vfs_single.c | 64 +++++++-------- yaffs_yaffs1.c | 4 +- yaffs_yaffs2.c | 12 +-- yportenv.h | 1 + 29 files changed, 276 insertions(+), 273 deletions(-) rename yaffs_list.h => direct/yaffs_list.h (64%) diff --git a/direct/basic-test/Makefile b/direct/basic-test/Makefile index 4054ed1..6074e00 100644 --- a/direct/basic-test/Makefile +++ b/direct/basic-test/Makefile @@ -51,7 +51,7 @@ ALLOBJS = $(sort $(YAFFSTESTOBJS)) YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yportenv.h yaffs_tagscompat.c yaffs_tagscompat.h \ yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h \ - yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h yaffs_list.h \ + yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h \ yaffs_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \ yaffs_nameval.c yaffs_nameval.h \ yaffs_qsort.h yaffs_trace.h \ @@ -63,7 +63,7 @@ YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yp YAFFSDIRECTSYMLINKS = yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\ yaffsfs.h yaffs_malloc.h ydirectenv.h \ - yaffs_flashif.c yaffscfg.h \ + yaffs_flashif.c yaffscfg.h yaffs_list.h \ yaffs_qsort.c \ yaffs_nandif.c yaffs_nandif.h yaffs_nandemul2k.h diff --git a/direct/basic-test/yaffs_fileem2k.c b/direct/basic-test/yaffs_fileem2k.c index 31549f0..072e2f1 100644 --- a/direct/basic-test/yaffs_fileem2k.c +++ b/direct/basic-test/yaffs_fileem2k.c @@ -187,8 +187,8 @@ int yflash2_WriteChunkWithTagsToNAND(struct yaffs_dev *dev,int nand_chunk,const if(dev->param.inband_tags){ - yaffs_packed_tags2_tags_only * pt2tp; - pt2tp = (yaffs_packed_tags2_tags_only *)&data[dev->data_bytes_per_chunk]; + struct yaffs_packed_tags2_tags_only * pt2tp; + pt2tp = (struct yaffs_packed_tags2_tags_only *)&data[dev->data_bytes_per_chunk]; yaffs_pack_tags2_tags_only(pt2tp,tags); pos = (nand_chunk % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE; @@ -260,7 +260,7 @@ int yflash2_WriteChunkWithTagsToNAND(struct yaffs_dev *dev,int nand_chunk,const } else { - yaffs_packed_tags2 pt; + struct yaffs_packed_tags2 pt; yaffs_pack_tags2(&pt,tags, !dev->param.no_tags_ecc); u8 * ptab = (u8 *)&pt; @@ -338,7 +338,7 @@ int yflash2_WriteChunkWithTagsToNAND(struct yaffs_dev *dev,int nand_chunk,const } else { - yaffs_packed_tags2 pt; + struct yaffs_packed_tags2 pt; yaffs_pack_tags2(&pt,tags,!dev->param.no_tags_ecc); u8 * ptab = (u8 *)&pt; @@ -412,8 +412,8 @@ int yflash2_ReadChunkWithTagsFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 * } - yaffs_packed_tags2_tags_only * pt2tp; - pt2tp = (yaffs_packed_tags2_tags_only *)&data[dev->data_bytes_per_chunk]; + struct yaffs_packed_tags2_tags_only * pt2tp; + pt2tp = (struct yaffs_packed_tags2_tags_only *)&data[dev->data_bytes_per_chunk]; pos = (nand_chunk % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE; @@ -472,7 +472,7 @@ int yflash2_ReadChunkWithTagsFromNAND(struct yaffs_dev *dev,int nand_chunk, u8 * } else { - yaffs_packed_tags2 pt; + struct yaffs_packed_tags2 pt; nread= read(h,&pt,sizeof(pt)); yaffs_unpack_tags2(tags,&pt, !dev->param.no_tags_ecc); #ifdef SIMULATE_FAILURES @@ -513,7 +513,7 @@ int yflash2_MarkNANDBlockBad(struct yaffs_dev *dev, int block_no) int written; int h; - yaffs_packed_tags2 pt; + struct yaffs_packed_tags2 pt; CheckInit(); diff --git a/direct/basic-test/yaffs_ramdisk.c b/direct/basic-test/yaffs_ramdisk.c index e9fe6dc..e202028 100644 --- a/direct/basic-test/yaffs_ramdisk.c +++ b/direct/basic-test/yaffs_ramdisk.c @@ -139,7 +139,7 @@ int yramdisk_wr_chunk(struct yaffs_dev *dev,int nand_chunk,const u8 *data, const if(tags) { - yaffs_packed_tags1 pt; + struct yaffs_packed_tags1 pt; yaffs_pack_tags1(&pt,tags); memcpy(&ramdisk.block[blk]->page[pg].data[512],&pt,sizeof(pt)); @@ -170,7 +170,7 @@ int yramdisk_rd_chunk(struct yaffs_dev *dev,int nand_chunk, u8 *data, struct yaf if(tags) { - yaffs_packed_tags1 pt; + struct yaffs_packed_tags1 pt; memcpy(&pt,&ramdisk.block[blk]->page[pg].data[512],sizeof(pt)); yaffs_unpack_tags1(tags,&pt); diff --git a/direct/basic-test/yaffs_ramem2k.c b/direct/basic-test/yaffs_ramem2k.c index 8b3c028..0310357 100644 --- a/direct/basic-test/yaffs_ramem2k.c +++ b/direct/basic-test/yaffs_ramem2k.c @@ -220,7 +220,7 @@ int nandemul2k_WriteChunkWithTagsToNAND(struct yaffs_dev *dev,int nand_chunk,con { x = &ned.block[blk]->page[pg]->data[PAGE_DATA_SIZE]; - yaffs_pack_tags2((yaffs_packed_tags2 *)x,tags, !dev->param.no_tags_ecc); + yaffs_pack_tags2((struct yaffs_packed_tags2 *)x,tags, !dev->param.no_tags_ecc); } @@ -256,7 +256,7 @@ int nandemul2k_ReadChunkWithTagsFromNAND(struct yaffs_dev *dev,int nand_chunk, u { x = &ned.block[blk]->page[pg]->data[PAGE_DATA_SIZE]; - yaffs_unpack_tags2(tags,(yaffs_packed_tags2 *)x, !dev->param.no_tags_ecc); + yaffs_unpack_tags2(tags,(struct yaffs_packed_tags2 *)x, !dev->param.no_tags_ecc); } return YAFFS_OK; @@ -320,7 +320,7 @@ int nandemul2k_MarkNANDBlockBad(struct yaffs_dev *dev, int block_no) x = &ned.block[block_no]->page[0]->data[PAGE_DATA_SIZE]; - memset(x,0,sizeof(yaffs_packed_tags2)); + memset(x,0,sizeof(struct yaffs_packed_tags2)); return YAFFS_OK; diff --git a/direct/python/Makefile b/direct/python/Makefile index f2eac15..6fc217e 100644 --- a/direct/python/Makefile +++ b/direct/python/Makefile @@ -49,7 +49,7 @@ YAFFSLIBOBJS = $(COMMONTESTOBJS) yaffs_python_helper.o yaffs_error_converter.o YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yportenv.h yaffs_tagscompat.c yaffs_tagscompat.h \ yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h \ - yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h yaffs_list.h \ + yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h \ yaffs_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \ yaffs_nameval.c yaffs_nameval.h \ yaffs_qsort.h yaffs_trace.h \ @@ -61,7 +61,7 @@ YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yp YAFFSDIRECTSYMLINKS = yaffsfs.c yaffsfs.h yaffscfg.h yaffs_malloc.h ydirectenv.h \ - yaffs_flashif.c yaffs_flashif.h yaffs_flashif2.h\ + yaffs_flashif.c yaffs_flashif.h yaffs_flashif2.h yaffs_list.h \ yaffs_nandif.c yaffs_nandif.h yaffs_qsort.c yaffs_nandemul2k.h DIRECTEXTRASYMLINKS = yaffscfg2k.c yaffs_fileem2k.c yaffs_fileem2k.h\ diff --git a/direct/tests/Makefile b/direct/tests/Makefile index 5800b0a..302d5b4 100644 --- a/direct/tests/Makefile +++ b/direct/tests/Makefile @@ -51,7 +51,7 @@ ALLOBJS = $(sort $(YAFFSTESTOBJS)) YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yportenv.h yaffs_tagscompat.c yaffs_tagscompat.h \ yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h yaffs_nandemul2k.h \ - yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h yaffs_list.h \ + yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h \ yaffs_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \ yaffs_nameval.c yaffs_nameval.h \ yaffs_qsort.h yaffs_trace.h \ @@ -64,7 +64,7 @@ YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yp YAFFSDIRECTSYMLINKS = yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\ yaffsfs.h yaffs_malloc.h ydirectenv.h \ yaffs_flashif.c yaffscfg.h yaffs_qsort.c \ - yaffs_nandemul2k.h \ + yaffs_nandemul2k.h yaffs_list.h \ yaffs_nandif.c yaffs_nandif.h diff --git a/yaffs_list.h b/direct/yaffs_list.h similarity index 64% rename from yaffs_list.h rename to direct/yaffs_list.h index 145a1c5..624cd5f 100644 --- a/yaffs_list.h +++ b/direct/yaffs_list.h @@ -31,20 +31,20 @@ * way the Linux kernel doubly linked list implementation works. */ -struct ylist_head { - struct ylist_head *next; /* next in chain */ - struct ylist_head *prev; /* previous in chain */ +struct list_head { + struct list_head *next; /* next in chain */ + struct list_head *prev; /* previous in chain */ }; /* Initialise a static list */ -#define YLIST_HEAD(name) \ -struct ylist_head name = { &(name), &(name)} +#define LIST_HEAD(name) \ +struct list_head name = { &(name), &(name)} /* Initialise a list head to an empty list */ -#define YINIT_LIST_HEAD(p) \ +#define INIT_LIST_HEAD(p) \ do { \ (p)->next = (p);\ (p)->prev = (p); \ @@ -52,10 +52,10 @@ do { \ /* Add an element to a list */ -static Y_INLINE void ylist_add(struct ylist_head *new_entry, - struct ylist_head *list) +static Y_INLINE void list_add(struct list_head *new_entry, + struct list_head *list) { - struct ylist_head *list_next = list->next; + struct list_head *list_next = list->next; list->next = new_entry; new_entry->prev = list; @@ -64,10 +64,10 @@ static Y_INLINE void ylist_add(struct ylist_head *new_entry, } -static Y_INLINE void ylist_add_tail(struct ylist_head *new_entry, - struct ylist_head *list) +static Y_INLINE void list_add_tail(struct list_head *new_entry, + struct list_head *list) { - struct ylist_head *list_prev = list->prev; + struct list_head *list_prev = list->prev; list->prev = new_entry; new_entry->next = list; @@ -79,47 +79,47 @@ static Y_INLINE void ylist_add_tail(struct ylist_head *new_entry, /* Take an element out of its current list, with or without * reinitialising the links.of the entry*/ -static Y_INLINE void ylist_del(struct ylist_head *entry) +static Y_INLINE void list_del(struct list_head *entry) { - struct ylist_head *list_next = entry->next; - struct ylist_head *list_prev = entry->prev; + struct list_head *list_next = entry->next; + struct list_head *list_prev = entry->prev; list_next->prev = list_prev; list_prev->next = list_next; } -static Y_INLINE void ylist_del_init(struct ylist_head *entry) +static Y_INLINE void list_del_init(struct list_head *entry) { - ylist_del(entry); + list_del(entry); entry->next = entry->prev = entry; } /* Test if the list is empty */ -static Y_INLINE int ylist_empty(struct ylist_head *entry) +static Y_INLINE int list_empty(struct list_head *entry) { return (entry->next == entry); } -/* ylist_entry takes a pointer to a list entry and offsets it to that +/* list_entry takes a pointer to a list entry and offsets it to that * we can find a pointer to the object it is embedded in. */ -#define ylist_entry(entry, type, member) \ +#define list_entry(entry, type, member) \ ((type *)((char *)(entry)-(unsigned long)(&((type *)NULL)->member))) -/* ylist_for_each and list_for_each_safe iterate over lists. - * ylist_for_each_safe uses temporary storage to make the list delete safe +/* list_for_each and list_for_each_safe iterate over lists. + * list_for_each_safe uses temporary storage to make the list delete safe */ -#define ylist_for_each(itervar, list) \ +#define list_for_each(itervar, list) \ for (itervar = (list)->next; itervar != (list); itervar = itervar->next) -#define ylist_for_each_safe(itervar, save_var, list) \ +#define list_for_each_safe(itervar, save_var, list) \ for (itervar = (list)->next, save_var = (list)->next->next; \ itervar != (list); itervar = save_var, save_var = save_var->next) diff --git a/direct/yaffs_nandif.c b/direct/yaffs_nandif.c index 57689f3..0e2c14a 100644 --- a/direct/yaffs_nandif.c +++ b/direct/yaffs_nandif.c @@ -35,7 +35,7 @@ int ynandif_WriteChunkWithTagsToNAND(struct yaffs_dev * dev, int nand_chunk, { int retval = 0; - yaffs_packed_tags2 pt; + struct yaffs_packed_tags2 pt; void *spare; unsigned spareSize = 0; ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driver_context); @@ -52,8 +52,8 @@ int ynandif_WriteChunkWithTagsToNAND(struct yaffs_dev * dev, int nand_chunk, */ if(dev->param.inband_tags){ - yaffs_packed_tags2_tags_only *pt2tp; - pt2tp = (yaffs_packed_tags2_tags_only *)(data + dev->data_bytes_per_chunk); + struct yaffs_packed_tags2_tags_only *pt2tp; + pt2tp = (struct yaffs_packed_tags2_tags_only *)(data + dev->data_bytes_per_chunk); yaffs_pack_tags2_tags_only(pt2tp,tags); spare = NULL; spareSize = 0; @@ -61,7 +61,7 @@ int ynandif_WriteChunkWithTagsToNAND(struct yaffs_dev * dev, int nand_chunk, else{ yaffs_pack_tags2(&pt, tags,!dev->param.no_tags_ecc); spare = &pt; - spareSize = sizeof(yaffs_packed_tags2); + spareSize = sizeof(struct yaffs_packed_tags2); } retval = geometry->writeChunk(dev,nand_chunk, @@ -73,7 +73,7 @@ int ynandif_WriteChunkWithTagsToNAND(struct yaffs_dev * dev, int nand_chunk, int ynandif_ReadChunkWithTagsFromNAND(struct yaffs_dev * dev, int nand_chunk, u8 * data, struct yaffs_ext_tags * tags) { - yaffs_packed_tags2 pt; + struct yaffs_packed_tags2 pt; int localData = 0; void *spare = NULL; unsigned spareSize; @@ -100,7 +100,7 @@ int ynandif_ReadChunkWithTagsFromNAND(struct yaffs_dev * dev, int nand_chunk, } else { spare = &pt; - spareSize = sizeof(yaffs_packed_tags2); + spareSize = sizeof(struct yaffs_packed_tags2); } retval = geometry->readChunk(dev,nand_chunk, @@ -111,8 +111,8 @@ int ynandif_ReadChunkWithTagsFromNAND(struct yaffs_dev * dev, int nand_chunk, if(dev->param.inband_tags){ if(tags){ - yaffs_packed_tags2_tags_only * pt2tp; - pt2tp = (yaffs_packed_tags2_tags_only *)&data[dev->data_bytes_per_chunk]; + struct yaffs_packed_tags2_tags_only * pt2tp; + pt2tp = (struct yaffs_packed_tags2_tags_only *)&data[dev->data_bytes_per_chunk]; yaffs_unpack_tags2_tags_only(tags,pt2tp); } } diff --git a/direct/yaffsfs.c b/direct/yaffsfs.c index 30b1486..5c583b9 100644 --- a/direct/yaffsfs.c +++ b/direct/yaffsfs.c @@ -290,7 +290,7 @@ int yaffsfs_IsPathDivider(YCHAR ch) -YLIST_HEAD(yaffsfs_deviceList); +LIST_HEAD(yaffsfs_deviceList); /* * yaffsfs_FindDevice @@ -301,7 +301,7 @@ YLIST_HEAD(yaffsfs_deviceList); */ static struct yaffs_dev *yaffsfs_FindDevice(const YCHAR *path, YCHAR **restOfPath) { - struct ylist_head *cfg; + struct list_head *cfg; const YCHAR *leftOver; const YCHAR *p; struct yaffs_dev *retval = NULL; @@ -315,8 +315,8 @@ static struct yaffs_dev *yaffsfs_FindDevice(const YCHAR *path, YCHAR **restOfPat * 1) Actually matches a prefix (ie /a amd /abc will not match * 2) Matches the longest. */ - ylist_for_each(cfg, &yaffsfs_deviceList){ - dev = ylist_entry(cfg, struct yaffs_dev, dev_list); + list_for_each(cfg, &yaffsfs_deviceList){ + dev = list_entry(cfg, struct yaffs_dev, dev_list); leftOver = path; p = dev->param.name; thisMatchLength = 0; @@ -2025,14 +2025,14 @@ void yaffs_add_device(struct yaffs_dev *dev) dev->param.remove_obj_fn = yaffsfs_RemoveObjectCallback; if(!dev->dev_list.next) - YINIT_LIST_HEAD(&dev->dev_list); + INIT_LIST_HEAD(&dev->dev_list); - ylist_add(&dev->dev_list,&yaffsfs_deviceList); + list_add(&dev->dev_list,&yaffsfs_deviceList); } void yaffs_remove_device(struct yaffs_dev *dev) { - ylist_del_init(&dev->dev_list); + list_del_init(&dev->dev_list); } @@ -2055,12 +2055,12 @@ typedef struct struct yaffs_obj *dirObj; /* ptr to directory being searched */ struct yaffs_obj *nextReturn; /* obj to be returned by next readddir */ int offset; - struct ylist_head others; + struct list_head others; } yaffsfs_DirectorySearchContext; -static struct ylist_head search_contexts; +static struct list_head search_contexts; static void yaffsfs_SetDirRewound(yaffsfs_DirectorySearchContext *dsc) @@ -2071,10 +2071,10 @@ static void yaffsfs_SetDirRewound(yaffsfs_DirectorySearchContext *dsc) dsc->offset = 0; - if( ylist_empty(&dsc->dirObj->variant.dir_variant.children)) + if( list_empty(&dsc->dirObj->variant.dir_variant.children)) dsc->nextReturn = NULL; else - dsc->nextReturn = ylist_entry(dsc->dirObj->variant.dir_variant.children.next, + dsc->nextReturn = list_entry(dsc->dirObj->variant.dir_variant.children.next, struct yaffs_obj,siblings); } else { /* Hey someone isn't playing nice! */ @@ -2088,15 +2088,15 @@ static void yaffsfs_DirAdvance(yaffsfs_DirectorySearchContext *dsc) dsc->dirObj->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY){ if( dsc->nextReturn == NULL || - ylist_empty(&dsc->dirObj->variant.dir_variant.children)) + list_empty(&dsc->dirObj->variant.dir_variant.children)) dsc->nextReturn = NULL; else { - struct ylist_head *next = dsc->nextReturn->siblings.next; + struct list_head *next = dsc->nextReturn->siblings.next; if( next == &dsc->dirObj->variant.dir_variant.children) dsc->nextReturn = NULL; /* end of list */ else - dsc->nextReturn = ylist_entry(next,struct yaffs_obj,siblings); + dsc->nextReturn = list_entry(next,struct yaffs_obj,siblings); } } else { /* Hey someone isn't playing nice! */ @@ -2106,7 +2106,7 @@ static void yaffsfs_DirAdvance(yaffsfs_DirectorySearchContext *dsc) static void yaffsfs_RemoveObjectCallback(struct yaffs_obj *obj) { - struct ylist_head *i; + struct list_head *i; yaffsfs_DirectorySearchContext *dsc; /* if search contexts not initilised then skip */ @@ -2117,9 +2117,9 @@ static void yaffsfs_RemoveObjectCallback(struct yaffs_obj *obj) * If any are the one being removed, then advance the dsc to * the next one to prevent a hanging ptr. */ - ylist_for_each(i, &search_contexts) { + list_for_each(i, &search_contexts) { if (i) { - dsc = ylist_entry(i, yaffsfs_DirectorySearchContext,others); + dsc = list_entry(i, yaffsfs_DirectorySearchContext,others); if(dsc->nextReturn == obj) yaffsfs_DirAdvance(dsc); } @@ -2147,12 +2147,12 @@ yaffs_DIR *yaffs_opendir(const YCHAR *dirname) dsc->magic = YAFFS_MAGIC; dsc->dirObj = obj; yaffs_strncpy(dsc->name,dirname,NAME_MAX); - YINIT_LIST_HEAD(&dsc->others); + INIT_LIST_HEAD(&dsc->others); if(!search_contexts.next) - YINIT_LIST_HEAD(&search_contexts); + INIT_LIST_HEAD(&search_contexts); - ylist_add(&dsc->others,&search_contexts); + list_add(&dsc->others,&search_contexts); yaffsfs_SetDirRewound(dsc); } @@ -2215,7 +2215,7 @@ int yaffs_closedir(yaffs_DIR *dirp) yaffsfs_Lock(); dsc->magic = 0; - ylist_del(&dsc->others); /* unhook from list */ + list_del(&dsc->others); /* unhook from list */ YFREE(dsc); yaffsfs_Unlock(); return 0; diff --git a/direct/ydirectenv.h b/direct/ydirectenv.h index 824ce20..ea224cc 100644 --- a/direct/ydirectenv.h +++ b/direct/ydirectenv.h @@ -87,6 +87,9 @@ #define yaffs_sum_cmp(x,y) ((x) == (y)) #define yaffs_strcmp(a,b) strcmp(a,b) +#include "yaffs_list.h" + + #include "yaffsfs.h" #endif diff --git a/utils/mkyaffs2image.c b/utils/mkyaffs2image.c index 2d2da43..fa2229b 100644 --- a/utils/mkyaffs2image.c +++ b/utils/mkyaffs2image.c @@ -172,7 +172,7 @@ static void little_to_big_endian(struct yaffs_ext_tags *tagsPtr) #endif } -static void shuffle_oob(char *spareData, yaffs_packed_tags2 *pt) +static void shuffle_oob(char *spareData, struct yaffs_packed_tags2 *pt) { assert(sizeof(*pt) <= spareSize); // NAND LAYOUT: For non-trivial OOB orderings, here would be a good place to shuffle. @@ -182,7 +182,7 @@ static void shuffle_oob(char *spareData, yaffs_packed_tags2 *pt) static int write_chunk(u8 *data, u32 id, u32 chunk_id, u32 n_bytes) { struct yaffs_ext_tags t; - yaffs_packed_tags2 pt; + struct yaffs_packed_tags2 pt; char spareData[spareSize]; if (write(outFile,data,chunkSize) != chunkSize) diff --git a/yaffs_allocator.c b/yaffs_allocator.c index 586ca05..35d8869 100644 --- a/yaffs_allocator.c +++ b/yaffs_allocator.c @@ -315,7 +315,7 @@ static int yaffs_create_free_objs(struct yaffs_dev *dev, int n_obj) /* Hook them into the free list */ for (i = 0; i < n_obj - 1; i++) { new_objs[i].siblings.next = - (struct ylist_head *)(&new_objs[i + 1]); + (struct list_head *)(&new_objs[i + 1]); } new_objs[n_obj - 1].siblings.next = (void *)allocator->free_objs; @@ -366,7 +366,7 @@ void yaffs_free_raw_obj(struct yaffs_dev *dev, struct yaffs_obj *obj) YBUG(); else { /* Link into the free list. */ - obj->siblings.next = (struct ylist_head *)(allocator->free_objs); + obj->siblings.next = (struct list_head *)(allocator->free_objs); allocator->free_objs = obj; allocator->n_free_objects++; } diff --git a/yaffs_ecc.c b/yaffs_ecc.c index 35f8747..290f8d3 100644 --- a/yaffs_ecc.c +++ b/yaffs_ecc.c @@ -246,7 +246,7 @@ int yaffs_ecc_correct(unsigned char *data, unsigned char *read_ecc, * ECCxxxOther does ECC calcs on arbitrary n bytes of data */ void yaffs_ecc_calc_other(const unsigned char *data, unsigned n_bytes, - yaffs_ecc_other *ecc_other) + struct yaffs_ecc_other *ecc_other) { unsigned int i; @@ -273,8 +273,8 @@ void yaffs_ecc_calc_other(const unsigned char *data, unsigned n_bytes, } int yaffs_ecc_correct_other(unsigned char *data, unsigned n_bytes, - yaffs_ecc_other *read_ecc, - const yaffs_ecc_other *test_ecc) + struct yaffs_ecc_other *read_ecc, + const struct yaffs_ecc_other *test_ecc) { unsigned char delta_col; /* column parity delta */ unsigned delta_line; /* line parity delta */ diff --git a/yaffs_ecc.h b/yaffs_ecc.h index f505ab5..c2d0013 100644 --- a/yaffs_ecc.h +++ b/yaffs_ecc.h @@ -26,19 +26,19 @@ #ifndef __YAFFS_ECC_H__ #define __YAFFS_ECC_H__ -typedef struct { +struct yaffs_ecc_other { unsigned char col_parity; unsigned line_parity; unsigned line_parity_prime; -} yaffs_ecc_other; +} ; void yaffs_ecc_cacl(const unsigned char *data, unsigned char *ecc); int yaffs_ecc_correct(unsigned char *data, unsigned char *read_ecc, const unsigned char *test_ecc); void yaffs_ecc_calc_other(const unsigned char *data, unsigned n_bytes, - yaffs_ecc_other *ecc); + struct yaffs_ecc_other *ecc); int yaffs_ecc_correct_other(unsigned char *data, unsigned n_bytes, - yaffs_ecc_other *read_ecc, - const yaffs_ecc_other *test_ecc); + struct yaffs_ecc_other *read_ecc, + const struct yaffs_ecc_other *test_ecc); #endif diff --git a/yaffs_guts.c b/yaffs_guts.c index aa4b0d6..19a5b39 100644 --- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -1136,15 +1136,15 @@ static struct yaffs_obj *yaffs_alloc_empty_obj(struct yaffs_dev *dev) obj->my_dev = dev; obj->hdr_chunk = 0; obj->variant_type = YAFFS_OBJECT_TYPE_UNKNOWN; - YINIT_LIST_HEAD(&(obj->hard_links)); - YINIT_LIST_HEAD(&(obj->hash_link)); - YINIT_LIST_HEAD(&obj->siblings); + INIT_LIST_HEAD(&(obj->hard_links)); + INIT_LIST_HEAD(&(obj->hash_link)); + INIT_LIST_HEAD(&obj->siblings); /* Now make the directory sane */ if (dev->root_dir) { obj->parent = dev->root_dir; - ylist_add(&(obj->siblings), &dev->root_dir->variant.dir_variant.children); + list_add(&(obj->siblings), &dev->root_dir->variant.dir_variant.children); } /* Add it to the lost and found directory. @@ -1189,8 +1189,8 @@ static void yaffs_unhash_obj(struct yaffs_obj *obj) struct yaffs_dev *dev = obj->my_dev; /* If it is still linked into the bucket list, free from the list */ - if (!ylist_empty(&obj->hash_link)) { - ylist_del_init(&obj->hash_link); + if (!list_empty(&obj->hash_link)) { + list_del_init(&obj->hash_link); bucket = yaffs_hash_fn(obj->obj_id); dev->obj_bucket[bucket].count--; } @@ -1207,7 +1207,7 @@ static void yaffs_free_obj(struct yaffs_obj *obj) YBUG(); if (obj->parent) YBUG(); - if (!ylist_empty(&obj->siblings)) + if (!list_empty(&obj->siblings)) YBUG(); @@ -1243,7 +1243,7 @@ static void yaffs_init_tnodes_and_objs(struct yaffs_dev *dev) yaffs_init_raw_tnodes_and_objs(dev); for (i = 0; i < YAFFS_NOBJECT_BUCKETS; i++) { - YINIT_LIST_HEAD(&dev->obj_bucket[i].list); + INIT_LIST_HEAD(&dev->obj_bucket[i].list); dev->obj_bucket[i].count = 0; } } @@ -1281,7 +1281,7 @@ static int yaffs_new_obj_id(struct yaffs_dev *dev) */ int found = 0; - struct ylist_head *i; + struct list_head *i; u32 n = (u32) bucket; @@ -1291,9 +1291,9 @@ static int yaffs_new_obj_id(struct yaffs_dev *dev) found = 1; n += YAFFS_NOBJECT_BUCKETS; if (1 || dev->obj_bucket[bucket].count > 0) { - ylist_for_each(i, &dev->obj_bucket[bucket].list) { + list_for_each(i, &dev->obj_bucket[bucket].list) { /* If there is already one in the list */ - if (i && ylist_entry(i, struct yaffs_obj, + if (i && list_entry(i, struct yaffs_obj, hash_link)->obj_id == n) { found = 0; } @@ -1309,20 +1309,20 @@ static void yaffs_hash_obj(struct yaffs_obj *in) int bucket = yaffs_hash_fn(in->obj_id); struct yaffs_dev *dev = in->my_dev; - ylist_add(&in->hash_link, &dev->obj_bucket[bucket].list); + list_add(&in->hash_link, &dev->obj_bucket[bucket].list); dev->obj_bucket[bucket].count++; } struct yaffs_obj *yaffs_find_by_number(struct yaffs_dev *dev, u32 number) { int bucket = yaffs_hash_fn(number); - struct ylist_head *i; + struct list_head *i; struct yaffs_obj *in; - ylist_for_each(i, &dev->obj_bucket[bucket].list) { + list_for_each(i, &dev->obj_bucket[bucket].list) { /* Look if it is in the list */ if (i) { - in = ylist_entry(i, struct yaffs_obj, hash_link); + in = list_entry(i, struct yaffs_obj, hash_link); if (in->obj_id == number) { /* Don't tell the VFS about this one if it is defered free */ @@ -1388,9 +1388,9 @@ struct yaffs_obj *yaffs_new_obj(struct yaffs_dev *dev, int number, the_obj->variant.file_variant.top = tn; break; case YAFFS_OBJECT_TYPE_DIRECTORY: - YINIT_LIST_HEAD(&the_obj->variant.dir_variant. + INIT_LIST_HEAD(&the_obj->variant.dir_variant. children); - YINIT_LIST_HEAD(&the_obj->variant.dir_variant. + INIT_LIST_HEAD(&the_obj->variant.dir_variant. dirty); break; case YAFFS_OBJECT_TYPE_SYMLINK: @@ -1522,7 +1522,7 @@ static struct yaffs_obj *yaffs_create_obj(enum yaffs_obj_type type, equiv_obj; in->variant.hardlink_variant.equiv_id = equiv_obj->obj_id; - ylist_add(&in->hard_links, &equiv_obj->hard_links); + list_add(&in->hard_links, &equiv_obj->hard_links); break; case YAFFS_OBJECT_TYPE_FILE: case YAFFS_OBJECT_TYPE_DIRECTORY: @@ -1686,7 +1686,7 @@ int yaffs_rename_obj(struct yaffs_obj *old_dir, const YCHAR *old_name, existing_target = yaffs_find_by_name(new_dir, new_name); if (existing_target && existing_target->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY && - !ylist_empty(&existing_target->variant.dir_variant.children)) { + !list_empty(&existing_target->variant.dir_variant.children)) { /* There is a target that is a non-empty directory, so we fail */ return YAFFS_FAIL; /* EEXIST or ENOTEMPTY */ } else if (existing_target && existing_target != obj) { @@ -3870,7 +3870,7 @@ int yaffs_del_file(struct yaffs_obj *in) static int yaffs_is_non_empty_dir(struct yaffs_obj *obj) { return (obj->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY) && - !(ylist_empty(&obj->variant.dir_variant.children)); + !(list_empty(&obj->variant.dir_variant.children)); } static int yaffs_del_dir(struct yaffs_obj *obj) @@ -3896,7 +3896,7 @@ static int yaffs_del_link(struct yaffs_obj *in) /* remove this hardlink from the list assocaited with the equivalent * object */ - ylist_del_init(&in->hard_links); + list_del_init(&in->hard_links); return yaffs_generic_obj_del(in); } @@ -3908,9 +3908,9 @@ int ret_val = -1; ret_val = yaffs_del_file(obj); break; case YAFFS_OBJECT_TYPE_DIRECTORY: - if(!ylist_empty(&obj->variant.dir_variant.dirty)){ + if(!list_empty(&obj->variant.dir_variant.dirty)){ T(YAFFS_TRACE_BACKGROUND, (TSTR("Remove object %d from dirty directories" TENDSTR),obj->obj_id)); - ylist_del_init(&obj->variant.dir_variant.dirty); + list_del_init(&obj->variant.dir_variant.dirty); } return yaffs_del_dir(obj); break; @@ -3944,7 +3944,7 @@ static int yaffs_unlink_worker(struct yaffs_obj *obj) if (obj->variant_type == YAFFS_OBJECT_TYPE_HARDLINK) { return yaffs_del_link(obj); - } else if (!ylist_empty(&obj->hard_links)) { + } else if (!list_empty(&obj->hard_links)) { /* Curve ball: We're unlinking an object that has a hardlink. * * This problem arises because we are not strictly following @@ -3964,12 +3964,12 @@ static int yaffs_unlink_worker(struct yaffs_obj *obj) int ret_val; YCHAR name[YAFFS_MAX_NAME_LENGTH + 1]; - hl = ylist_entry(obj->hard_links.next, struct yaffs_obj, hard_links); + hl = list_entry(obj->hard_links.next, struct yaffs_obj, hard_links); yaffs_get_obj_name(hl, name, YAFFS_MAX_NAME_LENGTH + 1); parent = hl->parent; - ylist_del_init(&hl->hard_links); + list_del_init(&hl->hard_links); yaffs_add_obj_to_dir(obj->my_dev->unlinked_dir, hl); @@ -3986,7 +3986,7 @@ static int yaffs_unlink_worker(struct yaffs_obj *obj) return yaffs_del_file(obj); break; case YAFFS_OBJECT_TYPE_DIRECTORY: - ylist_del_init(&obj->variant.dir_variant.dirty); + list_del_init(&obj->variant.dir_variant.dirty); return yaffs_del_dir(obj); break; case YAFFS_OBJECT_TYPE_SYMLINK: @@ -4078,13 +4078,13 @@ void yaffs_link_fixup(struct yaffs_dev *dev, struct yaffs_obj *hard_list) if (in) { /* Add the hardlink pointers */ hl->variant.hardlink_variant.equiv_obj = in; - ylist_add(&hl->hard_links, &in->hard_links); + list_add(&hl->hard_links, &in->hard_links); } else { /* Todo Need to report/handle this better. * Got a problem... hardlink to a non-existant object */ hl->variant.hardlink_variant.equiv_obj = NULL; - YINIT_LIST_HEAD(&hl->hard_links); + INIT_LIST_HEAD(&hl->hard_links); } } @@ -4096,26 +4096,26 @@ static void yaffs_strip_deleted_objs(struct yaffs_dev *dev) /* * Sort out state of unlinked and deleted objects after scanning. */ - struct ylist_head *i; - struct ylist_head *n; + struct list_head *i; + struct list_head *n; struct yaffs_obj *l; if (dev->read_only) return; /* Soft delete all the unlinked files */ - ylist_for_each_safe(i, n, + list_for_each_safe(i, n, &dev->unlinked_dir->variant.dir_variant.children) { if (i) { - l = ylist_entry(i, struct yaffs_obj, siblings); + l = list_entry(i, struct yaffs_obj, siblings); yaffs_del_obj(l); } } - ylist_for_each_safe(i, n, + list_for_each_safe(i, n, &dev->del_dir->variant.dir_variant.children) { if (i) { - l = ylist_entry(i, struct yaffs_obj, siblings); + l = list_entry(i, struct yaffs_obj, siblings); yaffs_del_obj(l); } } @@ -4151,8 +4151,8 @@ static void yaffs_fix_hanging_objs(struct yaffs_dev *dev) struct yaffs_obj *obj; struct yaffs_obj *parent; int i; - struct ylist_head *lh; - struct ylist_head *n; + struct list_head *lh; + struct list_head *n; int depth_limit; int hanging; @@ -4165,9 +4165,9 @@ static void yaffs_fix_hanging_objs(struct yaffs_dev *dev) */ for (i = 0; i < YAFFS_NOBJECT_BUCKETS; i++) { - ylist_for_each_safe(lh, n, &dev->obj_bucket[i].list) { + list_for_each_safe(lh, n, &dev->obj_bucket[i].list) { if (lh) { - obj = ylist_entry(lh, struct yaffs_obj, hash_link); + obj = list_entry(lh, struct yaffs_obj, hash_link); parent= obj->parent; if(yaffs_has_null_parent(dev,obj)){ @@ -4213,15 +4213,15 @@ static void yaffs_fix_hanging_objs(struct yaffs_dev *dev) static void yaffs_del_dir_contents(struct yaffs_obj *dir) { struct yaffs_obj *obj; - struct ylist_head *lh; - struct ylist_head *n; + struct list_head *lh; + struct list_head *n; if(dir->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY) YBUG(); - ylist_for_each_safe(lh, n, &dir->variant.dir_variant.children) { + list_for_each_safe(lh, n, &dir->variant.dir_variant.children) { if (lh) { - obj = ylist_entry(lh, struct yaffs_obj, siblings); + obj = list_entry(lh, struct yaffs_obj, siblings); if(obj->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY) yaffs_del_dir_contents(obj); @@ -4323,10 +4323,10 @@ static void yaffs_update_parent(struct yaffs_obj *obj) obj->dirty = 1; obj->yst_mtime = obj->yst_ctime = Y_CURRENT_TIME; if(dev->param.defered_dir_update){ - struct ylist_head *link = &obj->variant.dir_variant.dirty; + struct list_head *link = &obj->variant.dir_variant.dirty; - if(ylist_empty(link)){ - ylist_add(link,&dev->dirty_dirs); + if(list_empty(link)){ + list_add(link,&dev->dirty_dirs); T(YAFFS_TRACE_BACKGROUND, (TSTR("Added object %d to dirty directories" TENDSTR),obj->obj_id)); } @@ -4337,20 +4337,20 @@ static void yaffs_update_parent(struct yaffs_obj *obj) void yaffs_update_dirty_dirs(struct yaffs_dev *dev) { - struct ylist_head *link; + struct list_head *link; struct yaffs_obj *obj; struct yaffs_dir_var *d_s; union yaffs_obj_var *o_v; T(YAFFS_TRACE_BACKGROUND, (TSTR("Update dirty directories" TENDSTR))); - while(!ylist_empty(&dev->dirty_dirs)){ + while(!list_empty(&dev->dirty_dirs)){ link = dev->dirty_dirs.next; - ylist_del_init(link); + list_del_init(link); - 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); + d_s=list_entry(link,struct yaffs_dir_var,dirty); + o_v = list_entry(d_s,union yaffs_obj_var,dir_variant); + obj = list_entry(o_v,struct yaffs_obj,variant); T(YAFFS_TRACE_BACKGROUND, (TSTR("Update directory %d" TENDSTR), obj->obj_id)); @@ -4373,7 +4373,7 @@ static void yaffs_remove_obj_from_dir(struct yaffs_obj *obj) dev->param.remove_obj_fn(obj); - ylist_del_init(&obj->siblings); + list_del_init(&obj->siblings); obj->parent = NULL; yaffs_verify_dir(parent); @@ -4410,7 +4410,7 @@ void yaffs_add_obj_to_dir(struct yaffs_obj *directory, /* Now add it */ - ylist_add(&obj->siblings, &directory->variant.dir_variant.children); + list_add(&obj->siblings, &directory->variant.dir_variant.children); obj->parent = directory; if (directory == obj->my_dev->unlinked_dir @@ -4429,7 +4429,7 @@ struct yaffs_obj *yaffs_find_by_name(struct yaffs_obj *directory, { int sum; - struct ylist_head *i; + struct list_head *i; YCHAR buffer[YAFFS_MAX_NAME_LENGTH + 1]; struct yaffs_obj *l; @@ -4454,9 +4454,9 @@ struct yaffs_obj *yaffs_find_by_name(struct yaffs_obj *directory, sum = yaffs_calc_name_sum(name); - ylist_for_each(i, &directory->variant.dir_variant.children) { + list_for_each(i, &directory->variant.dir_variant.children) { if (i) { - l = ylist_entry(i, struct yaffs_obj, siblings); + l = list_entry(i, struct yaffs_obj, siblings); if (l->parent != directory) YBUG(); @@ -4658,12 +4658,12 @@ int yaffs_get_obj_length(struct yaffs_obj *obj) int yaffs_get_obj_link_count(struct yaffs_obj *obj) { int count = 0; - struct ylist_head *i; + struct list_head *i; if (!obj->unlinked) count++; /* the object itself */ - ylist_for_each(i, &obj->hard_links) + list_for_each(i, &obj->hard_links) count++; /* add the hard links; */ return count; @@ -5006,7 +5006,7 @@ int yaffs_guts_initialise(struct yaffs_dev *dev) /* Sort out space for inband tags, if required */ if (dev->param.inband_tags) - dev->data_bytes_per_chunk = dev->param.total_bytes_per_chunk - sizeof(yaffs_packed_tags2_tags_only); + dev->data_bytes_per_chunk = dev->param.total_bytes_per_chunk - sizeof(struct yaffs_packed_tags2_tags_only); else dev->data_bytes_per_chunk = dev->param.total_bytes_per_chunk; @@ -5122,7 +5122,7 @@ int yaffs_guts_initialise(struct yaffs_dev *dev) dev->n_erased_blocks = 0; dev->gc_disable= 0; dev->has_pending_prioritised_gc = 1; /* Assume the worst for now, will get fixed on first GC */ - YINIT_LIST_HEAD(&dev->dirty_dirs); + INIT_LIST_HEAD(&dev->dirty_dirs); dev->oldest_dirty_seq = 0; dev->oldest_dirty_block = 0; diff --git a/yaffs_guts.h b/yaffs_guts.h index 4730efc..b4ee59f 100644 --- a/yaffs_guts.h +++ b/yaffs_guts.h @@ -18,7 +18,6 @@ #include "yportenv.h" #include "devextras.h" -#include "yaffs_list.h" #define YAFFS_OK 1 #define YAFFS_FAIL 0 @@ -373,8 +372,8 @@ struct yaffs_file_var { } ; struct yaffs_dir_var{ - struct ylist_head children; /* list of child links */ - struct ylist_head dirty; /* Entry for list of dirty directories */ + struct list_head children; /* list of child links */ + struct list_head dirty; /* Entry for list of dirty directories */ }; struct yaffs_symlink_var{ @@ -424,14 +423,14 @@ struct yaffs_obj { struct yaffs_dev *my_dev; /* The device I'm on */ - struct ylist_head hash_link; /* list of objects in this hash bucket */ + struct list_head hash_link; /* list of objects in this hash bucket */ - struct ylist_head hard_links; /* all the equivalent hard linked objects */ + struct list_head hard_links; /* all the equivalent hard linked objects */ /* directory structure stuff */ /* also used for linking up the free list */ struct yaffs_obj *parent; - struct ylist_head siblings; + struct list_head siblings; /* Where's my object header in NAND? */ int hdr_chunk; @@ -469,7 +468,7 @@ struct yaffs_obj { }; struct yaffs_obj_bucket { - struct ylist_head list; + struct list_head list; int count; } ; @@ -608,7 +607,7 @@ struct yaffs_dev { void *os_context; void *driver_context; - struct ylist_head dev_list; + struct list_head dev_list; /* Runtime parameters. Set up by YAFFS. */ int data_bytes_per_chunk; @@ -739,7 +738,7 @@ struct yaffs_dev { int refresh_skip; /* A skip down counter. Refresh happens when this gets to zero. */ /* Dirty directory handling */ - struct ylist_head dirty_dirs; /* List of dirty directories */ + struct list_head dirty_dirs; /* List of dirty directories */ /* Statistcs */ diff --git a/yaffs_linux.h b/yaffs_linux.h index 2d808d7..e5ecb8a 100644 --- a/yaffs_linux.h +++ b/yaffs_linux.h @@ -20,7 +20,7 @@ #include "yportenv.h" struct yaffs_linux_context { - struct ylist_head context_list; /* List of these we have mounted */ + struct list_head context_list; /* List of these we have mounted */ struct yaffs_dev *dev; struct super_block * super; struct task_struct *bg_thread; /* Background thread for this device */ @@ -29,7 +29,7 @@ struct yaffs_linux_context { u8 *spare_buffer; /* For mtdif2 use. Don't know the size of the buffer * at compile time so we have to allocate it. */ - struct ylist_head search_contexts; + struct list_head search_contexts; void (*put_super_fn)(struct super_block *sb); struct task_struct *readdir_process; diff --git a/yaffs_mtdif1_single.c b/yaffs_mtdif1_single.c index 55b367b..02281fd 100644 --- a/yaffs_mtdif1_single.c +++ b/yaffs_mtdif1_single.c @@ -71,11 +71,11 @@ int nandmtd1_write_chunk_tags(struct yaffs_dev *dev, int chunk_bytes = dev->data_bytes_per_chunk; loff_t addr = ((loff_t)nand_chunk) * chunk_bytes; struct mtd_oob_ops ops; - yaffs_packed_tags1 pt1; + struct yaffs_packed_tags1 pt1; int retval; /* we assume that packed_tags1 and struct yaffs_tags are compatible */ - compile_time_assertion(sizeof(yaffs_packed_tags1) == 12); + compile_time_assertion(sizeof(struct yaffs_packed_tags1) == 12); compile_time_assertion(sizeof(struct yaffs_tags) == 8); yaffs_pack_tags1(&pt1, etags); @@ -150,7 +150,7 @@ int nandmtd1_read_chunk_tags(struct yaffs_dev *dev, loff_t addr = ((loff_t)nand_chunk) * chunk_bytes; int eccres = YAFFS_ECC_RESULT_NO_ERROR; struct mtd_oob_ops ops; - yaffs_packed_tags1 pt1; + struct yaffs_packed_tags1 pt1; int retval; int deleted; diff --git a/yaffs_mtdif2_single.c b/yaffs_mtdif2_single.c index 667d129..f5a5c10 100644 --- a/yaffs_mtdif2_single.c +++ b/yaffs_mtdif2_single.c @@ -40,7 +40,7 @@ int nandmtd2_write_chunk_tags(struct yaffs_dev *dev, int nand_chunk, loff_t addr; - yaffs_packed_tags2 pt; + struct yaffs_packed_tags2 pt; int packed_tags_size = dev->param.no_tags_ecc ? sizeof(pt.t) : sizeof(pt); void * packed_tags_ptr = dev->param.no_tags_ecc ? (void *) &pt.t : (void *)&pt; @@ -60,8 +60,8 @@ int nandmtd2_write_chunk_tags(struct yaffs_dev *dev, int nand_chunk, if (!data || !tags) BUG(); else if (dev->param.inband_tags) { - yaffs_packed_tags2_tags_only *pt2tp; - pt2tp = (yaffs_packed_tags2_tags_only *)(data + dev->data_bytes_per_chunk); + struct yaffs_packed_tags2_tags_only *pt2tp; + pt2tp = (struct yaffs_packed_tags2_tags_only *)(data + dev->data_bytes_per_chunk); yaffs_pack_tags2_tags_only(pt2tp, tags); } else yaffs_pack_tags2(&pt, tags, !dev->param.no_tags_ecc); @@ -93,7 +93,7 @@ int nandmtd2_read_chunk_tags(struct yaffs_dev *dev, int nand_chunk, loff_t addr = ((loff_t) nand_chunk) * dev->param.total_bytes_per_chunk; - yaffs_packed_tags2 pt; + struct yaffs_packed_tags2 pt; int packed_tags_size = dev->param.no_tags_ecc ? sizeof(pt.t) : sizeof(pt); void * packed_tags_ptr = dev->param.no_tags_ecc ? (void *) &pt.t: (void *)&pt; @@ -129,8 +129,8 @@ int nandmtd2_read_chunk_tags(struct yaffs_dev *dev, int nand_chunk, if (dev->param.inband_tags) { if (tags) { - yaffs_packed_tags2_tags_only *pt2tp; - pt2tp = (yaffs_packed_tags2_tags_only *)&data[dev->data_bytes_per_chunk]; + struct yaffs_packed_tags2_tags_only *pt2tp; + pt2tp = (struct yaffs_packed_tags2_tags_only *)&data[dev->data_bytes_per_chunk]; yaffs_unpack_tags2_tags_only(tags, pt2tp); } } else { diff --git a/yaffs_packedtags1.c b/yaffs_packedtags1.c index 45dd54d..9055512 100644 --- a/yaffs_packedtags1.c +++ b/yaffs_packedtags1.c @@ -14,7 +14,7 @@ #include "yaffs_packedtags1.h" #include "yportenv.h" -void yaffs_pack_tags1(yaffs_packed_tags1 *pt, const struct yaffs_ext_tags *t) +void yaffs_pack_tags1(struct yaffs_packed_tags1 *pt, const struct yaffs_ext_tags *t) { pt->chunk_id = t->chunk_id; pt->serial_number = t->serial_number; @@ -27,13 +27,13 @@ void yaffs_pack_tags1(yaffs_packed_tags1 *pt, const struct yaffs_ext_tags *t) } -void yaffs_unpack_tags1(struct yaffs_ext_tags *t, const yaffs_packed_tags1 *pt) +void yaffs_unpack_tags1(struct yaffs_ext_tags *t, const struct yaffs_packed_tags1 *pt) { static const u8 all_ff[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - if (memcmp(all_ff, pt, sizeof(yaffs_packed_tags1))) { + if (memcmp(all_ff, pt, sizeof(struct yaffs_packed_tags1))) { t->block_bad = 0; if (pt->should_be_ff != 0xFFFFFFFF) t->block_bad = 1; diff --git a/yaffs_packedtags1.h b/yaffs_packedtags1.h index 01f952a..9174837 100644 --- a/yaffs_packedtags1.h +++ b/yaffs_packedtags1.h @@ -20,7 +20,7 @@ #include "yaffs_guts.h" -typedef struct { +struct yaffs_packed_tags1 { unsigned chunk_id:20; unsigned serial_number:2; unsigned n_bytes:10; @@ -30,8 +30,8 @@ typedef struct { unsigned unused_stuff:1; unsigned should_be_ff; -} yaffs_packed_tags1; +} ; -void yaffs_pack_tags1(yaffs_packed_tags1 *pt, const struct yaffs_ext_tags *t); -void yaffs_unpack_tags1(struct yaffs_ext_tags *t, const yaffs_packed_tags1 *pt); +void yaffs_pack_tags1(struct yaffs_packed_tags1 *pt, const struct yaffs_ext_tags *t); +void yaffs_unpack_tags1(struct yaffs_ext_tags *t, const struct yaffs_packed_tags1 *pt); #endif diff --git a/yaffs_packedtags2.c b/yaffs_packedtags2.c index 12a893e..6a22939 100644 --- a/yaffs_packedtags2.c +++ b/yaffs_packedtags2.c @@ -39,14 +39,14 @@ #define EXTRA_OBJECT_TYPE_MASK ((0x0F) << EXTRA_OBJECT_TYPE_SHIFT) -static void yaffs_dump_packed_tags2_tags_only(const yaffs_packed_tags2_tags_only *ptt) +static void yaffs_dump_packed_tags2_tags_only(const struct yaffs_packed_tags2_tags_only *ptt) { T(YAFFS_TRACE_MTD, (TSTR("packed tags obj %d chunk %d byte %d seq %d" TENDSTR), ptt->obj_id, ptt->chunk_id, ptt->n_bytes, ptt->seq_number)); } -static void yaffs_dump_packed_tags2(const yaffs_packed_tags2 *pt) +static void yaffs_dump_packed_tags2(const struct yaffs_packed_tags2 *pt) { yaffs_dump_packed_tags2_tags_only(&pt->t); } @@ -62,7 +62,7 @@ static void yaffs_dump_tags2(const struct yaffs_ext_tags *t) } -void yaffs_pack_tags2_tags_only(yaffs_packed_tags2_tags_only *ptt, +void yaffs_pack_tags2_tags_only(struct yaffs_packed_tags2_tags_only *ptt, const struct yaffs_ext_tags *t) { ptt->chunk_id = t->chunk_id; @@ -97,19 +97,19 @@ void yaffs_pack_tags2_tags_only(yaffs_packed_tags2_tags_only *ptt, } -void yaffs_pack_tags2(yaffs_packed_tags2 *pt, const struct yaffs_ext_tags *t, int tags_ecc) +void yaffs_pack_tags2(struct yaffs_packed_tags2 *pt, const struct yaffs_ext_tags *t, int tags_ecc) { yaffs_pack_tags2_tags_only(&pt->t, t); if(tags_ecc) yaffs_ecc_calc_other((unsigned char *)&pt->t, - sizeof(yaffs_packed_tags2_tags_only), + sizeof(struct yaffs_packed_tags2_tags_only), &pt->ecc); } void yaffs_unpack_tags2_tags_only(struct yaffs_ext_tags *t, - yaffs_packed_tags2_tags_only *ptt) + struct yaffs_packed_tags2_tags_only *ptt) { memset(t, 0, sizeof(struct yaffs_ext_tags)); @@ -156,7 +156,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) +void yaffs_unpack_tags2(struct yaffs_ext_tags *t, struct yaffs_packed_tags2 *pt, int tags_ecc) { enum yaffs_ecc_result ecc_result = YAFFS_ECC_RESULT_NO_ERROR; @@ -165,13 +165,13 @@ void yaffs_unpack_tags2(struct yaffs_ext_tags *t, yaffs_packed_tags2 *pt, int ta tags_ecc){ /* Chunk is in use and we need to do ECC */ - yaffs_ecc_other ecc; + struct yaffs_ecc_other ecc; int result; yaffs_ecc_calc_other((unsigned char *)&pt->t, - sizeof(yaffs_packed_tags2_tags_only), + sizeof(struct yaffs_packed_tags2_tags_only), &ecc); result = yaffs_ecc_correct_other((unsigned char *)&pt->t, - sizeof(yaffs_packed_tags2_tags_only), + sizeof(struct yaffs_packed_tags2_tags_only), &pt->ecc, &ecc); switch (result) { case 0: diff --git a/yaffs_packedtags2.h b/yaffs_packedtags2.h index e869a8a..f147c09 100644 --- a/yaffs_packedtags2.h +++ b/yaffs_packedtags2.h @@ -21,23 +21,23 @@ #include "yaffs_guts.h" #include "yaffs_ecc.h" -typedef struct { +struct yaffs_packed_tags2_tags_only { unsigned seq_number; unsigned obj_id; unsigned chunk_id; unsigned n_bytes; -} yaffs_packed_tags2_tags_only; +} ; -typedef struct { - yaffs_packed_tags2_tags_only t; - yaffs_ecc_other ecc; -} yaffs_packed_tags2; +struct yaffs_packed_tags2 { + struct yaffs_packed_tags2_tags_only t; + struct yaffs_ecc_other ecc; +} ; /* Full packed tags with ECC, used for oob tags */ -void yaffs_pack_tags2(yaffs_packed_tags2 *pt, const struct yaffs_ext_tags *t, int tags_ecc); -void yaffs_unpack_tags2(struct yaffs_ext_tags *t, yaffs_packed_tags2 *pt, int tags_ecc); +void yaffs_pack_tags2(struct yaffs_packed_tags2 *pt, const struct yaffs_ext_tags *t, int tags_ecc); +void yaffs_unpack_tags2(struct yaffs_ext_tags *t, struct yaffs_packed_tags2 *pt, int tags_ecc); /* Only the tags part (no ECC for use with inband tags */ -void yaffs_pack_tags2_tags_only(yaffs_packed_tags2_tags_only *pt, const struct yaffs_ext_tags *t); -void yaffs_unpack_tags2_tags_only(struct yaffs_ext_tags *t, yaffs_packed_tags2_tags_only *pt); +void yaffs_pack_tags2_tags_only(struct yaffs_packed_tags2_tags_only *pt, const struct yaffs_ext_tags *t); +void yaffs_unpack_tags2_tags_only(struct yaffs_ext_tags *t, struct yaffs_packed_tags2_tags_only *pt); #endif diff --git a/yaffs_verify.c b/yaffs_verify.c index 95093df..e15bb32 100644 --- a/yaffs_verify.c +++ b/yaffs_verify.c @@ -403,7 +403,7 @@ void yaffs_verify_objects(struct yaffs_dev *dev) { struct yaffs_obj *obj; int i; - struct ylist_head *lh; + struct list_head *lh; if (yaffs_skip_verification(dev)) return; @@ -411,9 +411,9 @@ void yaffs_verify_objects(struct yaffs_dev *dev) /* Iterate through the objects in each hash entry */ for (i = 0; i < YAFFS_NOBJECT_BUCKETS; i++) { - ylist_for_each(lh, &dev->obj_bucket[i].list) { + list_for_each(lh, &dev->obj_bucket[i].list) { if (lh) { - obj = ylist_entry(lh, struct yaffs_obj, hash_link); + obj = list_entry(lh, struct yaffs_obj, hash_link); yaffs_verify_obj(obj); } } @@ -423,7 +423,7 @@ void yaffs_verify_objects(struct yaffs_dev *dev) void yaffs_verify_obj_in_dir(struct yaffs_obj *obj) { - struct ylist_head *lh; + struct list_head *lh; struct yaffs_obj *list_obj; int count = 0; @@ -450,9 +450,9 @@ void yaffs_verify_obj_in_dir(struct yaffs_obj *obj) /* Iterate through the objects in each hash entry */ - ylist_for_each(lh, &obj->parent->variant.dir_variant.children) { + list_for_each(lh, &obj->parent->variant.dir_variant.children) { if (lh) { - list_obj = ylist_entry(lh, struct yaffs_obj, siblings); + list_obj = list_entry(lh, struct yaffs_obj, siblings); yaffs_verify_obj(list_obj); if (obj == list_obj) count++; @@ -467,7 +467,7 @@ void yaffs_verify_obj_in_dir(struct yaffs_obj *obj) void yaffs_verify_dir(struct yaffs_obj *directory) { - struct ylist_head *lh; + struct list_head *lh; struct yaffs_obj *list_obj; if (!directory) { @@ -487,9 +487,9 @@ void yaffs_verify_dir(struct yaffs_obj *directory) /* Iterate through the objects in each hash entry */ - ylist_for_each(lh, &directory->variant.dir_variant.children) { + list_for_each(lh, &directory->variant.dir_variant.children) { if (lh) { - list_obj = ylist_entry(lh, struct yaffs_obj, siblings); + list_obj = list_entry(lh, struct yaffs_obj, siblings); if (list_obj->parent != directory) { T(YAFFS_TRACE_ALWAYS, ( TSTR("Object in directory list has wrong parent %p" TENDSTR), diff --git a/yaffs_vfs_multi.c b/yaffs_vfs_multi.c index e1438da..fa83cab 100644 --- a/yaffs_vfs_multi.c +++ b/yaffs_vfs_multi.c @@ -614,7 +614,7 @@ struct yaffs_search_context { struct yaffs_dev *dev; struct yaffs_obj *dir_obj; struct yaffs_obj *next_return; - struct ylist_head others; + struct list_head others; }; /* @@ -630,14 +630,14 @@ static struct yaffs_search_context * yaffs_new_search(struct yaffs_obj *dir) if(sc){ sc->dir_obj = dir; sc->dev = dev; - if( ylist_empty(&sc->dir_obj->variant.dir_variant.children)) + if( list_empty(&sc->dir_obj->variant.dir_variant.children)) sc->next_return = NULL; else - sc->next_return = ylist_entry( + sc->next_return = list_entry( dir->variant.dir_variant.children.next, struct yaffs_obj,siblings); - YINIT_LIST_HEAD(&sc->others); - ylist_add(&sc->others,&(yaffs_dev_to_lc(dev)->search_contexts)); + INIT_LIST_HEAD(&sc->others); + list_add(&sc->others,&(yaffs_dev_to_lc(dev)->search_contexts)); } return sc; } @@ -648,7 +648,7 @@ static struct yaffs_search_context * yaffs_new_search(struct yaffs_obj *dir) static void yaffs_search_end(struct yaffs_search_context * sc) { if(sc){ - ylist_del(&sc->others); + list_del(&sc->others); YFREE(sc); } } @@ -664,15 +664,15 @@ static void yaffs_search_advance(struct yaffs_search_context *sc) return; if( sc->next_return == NULL || - ylist_empty(&sc->dir_obj->variant.dir_variant.children)) + list_empty(&sc->dir_obj->variant.dir_variant.children)) sc->next_return = NULL; else { - struct ylist_head *next = sc->next_return->siblings.next; + struct list_head *next = sc->next_return->siblings.next; if( next == &sc->dir_obj->variant.dir_variant.children) sc->next_return = NULL; /* end of list */ else - sc->next_return = ylist_entry(next,struct yaffs_obj,siblings); + sc->next_return = list_entry(next,struct yaffs_obj,siblings); } } @@ -684,18 +684,18 @@ static void yaffs_search_advance(struct yaffs_search_context *sc) static void yaffs_remove_obj_callback(struct yaffs_obj *obj) { - struct ylist_head *i; + struct list_head *i; struct yaffs_search_context *sc; - struct ylist_head *search_contexts = &(yaffs_dev_to_lc(obj->my_dev)->search_contexts); + struct list_head *search_contexts = &(yaffs_dev_to_lc(obj->my_dev)->search_contexts); /* Iterate through the directory search contexts. * If any are currently on the object being removed, then advance * the search context to the next object to prevent a hanging pointer. */ - ylist_for_each(i, search_contexts) { + list_for_each(i, search_contexts) { if (i) { - sc = ylist_entry(i, struct yaffs_search_context,others); + sc = list_entry(i, struct yaffs_search_context,others); if(sc->next_return == obj) yaffs_search_advance(sc); } @@ -1949,7 +1949,7 @@ static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry, if (target && target->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY && - !ylist_empty(&target->variant.dir_variant.children)) { + !list_empty(&target->variant.dir_variant.children)) { T(YAFFS_TRACE_OS, (TSTR("target is non-empty dir\n"))); @@ -2548,7 +2548,7 @@ static void yaffs_read_inode(struct inode *inode) #endif -static YLIST_HEAD(yaffs_context_list); +static LIST_HEAD(yaffs_context_list); struct semaphore yaffs_context_lock; static void yaffs_put_super(struct super_block *sb) @@ -2576,7 +2576,7 @@ static void yaffs_put_super(struct super_block *sb) yaffs_gross_unlock(dev); down(&yaffs_context_lock); - ylist_del_init(&(yaffs_dev_to_lc(dev)->context_list)); + list_del_init(&(yaffs_dev_to_lc(dev)->context_list)); up(&yaffs_context_lock); if (yaffs_dev_to_lc(dev)->spare_buffer) { @@ -2608,7 +2608,7 @@ static void yaffs_touch_super(struct yaffs_dev *dev) sb->s_dirt = 1; } -typedef struct { +struct yaffs_options { int inband_tags; int skip_checkpoint_read; int skip_checkpoint_write; @@ -2619,10 +2619,10 @@ typedef struct { int lazy_loading_overridden; int empty_lost_and_found; int empty_lost_and_found_overridden; -} yaffs_options; +} ; #define MAX_OPT_LEN 30 -static int yaffs_parse_options(yaffs_options *options, const char *options_str) +static int yaffs_parse_options(struct yaffs_options *options, const char *options_str) { char cur_opt[MAX_OPT_LEN + 1]; int p; @@ -2701,12 +2701,12 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, int read_only = 0; - yaffs_options options; + struct yaffs_options options; unsigned mount_id; int found; struct yaffs_linux_context *context_iterator; - struct ylist_head *l; + struct list_head *l; sb->s_magic = YAFFS_MAGIC; sb->s_op = &yaffs_super_ops; @@ -2899,7 +2899,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, memset(context,0,sizeof(struct yaffs_linux_context)); dev->os_context = context; - YINIT_LIST_HEAD(&(context->context_list)); + INIT_LIST_HEAD(&(context->context_list)); context->dev = dev; context->super = sb; @@ -3028,19 +3028,19 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, found = 0; for(mount_id=0; ! found; mount_id++){ found = 1; - ylist_for_each(l,&yaffs_context_list){ - context_iterator = ylist_entry(l,struct yaffs_linux_context,context_list); + list_for_each(l,&yaffs_context_list){ + context_iterator = list_entry(l,struct yaffs_linux_context,context_list); if(context_iterator->mount_id == mount_id) found = 0; } } context->mount_id = mount_id; - ylist_add_tail(&(yaffs_dev_to_lc(dev)->context_list), &yaffs_context_list); + list_add_tail(&(yaffs_dev_to_lc(dev)->context_list), &yaffs_context_list); up(&yaffs_context_lock); /* Directory search handling...*/ - YINIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->search_contexts)); + INIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->search_contexts)); param->remove_obj_fn = yaffs_remove_obj_callback; init_MUTEX(&(yaffs_dev_to_lc(dev)->gross_lock)); @@ -3254,7 +3254,7 @@ static int yaffs_proc_read(char *page, char **start, off_t offset, int count, int *eof, void *data) { - struct ylist_head *item; + struct list_head *item; char *buf = page; int step = offset; int n = 0; @@ -3278,8 +3278,8 @@ static int yaffs_proc_read(char *page, down(&yaffs_context_lock); /* Locate and print the Nth entry. Order N-squared but N is small. */ - ylist_for_each(item, &yaffs_context_list) { - struct yaffs_linux_context *dc = ylist_entry(item, struct yaffs_linux_context, context_list); + list_for_each(item, &yaffs_context_list) { + struct yaffs_linux_context *dc = list_entry(item, struct yaffs_linux_context, context_list); struct yaffs_dev *dev = dc->dev; if (n < (step & ~1)) { @@ -3304,15 +3304,15 @@ static int yaffs_stats_proc_read(char *page, char **start, off_t offset, int count, int *eof, void *data) { - struct ylist_head *item; + struct list_head *item; char *buf = page; int n = 0; down(&yaffs_context_lock); /* Locate and print the Nth entry. Order N-squared but N is small. */ - ylist_for_each(item, &yaffs_context_list) { - struct yaffs_linux_context *dc = ylist_entry(item, struct yaffs_linux_context, context_list); + list_for_each(item, &yaffs_context_list) { + struct yaffs_linux_context *dc = list_entry(item, struct yaffs_linux_context, context_list); struct yaffs_dev *dev = dc->dev; int erased_chunks; diff --git a/yaffs_vfs_single.c b/yaffs_vfs_single.c index 2e92c25..cb5968f 100644 --- a/yaffs_vfs_single.c +++ b/yaffs_vfs_single.c @@ -395,7 +395,7 @@ struct yaffs_search_context { struct yaffs_dev *dev; struct yaffs_obj *dir_obj; struct yaffs_obj *next_return; - struct ylist_head others; + struct list_head others; }; /* @@ -411,14 +411,14 @@ static struct yaffs_search_context * yaffs_new_search(struct yaffs_obj *dir) if(sc){ sc->dir_obj = dir; sc->dev = dev; - if( ylist_empty(&sc->dir_obj->variant.dir_variant.children)) + if( list_empty(&sc->dir_obj->variant.dir_variant.children)) sc->next_return = NULL; else - sc->next_return = ylist_entry( + sc->next_return = list_entry( dir->variant.dir_variant.children.next, struct yaffs_obj,siblings); - YINIT_LIST_HEAD(&sc->others); - ylist_add(&sc->others,&(yaffs_dev_to_lc(dev)->search_contexts)); + INIT_LIST_HEAD(&sc->others); + list_add(&sc->others,&(yaffs_dev_to_lc(dev)->search_contexts)); } return sc; } @@ -429,7 +429,7 @@ static struct yaffs_search_context * yaffs_new_search(struct yaffs_obj *dir) static void yaffs_search_end(struct yaffs_search_context * sc) { if(sc){ - ylist_del(&sc->others); + list_del(&sc->others); YFREE(sc); } } @@ -445,15 +445,15 @@ static void yaffs_search_advance(struct yaffs_search_context *sc) return; if( sc->next_return == NULL || - ylist_empty(&sc->dir_obj->variant.dir_variant.children)) + list_empty(&sc->dir_obj->variant.dir_variant.children)) sc->next_return = NULL; else { - struct ylist_head *next = sc->next_return->siblings.next; + struct list_head *next = sc->next_return->siblings.next; if( next == &sc->dir_obj->variant.dir_variant.children) sc->next_return = NULL; /* end of list */ else - sc->next_return = ylist_entry(next,struct yaffs_obj,siblings); + sc->next_return = list_entry(next,struct yaffs_obj,siblings); } } @@ -465,18 +465,18 @@ static void yaffs_search_advance(struct yaffs_search_context *sc) static void yaffs_remove_obj_callback(struct yaffs_obj *obj) { - struct ylist_head *i; + struct list_head *i; struct yaffs_search_context *sc; - struct ylist_head *search_contexts = &(yaffs_dev_to_lc(obj->my_dev)->search_contexts); + struct list_head *search_contexts = &(yaffs_dev_to_lc(obj->my_dev)->search_contexts); /* Iterate through the directory search contexts. * If any are currently on the object being removed, then advance * the search context to the next object to prevent a hanging pointer. */ - ylist_for_each(i, search_contexts) { + list_for_each(i, search_contexts) { if (i) { - sc = ylist_entry(i, struct yaffs_search_context,others); + sc = list_entry(i, struct yaffs_search_context,others); if(sc->next_return == obj) yaffs_search_advance(sc); } @@ -1527,7 +1527,7 @@ static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry, if (target && target->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY && - !ylist_empty(&target->variant.dir_variant.children)) { + !list_empty(&target->variant.dir_variant.children)) { T(YAFFS_TRACE_OS, (TSTR("target is non-empty dir\n"))); @@ -2052,7 +2052,7 @@ static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino) return inode; } -static YLIST_HEAD(yaffs_context_list); +static LIST_HEAD(yaffs_context_list); struct semaphore yaffs_context_lock; static void yaffs_put_super(struct super_block *sb) @@ -2080,7 +2080,7 @@ static void yaffs_put_super(struct super_block *sb) yaffs_gross_unlock(dev); down(&yaffs_context_lock); - ylist_del_init(&(yaffs_dev_to_lc(dev)->context_list)); + list_del_init(&(yaffs_dev_to_lc(dev)->context_list)); up(&yaffs_context_lock); if (yaffs_dev_to_lc(dev)->spare_buffer) { @@ -2112,7 +2112,7 @@ static void yaffs_touch_super(struct yaffs_dev *dev) sb->s_dirt = 1; } -typedef struct { +struct yaffs_options { int inband_tags; int skip_checkpoint_read; int skip_checkpoint_write; @@ -2123,10 +2123,10 @@ typedef struct { int lazy_loading_overridden; int empty_lost_and_found; int empty_lost_and_found_overridden; -} yaffs_options; +} ; #define MAX_OPT_LEN 30 -static int yaffs_parse_options(yaffs_options *options, const char *options_str) +static int yaffs_parse_options(struct yaffs_options *options, const char *options_str) { char cur_opt[MAX_OPT_LEN + 1]; int p; @@ -2205,12 +2205,12 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, int read_only = 0; - yaffs_options options; + struct yaffs_options options; unsigned mount_id; int found; struct yaffs_linux_context *context_iterator; - struct ylist_head *l; + struct list_head *l; sb->s_magic = YAFFS_MAGIC; sb->s_op = &yaffs_super_ops; @@ -2386,7 +2386,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, memset(context,0,sizeof(struct yaffs_linux_context)); dev->os_context = context; - YINIT_LIST_HEAD(&(context->context_list)); + INIT_LIST_HEAD(&(context->context_list)); context->dev = dev; context->super = sb; @@ -2501,19 +2501,19 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, found = 0; for(mount_id=0; ! found; mount_id++){ found = 1; - ylist_for_each(l,&yaffs_context_list){ - context_iterator = ylist_entry(l,struct yaffs_linux_context,context_list); + list_for_each(l,&yaffs_context_list){ + context_iterator = list_entry(l,struct yaffs_linux_context,context_list); if(context_iterator->mount_id == mount_id) found = 0; } } context->mount_id = mount_id; - ylist_add_tail(&(yaffs_dev_to_lc(dev)->context_list), &yaffs_context_list); + list_add_tail(&(yaffs_dev_to_lc(dev)->context_list), &yaffs_context_list); up(&yaffs_context_lock); /* Directory search handling...*/ - YINIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->search_contexts)); + INIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->search_contexts)); param->remove_obj_fn = yaffs_remove_obj_callback; init_MUTEX(&(yaffs_dev_to_lc(dev)->gross_lock)); @@ -2682,7 +2682,7 @@ static int yaffs_proc_read(char *page, char **start, off_t offset, int count, int *eof, void *data) { - struct ylist_head *item; + struct list_head *item; char *buf = page; int step = offset; int n = 0; @@ -2706,8 +2706,8 @@ static int yaffs_proc_read(char *page, down(&yaffs_context_lock); /* Locate and print the Nth entry. Order N-squared but N is small. */ - ylist_for_each(item, &yaffs_context_list) { - struct yaffs_linux_context *dc = ylist_entry(item, struct yaffs_linux_context, context_list); + list_for_each(item, &yaffs_context_list) { + struct yaffs_linux_context *dc = list_entry(item, struct yaffs_linux_context, context_list); struct yaffs_dev *dev = dc->dev; if (n < (step & ~1)) { @@ -2732,15 +2732,15 @@ static int yaffs_stats_proc_read(char *page, char **start, off_t offset, int count, int *eof, void *data) { - struct ylist_head *item; + struct list_head *item; char *buf = page; int n = 0; down(&yaffs_context_lock); /* Locate and print the Nth entry. Order N-squared but N is small. */ - ylist_for_each(item, &yaffs_context_list) { - struct yaffs_linux_context *dc = ylist_entry(item, struct yaffs_linux_context, context_list); + list_for_each(item, &yaffs_context_list) { + struct yaffs_linux_context *dc = list_entry(item, struct yaffs_linux_context, context_list); struct yaffs_dev *dev = dc->dev; int erased_chunks; diff --git a/yaffs_yaffs1.c b/yaffs_yaffs1.c index 89d570e..3816962 100644 --- a/yaffs_yaffs1.c +++ b/yaffs_yaffs1.c @@ -320,7 +320,7 @@ int yaffs1_scan(struct yaffs_dev *dev) /* Set up as a directory */ parent->variant_type = YAFFS_OBJECT_TYPE_DIRECTORY; - YINIT_LIST_HEAD(&parent->variant. + INIT_LIST_HEAD(&parent->variant. dir_variant. children); } else if (!parent || parent->variant_type != @@ -367,7 +367,7 @@ int yaffs1_scan(struct yaffs_dev *dev) equiv_id = oh->equiv_id; in->hard_links.next = - (struct ylist_head *) + (struct list_head *) hard_list; hard_list = in; break; diff --git a/yaffs_yaffs2.c b/yaffs_yaffs2.c index 5162f15..0bac099 100644 --- a/yaffs_yaffs2.c +++ b/yaffs_yaffs2.c @@ -547,7 +547,7 @@ static int yaffs2_wr_checkpt_objs(struct yaffs_dev *dev) struct yaffs_checkpt_obj cp; int i; int ok = 1; - struct ylist_head *lh; + struct list_head *lh; /* Iterate through the objects in each hash entry, @@ -555,9 +555,9 @@ static int yaffs2_wr_checkpt_objs(struct yaffs_dev *dev) */ for (i = 0; ok && i < YAFFS_NOBJECT_BUCKETS; i++) { - ylist_for_each(lh, &dev->obj_bucket[i].list) { + list_for_each(lh, &dev->obj_bucket[i].list) { if (lh) { - obj = ylist_entry(lh, struct yaffs_obj, hash_link); + obj = list_entry(lh, struct yaffs_obj, hash_link); if (!obj->defered_free) { yaffs2_obj_checkpt_obj(&cp, obj); cp.struct_type = sizeof(cp); @@ -616,7 +616,7 @@ static int yaffs2_rd_checkpt_objs(struct yaffs_dev *dev) ok = yaffs2_rd_checkpt_tnodes(obj); } else if (obj->variant_type == YAFFS_OBJECT_TYPE_HARDLINK) { obj->hard_links.next = - (struct ylist_head *) hard_list; + (struct list_head *) hard_list; hard_list = obj; } } else @@ -1412,7 +1412,7 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev) /* Set up as a directory */ parent->variant_type = YAFFS_OBJECT_TYPE_DIRECTORY; - YINIT_LIST_HEAD(&parent->variant. + INIT_LIST_HEAD(&parent->variant. dir_variant. children); } else if (!parent || parent->variant_type != @@ -1472,7 +1472,7 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev) in->variant.hardlink_variant.equiv_id = equiv_id; in->hard_links.next = - (struct ylist_head *) hard_list; + (struct list_head *) hard_list; hard_list = in; } break; diff --git a/yportenv.h b/yportenv.h index 38a3595..ebb4f92 100644 --- a/yportenv.h +++ b/yportenv.h @@ -49,6 +49,7 @@ #include #include #include +#include #define YCHAR char #define YUCHAR unsigned char -- 2.30.2