summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--direct/basic-test/Makefile9
-rw-r--r--direct/basic-test/yaffs_fileem2k.c24
-rw-r--r--direct/basic-test/yaffs_ramdisk.c6
-rw-r--r--direct/basic-test/yaffs_ramem2k.c7
-rw-r--r--direct/python/Makefile8
-rw-r--r--direct/tests/Makefile7
-rw-r--r--direct/yaffs_nandemul2k.h (renamed from yaffs_nandemul2k.h)0
-rw-r--r--direct/yaffs_nandif.c22
-rw-r--r--direct/yaffs_qsort.c (renamed from yaffs_qsort.c)0
-rw-r--r--utils/mkyaffs2image.c20
-rw-r--r--yaffs_allocator.c30
-rw-r--r--yaffs_bitmap.c30
-rw-r--r--yaffs_checkptrw.c63
-rw-r--r--yaffs_checkptrw.h2
-rw-r--r--yaffs_ecc.c44
-rw-r--r--yaffs_ecc.h14
-rw-r--r--yaffs_getblockinfo.h2
-rw-r--r--yaffs_guts.c1161
-rw-r--r--yaffs_guts.h2
-rw-r--r--yaffs_linux.h22
-rw-r--r--yaffs_list.h38
-rw-r--r--yaffs_mtdif.c6
-rw-r--r--yaffs_mtdif.h4
-rw-r--r--yaffs_mtdif1.c64
-rw-r--r--yaffs_mtdif1.h8
-rw-r--r--yaffs_mtdif2.c53
-rw-r--r--yaffs_mtdif2.h8
-rw-r--r--yaffs_nand.c10
-rw-r--r--yaffs_packedtags1.c14
-rw-r--r--yaffs_packedtags1.h10
-rw-r--r--yaffs_packedtags2.c46
-rw-r--r--yaffs_packedtags2.h16
-rw-r--r--yaffs_tagscompat.c138
-rw-r--r--yaffs_verify.c169
-rw-r--r--yaffs_verify.h2
-rw-r--r--yaffs_vfs.c324
-rw-r--r--yaffs_vfs_multi.c370
-rw-r--r--yaffs_yaffs1.c43
-rw-r--r--yaffs_yaffs2.c225
-rw-r--r--yaffsinterface.h21
40 files changed, 1507 insertions, 1535 deletions
diff --git a/direct/basic-test/Makefile b/direct/basic-test/Makefile
index 2b52cca..4054ed1 100644
--- a/direct/basic-test/Makefile
+++ b/direct/basic-test/Makefile
@@ -49,12 +49,12 @@ YAFFSTESTOBJS = $(COMMONTESTOBJS) yaffs_test.o
ALLOBJS = $(sort $(YAFFSTESTOBJS))
-YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffsinterface.h yportenv.h yaffs_tagscompat.c yaffs_tagscompat.h \
- yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h yaffs_nandemul2k.h \
+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_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \
yaffs_nameval.c yaffs_nameval.h \
- yaffs_qsort.c yaffs_qsort.h yaffs_trace.h \
+ yaffs_qsort.h yaffs_trace.h \
yaffs_allocator.c yaffs_allocator.h \
yaffs_yaffs1.c yaffs_yaffs1.h \
yaffs_yaffs2.c yaffs_yaffs2.h \
@@ -64,7 +64,8 @@ YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h ya
YAFFSDIRECTSYMLINKS = yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\
yaffsfs.h yaffs_malloc.h ydirectenv.h \
yaffs_flashif.c yaffscfg.h \
- yaffs_nandif.c yaffs_nandif.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 ad76c01..367003e 100644
--- a/direct/basic-test/yaffs_fileem2k.c
+++ b/direct/basic-test/yaffs_fileem2k.c
@@ -187,9 +187,9 @@ int yflash2_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8
if(dev->param.inband_tags){
- yaffs_PackedTags2TagsPart * pt2tp;
- pt2tp = (yaffs_PackedTags2TagsPart *)&data[dev->data_bytes_per_chunk];
- yaffs_PackTags2TagsPart(pt2tp,tags);
+ yaffs_packed_tags2_tags_only * pt2tp;
+ pt2tp = (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;
h = filedisk.handle[(nand_chunk / (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE))];
@@ -260,8 +260,8 @@ int yflash2_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8
}
else
{
- yaffs_PackedTags2 pt;
- yaffs_PackTags2(&pt,tags, !dev->param.no_tags_ecc);
+ yaffs_packed_tags2 pt;
+ yaffs_pack_tags2(&pt,tags, !dev->param.no_tags_ecc);
__u8 * ptab = (__u8 *)&pt;
nRead = read(h,localBuffer,sizeof(pt));
@@ -338,8 +338,8 @@ int yflash2_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __u8
}
else
{
- yaffs_PackedTags2 pt;
- yaffs_PackTags2(&pt,tags,!dev->param.no_tags_ecc);
+ yaffs_packed_tags2 pt;
+ yaffs_pack_tags2(&pt,tags,!dev->param.no_tags_ecc);
__u8 * ptab = (__u8 *)&pt;
nRead = read(h,localBuffer,sizeof(pt));
@@ -412,8 +412,8 @@ int yflash2_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *dat
}
- yaffs_PackedTags2TagsPart * pt2tp;
- pt2tp = (yaffs_PackedTags2TagsPart *)&data[dev->data_bytes_per_chunk];
+ yaffs_packed_tags2_tags_only * pt2tp;
+ pt2tp = (yaffs_packed_tags2_tags_only *)&data[dev->data_bytes_per_chunk];
pos = (nand_chunk % (PAGES_PER_BLOCK * BLOCKS_PER_HANDLE)) * PAGE_SIZE;
@@ -423,7 +423,7 @@ int yflash2_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *dat
nRead = read(h, data,dev->param.total_bytes_per_chunk);
- yaffs_unpack_tags2tags_part(tags,pt2tp);
+ yaffs_unpack_tags2_tags_only(tags,pt2tp);
if(nread != dev->param.total_bytes_per_chunk)
retval = YAFFS_FAIL;
@@ -472,7 +472,7 @@ int yflash2_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *dat
}
else
{
- yaffs_PackedTags2 pt;
+ 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_s *dev, int block_no)
int written;
int h;
- yaffs_PackedTags2 pt;
+ yaffs_packed_tags2 pt;
CheckInit();
diff --git a/direct/basic-test/yaffs_ramdisk.c b/direct/basic-test/yaffs_ramdisk.c
index f6e7773..9834bb2 100644
--- a/direct/basic-test/yaffs_ramdisk.c
+++ b/direct/basic-test/yaffs_ramdisk.c
@@ -139,9 +139,9 @@ int yramdisk_wr_chunk(yaffs_dev_t *dev,int nand_chunk,const __u8 *data, const ya
if(tags)
{
- yaffs_PackedTags1 pt;
+ yaffs_packed_tags1 pt;
- yaffs_PackTags1(&pt,tags);
+ yaffs_pack_tags1(&pt,tags);
memcpy(&ramdisk.block[blk]->page[pg].data[512],&pt,sizeof(pt));
}
@@ -170,7 +170,7 @@ int yramdisk_rd_chunk(yaffs_dev_t *dev,int nand_chunk, __u8 *data, yaffs_ext_tag
if(tags)
{
- yaffs_PackedTags1 pt;
+ 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 9bf673a..1a9765d 100644
--- a/direct/basic-test/yaffs_ramem2k.c
+++ b/direct/basic-test/yaffs_ramem2k.c
@@ -31,7 +31,6 @@ const char *yaffs_ramem2k_c_version = "$Id: yaffs_ramem2k.c,v 1.8 2010-02-18 01:
#include "yaffs_nandemul2k.h"
#include "yaffs_guts.h"
-#include "yaffsinterface.h"
#include "devextras.h"
#include "yaffs_packedtags2.h"
@@ -221,7 +220,7 @@ int nandemul2k_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,int nand_chunk,const __
{
x = &ned.block[blk]->page[pg]->data[PAGE_DATA_SIZE];
- yaffs_PackTags2((yaffs_PackedTags2 *)x,tags, !dev->param.no_tags_ecc);
+ yaffs_pack_tags2((yaffs_packed_tags2 *)x,tags, !dev->param.no_tags_ecc);
}
@@ -257,7 +256,7 @@ int nandemul2k_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,int nand_chunk, __u8 *
{
x = &ned.block[blk]->page[pg]->data[PAGE_DATA_SIZE];
- yaffs_unpack_tags2(tags,(yaffs_PackedTags2 *)x, !dev->param.no_tags_ecc);
+ yaffs_unpack_tags2(tags,(yaffs_packed_tags2 *)x, !dev->param.no_tags_ecc);
}
return YAFFS_OK;
@@ -321,7 +320,7 @@ int nandemul2k_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no)
x = &ned.block[block_no]->page[0]->data[PAGE_DATA_SIZE];
- memset(x,0,sizeof(yaffs_PackedTags2));
+ memset(x,0,sizeof(yaffs_packed_tags2));
return YAFFS_OK;
diff --git a/direct/python/Makefile b/direct/python/Makefile
index a6cfc4e..c3bb981 100644
--- a/direct/python/Makefile
+++ b/direct/python/Makefile
@@ -47,12 +47,12 @@ YAFFSLIBOBJS = $(COMMONTESTOBJS) yaffs_python_helper.o
-YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffsinterface.h yportenv.h yaffs_tagscompat.c yaffs_tagscompat.h \
- yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h yaffs_nandemul2k.h \
+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_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \
yaffs_nameval.c yaffs_nameval.h \
- yaffs_qsort.c yaffs_qsort.h yaffs_trace.h \
+ yaffs_qsort.h yaffs_trace.h \
yaffs_allocator.c yaffs_allocator.h \
yaffs_yaffs1.c yaffs_yaffs1.h \
yaffs_yaffs2.c yaffs_yaffs2.h \
@@ -62,7 +62,7 @@ YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h ya
YAFFSDIRECTSYMLINKS = yaffsfs.c yaffsfs.h yaffscfg.h yaffs_malloc.h ydirectenv.h \
yaffs_flashif.c yaffs_flashif.h yaffs_flashif2.h\
- yaffs_nandif.c yaffs_nandif.h
+ yaffs_nandif.c yaffs_nandif.h yaffs_qsort.c yaffs_nandemul2k.h
DIRECTEXTRASYMLINKS = yaffscfg2k.c yaffs_fileem2k.c yaffs_fileem2k.h\
yaffs_fileem.c yaffs_norif1.c yaffs_norif1.h \
diff --git a/direct/tests/Makefile b/direct/tests/Makefile
index 0844399..5800b0a 100644
--- a/direct/tests/Makefile
+++ b/direct/tests/Makefile
@@ -49,12 +49,12 @@ YAFFSTESTOBJS = $(COMMONTESTOBJS) yaffs_test.o
ALLOBJS = $(sort $(YAFFSTESTOBJS))
-YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffsinterface.h yportenv.h yaffs_tagscompat.c yaffs_tagscompat.h \
+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_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \
yaffs_nameval.c yaffs_nameval.h \
- yaffs_qsort.c yaffs_qsort.h yaffs_trace.h \
+ yaffs_qsort.h yaffs_trace.h \
yaffs_allocator.c yaffs_allocator.h \
yaffs_yaffs1.c yaffs_yaffs1.h \
yaffs_yaffs2.c yaffs_yaffs2.h \
@@ -63,7 +63,8 @@ YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h ya
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_qsort.c \
+ yaffs_nandemul2k.h \
yaffs_nandif.c yaffs_nandif.h
diff --git a/yaffs_nandemul2k.h b/direct/yaffs_nandemul2k.h
index 30b7cbd..30b7cbd 100644
--- a/yaffs_nandemul2k.h
+++ b/direct/yaffs_nandemul2k.h
diff --git a/direct/yaffs_nandif.c b/direct/yaffs_nandif.c
index 34665f4..135e894 100644
--- a/direct/yaffs_nandif.c
+++ b/direct/yaffs_nandif.c
@@ -35,7 +35,7 @@ int ynandif_WriteChunkWithTagsToNAND(yaffs_dev_t * dev, int nand_chunk,
{
int retval = 0;
- yaffs_PackedTags2 pt;
+ yaffs_packed_tags2 pt;
void *spare;
unsigned spareSize = 0;
ynandif_Geometry *geometry = (ynandif_Geometry *)(dev->driver_context);
@@ -52,16 +52,16 @@ int ynandif_WriteChunkWithTagsToNAND(yaffs_dev_t * dev, int nand_chunk,
*/
if(dev->param.inband_tags){
- yaffs_PackedTags2TagsPart *pt2tp;
- pt2tp = (yaffs_PackedTags2TagsPart *)(data + dev->data_bytes_per_chunk);
- yaffs_PackTags2TagsPart(pt2tp,tags);
+ yaffs_packed_tags2_tags_only *pt2tp;
+ pt2tp = (yaffs_packed_tags2_tags_only *)(data + dev->data_bytes_per_chunk);
+ yaffs_pack_tags2_tags_only(pt2tp,tags);
spare = NULL;
spareSize = 0;
}
else{
- yaffs_PackTags2(&pt, tags,!dev->param.no_tags_ecc);
+ yaffs_pack_tags2(&pt, tags,!dev->param.no_tags_ecc);
spare = &pt;
- spareSize = sizeof(yaffs_PackedTags2);
+ spareSize = sizeof(yaffs_packed_tags2);
}
retval = geometry->writeChunk(dev,nand_chunk,
@@ -73,7 +73,7 @@ int ynandif_WriteChunkWithTagsToNAND(yaffs_dev_t * dev, int nand_chunk,
int ynandif_ReadChunkWithTagsFromNAND(yaffs_dev_t * dev, int nand_chunk,
__u8 * data, yaffs_ext_tags * tags)
{
- yaffs_PackedTags2 pt;
+ yaffs_packed_tags2 pt;
int localData = 0;
void *spare = NULL;
unsigned spareSize;
@@ -100,7 +100,7 @@ int ynandif_ReadChunkWithTagsFromNAND(yaffs_dev_t * dev, int nand_chunk,
}
else {
spare = &pt;
- spareSize = sizeof(yaffs_PackedTags2);
+ spareSize = sizeof(yaffs_packed_tags2);
}
retval = geometry->readChunk(dev,nand_chunk,
@@ -111,9 +111,9 @@ int ynandif_ReadChunkWithTagsFromNAND(yaffs_dev_t * dev, int nand_chunk,
if(dev->param.inband_tags){
if(tags){
- yaffs_PackedTags2TagsPart * pt2tp;
- pt2tp = (yaffs_PackedTags2TagsPart *)&data[dev->data_bytes_per_chunk];
- yaffs_unpack_tags2tags_part(tags,pt2tp);
+ yaffs_packed_tags2_tags_only * pt2tp;
+ pt2tp = (yaffs_packed_tags2_tags_only *)&data[dev->data_bytes_per_chunk];
+ yaffs_unpack_tags2_tags_only(tags,pt2tp);
}
}
else {
diff --git a/yaffs_qsort.c b/direct/yaffs_qsort.c
index 187519f..187519f 100644
--- a/yaffs_qsort.c
+++ b/direct/yaffs_qsort.c
diff --git a/utils/mkyaffs2image.c b/utils/mkyaffs2image.c
index f54d3be..2d63908 100644
--- a/utils/mkyaffs2image.c
+++ b/utils/mkyaffs2image.c
@@ -46,7 +46,6 @@ unsigned yaffs_trace_mask=0;
#define spareSize 64
#define pagesPerBlock 64
-const char * mkyaffsimage_c_version = "$Id: mkyaffs2image.c,v 1.5 2010-01-11 21:43:18 charles Exp $";
typedef struct
@@ -58,7 +57,6 @@ typedef struct
static objItem obj_list[MAX_OBJECTS];
-static int n_obj = 0;
static int obj_id = YAFFS_NOBJECT_BUCKETS + 1;
static int n_obj, nDirectories, nPages;
@@ -145,7 +143,7 @@ static int find_obj_in_list(dev_t dev, ino_t ino)
* NOTE: The tag is not usable after this other than calculating the CRC
* with.
*/
-static void little_to_big_endian(yaffs_tags_t *tagsPtr)
+static void little_to_big_endian(yaffs_ext_tags *tagsPtr)
{
#if 0 // FIXME NCB
yaffs_tags_union_t * tags = (yaffs_tags_union_t* )tagsPtr; // Work in bytes.
@@ -174,17 +172,17 @@ static void little_to_big_endian(yaffs_tags_t *tagsPtr)
#endif
}
-static void shuffle_oob(char *spareData, yaffs_PackedTags2 *pt)
+static void shuffle_oob(char *spareData, yaffs_packed_tags2 *pt)
{
assert(sizeof(*pt) <= spareSize);
// NAND LAYOUT: For non-trivial OOB orderings, here would be a good place to shuffle.
memcpy(spareData, pt, sizeof(*pt));
}
-static int write_chunk(__u8 *data, __u32 obj_id, __u32 chunk_id, __u32 n_bytes)
+static int write_chunk(__u8 *data, __u32 id, __u32 chunk_id, __u32 n_bytes)
{
yaffs_ext_tags t;
- yaffs_PackedTags2 pt;
+ yaffs_packed_tags2 pt;
char spareData[spareSize];
if (write(outFile,data,chunkSize) != chunkSize)
@@ -196,7 +194,7 @@ static int write_chunk(__u8 *data, __u32 obj_id, __u32 chunk_id, __u32 n_bytes)
// t.serial_number = 0;
t.serial_number = 1; // **CHECK**
t.n_bytes = n_bytes;
- t.obj_id = obj_id;
+ t.obj_id = id;
t.seq_number = YAFFS_LOWEST_SEQUENCE_NUMBER;
@@ -211,7 +209,7 @@ static int write_chunk(__u8 *data, __u32 obj_id, __u32 chunk_id, __u32 n_bytes)
nPages++;
memset(&pt, 0, sizeof(pt));
- yaffs_PackTags2(&pt,&t,1);
+ yaffs_pack_tags2(&pt,&t,1);
memset(spareData, 0xff, sizeof(spareData));
shuffle_oob(spareData, &pt);
@@ -278,7 +276,7 @@ static void object_header_little_to_big_endian(yaffs_obj_header* oh)
#endif
}
-static int write_object_header(int obj_id, yaffs_obj_type t, struct stat *s, int parent, const char *name, int equivalentObj, const char * alias)
+static int write_object_header(int id, yaffs_obj_type t, struct stat *s, int parent, const char *name, int equivalentObj, const char * alias)
{
__u8 bytes[chunkSize];
@@ -338,11 +336,11 @@ static int write_object_header(int obj_id, yaffs_obj_type t, struct stat *s, int
object_header_little_to_big_endian(oh);
}
- return write_chunk(bytes,obj_id,0,0xffff);
+ return write_chunk(bytes,id,0,0xffff);
}
-static void pad_image()
+static void pad_image(void)
{
__u8 data[chunkSize + spareSize];
int padPages = (nPages % pagesPerBlock);
diff --git a/yaffs_allocator.c b/yaffs_allocator.c
index 47c89b8..024ee2a 100644
--- a/yaffs_allocator.c
+++ b/yaffs_allocator.c
@@ -74,12 +74,12 @@ struct yaffs_tnode_list {
typedef struct yaffs_tnode_list yaffs_tnodelist_t;
-struct yaffs_obj_tList_struct {
+struct yaffs_obj_list_struct {
yaffs_obj_t *objects;
- struct yaffs_obj_tList_struct *next;
+ struct yaffs_obj_list_struct *next;
};
-typedef struct yaffs_obj_tList_struct yaffs_obj_tList;
+typedef struct yaffs_obj_list_struct yaffs_obj_list;
struct yaffs_AllocatorStruct {
@@ -92,7 +92,7 @@ struct yaffs_AllocatorStruct {
yaffs_obj_t *freeObjects;
int nFreeObjects;
- yaffs_obj_tList *allocatedObjectList;
+ yaffs_obj_list *allocated_list;
};
typedef struct yaffs_AllocatorStruct yaffs_Allocator;
@@ -252,7 +252,7 @@ static void yaffs_init_raw_objs(yaffs_dev_t *dev)
yaffs_Allocator *allocator = dev->allocator;
if(allocator) {
- allocator->allocatedObjectList = NULL;
+ allocator->allocated_list = NULL;
allocator->freeObjects = NULL;
allocator->nFreeObjects = 0;
} else
@@ -262,19 +262,19 @@ static void yaffs_init_raw_objs(yaffs_dev_t *dev)
static void yaffs_deinit_raw_objs(yaffs_dev_t *dev)
{
yaffs_Allocator *allocator = dev->allocator;
- yaffs_obj_tList *tmp;
+ yaffs_obj_list *tmp;
if(!allocator){
YBUG();
return;
}
- while (allocator->allocatedObjectList) {
- tmp = allocator->allocatedObjectList->next;
- YFREE(allocator->allocatedObjectList->objects);
- YFREE(allocator->allocatedObjectList);
+ while (allocator->allocated_list) {
+ tmp = allocator->allocated_list->next;
+ YFREE(allocator->allocated_list->objects);
+ YFREE(allocator->allocated_list);
- allocator->allocatedObjectList = tmp;
+ allocator->allocated_list = tmp;
}
allocator->freeObjects = NULL;
@@ -289,7 +289,7 @@ static int yaffs_create_free_objs(yaffs_dev_t *dev, int n_obj)
int i;
yaffs_obj_t *newObjects;
- yaffs_obj_tList *list;
+ yaffs_obj_list *list;
if(!allocator){
YBUG();
@@ -301,7 +301,7 @@ static int yaffs_create_free_objs(yaffs_dev_t *dev, int n_obj)
/* make these things */
newObjects = YMALLOC(n_obj * sizeof(yaffs_obj_t));
- list = YMALLOC(sizeof(yaffs_obj_tList));
+ list = YMALLOC(sizeof(yaffs_obj_list));
if (!newObjects || !list) {
if (newObjects){
@@ -331,8 +331,8 @@ static int yaffs_create_free_objs(yaffs_dev_t *dev, int n_obj)
/* Now add this bunch of Objects to a list for freeing up. */
list->objects = newObjects;
- list->next = allocator->allocatedObjectList;
- allocator->allocatedObjectList = list;
+ list->next = allocator->allocated_list;
+ allocator->allocated_list = list;
return YAFFS_OK;
}
diff --git a/yaffs_bitmap.c b/yaffs_bitmap.c
index 1769e9b..85c8c1d 100644
--- a/yaffs_bitmap.c
+++ b/yaffs_bitmap.c
@@ -17,7 +17,7 @@
* Chunk bitmap manipulations
*/
-static Y_INLINE __u8 *yaffs_BlockBits(yaffs_dev_t *dev, int blk)
+static Y_INLINE __u8 *yaffs_block_bits(yaffs_dev_t *dev, int blk)
{
if (blk < dev->internal_start_block || blk > dev->internal_end_block) {
T(YAFFS_TRACE_ERROR,
@@ -42,63 +42,63 @@ void yaffs_verify_chunk_bit_id(yaffs_dev_t *dev, int blk, int chunk)
void yaffs_clear_chunk_bits(yaffs_dev_t *dev, int blk)
{
- __u8 *blkBits = yaffs_BlockBits(dev, blk);
+ __u8 *blk_bits = yaffs_block_bits(dev, blk);
- memset(blkBits, 0, dev->chunk_bit_stride);
+ memset(blk_bits, 0, dev->chunk_bit_stride);
}
void yaffs_clear_chunk_bit(yaffs_dev_t *dev, int blk, int chunk)
{
- __u8 *blkBits = yaffs_BlockBits(dev, blk);
+ __u8 *blk_bits = yaffs_block_bits(dev, blk);
yaffs_verify_chunk_bit_id(dev, blk, chunk);
- blkBits[chunk / 8] &= ~(1 << (chunk & 7));
+ blk_bits[chunk / 8] &= ~(1 << (chunk & 7));
}
void yaffs_set_chunk_bit(yaffs_dev_t *dev, int blk, int chunk)
{
- __u8 *blkBits = yaffs_BlockBits(dev, blk);
+ __u8 *blk_bits = yaffs_block_bits(dev, blk);
yaffs_verify_chunk_bit_id(dev, blk, chunk);
- blkBits[chunk / 8] |= (1 << (chunk & 7));
+ blk_bits[chunk / 8] |= (1 << (chunk & 7));
}
int yaffs_check_chunk_bit(yaffs_dev_t *dev, int blk, int chunk)
{
- __u8 *blkBits = yaffs_BlockBits(dev, blk);
+ __u8 *blk_bits = yaffs_block_bits(dev, blk);
yaffs_verify_chunk_bit_id(dev, blk, chunk);
- return (blkBits[chunk / 8] & (1 << (chunk & 7))) ? 1 : 0;
+ return (blk_bits[chunk / 8] & (1 << (chunk & 7))) ? 1 : 0;
}
int yaffs_still_some_chunks(yaffs_dev_t *dev, int blk)
{
- __u8 *blkBits = yaffs_BlockBits(dev, blk);
+ __u8 *blk_bits = yaffs_block_bits(dev, blk);
int i;
for (i = 0; i < dev->chunk_bit_stride; i++) {
- if (*blkBits)
+ if (*blk_bits)
return 1;
- blkBits++;
+ blk_bits++;
}
return 0;
}
int yaffs_count_chunk_bits(yaffs_dev_t *dev, int blk)
{
- __u8 *blkBits = yaffs_BlockBits(dev, blk);
+ __u8 *blk_bits = yaffs_block_bits(dev, blk);
int i;
int n = 0;
for (i = 0; i < dev->chunk_bit_stride; i++) {
- __u8 x = *blkBits;
+ __u8 x = *blk_bits;
while (x) {
if (x & 1)
n++;
x >>= 1;
}
- blkBits++;
+ blk_bits++;
}
return n;
}
diff --git a/yaffs_checkptrw.c b/yaffs_checkptrw.c
index d46f563..82d6874 100644
--- a/yaffs_checkptrw.c
+++ b/yaffs_checkptrw.c
@@ -16,13 +16,13 @@
static int yaffs2_checkpt_space_ok(yaffs_dev_t *dev)
{
- int blocksAvailable = dev->n_erased_blocks - dev->param.n_reserved_blocks;
+ int blocks_avail = dev->n_erased_blocks - dev->param.n_reserved_blocks;
T(YAFFS_TRACE_CHECKPOINT,
(TSTR("checkpt blocks available = %d" TENDSTR),
- blocksAvailable));
+ blocks_avail));
- return (blocksAvailable <= 0) ? 0 : 1;
+ return (blocks_avail <= 0) ? 0 : 1;
}
@@ -62,14 +62,14 @@ static int yaffs_checkpt_erase(yaffs_dev_t *dev)
static void yaffs2_checkpt_find_erased_block(yaffs_dev_t *dev)
{
int i;
- int blocksAvailable = dev->n_erased_blocks - dev->param.n_reserved_blocks;
+ int blocks_avail = dev->n_erased_blocks - dev->param.n_reserved_blocks;
T(YAFFS_TRACE_CHECKPOINT,
(TSTR("allocating checkpt block: erased %d reserved %d avail %d next %d "TENDSTR),
- dev->n_erased_blocks, dev->param.n_reserved_blocks, blocksAvailable, dev->checkpt_next_block));
+ dev->n_erased_blocks, dev->param.n_reserved_blocks, blocks_avail, dev->checkpt_next_block));
if (dev->checkpt_next_block >= 0 &&
dev->checkpt_next_block <= dev->internal_end_block &&
- blocksAvailable > 0) {
+ 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);
@@ -98,9 +98,9 @@ static void yaffs2_checkpt_find_block(yaffs_dev_t *dev)
if (dev->blocks_in_checkpt < dev->checkpt_max_blocks)
for (i = dev->checkpt_next_block; i <= dev->internal_end_block; i++) {
int chunk = i * dev->param.chunks_per_block;
- int realignedChunk = chunk - dev->chunk_offset;
+ int realigned_chunk = chunk - dev->chunk_offset;
- dev->param.read_chunk_tags_fn(dev, realignedChunk,
+ dev->param.read_chunk_tags_fn(dev, realigned_chunk,
NULL, &tags);
T(YAFFS_TRACE_CHECKPOINT, (TSTR("find next checkpt block: search: block %d oid %d seq %d eccr %d" TENDSTR),
i, tags.obj_id, tags.seq_number, tags.ecc_result));
@@ -123,11 +123,11 @@ static void yaffs2_checkpt_find_block(yaffs_dev_t *dev)
}
-int yaffs2_checkpt_open(yaffs_dev_t *dev, int forWriting)
+int yaffs2_checkpt_open(yaffs_dev_t *dev, int writing)
{
- dev->checkpt_open_write = forWriting;
+ dev->checkpt_open_write = writing;
/* Got the functions we need? */
if (!dev->param.write_chunk_tags_fn ||
@@ -136,7 +136,7 @@ int yaffs2_checkpt_open(yaffs_dev_t *dev, int forWriting)
!dev->param.bad_block_fn)
return 0;
- if (forWriting && !yaffs2_checkpt_space_ok(dev))
+ if (writing && !yaffs2_checkpt_space_ok(dev))
return 0;
if (!dev->checkpt_buffer)
@@ -154,7 +154,7 @@ int yaffs2_checkpt_open(yaffs_dev_t *dev, int forWriting)
dev->checkpt_next_block = dev->internal_start_block;
/* Erase all the blocks in the checkpoint area */
- if (forWriting) {
+ if (writing) {
memset(dev->checkpt_buffer, 0, dev->data_bytes_per_chunk);
dev->checkpt_byte_offs = 0;
return yaffs_checkpt_erase(dev);
@@ -179,16 +179,16 @@ int yaffs2_checkpt_open(yaffs_dev_t *dev, int forWriting)
int yaffs2_get_checkpt_sum(yaffs_dev_t *dev, __u32 *sum)
{
- __u32 compositeSum;
- compositeSum = (dev->checkpt_sum << 8) | (dev->checkpt_xor & 0xFF);
- *sum = compositeSum;
+ __u32 composite_sum;
+ composite_sum = (dev->checkpt_sum << 8) | (dev->checkpt_xor & 0xFF);
+ *sum = composite_sum;
return 1;
}
static int yaffs2_checkpt_flush_buffer(yaffs_dev_t *dev)
{
int chunk;
- int realignedChunk;
+ int realigned_chunk;
yaffs_ext_tags tags;
@@ -219,11 +219,11 @@ static int yaffs2_checkpt_flush_buffer(yaffs_dev_t *dev)
T(YAFFS_TRACE_CHECKPOINT, (TSTR("checkpoint wite buffer nand %d(%d:%d) objid %d chId %d" TENDSTR),
chunk, dev->checkpt_cur_block, dev->checkpt_cur_chunk, tags.obj_id, tags.chunk_id));
- realignedChunk = chunk - dev->chunk_offset;
+ realigned_chunk = chunk - dev->chunk_offset;
dev->n_page_writes++;
- dev->param.write_chunk_tags_fn(dev, realignedChunk,
+ dev->param.write_chunk_tags_fn(dev, realigned_chunk,
dev->checkpt_buffer, &tags);
dev->checkpt_byte_offs = 0;
dev->checkpt_page_seq++;
@@ -244,7 +244,7 @@ int yaffs2_checkpt_wr(yaffs_dev_t *dev, const void *data, int n_bytes)
int ok = 1;
- __u8 * dataBytes = (__u8 *)data;
+ __u8 * data_bytes = (__u8 *)data;
@@ -255,13 +255,13 @@ int yaffs2_checkpt_wr(yaffs_dev_t *dev, const void *data, int n_bytes)
return -1;
while (i < n_bytes && ok) {
- dev->checkpt_buffer[dev->checkpt_byte_offs] = *dataBytes;
- dev->checkpt_sum += *dataBytes;
- dev->checkpt_xor ^= *dataBytes;
+ dev->checkpt_buffer[dev->checkpt_byte_offs] = *data_bytes;
+ dev->checkpt_sum += *data_bytes;
+ dev->checkpt_xor ^= *data_bytes;
dev->checkpt_byte_offs++;
i++;
- dataBytes++;
+ data_bytes++;
dev->checkpt_byte_count++;
@@ -281,9 +281,9 @@ int yaffs2_checkpt_rd(yaffs_dev_t *dev, void *data, int n_bytes)
int chunk;
- int realignedChunk;
+ int realigned_chunk;
- __u8 *dataBytes = (__u8 *)data;
+ __u8 *data_bytes = (__u8 *)data;
if (!dev->checkpt_buffer)
return 0;
@@ -309,14 +309,13 @@ int yaffs2_checkpt_rd(yaffs_dev_t *dev, void *data, int n_bytes)
dev->param.chunks_per_block +
dev->checkpt_cur_chunk;
- realignedChunk = chunk - dev->chunk_offset;
+ realigned_chunk = chunk - dev->chunk_offset;
dev->n_page_reads++;
/* read in the next chunk */
- /* printf("read checkpoint page %d\n",dev->checkpointPage); */
dev->param.read_chunk_tags_fn(dev,
- realignedChunk,
+ realigned_chunk,
dev->checkpt_buffer,
&tags);
@@ -335,12 +334,12 @@ int yaffs2_checkpt_rd(yaffs_dev_t *dev, void *data, int n_bytes)
}
if (ok) {
- *dataBytes = dev->checkpt_buffer[dev->checkpt_byte_offs];
- dev->checkpt_sum += *dataBytes;
- dev->checkpt_xor ^= *dataBytes;
+ *data_bytes = dev->checkpt_buffer[dev->checkpt_byte_offs];
+ dev->checkpt_sum += *data_bytes;
+ dev->checkpt_xor ^= *data_bytes;
dev->checkpt_byte_offs++;
i++;
- dataBytes++;
+ data_bytes++;
dev->checkpt_byte_count++;
}
}
diff --git a/yaffs_checkptrw.h b/yaffs_checkptrw.h
index 059ba9e..582b89c 100644
--- a/yaffs_checkptrw.h
+++ b/yaffs_checkptrw.h
@@ -18,7 +18,7 @@
#include "yaffs_guts.h"
-int yaffs2_checkpt_open(yaffs_dev_t *dev, int forWriting);
+int yaffs2_checkpt_open(yaffs_dev_t *dev, int writing);
int yaffs2_checkpt_wr(yaffs_dev_t *dev, const void *data, int n_bytes);
diff --git a/yaffs_ecc.c b/yaffs_ecc.c
index 4030908..35f8747 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_ECCOther *eccOther)
+ yaffs_ecc_other *ecc_other)
{
unsigned int i;
@@ -267,50 +267,50 @@ void yaffs_ecc_calc_other(const unsigned char *data, unsigned n_bytes,
}
- eccOther->colParity = (col_parity >> 2) & 0x3f;
- eccOther->lineParity = line_parity;
- eccOther->lineParityPrime = line_parity_prime;
+ ecc_other->col_parity = (col_parity >> 2) & 0x3f;
+ ecc_other->line_parity = line_parity;
+ ecc_other->line_parity_prime = line_parity_prime;
}
int yaffs_ecc_correct_other(unsigned char *data, unsigned n_bytes,
- yaffs_ECCOther *read_ecc,
- const yaffs_ECCOther *test_ecc)
+ yaffs_ecc_other *read_ecc,
+ const yaffs_ecc_other *test_ecc)
{
- unsigned char cDelta; /* column parity delta */
- unsigned lDelta; /* line parity delta */
- unsigned lDeltaPrime; /* line parity delta */
+ unsigned char delta_col; /* column parity delta */
+ unsigned delta_line; /* line parity delta */
+ unsigned delta_line_prime; /* line parity delta */
unsigned bit;
- cDelta = read_ecc->colParity ^ test_ecc->colParity;
- lDelta = read_ecc->lineParity ^ test_ecc->lineParity;
- lDeltaPrime = read_ecc->lineParityPrime ^ test_ecc->lineParityPrime;
+ delta_col = read_ecc->col_parity ^ test_ecc->col_parity;
+ delta_line = read_ecc->line_parity ^ test_ecc->line_parity;
+ delta_line_prime = read_ecc->line_parity_prime ^ test_ecc->line_parity_prime;
- if ((cDelta | lDelta | lDeltaPrime) == 0)
+ if ((delta_col | delta_line | delta_line_prime) == 0)
return 0; /* no error */
- if (lDelta == ~lDeltaPrime &&
- (((cDelta ^ (cDelta >> 1)) & 0x15) == 0x15)) {
+ if (delta_line == ~delta_line_prime &&
+ (((delta_col ^ (delta_col >> 1)) & 0x15) == 0x15)) {
/* Single bit (recoverable) error in data */
bit = 0;
- if (cDelta & 0x20)
+ if (delta_col & 0x20)
bit |= 0x04;
- if (cDelta & 0x08)
+ if (delta_col & 0x08)
bit |= 0x02;
- if (cDelta & 0x02)
+ if (delta_col & 0x02)
bit |= 0x01;
- if (lDelta >= n_bytes)
+ if (delta_line >= n_bytes)
return -1;
- data[lDelta] ^= (1 << bit);
+ data[delta_line] ^= (1 << bit);
return 1; /* corrected */
}
- if ((yaffs_count_bits32(lDelta) + yaffs_count_bits32(lDeltaPrime) +
- yaffs_count_bits(cDelta)) == 1) {
+ if ((yaffs_count_bits32(delta_line) + yaffs_count_bits32(delta_line_prime) +
+ yaffs_count_bits(delta_col)) == 1) {
/* Reccoverable error in ecc */
*read_ecc = *test_ecc;
diff --git a/yaffs_ecc.h b/yaffs_ecc.h
index 124e5a0..f505ab5 100644
--- a/yaffs_ecc.h
+++ b/yaffs_ecc.h
@@ -27,18 +27,18 @@
#define __YAFFS_ECC_H__
typedef struct {
- unsigned char colParity;
- unsigned lineParity;
- unsigned lineParityPrime;
-} yaffs_ECCOther;
+ 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_ECCOther *ecc);
+ yaffs_ecc_other *ecc);
int yaffs_ecc_correct_other(unsigned char *data, unsigned n_bytes,
- yaffs_ECCOther *read_ecc,
- const yaffs_ECCOther *test_ecc);
+ yaffs_ecc_other *read_ecc,
+ const yaffs_ecc_other *test_ecc);
#endif
diff --git a/yaffs_getblockinfo.h b/yaffs_getblockinfo.h
index 432441b..1c43b6c 100644
--- a/yaffs_getblockinfo.h
+++ b/yaffs_getblockinfo.h
@@ -25,7 +25,7 @@ static Y_INLINE yaffs_block_info_t *yaffs_get_block_info(yaffs_dev_t * dev, int
if (blk < dev->internal_start_block || blk > dev->internal_end_block) {
T(YAFFS_TRACE_ERROR,
(TSTR
- ("**>> yaffs: getBlockInfo block %d is not valid" TENDSTR),
+ ("**>> yaffs: get_block_info block %d is not valid" TENDSTR),
blk));
YBUG();
}
diff --git a/yaffs_guts.c b/yaffs_guts.c
index 4200ad5..eea828a 100644
--- a/yaffs_guts.c
+++ b/yaffs_guts.c
@@ -14,7 +14,6 @@
#include "yportenv.h"
#include "yaffs_trace.h"
-#include "yaffsinterface.h"
#include "yaffs_guts.h"
#include "yaffs_tagsvalidity.h"
#include "yaffs_getblockinfo.h"
@@ -45,7 +44,7 @@
/* Robustification (if it ever comes about...) */
static void yaffs_retire_block(yaffs_dev_t *dev, int flash_block);
static void yaffs_handle_chunk_wr_error(yaffs_dev_t *dev, int nand_chunk,
- int erasedOk);
+ int erased_ok);
static void yaffs_handle_chunk_wr_ok(yaffs_dev_t *dev, int nand_chunk,
const __u8 *data,
const yaffs_ext_tags *tags);
@@ -60,7 +59,7 @@ static int yaffs_obj_cache_dirty(yaffs_obj_t *obj);
static int yaffs_write_new_chunk(yaffs_dev_t *dev,
const __u8 *buffer,
yaffs_ext_tags *tags,
- int useReserve);
+ int use_reserver);
static yaffs_obj_t *yaffs_new_obj(yaffs_dev_t *dev, int number,
@@ -79,10 +78,10 @@ static int yaffs_check_chunk_erased(struct yaffs_dev_s *dev,
static int yaffs_unlink_worker(yaffs_obj_t *obj);
static int yaffs_tags_match(const yaffs_ext_tags *tags, int obj_id,
- int chunkInObject);
+ int chunk_obj);
-static int yaffs_alloc_chunk(yaffs_dev_t *dev, int useReserve,
- yaffs_block_info_t **blockUsedPtr);
+static int yaffs_alloc_chunk(yaffs_dev_t *dev, int use_reserver,
+ yaffs_block_info_t **block_ptr);
static void yaffs_check_obj_details_loaded(yaffs_obj_t *in);
@@ -98,14 +97,14 @@ static int yaffs_verify_chunk_written(yaffs_dev_t *dev,
yaffs_ext_tags *tags);
-static void yaffs_load_name_from_oh(yaffs_dev_t *dev,YCHAR *name, const YCHAR *ohName, int bufferSize);
-static void yaffs_load_oh_from_name(yaffs_dev_t *dev,YCHAR *ohName, const YCHAR *name);
+static void yaffs_load_name_from_oh(yaffs_dev_t *dev,YCHAR *name, const YCHAR *oh_name, int buff_size);
+static void yaffs_load_oh_from_name(yaffs_dev_t *dev,YCHAR *oh_name, const YCHAR *name);
/* Function to calculate chunk and offset */
-static void yaffs_addr_to_chunk(yaffs_dev_t *dev, loff_t addr, int *chunkOut,
- __u32 *offsetOut)
+static void yaffs_addr_to_chunk(yaffs_dev_t *dev, loff_t addr, int *chunk_out,
+ __u32 *offset_out)
{
int chunk;
__u32 offset;
@@ -118,16 +117,16 @@ static void yaffs_addr_to_chunk(yaffs_dev_t *dev, loff_t addr, int *chunkOut,
} else {
/* Non power-of-2 case */
- loff_t chunkBase;
+ loff_t chunk_base;
chunk /= dev->chunk_div;
- chunkBase = ((loff_t)chunk) * dev->data_bytes_per_chunk;
- offset = (__u32)(addr - chunkBase);
+ chunk_base = ((loff_t)chunk) * dev->data_bytes_per_chunk;
+ offset = (__u32)(addr - chunk_base);
}
- *chunkOut = chunk;
- *offsetOut = offset;
+ *chunk_out = chunk;
+ *offset_out = offset;
}
/* Function to return the number of shifts for a power of 2 greater than or
@@ -136,44 +135,44 @@ static void yaffs_addr_to_chunk(yaffs_dev_t *dev, loff_t addr, int *chunkOut,
* be hellishly efficient.
*/
-static __u32 ShiftsGE(__u32 x)
+static __u32 calc_shifts_ceiling(__u32 x)
{
- int extraBits;
- int nShifts;
+ int extra_bits;
+ int shifts;
- nShifts = extraBits = 0;
+ shifts = extra_bits = 0;
while (x > 1) {
if (x & 1)
- extraBits++;
+ extra_bits++;
x >>= 1;
- nShifts++;
+ shifts++;
}
- if (extraBits)
- nShifts++;
+ if (extra_bits)
+ shifts++;
- return nShifts;
+ return shifts;
}
/* Function to return the number of shifts to get a 1 in bit 0
*/
-static __u32 Shifts(__u32 x)
+static __u32 calc_shifts(__u32 x)
{
- __u32 nShifts;
+ __u32 shifts;
- nShifts = 0;
+ shifts = 0;
if (!x)
return 0;
while (!(x&1)) {
x >>= 1;
- nShifts++;
+ shifts++;
}
- return nShifts;
+ return shifts;
}
@@ -368,15 +367,15 @@ static int yaffs_verify_chunk_written(yaffs_dev_t *dev,
yaffs_ext_tags *tags)
{
int retval = YAFFS_OK;
- yaffs_ext_tags tempTags;
+ yaffs_ext_tags temp_tags;
__u8 *buffer = yaffs_get_temp_buffer(dev,__LINE__);
int result;
- result = yaffs_rd_chunk_tags_nand(dev,nand_chunk,buffer,&tempTags);
+ result = yaffs_rd_chunk_tags_nand(dev,nand_chunk,buffer,&temp_tags);
if(memcmp(buffer,data,dev->data_bytes_per_chunk) ||
- tempTags.obj_id != tags->obj_id ||
- tempTags.chunk_id != tags->chunk_id ||
- tempTags.n_bytes != tags->n_bytes)
+ temp_tags.obj_id != tags->obj_id ||
+ temp_tags.chunk_id != tags->chunk_id ||
+ temp_tags.n_bytes != tags->n_bytes)
retval = YAFFS_FAIL;
yaffs_release_temp_buffer(dev, buffer, __LINE__);
@@ -387,19 +386,19 @@ static int yaffs_verify_chunk_written(yaffs_dev_t *dev,
static int yaffs_write_new_chunk(struct yaffs_dev_s *dev,
const __u8 *data,
yaffs_ext_tags *tags,
- int useReserve)
+ int use_reserver)
{
int attempts = 0;
- int writeOk = 0;
+ int write_ok = 0;
int chunk;
yaffs2_checkpt_invalidate(dev);
do {
yaffs_block_info_t *bi = 0;
- int erasedOk = 0;
+ int erased_ok = 0;
- chunk = yaffs_alloc_chunk(dev, useReserve, &bi);
+ chunk = yaffs_alloc_chunk(dev, use_reserver, &bi);
if (chunk < 0) {
/* no space */
break;
@@ -436,8 +435,8 @@ static int yaffs_write_new_chunk(struct yaffs_dev_s *dev,
bi->skip_erased_check = 0;
if (!bi->skip_erased_check) {
- erasedOk = yaffs_check_chunk_erased(dev, chunk);
- if (erasedOk != YAFFS_OK) {
+ erased_ok = yaffs_check_chunk_erased(dev, chunk);
+ if (erased_ok != YAFFS_OK) {
T(YAFFS_TRACE_ERROR,
(TSTR("**>> yaffs chunk %d was not erased"
TENDSTR), chunk));
@@ -451,16 +450,16 @@ static int yaffs_write_new_chunk(struct yaffs_dev_s *dev,
}
}
- writeOk = yaffs_wr_chunk_tags_nand(dev, chunk,
+ write_ok = yaffs_wr_chunk_tags_nand(dev, chunk,
data, tags);
if(!bi->skip_erased_check)
- writeOk = yaffs_verify_chunk_written(dev, chunk, data, tags);
+ write_ok = yaffs_verify_chunk_written(dev, chunk, data, tags);
- if (writeOk != YAFFS_OK) {
+ if (write_ok != YAFFS_OK) {
/* Clean up aborted write, skip to next block and
* try another chunk */
- yaffs_handle_chunk_wr_error(dev, chunk, erasedOk);
+ yaffs_handle_chunk_wr_error(dev, chunk, erased_ok);
continue;
}
@@ -469,10 +468,10 @@ static int yaffs_write_new_chunk(struct yaffs_dev_s *dev,
/* Copy the data into the robustification buffer */
yaffs_handle_chunk_wr_ok(dev, chunk, data, tags);
- } while (writeOk != YAFFS_OK &&
+ } while (write_ok != YAFFS_OK &&
(yaffs_wr_attempts <= 0 || attempts <= yaffs_wr_attempts));
- if (!writeOk)
+ if (!write_ok)
chunk = -1;
if (attempts > 1) {
@@ -570,14 +569,14 @@ void yaffs_handle_chunk_error(yaffs_dev_t *dev, yaffs_block_info_t *bi)
}
static void yaffs_handle_chunk_wr_error(yaffs_dev_t *dev, int nand_chunk,
- int erasedOk)
+ 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);
yaffs_handle_chunk_error(dev, bi);
- if (erasedOk) {
+ if (erased_ok) {
/* Was an actual write failure, so mark the block for retirement */
bi->needs_retiring = 1;
T(YAFFS_TRACE_ERROR | YAFFS_TRACE_BAD_BLOCKS,
@@ -628,10 +627,10 @@ void yaffs_set_obj_name(yaffs_obj_t *obj, const YCHAR *name)
void yaffs_set_obj_name_from_oh(yaffs_obj_t *obj, const yaffs_obj_header *oh)
{
#ifdef CONFIG_YAFFS_AUTO_UNICODE
- YCHAR tmpName[YAFFS_MAX_NAME_LENGTH+1];
- memset(tmpName,0,sizeof(tmpName));
- yaffs_load_name_from_oh(obj->my_dev,tmpName,oh->name,YAFFS_MAX_NAME_LENGTH+1);
- yaffs_set_obj_name(obj,tmpName);
+ YCHAR tmp_name[YAFFS_MAX_NAME_LENGTH+1];
+ memset(tmp_name,0,sizeof(tmp_name));
+ yaffs_load_name_from_oh(obj->my_dev,tmp_name,oh->name,YAFFS_MAX_NAME_LENGTH+1);
+ yaffs_set_obj_name(obj,tmp_name);
#else
yaffs_set_obj_name(obj,oh->name);
#endif
@@ -678,29 +677,29 @@ void yaffs_load_tnode_0(yaffs_dev_t *dev, yaffs_tnode_t *tn, unsigned pos,
unsigned val)
{
__u32 *map = (__u32 *)tn;
- __u32 bitInMap;
- __u32 bitInWord;
- __u32 wordInMap;
+ __u32 bit_in_map;
+ __u32 bit_in_word;
+ __u32 word_in_map;
__u32 mask;
pos &= YAFFS_TNODES_LEVEL0_MASK;
val >>= dev->chunk_grp_bits;
- bitInMap = pos * dev->tnode_width;
- wordInMap = bitInMap / 32;
- bitInWord = bitInMap & (32 - 1);
+ bit_in_map = pos * dev->tnode_width;
+ word_in_map = bit_in_map / 32;
+ bit_in_word = bit_in_map & (32 - 1);
- mask = dev->tnode_mask << bitInWord;
+ mask = dev->tnode_mask << bit_in_word;
- map[wordInMap] &= ~mask;
- map[wordInMap] |= (mask & (val << bitInWord));
+ map[word_in_map] &= ~mask;
+ map[word_in_map] |= (mask & (val << bit_in_word));
- if (dev->tnode_width > (32 - bitInWord)) {
- bitInWord = (32 - bitInWord);
- wordInMap++;;
- mask = dev->tnode_mask >> (/*dev->tnode_width -*/ bitInWord);
- map[wordInMap] &= ~mask;
- map[wordInMap] |= (mask & (val >> bitInWord));
+ if (dev->tnode_width > (32 - bit_in_word)) {
+ bit_in_word = (32 - bit_in_word);
+ word_in_map++;;
+ mask = dev->tnode_mask >> (/*dev->tnode_width -*/ bit_in_word);
+ map[word_in_map] &= ~mask;
+ map[word_in_map] |= (mask & (val >> bit_in_word));
}
}
@@ -708,23 +707,23 @@ __u32 yaffs_get_group_base(yaffs_dev_t *dev, yaffs_tnode_t *tn,
unsigned pos)
{
__u32 *map = (__u32 *)tn;
- __u32 bitInMap;
- __u32 bitInWord;
- __u32 wordInMap;
+ __u32 bit_in_map;
+ __u32 bit_in_word;
+ __u32 word_in_map;
__u32 val;
pos &= YAFFS_TNODES_LEVEL0_MASK;
- bitInMap = pos * dev->tnode_width;
- wordInMap = bitInMap / 32;
- bitInWord = bitInMap & (32 - 1);
+ bit_in_map = pos * dev->tnode_width;
+ word_in_map = bit_in_map / 32;
+ bit_in_word = bit_in_map & (32 - 1);
- val = map[wordInMap] >> bitInWord;
+ val = map[word_in_map] >> bit_in_word;
- if (dev->tnode_width > (32 - bitInWord)) {
- bitInWord = (32 - bitInWord);
- wordInMap++;;
- val |= (map[wordInMap] << bitInWord);
+ if (dev->tnode_width > (32 - bit_in_word)) {
+ bit_in_word = (32 - bit_in_word);
+ word_in_map++;;
+ val |= (map[word_in_map] << bit_in_word);
}
val &= dev->tnode_mask;
@@ -747,7 +746,7 @@ yaffs_tnode_t *yaffs_find_tnode_0(yaffs_dev_t *dev,
{
yaffs_tnode_t *tn = file_struct->top;
__u32 i;
- int requiredTallness;
+ int required_depth;
int level = file_struct->top_level;
dev=dev;
@@ -762,13 +761,13 @@ yaffs_tnode_t *yaffs_find_tnode_0(yaffs_dev_t *dev,
/* First check we're tall enough (ie enough top_level) */
i = chunk_id >> YAFFS_TNODES_LEVEL0_BITS;
- requiredTallness = 0;
+ required_depth = 0;
while (i) {
i >>= YAFFS_TNODES_INTERNAL_BITS;
- requiredTallness++;
+ required_depth++;
}
- if (requiredTallness > file_struct->top_level)
+ if (required_depth > file_struct->top_level)
return NULL; /* Not tall enough, so we can't find it */
/* Traverse down to level 0 */
@@ -800,7 +799,7 @@ yaffs_tnode_t *yaffs_add_find_tnode_0(yaffs_dev_t *dev,
__u32 chunk_id,
yaffs_tnode_t *passed_tn)
{
- int requiredTallness;
+ int required_depth;
int i;
int l;
yaffs_tnode_t *tn;
@@ -818,16 +817,16 @@ yaffs_tnode_t *yaffs_add_find_tnode_0(yaffs_dev_t *dev,
/* First check we're tall enough (ie enough top_level) */
x = chunk_id >> YAFFS_TNODES_LEVEL0_BITS;
- requiredTallness = 0;
+ required_depth = 0;
while (x) {
x >>= YAFFS_TNODES_INTERNAL_BITS;
- requiredTallness++;
+ required_depth++;
}
- if (requiredTallness > file_struct->top_level) {
+ if (required_depth > file_struct->top_level) {
/* Not tall enough, gotta make the tree taller */
- for (i = file_struct->top_level; i < requiredTallness; i++) {
+ for (i = file_struct->top_level; i < required_depth; i++) {
tn = yaffs_get_tnode(dev);
@@ -891,28 +890,28 @@ yaffs_tnode_t *yaffs_add_find_tnode_0(yaffs_dev_t *dev,
return tn;
}
-static int yaffs_find_chunk_in_group(yaffs_dev_t *dev, int theChunk,
+static int yaffs_find_chunk_in_group(yaffs_dev_t *dev, int the_chunk,
yaffs_ext_tags *tags, int obj_id,
int inode_chunk)
{
int j;
- for (j = 0; theChunk && j < dev->chunk_grp_size; j++) {
- if (yaffs_check_chunk_bit(dev, theChunk / dev->param.chunks_per_block,
- theChunk % dev->param.chunks_per_block)) {
+ for (j = 0; the_chunk && j < dev->chunk_grp_size; j++) {
+ if (yaffs_check_chunk_bit(dev, the_chunk / dev->param.chunks_per_block,
+ the_chunk % dev->param.chunks_per_block)) {
if(dev->chunk_grp_size == 1)
- return theChunk;
+ return the_chunk;
else {
- yaffs_rd_chunk_tags_nand(dev, theChunk, NULL,
+ yaffs_rd_chunk_tags_nand(dev, the_chunk, NULL,
tags);
if (yaffs_tags_match(tags, obj_id, inode_chunk)) {
/* found it; */
- return theChunk;
+ return the_chunk;
}
}
}
- theChunk++;
+ the_chunk++;
}
return -1;
}
@@ -930,22 +929,22 @@ static int yaffs_del_worker(yaffs_obj_t *in, yaffs_tnode_t *tn, __u32 level,
{
int i;
int inode_chunk;
- int theChunk;
+ int the_chunk;
yaffs_ext_tags tags;
- int foundChunk;
+ int found_chunk;
yaffs_dev_t *dev = in->my_dev;
- int allDone = 1;
+ int all_done = 1;
if (tn) {
if (level > 0) {
- for (i = YAFFS_NTNODES_INTERNAL - 1; allDone && i >= 0;
+ for (i = YAFFS_NTNODES_INTERNAL - 1; all_done && i >= 0;
i--) {
if (tn->internal[i]) {
if (limit && (*limit) < 0) {
- allDone = 0;
+ all_done = 0;
} else {
- allDone =
+ all_done =
yaffs_del_worker(in,
tn->
internal
@@ -958,7 +957,7 @@ static int yaffs_del_worker(yaffs_obj_t *in, yaffs_tnode_t *tn, __u32 level,
+ i,
limit);
}
- if (allDone) {
+ if (all_done) {
yaffs_free_tnode(dev,
tn->
internal[i]);
@@ -966,34 +965,34 @@ static int yaffs_del_worker(yaffs_obj_t *in, yaffs_tnode_t *tn, __u32 level,
}
}
}
- return (allDone) ? 1 : 0;
+ return (all_done) ? 1 : 0;
} else if (level == 0) {
- int hitLimit = 0;
+ int hit_limit = 0;
- for (i = YAFFS_NTNODES_LEVEL0 - 1; i >= 0 && !hitLimit;
+ for (i = YAFFS_NTNODES_LEVEL0 - 1; i >= 0 && !hit_limit;
i--) {
- theChunk = yaffs_get_group_base(dev, tn, i);
- if (theChunk) {
+ the_chunk = yaffs_get_group_base(dev, tn, i);
+ if (the_chunk) {
inode_chunk = (chunk_offset <<
YAFFS_TNODES_LEVEL0_BITS) + i;
- foundChunk =
+ found_chunk =
yaffs_find_chunk_in_group(dev,
- theChunk,
+ the_chunk,
&tags,
in->obj_id,
inode_chunk);
- if (foundChunk > 0) {
+ if (found_chunk > 0) {
yaffs_chunk_del(dev,
- foundChunk, 1,
+ found_chunk, 1,
__LINE__);
in->n_data_chunks--;
if (limit) {
*limit = *limit - 1;
if (*limit <= 0)
- hitLimit = 1;
+ hit_limit = 1;
}
}
@@ -1016,17 +1015,17 @@ static int yaffs_del_worker(yaffs_obj_t *in, yaffs_tnode_t *tn, __u32 level,
static void yaffs_soft_del_chunk(yaffs_dev_t *dev, int chunk)
{
- yaffs_block_info_t *theBlock;
+ yaffs_block_info_t *the_block;
unsigned block_no;
T(YAFFS_TRACE_DELETION, (TSTR("soft delete chunk %d" TENDSTR), chunk));
block_no = chunk / dev->param.chunks_per_block;
- theBlock = yaffs_get_block_info(dev, block_no);
- if (theBlock) {
- theBlock->soft_del_pages++;
+ the_block = yaffs_get_block_info(dev, block_no);
+ if (the_block) {
+ the_block->soft_del_pages++;
dev->n_free_chunks++;
- yaffs2_update_oldest_dirty_seq(dev, block_no, theBlock);
+ yaffs2_update_oldest_dirty_seq(dev, block_no, the_block);
}
}
@@ -1040,17 +1039,17 @@ static int yaffs_soft_del_worker(yaffs_obj_t *in, yaffs_tnode_t *tn,
__u32 level, int chunk_offset)
{
int i;
- int theChunk;
- int allDone = 1;
+ int the_chunk;
+ int all_done = 1;
yaffs_dev_t *dev = in->my_dev;
if (tn) {
if (level > 0) {
- for (i = YAFFS_NTNODES_INTERNAL - 1; allDone && i >= 0;
+ for (i = YAFFS_NTNODES_INTERNAL - 1; all_done && i >= 0;
i--) {
if (tn->internal[i]) {
- allDone =
+ all_done =
yaffs_soft_del_worker(in,
tn->
internal[i],
@@ -1059,7 +1058,7 @@ static int yaffs_soft_del_worker(yaffs_obj_t *in, yaffs_tnode_t *tn,
<<
YAFFS_TNODES_INTERNAL_BITS)
+ i);
- if (allDone) {
+ if (all_done) {
yaffs_free_tnode(dev,
tn->
internal[i]);
@@ -1069,17 +1068,17 @@ static int yaffs_soft_del_worker(yaffs_obj_t *in, yaffs_tnode_t *tn,
}
}
}
- return (allDone) ? 1 : 0;
+ return (all_done) ? 1 : 0;
} else if (level == 0) {
for (i = YAFFS_NTNODES_LEVEL0 - 1; i >= 0; i--) {
- theChunk = yaffs_get_group_base(dev, tn, i);
- if (theChunk) {
+ the_chunk = yaffs_get_group_base(dev, tn, i);
+ if (the_chunk) {
/* Note this does not find the real chunk, only the chunk group.
* We make an assumption that a chunk group is not larger than
* a block.
*/
- yaffs_soft_del_chunk(dev, theChunk);
+ yaffs_soft_del_chunk(dev, the_chunk);
yaffs_load_tnode_0(dev, tn, i, 0);
}
@@ -1136,10 +1135,10 @@ static yaffs_tnode_t *yaffs_prune_worker(yaffs_dev_t *dev, yaffs_tnode_t *tn,
__u32 level, int del0)
{
int i;
- int hasData;
+ int has_data;
if (tn) {
- hasData = 0;
+ has_data = 0;
if(level > 0){
for (i = 0; i < YAFFS_NTNODES_INTERNAL; i++) {
@@ -1151,19 +1150,19 @@ static yaffs_tnode_t *yaffs_prune_worker(yaffs_dev_t *dev, yaffs_tnode_t *tn,
}
if (tn->internal[i])
- hasData++;
+ has_data++;
}
} else {
int tnode_size_u32 = dev->tnode_size/sizeof(__u32);
__u32 *map = (__u32 *)tn;
- for(i = 0; !hasData && i < tnode_size_u32; i++){
+ for(i = 0; !has_data && i < tnode_size_u32; i++){
if(map[i])
- hasData++;
+ has_data++;
}
}
- if (hasData == 0 && del0) {
+ if (has_data == 0 && del0) {
/* Free and return NULL */
yaffs_free_tnode(dev, tn);
@@ -1180,7 +1179,7 @@ static int yaffs_prune_tree(yaffs_dev_t *dev,
yaffs_file_s *file_struct)
{
int i;
- int hasData;
+ int has_data;
int done = 0;
yaffs_tnode_t *tn;
@@ -1198,13 +1197,13 @@ static int yaffs_prune_tree(yaffs_dev_t *dev,
while (file_struct->top_level && !done) {
tn = file_struct->top;
- hasData = 0;
+ has_data = 0;
for (i = 1; i < YAFFS_NTNODES_INTERNAL; i++) {
if (tn->internal[i])
- hasData++;
+ has_data++;
}
- if (!hasData) {
+ if (!has_data) {
file_struct->top = tn->internal[0];
file_struct->top_level--;
yaffs_free_tnode(dev, tn);
@@ -1248,8 +1247,8 @@ static yaffs_obj_t *yaffs_alloc_empty_obj(yaffs_dev_t *dev)
}
/* Add it to the lost and found directory.
- * NB Can't put root or lostNFound in lostNFound so
- * check if lostNFound exists first
+ * NB Can't put root or lost-n-found in lost-n-found so
+ * check if lost-n-found exists first
*/
if (dev->lost_n_found)
yaffs_add_obj_to_dir(dev->lost_n_found, obj);
@@ -1440,7 +1439,7 @@ yaffs_obj_t *yaffs_find_by_number(yaffs_dev_t *dev, __u32 number)
yaffs_obj_t *yaffs_new_obj(yaffs_dev_t *dev, int number,
yaffs_obj_type type)
{
- yaffs_obj_t *theObject=NULL;
+ yaffs_obj_t *the_obj=NULL;
yaffs_tnode_t *tn = NULL;
if (number < 0)
@@ -1452,45 +1451,45 @@ yaffs_obj_t *yaffs_new_obj(yaffs_dev_t *dev, int number,
return NULL;
}
- theObject = yaffs_alloc_empty_obj(dev);
- if (!theObject){
+ the_obj = yaffs_alloc_empty_obj(dev);
+ if (!the_obj){
if(tn)
yaffs_free_tnode(dev,tn);
return NULL;
}
- if (theObject) {
- theObject->fake = 0;
- theObject->rename_allowed = 1;
- theObject->unlink_allowed = 1;
- theObject->obj_id = number;
- yaffs_hash_obj(theObject);
- theObject->variant_type = type;
+ if (the_obj) {
+ the_obj->fake = 0;
+ the_obj->rename_allowed = 1;
+ the_obj->unlink_allowed = 1;
+ the_obj->obj_id = number;
+ yaffs_hash_obj(the_obj);
+ the_obj->variant_type = type;
#ifdef CONFIG_YAFFS_WINCE
- yfsd_win_file_time_now(theObject->win_atime);
- theObject->win_ctime[0] = theObject->win_mtime[0] =
- theObject->win_atime[0];
- theObject->win_ctime[1] = theObject->win_mtime[1] =
- theObject->win_atime[1];
+ yfsd_win_file_time_now(the_obj->win_atime);
+ the_obj->win_ctime[0] = the_obj->win_mtime[0] =
+ the_obj->win_atime[0];
+ the_obj->win_ctime[1] = the_obj->win_mtime[1] =
+ the_obj->win_atime[1];
#else
- theObject->yst_atime = theObject->yst_mtime =
- theObject->yst_ctime = Y_CURRENT_TIME;
+ the_obj->yst_atime = the_obj->yst_mtime =
+ the_obj->yst_ctime = Y_CURRENT_TIME;
#endif
switch (type) {
case YAFFS_OBJECT_TYPE_FILE:
- theObject->variant.file_variant.file_size = 0;
- theObject->variant.file_variant.scanned_size = 0;
- theObject->variant.file_variant.shrink_size = 0xFFFFFFFF; /* max __u32 */
- theObject->variant.file_variant.top_level = 0;
- theObject->variant.file_variant.top = tn;
+ the_obj->variant.file_variant.file_size = 0;
+ the_obj->variant.file_variant.scanned_size = 0;
+ the_obj->variant.file_variant.shrink_size = 0xFFFFFFFF; /* max __u32 */
+ the_obj->variant.file_variant.top_level = 0;
+ the_obj->variant.file_variant.top = tn;
break;
case YAFFS_OBJECT_TYPE_DIRECTORY:
- YINIT_LIST_HEAD(&theObject->variant.dir_variant.
+ YINIT_LIST_HEAD(&the_obj->variant.dir_variant.
children);
- YINIT_LIST_HEAD(&theObject->variant.dir_variant.
+ YINIT_LIST_HEAD(&the_obj->variant.dir_variant.
dirty);
break;
case YAFFS_OBJECT_TYPE_SYMLINK:
@@ -1504,48 +1503,48 @@ yaffs_obj_t *yaffs_new_obj(yaffs_dev_t *dev, int number,
}
}
- return theObject;
+ return the_obj;
}
yaffs_obj_t *yaffs_find_or_create_by_number(yaffs_dev_t *dev,
int number,
yaffs_obj_type type)
{
- yaffs_obj_t *theObject = NULL;
+ yaffs_obj_t *the_obj = NULL;
if (number > 0)
- theObject = yaffs_find_by_number(dev, number);
+ the_obj = yaffs_find_by_number(dev, number);
- if (!theObject)
- theObject = yaffs_new_obj(dev, number, type);
+ if (!the_obj)
+ the_obj = yaffs_new_obj(dev, number, type);
- return theObject;
+ return the_obj;
}
YCHAR *yaffs_clone_str(const YCHAR *str)
{
- YCHAR *newStr = NULL;
+ YCHAR *new_str = NULL;
int len;
if (!str)
str = _Y("");
len = yaffs_strnlen(str,YAFFS_MAX_ALIAS_LENGTH);
- newStr = YMALLOC((len + 1) * sizeof(YCHAR));
- if (newStr){
- yaffs_strncpy(newStr, str,len);
- newStr[len] = 0;
+ new_str = YMALLOC((len + 1) * sizeof(YCHAR));
+ if (new_str){
+ yaffs_strncpy(new_str, str,len);
+ new_str[len] = 0;
}
- return newStr;
+ return new_str;
}
/*
* Mknod (create) a new object.
* equiv_obj only has meaning for a hard link;
- * aliasString only has meaning for a symlink.
+ * alias_str only has meaning for a symlink.
* rdev only has meaning for devices (a subset of special objects)
*/
@@ -1556,7 +1555,7 @@ static yaffs_obj_t *yaffs_create_obj(yaffs_obj_type type,
__u32 uid,
__u32 gid,
yaffs_obj_t *equiv_obj,
- const YCHAR *aliasString, __u32 rdev)
+ const YCHAR *alias_str, __u32 rdev)
{
yaffs_obj_t *in;
YCHAR *str = NULL;
@@ -1568,7 +1567,7 @@ static yaffs_obj_t *yaffs_create_obj(yaffs_obj_type type,
return NULL;
if (type == YAFFS_OBJECT_TYPE_SYMLINK) {
- str = yaffs_clone_str(aliasString);
+ str = yaffs_clone_str(alias_str);
if (!str)
return NULL;
}
@@ -1693,10 +1692,10 @@ yaffs_obj_t *yaffs_link_obj(yaffs_obj_t *parent, const YCHAR *name,
static int yaffs_change_obj_name(yaffs_obj_t *obj, yaffs_obj_t *new_dir,
const YCHAR *new_name, int force, int shadows)
{
- int unlinkOp;
- int deleteOp;
+ int unlink_op;
+ int del_op;
- yaffs_obj_t *existingTarget;
+ yaffs_obj_t *existing_target;
if (new_dir == NULL)
new_dir = obj->parent; /* use the old directory */
@@ -1711,36 +1710,36 @@ static int yaffs_change_obj_name(yaffs_obj_t *obj, yaffs_obj_t *new_dir,
/* TODO: Do we need this different handling for YAFFS2 and YAFFS1?? */
if (obj->my_dev->param.is_yaffs2)
- unlinkOp = (new_dir == obj->my_dev->unlinked_dir);
+ unlink_op = (new_dir == obj->my_dev->unlinked_dir);
else
- unlinkOp = (new_dir == obj->my_dev->unlinked_dir
+ unlink_op = (new_dir == obj->my_dev->unlinked_dir
&& obj->variant_type == YAFFS_OBJECT_TYPE_FILE);
- deleteOp = (new_dir == obj->my_dev->del_dir);
+ del_op = (new_dir == obj->my_dev->del_dir);
- existingTarget = yaffs_find_by_name(new_dir, new_name);
+ existing_target = yaffs_find_by_name(new_dir, new_name);
/* If the object is a file going into the unlinked directory,
* then it is OK to just stuff it in since duplicate names are allowed.
* else only proceed if the new name does not exist and if we're putting
* it into a directory.
*/
- if ((unlinkOp ||
- deleteOp ||
+ if ((unlink_op ||
+ del_op ||
force ||
(shadows > 0) ||
- !existingTarget) &&
+ !existing_target) &&
new_dir->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY) {
yaffs_set_obj_name(obj, new_name);
obj->dirty = 1;
yaffs_add_obj_to_dir(new_dir, obj);
- if (unlinkOp)
+ if (unlink_op)
obj->unlinked = 1;
/* If it is a deletion then we mark it as a shrink for gc purposes. */
- if (yaffs_update_oh(obj, new_name, 0, deleteOp, shadows, NULL) >= 0)
+ if (yaffs_update_oh(obj, new_name, 0, del_op, shadows, NULL) >= 0)
return YAFFS_OK;
}
@@ -1751,7 +1750,7 @@ int yaffs_rename_obj(yaffs_obj_t *old_dir, const YCHAR *old_name,
yaffs_obj_t *new_dir, const YCHAR *new_name)
{
yaffs_obj_t *obj = NULL;
- yaffs_obj_t *existingTarget = NULL;
+ yaffs_obj_t *existing_target = NULL;
int force = 0;
int result;
yaffs_dev_t *dev;
@@ -1783,13 +1782,13 @@ int yaffs_rename_obj(yaffs_obj_t *old_dir, const YCHAR *old_name,
/* Now do the handling for an existing target, if there is one */
- existingTarget = yaffs_find_by_name(new_dir, new_name);
- if (existingTarget &&
- existingTarget->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY &&
- !ylist_empty(&existingTarget->variant.dir_variant.children)) {
+ 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)) {
/* There is a target that is a non-empty directory, so we fail */
return YAFFS_FAIL; /* EEXIST or ENOTEMPTY */
- } else if (existingTarget && existingTarget != obj) {
+ } else if (existing_target && existing_target != obj) {
/* Nuke the target first, using shadowing,
* but only if it isn't the same object.
*
@@ -1798,9 +1797,9 @@ int yaffs_rename_obj(yaffs_obj_t *old_dir, const YCHAR *old_name,
*/
dev->gc_disable=1;
yaffs_change_obj_name(obj, new_dir, new_name, force,
- existingTarget->obj_id);
- existingTarget->is_shadowed = 1;
- yaffs_unlink_obj(existingTarget);
+ existing_target->obj_id);
+ existing_target->is_shadowed = 1;
+ yaffs_unlink_obj(existing_target);
dev->gc_disable=0;
}
@@ -1819,7 +1818,7 @@ int yaffs_rename_obj(yaffs_obj_t *old_dir, const YCHAR *old_name,
static int yaffs_init_blocks(yaffs_dev_t *dev)
{
- int nBlocks = dev->internal_end_block - dev->internal_start_block + 1;
+ int n_blocks = dev->internal_end_block - dev->internal_start_block + 1;
dev->block_info = NULL;
dev->chunk_bits = NULL;
@@ -1827,9 +1826,9 @@ static int yaffs_init_blocks(yaffs_dev_t *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(nBlocks * sizeof(yaffs_block_info_t));
+ dev->block_info = YMALLOC(n_blocks * sizeof(yaffs_block_info_t));
if (!dev->block_info) {
- dev->block_info = YMALLOC_ALT(nBlocks * sizeof(yaffs_block_info_t));
+ dev->block_info = YMALLOC_ALT(n_blocks * sizeof(yaffs_block_info_t));
dev->block_info_alt = 1;
} else
dev->block_info_alt = 0;
@@ -1837,17 +1836,17 @@ static int yaffs_init_blocks(yaffs_dev_t *dev)
if (dev->block_info) {
/* Set up dynamic blockinfo stuff. */
dev->chunk_bit_stride = (dev->param.chunks_per_block + 7) / 8; /* round up bytes */
- dev->chunk_bits = YMALLOC(dev->chunk_bit_stride * nBlocks);
+ dev->chunk_bits = YMALLOC(dev->chunk_bit_stride * n_blocks);
if (!dev->chunk_bits) {
- dev->chunk_bits = YMALLOC_ALT(dev->chunk_bit_stride * nBlocks);
+ dev->chunk_bits = YMALLOC_ALT(dev->chunk_bit_stride * n_blocks);
dev->chunk_bits_alt = 1;
} else
dev->chunk_bits_alt = 0;
}
if (dev->block_info && dev->chunk_bits) {
- memset(dev->block_info, 0, nBlocks * sizeof(yaffs_block_info_t));
- memset(dev->chunk_bits, 0, dev->chunk_bit_stride * nBlocks);
+ memset(dev->block_info, 0, n_blocks * sizeof(yaffs_block_info_t));
+ memset(dev->chunk_bits, 0, dev->chunk_bit_stride * n_blocks);
return YAFFS_OK;
}
@@ -1877,7 +1876,7 @@ void yaffs_block_became_dirty(yaffs_dev_t *dev, int block_no)
{
yaffs_block_info_t *bi = yaffs_get_block_info(dev, block_no);
- int erasedOk = 0;
+ int erased_ok = 0;
/* If the block is still healthy erase it and mark as clean.
* If the block has had a data failure, then retire it.
@@ -1903,15 +1902,15 @@ void yaffs_block_became_dirty(yaffs_dev_t *dev, int block_no)
if (!bi->needs_retiring) {
yaffs2_checkpt_invalidate(dev);
- erasedOk = yaffs_erase_block(dev, block_no);
- if (!erasedOk) {
+ erased_ok = yaffs_erase_block(dev, block_no);
+ if (!erased_ok) {
dev->n_erase_failures++;
T(YAFFS_TRACE_ERROR | YAFFS_TRACE_BAD_BLOCKS,
(TSTR("**>> Erasure failed %d" TENDSTR), block_no));
}
}
- if (erasedOk &&
+ if (erased_ok &&
((yaffs_trace_mask & YAFFS_TRACE_ERASE) || !yaffs_skip_verification(dev))) {
int i;
for (i = 0; i < dev->param.chunks_per_block; i++) {
@@ -1925,7 +1924,7 @@ void yaffs_block_became_dirty(yaffs_dev_t *dev, int block_no)
}
}
- if (erasedOk) {
+ if (erased_ok) {
/* Clean it up... */
bi->block_state = YAFFS_BLOCK_STATE_EMPTY;
bi->seq_number = 0;
@@ -2003,21 +2002,21 @@ static int yaffs_find_alloc_block(yaffs_dev_t *dev)
*/
int yaffs_check_alloc_available(yaffs_dev_t *dev, int n_chunks)
{
- int reservedChunks;
- int reservedBlocks = dev->param.n_reserved_blocks;
- int checkpointBlocks;
+ int reserved_chunks;
+ int reserved_blocks = dev->param.n_reserved_blocks;
+ int checkpt_blocks;
- checkpointBlocks = yaffs_calc_checkpt_blocks_required(dev);
+ checkpt_blocks = yaffs_calc_checkpt_blocks_required(dev);
- reservedChunks = ((reservedBlocks + checkpointBlocks) * dev->param.chunks_per_block);
+ reserved_chunks = ((reserved_blocks + checkpt_blocks) * dev->param.chunks_per_block);
- return (dev->n_free_chunks > (reservedChunks + n_chunks));
+ return (dev->n_free_chunks > (reserved_chunks + n_chunks));
}
-static int yaffs_alloc_chunk(yaffs_dev_t *dev, int useReserve,
- yaffs_block_info_t **blockUsedPtr)
+static int yaffs_alloc_chunk(yaffs_dev_t *dev, int use_reserver,
+ yaffs_block_info_t **block_ptr)
{
- int retVal;
+ int ret_val;
yaffs_block_info_t *bi;
if (dev->alloc_block < 0) {
@@ -2026,7 +2025,7 @@ static int yaffs_alloc_chunk(yaffs_dev_t *dev, int useReserve,
dev->alloc_page = 0;
}
- if (!useReserve && !yaffs_check_alloc_available(dev, 1)) {
+ if (!use_reserver && !yaffs_check_alloc_available(dev, 1)) {
/* Not enough space to allocate unless we're allowed to use the reserve. */
return -1;
}
@@ -2040,7 +2039,7 @@ static int yaffs_alloc_chunk(yaffs_dev_t *dev, int useReserve,
if (dev->alloc_block >= 0) {
bi = yaffs_get_block_info(dev, dev->alloc_block);
- retVal = (dev->alloc_block * dev->param.chunks_per_block) +
+ ret_val = (dev->alloc_block * dev->param.chunks_per_block) +
dev->alloc_page;
bi->pages_in_use++;
yaffs_set_chunk_bit(dev, dev->alloc_block,
@@ -2056,10 +2055,10 @@ static int yaffs_alloc_chunk(yaffs_dev_t *dev, int useReserve,
dev->alloc_block = -1;
}
- if (blockUsedPtr)
- *blockUsedPtr = bi;
+ if (block_ptr)
+ *block_ptr = bi;
- return retVal;
+ return ret_val;
}
T(YAFFS_TRACE_ERROR,
@@ -2098,19 +2097,19 @@ void yaffs_skip_rest_of_block(yaffs_dev_t *dev)
static int yaffs_gc_block(yaffs_dev_t *dev, int block,
- int wholeBlock)
+ int whole_block)
{
- int oldChunk;
- int newChunk;
+ int old_chunk;
+ int new_chunk;
int mark_flash;
- int retVal = YAFFS_OK;
+ int ret_val = YAFFS_OK;
int i;
- int isCheckpointBlock;
- int matchingChunk;
- int maxCopies;
+ int is_checkpt_block;
+ int matching_chunk;
+ int max_copies;
- int chunksBefore = yaffs_get_erased_chunks(dev);
- int chunksAfter;
+ int chunks_before = yaffs_get_erased_chunks(dev);
+ int chunks_after;
yaffs_ext_tags tags;
@@ -2118,15 +2117,15 @@ static int yaffs_gc_block(yaffs_dev_t *dev, int block,
yaffs_obj_t *object;
- isCheckpointBlock = (bi->block_state == YAFFS_BLOCK_STATE_CHECKPOINT);
+ is_checkpt_block = (bi->block_state == YAFFS_BLOCK_STATE_CHECKPOINT);
T(YAFFS_TRACE_TRACING,
- (TSTR("Collecting block %d, in use %d, shrink %d, wholeBlock %d" TENDSTR),
+ (TSTR("Collecting block %d, in use %d, shrink %d, whole_block %d" TENDSTR),
block,
bi->pages_in_use,
bi->has_shrink_hdr,
- wholeBlock));
+ whole_block));
/*yaffs_verify_free_chunks(dev); */
@@ -2137,7 +2136,7 @@ static int yaffs_gc_block(yaffs_dev_t *dev, int block,
dev->gc_disable = 1;
- if (isCheckpointBlock ||
+ if (is_checkpt_block ||
!yaffs_still_some_chunks(dev, block)) {
T(YAFFS_TRACE_TRACING,
(TSTR
@@ -2150,26 +2149,26 @@ static int yaffs_gc_block(yaffs_dev_t *dev, int block,
yaffs_verify_blk(dev, bi, block);
- maxCopies = (wholeBlock) ? dev->param.chunks_per_block : 5;
- oldChunk = block * dev->param.chunks_per_block + dev->gc_chunk;
+ max_copies = (whole_block) ? dev->param.chunks_per_block : 5;
+ old_chunk = block * dev->param.chunks_per_block + dev->gc_chunk;
for (/* init already done */;
- retVal == YAFFS_OK &&
+ ret_val == YAFFS_OK &&
dev->gc_chunk < dev->param.chunks_per_block &&
(bi->block_state == YAFFS_BLOCK_STATE_COLLECTING) &&
- maxCopies > 0;
- dev->gc_chunk++, oldChunk++) {
+ max_copies > 0;
+ dev->gc_chunk++, old_chunk++) {
if (yaffs_check_chunk_bit(dev, block, dev->gc_chunk)) {
/* This page is in use and might need to be copied off */
- maxCopies--;
+ max_copies--;
mark_flash = 1;
yaffs_init_tags(&tags);
- yaffs_rd_chunk_tags_nand(dev, oldChunk,
+ yaffs_rd_chunk_tags_nand(dev, old_chunk,
buffer, &tags);
object =
@@ -2184,16 +2183,16 @@ static int yaffs_gc_block(yaffs_dev_t *dev, int block,
if (object && !yaffs_skip_verification(dev)) {
if (tags.chunk_id == 0)
- matchingChunk = object->hdr_chunk;
+ matching_chunk = object->hdr_chunk;
else if (object->soft_del)
- matchingChunk = oldChunk; /* Defeat the test */
+ matching_chunk = old_chunk; /* Defeat the test */
else
- matchingChunk = yaffs_find_chunk_in_file(object, tags.chunk_id, NULL);
+ matching_chunk = yaffs_find_chunk_in_file(object, tags.chunk_id, NULL);
- if (oldChunk != matchingChunk)
+ if (old_chunk != matching_chunk)
T(YAFFS_TRACE_ERROR,
(TSTR("gc: page in gc mismatch: %d %d %d %d"TENDSTR),
- oldChunk, matchingChunk, tags.obj_id, tags.chunk_id));
+ old_chunk, matching_chunk, tags.obj_id, tags.chunk_id));
}
@@ -2201,7 +2200,7 @@ static int yaffs_gc_block(yaffs_dev_t *dev, int block,
T(YAFFS_TRACE_ERROR,
(TSTR
("page %d in gc has no object: %d %d %d "
- TENDSTR), oldChunk,
+ TENDSTR), old_chunk,
tags.obj_id, tags.chunk_id, tags.n_bytes));
}
@@ -2258,7 +2257,7 @@ static int yaffs_gc_block(yaffs_dev_t *dev, int block,
/* It is an object Id,
* We need to nuke the shrinkheader flags first
* Also need to clean up shadowing.
- * We no longer want the shrinkHeader flag since its work is done
+ * We no longer want the shrink_header flag since its work is done
* and if it is left in place it will mess up scanning.
*/
@@ -2279,21 +2278,21 @@ static int yaffs_gc_block(yaffs_dev_t *dev, int block,
}
yaffs_verify_oh(object, oh, &tags, 1);
- newChunk =
+ new_chunk =
yaffs_write_new_chunk(dev,(__u8 *) oh, &tags, 1);
} else
- newChunk =
+ new_chunk =
yaffs_write_new_chunk(dev, buffer, &tags, 1);
- if (newChunk < 0) {
- retVal = YAFFS_FAIL;
+ if (new_chunk < 0) {
+ ret_val = YAFFS_FAIL;
} else {
/* Ok, now fix up the Tnodes etc. */
if (tags.chunk_id == 0) {
/* It's a header */
- object->hdr_chunk = newChunk;
+ object->hdr_chunk = new_chunk;
object->serial = tags.serial_number;
} else {
/* It's a data chunk */
@@ -2301,13 +2300,13 @@ static int yaffs_gc_block(yaffs_dev_t *dev, int block,
ok = yaffs_put_chunk_in_file
(object,
tags.chunk_id,
- newChunk, 0);
+ new_chunk, 0);
}
}
}
- if (retVal == YAFFS_OK)
- yaffs_chunk_del(dev, oldChunk, mark_flash, __LINE__);
+ if (ret_val == YAFFS_OK)
+ yaffs_chunk_del(dev, old_chunk, mark_flash, __LINE__);
}
}
@@ -2352,12 +2351,12 @@ static int yaffs_gc_block(yaffs_dev_t *dev, int block,
}
- chunksAfter = yaffs_get_erased_chunks(dev);
- if (chunksBefore >= chunksAfter) {
+ chunks_after = yaffs_get_erased_chunks(dev);
+ if (chunks_before >= chunks_after) {
T(YAFFS_TRACE_GC,
(TSTR
("gc did not increase free chunks before %d after %d"
- TENDSTR), chunksBefore, chunksAfter));
+ TENDSTR), chunks_before, chunks_after));
}
dev->gc_block = 0;
dev->gc_chunk = 0;
@@ -2366,7 +2365,7 @@ static int yaffs_gc_block(yaffs_dev_t *dev, int block,
dev->gc_disable = 0;
- return retVal;
+ return ret_val;
}
/*
@@ -2382,7 +2381,7 @@ static unsigned yaffs_find_gc_block(yaffs_dev_t *dev,
int iterations;
unsigned selected = 0;
int prioritised = 0;
- int prioritisedExists = 0;
+ int prioritised_exist = 0;
yaffs_block_info_t *bi;
int threshold;
@@ -2395,7 +2394,7 @@ static unsigned yaffs_find_gc_block(yaffs_dev_t *dev,
i++) {
if (bi->gc_prioritise) {
- prioritisedExists = 1;
+ prioritised_exist = 1;
if (bi->block_state == YAFFS_BLOCK_STATE_FULL &&
yaffs_block_ok_for_gc(dev, bi)) {
selected = i;
@@ -2411,12 +2410,12 @@ static unsigned yaffs_find_gc_block(yaffs_dev_t *dev,
* up the works. Let's gc the oldest dirty block.
*/
- if(prioritisedExists &&
+ if(prioritised_exist &&
!selected &&
dev->oldest_dirty_block > 0)
selected = dev->oldest_dirty_block;
- if (!prioritisedExists) /* None found, so we can clear this */
+ if (!prioritised_exist) /* None found, so we can clear this */
dev->has_pending_prioritised_gc = 0;
}
@@ -2427,30 +2426,30 @@ static unsigned yaffs_find_gc_block(yaffs_dev_t *dev,
*/
if (!selected){
- int pagesUsed;
- int nBlocks = dev->internal_end_block - dev->internal_start_block + 1;
+ int pages_used;
+ int n_blocks = dev->internal_end_block - dev->internal_start_block + 1;
if (aggressive){
threshold = dev->param.chunks_per_block;
- iterations = nBlocks;
+ iterations = n_blocks;
} else {
- int maxThreshold;
+ int max_threshold;
if(background)
- maxThreshold = dev->param.chunks_per_block/2;
+ max_threshold = dev->param.chunks_per_block/2;
else
- maxThreshold = dev->param.chunks_per_block/8;
+ max_threshold = dev->param.chunks_per_block/8;
- if(maxThreshold < YAFFS_GC_PASSIVE_THRESHOLD)
- maxThreshold = YAFFS_GC_PASSIVE_THRESHOLD;
+ if(max_threshold < YAFFS_GC_PASSIVE_THRESHOLD)
+ max_threshold = YAFFS_GC_PASSIVE_THRESHOLD;
threshold = background ?
(dev->gc_not_done + 2) * 2 : 0;
if(threshold <YAFFS_GC_PASSIVE_THRESHOLD)
threshold = YAFFS_GC_PASSIVE_THRESHOLD;
- if(threshold > maxThreshold)
- threshold = maxThreshold;
+ if(threshold > max_threshold)
+ threshold = max_threshold;
- iterations = nBlocks / 16 + 1;
+ iterations = n_blocks / 16 + 1;
if (iterations > 100)
iterations = 100;
}
@@ -2467,14 +2466,14 @@ static unsigned yaffs_find_gc_block(yaffs_dev_t *dev,
bi = yaffs_get_block_info(dev, dev->gc_block_finder);
- pagesUsed = bi->pages_in_use - bi->soft_del_pages;
+ pages_used = bi->pages_in_use - bi->soft_del_pages;
if (bi->block_state == YAFFS_BLOCK_STATE_FULL &&
- pagesUsed < dev->param.chunks_per_block &&
- (dev->gc_dirtiest < 1 || pagesUsed < dev->gc_pages_in_use) &&
+ pages_used < dev->param.chunks_per_block &&
+ (dev->gc_dirtiest < 1 || pages_used < dev->gc_pages_in_use) &&
yaffs_block_ok_for_gc(dev, bi)) {
dev->gc_dirtiest = dev->gc_block_finder;
- dev->gc_pages_in_use = pagesUsed;
+ dev->gc_pages_in_use = pages_used;
}
}
@@ -2542,11 +2541,11 @@ static unsigned yaffs_find_gc_block(yaffs_dev_t *dev,
static int yaffs_check_gc(yaffs_dev_t *dev, int background)
{
int aggressive = 0;
- int gcOk = YAFFS_OK;
- int maxTries = 0;
- int minErased;
- int erasedChunks;
- int checkpointBlockAdjust;
+ int gc_ok = YAFFS_OK;
+ int max_tries = 0;
+ int min_erased;
+ int erased_chunks;
+ int checkpt_block_adjust;
if(dev->param.gc_control &&
(dev->param.gc_control(dev) & 1) == 0)
@@ -2562,23 +2561,23 @@ static int yaffs_check_gc(yaffs_dev_t *dev, int background)
*/
do {
- maxTries++;
+ max_tries++;
- checkpointBlockAdjust = yaffs_calc_checkpt_blocks_required(dev);
+ checkpt_block_adjust = yaffs_calc_checkpt_blocks_required(dev);
- minErased = dev->param.n_reserved_blocks + checkpointBlockAdjust + 1;
- erasedChunks = dev->n_erased_blocks * dev->param.chunks_per_block;
+ min_erased = dev->param.n_reserved_blocks + checkpt_block_adjust + 1;
+ erased_chunks = dev->n_erased_blocks * dev->param.chunks_per_block;
/* If we need a block soon then do aggressive gc.*/
- if (dev->n_erased_blocks < minErased)
+ if (dev->n_erased_blocks < min_erased)
aggressive = 1;
else {
- if(!background && erasedChunks > (dev->n_free_chunks / 4))
+ if(!background && erased_chunks > (dev->n_free_chunks / 4))
break;
if(dev->gc_skip > 20)
dev->gc_skip = 20;
- if(erasedChunks < dev->n_free_chunks/2 ||
+ if(erased_chunks < dev->n_free_chunks/2 ||
dev->gc_skip < 1 ||
background)
aggressive = 0;
@@ -2610,23 +2609,23 @@ static int yaffs_check_gc(yaffs_dev_t *dev, int background)
T(YAFFS_TRACE_GC,
(TSTR
- ("yaffs: GC erasedBlocks %d aggressive %d" TENDSTR),
+ ("yaffs: GC n_erased_blocks %d aggressive %d" TENDSTR),
dev->n_erased_blocks, aggressive));
- gcOk = yaffs_gc_block(dev, dev->gc_block, aggressive);
+ gc_ok = yaffs_gc_block(dev, dev->gc_block, aggressive);
}
if (dev->n_erased_blocks < (dev->param.n_reserved_blocks) && dev->gc_block > 0) {
T(YAFFS_TRACE_GC,
(TSTR
- ("yaffs: GC !!!no reclaim!!! erasedBlocks %d after try %d block %d"
- TENDSTR), dev->n_erased_blocks, maxTries, dev->gc_block));
+ ("yaffs: GC !!!no reclaim!!! n_erased_blocks %d after try %d block %d"
+ TENDSTR), dev->n_erased_blocks, max_tries, dev->gc_block));
}
} while ((dev->n_erased_blocks < dev->param.n_reserved_blocks) &&
(dev->gc_block > 0) &&
- (maxTries < 2));
+ (max_tries < 2));
- return aggressive ? gcOk : YAFFS_OK;
+ return aggressive ? gc_ok : YAFFS_OK;
}
/*
@@ -2636,20 +2635,20 @@ static int yaffs_check_gc(yaffs_dev_t *dev, int background)
*/
int yaffs_bg_gc(yaffs_dev_t *dev, unsigned urgency)
{
- int erasedChunks = dev->n_erased_blocks * dev->param.chunks_per_block;
+ int erased_chunks = dev->n_erased_blocks * dev->param.chunks_per_block;
T(YAFFS_TRACE_BACKGROUND, (TSTR("Background gc %u" TENDSTR),urgency));
yaffs_check_gc(dev, 1);
- return erasedChunks > dev->n_free_chunks/2;
+ return erased_chunks > dev->n_free_chunks/2;
}
/*------------------------- TAGS --------------------------------*/
static int yaffs_tags_match(const yaffs_ext_tags *tags, int obj_id,
- int chunkInObject)
+ int chunk_obj)
{
- return (tags->chunk_id == chunkInObject &&
+ return (tags->chunk_id == chunk_obj &&
tags->obj_id == obj_id && !tags->is_deleted) ? 1 : 0;
}
@@ -2662,27 +2661,27 @@ static int yaffs_find_chunk_in_file(yaffs_obj_t *in, int inode_chunk,
{
/*Get the Tnode, then get the level 0 offset chunk offset */
yaffs_tnode_t *tn;
- int theChunk = -1;
- yaffs_ext_tags localTags;
- int retVal = -1;
+ int the_chunk = -1;
+ yaffs_ext_tags local_tags;
+ int ret_val = -1;
yaffs_dev_t *dev = in->my_dev;
if (!tags) {
/* Passed a NULL, so use our own tags space */
- tags = &localTags;
+ tags = &local_tags;
}
tn = yaffs_find_tnode_0(dev, &in->variant.file_variant, inode_chunk);
if (tn) {
- theChunk = yaffs_get_group_base(dev, tn, inode_chunk);
+ the_chunk = yaffs_get_group_base(dev, tn, inode_chunk);
- retVal =
- yaffs_find_chunk_in_group(dev, theChunk, tags, in->obj_id,
+ ret_val =
+ yaffs_find_chunk_in_group(dev, the_chunk, tags, in->obj_id,
inode_chunk);
}
- return retVal;
+ return ret_val;
}
static int yaffs_find_del_file_chunk(yaffs_obj_t *in, int inode_chunk,
@@ -2690,33 +2689,33 @@ static int yaffs_find_del_file_chunk(yaffs_obj_t *in, int inode_chunk,
{
/* Get the Tnode, then get the level 0 offset chunk offset */
yaffs_tnode_t *tn;
- int theChunk = -1;
- yaffs_ext_tags localTags;
+ int the_chunk = -1;
+ yaffs_ext_tags local_tags;
yaffs_dev_t *dev = in->my_dev;
- int retVal = -1;
+ int ret_val = -1;
if (!tags) {
/* Passed a NULL, so use our own tags space */
- tags = &localTags;
+ tags = &local_tags;
}
tn = yaffs_find_tnode_0(dev, &in->variant.file_variant, inode_chunk);
if (tn) {
- theChunk = yaffs_get_group_base(dev, tn, inode_chunk);
+ the_chunk = yaffs_get_group_base(dev, tn, inode_chunk);
- retVal =
- yaffs_find_chunk_in_group(dev, theChunk, tags, in->obj_id,
+ ret_val =
+ yaffs_find_chunk_in_group(dev, the_chunk, tags, in->obj_id,
inode_chunk);
/* Delete the entry in the filestructure (if found) */
- if (retVal != -1)
+ if (ret_val != -1)
yaffs_load_tnode_0(dev, tn, inode_chunk, 0);
}
- return retVal;
+ return ret_val;
}
@@ -2732,10 +2731,10 @@ int yaffs_put_chunk_in_file(yaffs_obj_t *in, int inode_chunk,
yaffs_tnode_t *tn;
yaffs_dev_t *dev = in->my_dev;
- int existingChunk;
- yaffs_ext_tags existingTags;
- yaffs_ext_tags newTags;
- unsigned existingSerial, newSerial;
+ int existing_cunk;
+ yaffs_ext_tags existing_tags;
+ yaffs_ext_tags new_tags;
+ unsigned existing_serial, new_serial;
if (in->variant_type != YAFFS_OBJECT_TYPE_FILE) {
/* Just ignore an attempt at putting a chunk into a non-file during scanning
@@ -2764,7 +2763,7 @@ int yaffs_put_chunk_in_file(yaffs_obj_t *in, int inode_chunk,
/* Dummy insert, bail now */
return YAFFS_OK;
- existingChunk = yaffs_get_group_base(dev, tn, inode_chunk);
+ existing_cunk = yaffs_get_group_base(dev, tn, inode_chunk);
if (in_scan != 0) {
/* If we're scanning then we need to test for duplicates
@@ -2776,7 +2775,7 @@ int yaffs_put_chunk_in_file(yaffs_obj_t *in, int inode_chunk,
* Update: For backward scanning we don't need to re-read tags so this is quite cheap.
*/
- if (existingChunk > 0) {
+ if (existing_cunk > 0) {
/* NB Right now existing chunk will not be real chunk_id if the chunk group size > 1
* thus we have to do a FindChunkInFile to get the real chunk id.
*
@@ -2791,15 +2790,15 @@ int yaffs_put_chunk_in_file(yaffs_obj_t *in, int inode_chunk,
/* Only do this for forward scanning */
yaffs_rd_chunk_tags_nand(dev,
nand_chunk,
- NULL, &newTags);
+ NULL, &new_tags);
/* Do a proper find */
- existingChunk =
+ existing_cunk =
yaffs_find_chunk_in_file(in, inode_chunk,
- &existingTags);
+ &existing_tags);
}
- if (existingChunk <= 0) {
+ if (existing_cunk <= 0) {
/*Hoosterman - how did this happen? */
T(YAFFS_TRACE_ERROR,
@@ -2814,18 +2813,18 @@ int yaffs_put_chunk_in_file(yaffs_obj_t *in, int inode_chunk,
*/
if (in_scan > 0) {
- newSerial = newTags.serial_number;
- existingSerial = existingTags.serial_number;
+ new_serial = new_tags.serial_number;
+ existing_serial = existing_tags.serial_number;
}
if ((in_scan > 0) &&
- (existingChunk <= 0 ||
- ((existingSerial + 1) & 3) == newSerial)) {
+ (existing_cunk <= 0 ||
+ ((existing_serial + 1) & 3) == new_serial)) {
/* Forward scanning.
* Use new
* Delete the old one and drop through to update the tnode
*/
- yaffs_chunk_del(dev, existingChunk, 1,
+ yaffs_chunk_del(dev, existing_cunk, 1,
__LINE__);
} else {
/* Backward scanning or we want to use the existing one
@@ -2840,7 +2839,7 @@ int yaffs_put_chunk_in_file(yaffs_obj_t *in, int inode_chunk,
}
- if (existingChunk == 0)
+ if (existing_cunk == 0)
in->n_data_chunks++;
yaffs_load_tnode_0(dev, tn, inode_chunk, nand_chunk);
@@ -2933,18 +2932,18 @@ void yaffs_chunk_del(yaffs_dev_t *dev, int chunk_id, int mark_flash, int lyn)
static int yaffs_wr_data_obj(yaffs_obj_t *in, int inode_chunk,
const __u8 *buffer, int n_bytes,
- int useReserve)
+ int use_reserve)
{
/* Find old chunk Need to do this to get serial number
* Write new one and patch into tree.
* Invalidate old tags.
*/
- int prevChunkId;
- yaffs_ext_tags prevTags;
+ int prev_chunk_id;
+ yaffs_ext_tags prev_tags;
- int newChunkId;
- yaffs_ext_tags newTags;
+ int new_chunk_id;
+ yaffs_ext_tags new_tags;
yaffs_dev_t *dev = in->my_dev;
@@ -2954,19 +2953,19 @@ static int yaffs_wr_data_obj(yaffs_obj_t *in, int inode_chunk,
* If it does not exist then put a zero into the tree. This creates
* the tnode now, rather than later when it is harder to clean up.
*/
- prevChunkId = yaffs_find_chunk_in_file(in, inode_chunk, &prevTags);
- if(prevChunkId < 1 &&
+ prev_chunk_id = yaffs_find_chunk_in_file(in, inode_chunk, &prev_tags);
+ if(prev_chunk_id < 1 &&
!yaffs_put_chunk_in_file(in, inode_chunk, 0, 0))
return 0;
/* Set up new tags */
- yaffs_init_tags(&newTags);
+ yaffs_init_tags(&new_tags);
- newTags.chunk_id = inode_chunk;
- newTags.obj_id = in->obj_id;
- newTags.serial_number =
- (prevChunkId > 0) ? prevTags.serial_number + 1 : 1;
- newTags.n_bytes = n_bytes;
+ new_tags.chunk_id = inode_chunk;
+ new_tags.obj_id = in->obj_id;
+ new_tags.serial_number =
+ (prev_chunk_id > 0) ? prev_tags.serial_number + 1 : 1;
+ new_tags.n_bytes = n_bytes;
if (n_bytes < 1 || n_bytes > dev->param.total_bytes_per_chunk) {
T(YAFFS_TRACE_ERROR,
@@ -2975,19 +2974,19 @@ static int yaffs_wr_data_obj(yaffs_obj_t *in, int inode_chunk,
}
- newChunkId =
- yaffs_write_new_chunk(dev, buffer, &newTags,
- useReserve);
+ new_chunk_id =
+ yaffs_write_new_chunk(dev, buffer, &new_tags,
+ use_reserve);
- if (newChunkId > 0) {
- yaffs_put_chunk_in_file(in, inode_chunk, newChunkId, 0);
+ if (new_chunk_id > 0) {
+ yaffs_put_chunk_in_file(in, inode_chunk, new_chunk_id, 0);
- if (prevChunkId > 0)
- yaffs_chunk_del(dev, prevChunkId, 1, __LINE__);
+ if (prev_chunk_id > 0)
+ yaffs_chunk_del(dev, prev_chunk_id, 1, __LINE__);
yaffs_verify_file_sane(in);
}
- return newChunkId;
+ return new_chunk_id;
}
@@ -3002,13 +3001,13 @@ int yaffs_update_oh(yaffs_obj_t *in, const YCHAR *name, int force,
yaffs_dev_t *dev = in->my_dev;
- int prevChunkId;
- int retVal = 0;
+ int prev_chunk_id;
+ int ret_val = 0;
int result = 0;
- int newChunkId;
- yaffs_ext_tags newTags;
- yaffs_ext_tags oldTags;
+ int new_chunk_id;
+ yaffs_ext_tags new_tags;
+ yaffs_ext_tags old_tags;
const YCHAR *alias = NULL;
__u8 *buffer = NULL;
@@ -3029,13 +3028,13 @@ int yaffs_update_oh(yaffs_obj_t *in, const YCHAR *name, int force,
buffer = yaffs_get_temp_buffer(in->my_dev, __LINE__);
oh = (yaffs_obj_header *) buffer;
- prevChunkId = in->hdr_chunk;
+ prev_chunk_id = in->hdr_chunk;
- if (prevChunkId > 0) {
- result = yaffs_rd_chunk_tags_nand(dev, prevChunkId,
- buffer, &oldTags);
+ if (prev_chunk_id > 0) {
+ result = yaffs_rd_chunk_tags_nand(dev, prev_chunk_id,
+ buffer, &old_tags);
- yaffs_verify_oh(in, oh, &oldTags, 0);
+ yaffs_verify_oh(in, oh, &old_tags, 0);
memcpy(old_name, oh->name, sizeof(oh->name));
memset(buffer, 0xFF, sizeof(yaffs_obj_header));
@@ -3069,7 +3068,7 @@ int yaffs_update_oh(yaffs_obj_t *in, const YCHAR *name, int force,
if (name && *name) {
memset(oh->name, 0, sizeof(oh->name));
yaffs_load_oh_from_name(dev,oh->name,name);
- } else if (prevChunkId > 0)
+ } else if (prev_chunk_id > 0)
memcpy(oh->name, old_name, sizeof(oh->name));
else
memset(oh->name, 0, sizeof(oh->name));
@@ -3114,35 +3113,35 @@ int yaffs_update_oh(yaffs_obj_t *in, const YCHAR *name, int force,
/* Tags */
- yaffs_init_tags(&newTags);
+ yaffs_init_tags(&new_tags);
in->serial++;
- newTags.chunk_id = 0;
- newTags.obj_id = in->obj_id;
- newTags.serial_number = in->serial;
+ new_tags.chunk_id = 0;
+ new_tags.obj_id = in->obj_id;
+ new_tags.serial_number = in->serial;
/* Add extra info for file header */
- newTags.extra_available = 1;
- newTags.extra_parent_id = oh->parent_obj_id;
- newTags.extra_length = oh->file_size;
- newTags.extra_is_shrink = oh->is_shrink;
- newTags.extra_equiv_id = oh->equiv_id;
- newTags.extra_shadows = (oh->shadows_obj > 0) ? 1 : 0;
- newTags.extra_obj_type = in->variant_type;
+ new_tags.extra_available = 1;
+ new_tags.extra_parent_id = oh->parent_obj_id;
+ new_tags.extra_length = oh->file_size;
+ new_tags.extra_is_shrink = oh->is_shrink;
+ new_tags.extra_equiv_id = oh->equiv_id;
+ new_tags.extra_shadows = (oh->shadows_obj > 0) ? 1 : 0;
+ new_tags.extra_obj_type = in->variant_type;
- yaffs_verify_oh(in, oh, &newTags, 1);
+ yaffs_verify_oh(in, oh, &new_tags, 1);
/* Create new chunk in NAND */
- newChunkId =
- yaffs_write_new_chunk(dev, buffer, &newTags,
- (prevChunkId > 0) ? 1 : 0);
+ new_chunk_id =
+ yaffs_write_new_chunk(dev, buffer, &new_tags,
+ (prev_chunk_id > 0) ? 1 : 0);
- if (newChunkId >= 0) {
+ if (new_chunk_id >= 0) {
- in->hdr_chunk = newChunkId;
+ in->hdr_chunk = new_chunk_id;
- if (prevChunkId > 0) {
- yaffs_chunk_del(dev, prevChunkId, 1,
+ if (prev_chunk_id > 0) {
+ yaffs_chunk_del(dev, prev_chunk_id, 1,
__LINE__);
}
@@ -3152,20 +3151,20 @@ int yaffs_update_oh(yaffs_obj_t *in, const YCHAR *name, int force,
/* If this was a shrink, then mark the block that the chunk lives on */
if (is_shrink) {
bi = yaffs_get_block_info(in->my_dev,
- newChunkId / in->my_dev->param.chunks_per_block);
+ new_chunk_id / in->my_dev->param.chunks_per_block);
bi->has_shrink_hdr = 1;
}
}
- retVal = newChunkId;
+ ret_val = new_chunk_id;
}
if (buffer)
yaffs_release_temp_buffer(dev, buffer, __LINE__);
- return retVal;
+ return ret_val;
}
/*------------------------ Short Operations Cache ----------------------------------------
@@ -3186,9 +3185,9 @@ static int yaffs_obj_cache_dirty(yaffs_obj_t *obj)
yaffs_dev_t *dev = obj->my_dev;
int i;
yaffs_cache_t *cache;
- int nCaches = obj->my_dev->param.n_caches;
+ int n_caches = obj->my_dev->param.n_caches;
- for (i = 0; i < nCaches; i++) {
+ for (i = 0; i < n_caches; i++) {
cache = &dev->cache[i];
if (cache->object == obj &&
cache->dirty)
@@ -3205,15 +3204,15 @@ static void yaffs_flush_file_cache(yaffs_obj_t *obj)
int lowest = -99; /* Stop compiler whining. */
int i;
yaffs_cache_t *cache;
- int chunkWritten = 0;
- int nCaches = obj->my_dev->param.n_caches;
+ int chunk_written = 0;
+ int n_caches = obj->my_dev->param.n_caches;
- if (nCaches > 0) {
+ if (n_caches > 0) {
do {
cache = NULL;
/* Find the dirty cache for this object with the lowest chunk id. */
- for (i = 0; i < nCaches; i++) {
+ for (i = 0; i < n_caches; i++) {
if (dev->cache[i].object == obj &&
dev->cache[i].dirty) {
if (!cache
@@ -3228,7 +3227,7 @@ static void yaffs_flush_file_cache(yaffs_obj_t *obj)
if (cache && !cache->locked) {
/* Write it out and free it up */
- chunkWritten =
+ chunk_written =
yaffs_wr_data_obj(cache->object,
cache->chunk_id,
cache->data,
@@ -3238,7 +3237,7 @@ static void yaffs_flush_file_cache(yaffs_obj_t *obj)
cache->object = NULL;
}
- } while (cache && chunkWritten > 0);
+ } while (cache && chunk_written > 0);
if (cache) {
/* Hoosterman, disk full while writing cache out. */
@@ -3258,7 +3257,7 @@ static void yaffs_flush_file_cache(yaffs_obj_t *obj)
void yaffs_flush_whole_cache(yaffs_dev_t *dev)
{
yaffs_obj_t *obj;
- int nCaches = dev->param.n_caches;
+ int n_caches = dev->param.n_caches;
int i;
/* Find a dirty object in the cache and flush it...
@@ -3266,7 +3265,7 @@ void yaffs_flush_whole_cache(yaffs_dev_t *dev)
*/
do {
obj = NULL;
- for (i = 0; i < nCaches && !obj; i++) {
+ for (i = 0; i < n_caches && !obj; i++) {
if (dev->cache[i].object &&
dev->cache[i].dirty)
obj = dev->cache[i].object;
@@ -3302,7 +3301,7 @@ static yaffs_cache_t *yaffs_grab_chunk_worker(yaffs_dev_t *dev)
static yaffs_cache_t *yaffs_grab_chunk_cache(yaffs_dev_t *dev)
{
yaffs_cache_t *cache;
- yaffs_obj_t *theObj;
+ yaffs_obj_t *the_obj;
int usage;
int i;
int pushout;
@@ -3321,7 +3320,7 @@ static yaffs_cache_t *yaffs_grab_chunk_cache(yaffs_dev_t *dev)
/* With locking we can't assume we can use entry zero */
- theObj = NULL;
+ the_obj = NULL;
usage = -1;
cache = NULL;
pushout = -1;
@@ -3331,7 +3330,7 @@ static yaffs_cache_t *yaffs_grab_chunk_cache(yaffs_dev_t *dev)
!dev->cache[i].locked &&
(dev->cache[i].last_use < usage || !cache)) {
usage = dev->cache[i].last_use;
- theObj = dev->cache[i].object;
+ the_obj = dev->cache[i].object;
cache = &dev->cache[i];
pushout = i;
}
@@ -3339,7 +3338,7 @@ static yaffs_cache_t *yaffs_grab_chunk_cache(yaffs_dev_t *dev)
if (!cache || cache->dirty) {
/* Flush and try again */
- yaffs_flush_file_cache(theObj);
+ yaffs_flush_file_cache(the_obj);
cache = yaffs_grab_chunk_worker(dev);
}
@@ -3371,7 +3370,7 @@ static yaffs_cache_t *yaffs_find_chunk_cache(const yaffs_obj_t *obj,
/* Mark the chunk for the least recently used algorithym */
static void yaffs_use_cache(yaffs_dev_t *dev, yaffs_cache_t *cache,
- int isAWrite)
+ int is_write)
{
if (dev->param.n_caches > 0) {
@@ -3388,7 +3387,7 @@ static void yaffs_use_cache(yaffs_dev_t *dev, yaffs_cache_t *cache,
cache->last_use = dev->cache_last_use;
- if (isAWrite)
+ if (is_write)
cache->dirty = 1;
}
}
@@ -3441,9 +3440,9 @@ int yaffs_file_rd(yaffs_obj_t *in, __u8 *buffer, loff_t offset,
int chunk;
__u32 start;
- int nToCopy;
+ int n_copy;
int n = n_bytes;
- int nDone = 0;
+ int n_done = 0;
yaffs_cache_t *cache;
yaffs_dev_t *dev;
@@ -3460,9 +3459,9 @@ int yaffs_file_rd(yaffs_obj_t *in, __u8 *buffer, loff_t offset,
* the same chunk.
*/
if ((start + n) < dev->data_bytes_per_chunk)
- nToCopy = n;
+ n_copy = n;
else
- nToCopy = dev->data_bytes_per_chunk - start;
+ n_copy = dev->data_bytes_per_chunk - start;
cache = yaffs_find_chunk_cache(in, chunk);
@@ -3470,7 +3469,7 @@ int yaffs_file_rd(yaffs_obj_t *in, __u8 *buffer, loff_t offset,
* or we're using inband tags then use the cache (if there is caching)
* else bypass the cache.
*/
- if (cache || nToCopy != dev->data_bytes_per_chunk || dev->param.inband_tags) {
+ if (cache || n_copy != dev->data_bytes_per_chunk || dev->param.inband_tags) {
if (dev->param.n_caches > 0) {
/* If we can't find the data in the cache, then load it up. */
@@ -3492,21 +3491,21 @@ int yaffs_file_rd(yaffs_obj_t *in, __u8 *buffer, loff_t offset,
cache->locked = 1;
- memcpy(buffer, &cache->data[start], nToCopy);
+ memcpy(buffer, &cache->data[start], n_copy);
cache->locked = 0;
} else {
/* Read into the local buffer then copy..*/
- __u8 *localBuffer =
+ __u8 *local_buffer =
yaffs_get_temp_buffer(dev, __LINE__);
yaffs_rd_data_obj(in, chunk,
- localBuffer);
+ local_buffer);
- memcpy(buffer, &localBuffer[start], nToCopy);
+ memcpy(buffer, &local_buffer[start], n_copy);
- yaffs_release_temp_buffer(dev, localBuffer,
+ yaffs_release_temp_buffer(dev, local_buffer,
__LINE__);
}
@@ -3517,14 +3516,14 @@ int yaffs_file_rd(yaffs_obj_t *in, __u8 *buffer, loff_t offset,
}
- n -= nToCopy;
- offset += nToCopy;
- buffer += nToCopy;
- nDone += nToCopy;
+ n -= n_copy;
+ offset += n_copy;
+ buffer += n_copy;
+ n_done += n_copy;
}
- return nDone;
+ return n_done;
}
int yaffs_do_file_wr(yaffs_obj_t *in, const __u8 *buffer, loff_t offset,
@@ -3533,20 +3532,20 @@ int yaffs_do_file_wr(yaffs_obj_t *in, const __u8 *buffer, loff_t offset,
int chunk;
__u32 start;
- int nToCopy;
+ int n_copy;
int n = n_bytes;
- int nDone = 0;
- int nToWriteBack;
- int startOfWrite = offset;
- int chunkWritten = 0;
- __u32 n_bytesRead;
- __u32 chunkStart;
+ int n_done = 0;
+ int n_writeback;
+ int start_write = offset;
+ int chunk_written = 0;
+ __u32 n_bytes_read;
+ __u32 chunk_start;
yaffs_dev_t *dev;
dev = in->my_dev;
- while (n > 0 && chunkWritten >= 0) {
+ while (n > 0 && chunk_written >= 0) {
yaffs_addr_to_chunk(dev, offset, &chunk, &start);
if (chunk * dev->data_bytes_per_chunk + start != offset ||
@@ -3563,36 +3562,36 @@ int yaffs_do_file_wr(yaffs_obj_t *in, const __u8 *buffer, loff_t offset,
*/
if ((start + n) < dev->data_bytes_per_chunk) {
- nToCopy = n;
+ n_copy = n;
/* Now folks, to calculate how many bytes to write back....
* If we're overwriting and not writing to then end of file then
* we need to write back as much as was there before.
*/
- chunkStart = ((chunk - 1) * dev->data_bytes_per_chunk);
+ chunk_start = ((chunk - 1) * dev->data_bytes_per_chunk);
- if (chunkStart > in->variant.file_variant.file_size)
- n_bytesRead = 0; /* Past end of file */
+ if (chunk_start > in->variant.file_variant.file_size)
+ n_bytes_read = 0; /* Past end of file */
else
- n_bytesRead = in->variant.file_variant.file_size - chunkStart;
+ n_bytes_read = in->variant.file_variant.file_size - chunk_start;
- if (n_bytesRead > dev->data_bytes_per_chunk)
- n_bytesRead = dev->data_bytes_per_chunk;
+ if (n_bytes_read > dev->data_bytes_per_chunk)
+ n_bytes_read = dev->data_bytes_per_chunk;
- nToWriteBack =
- (n_bytesRead >
- (start + n)) ? n_bytesRead : (start + n);
+ n_writeback =
+ (n_bytes_read >
+ (start + n)) ? n_bytes_read : (start + n);
- if (nToWriteBack < 0 || nToWriteBack > dev->data_bytes_per_chunk)
+ if (n_writeback < 0 || n_writeback > dev->data_bytes_per_chunk)
YBUG();
} else {
- nToCopy = dev->data_bytes_per_chunk - start;
- nToWriteBack = dev->data_bytes_per_chunk;
+ n_copy = dev->data_bytes_per_chunk - start;
+ n_writeback = dev->data_bytes_per_chunk;
}
- if (nToCopy != dev->data_bytes_per_chunk || dev->param.inband_tags) {
+ if (n_copy != dev->data_bytes_per_chunk || dev->param.inband_tags) {
/* An incomplete start or end chunk (or maybe both start and end chunk),
* or we're using inband tags, so we want to use the cache buffers.
*/
@@ -3625,14 +3624,14 @@ int yaffs_do_file_wr(yaffs_obj_t *in, const __u8 *buffer, loff_t offset,
memcpy(&cache->data[start], buffer,
- nToCopy);
+ n_copy);
cache->locked = 0;
- cache->n_bytes = nToWriteBack;
+ cache->n_bytes = n_writeback;
if (write_trhrough) {
- chunkWritten =
+ chunk_written =
yaffs_wr_data_obj
(cache->object,
cache->chunk_id,
@@ -3642,30 +3641,30 @@ int yaffs_do_file_wr(yaffs_obj_t *in, const __u8 *buffer, loff_t offset,
}
} else {
- chunkWritten = -1; /* fail the write */
+ chunk_written = -1; /* fail the write */
}
} else {
/* An incomplete start or end chunk (or maybe both start and end chunk)
* Read into the local buffer then copy, then copy over and write back.
*/
- __u8 *localBuffer =
+ __u8 *local_buffer =
yaffs_get_temp_buffer(dev, __LINE__);
yaffs_rd_data_obj(in, chunk,
- localBuffer);
+ local_buffer);
- memcpy(&localBuffer[start], buffer, nToCopy);
+ memcpy(&local_buffer[start], buffer, n_copy);
- chunkWritten =
+ chunk_written =
yaffs_wr_data_obj(in, chunk,
- localBuffer,
- nToWriteBack,
+ local_buffer,
+ n_writeback,
0);
- yaffs_release_temp_buffer(dev, localBuffer,
+ yaffs_release_temp_buffer(dev, local_buffer,
__LINE__);
}
@@ -3675,7 +3674,7 @@ int yaffs_do_file_wr(yaffs_obj_t *in, const __u8 *buffer, loff_t offset,
- chunkWritten =
+ chunk_written =
yaffs_wr_data_obj(in, chunk, buffer,
dev->data_bytes_per_chunk,
0);
@@ -3684,23 +3683,23 @@ int yaffs_do_file_wr(yaffs_obj_t *in, const __u8 *buffer, loff_t offset,
yaffs_invalidate_chunk_cache(in, chunk);
}
- if (chunkWritten >= 0) {
- n -= nToCopy;
- offset += nToCopy;
- buffer += nToCopy;
- nDone += nToCopy;
+ if (chunk_written >= 0) {
+ n -= n_copy;
+ offset += n_copy;
+ buffer += n_copy;
+ n_done += n_copy;
}
}
/* Update file object */
- if ((startOfWrite + nDone) > in->variant.file_variant.file_size)
- in->variant.file_variant.file_size = (startOfWrite + nDone);
+ if ((start_write + n_done) > in->variant.file_variant.file_size)
+ in->variant.file_variant.file_size = (start_write + n_done);
in->dirty = 1;
- return nDone;
+ return n_done;
}
int yaffs_wr_file(yaffs_obj_t *in, const __u8 *buffer, loff_t offset,
@@ -3718,11 +3717,11 @@ static void yaffs_prune_chunks(yaffs_obj_t *in, int new_size)
{
yaffs_dev_t *dev = in->my_dev;
- int oldFileSize = in->variant.file_variant.file_size;
+ int old_size = in->variant.file_variant.file_size;
- int lastDel = 1 + (oldFileSize - 1) / dev->data_bytes_per_chunk;
+ int last_del = 1 + (old_size - 1) / dev->data_bytes_per_chunk;
- int startDel = 1 + (new_size + dev->data_bytes_per_chunk - 1) /
+ int start_del = 1 + (new_size + dev->data_bytes_per_chunk - 1) /
dev->data_bytes_per_chunk;
int i;
int chunk_id;
@@ -3730,7 +3729,7 @@ static void yaffs_prune_chunks(yaffs_obj_t *in, int new_size)
/* Delete backwards so that we don't end up with holes if
* power is lost part-way through the operation.
*/
- for (i = lastDel; i >= startDel; i--) {
+ for (i = last_del; i >= start_del; i--) {
/* NB this could be optimised somewhat,
* eg. could retrieve the tags and write them without
* using yaffs_chunk_del
@@ -3758,27 +3757,27 @@ static void yaffs_prune_chunks(yaffs_obj_t *in, int new_size)
void yaffs_resize_file_down( yaffs_obj_t *obj, loff_t new_size)
{
- int newFullChunks;
- __u32 new_sizeOfPartialChunk;
+ int new_full;
+ __u32 new_partial;
yaffs_dev_t *dev = obj->my_dev;
- yaffs_addr_to_chunk(dev, new_size, &newFullChunks, &new_sizeOfPartialChunk);
+ yaffs_addr_to_chunk(dev, new_size, &new_full, &new_partial);
yaffs_prune_chunks(obj, new_size);
- if (new_sizeOfPartialChunk != 0) {
- int lastChunk = 1 + newFullChunks;
- __u8 *localBuffer = yaffs_get_temp_buffer(dev, __LINE__);
+ if (new_partial != 0) {
+ int last_chunk = 1 + new_full;
+ __u8 *local_buffer = yaffs_get_temp_buffer(dev, __LINE__);
/* Got to read and rewrite the last chunk with its new size and zero pad */
- yaffs_rd_data_obj(obj, lastChunk, localBuffer);
- memset(localBuffer + new_sizeOfPartialChunk, 0,
- dev->data_bytes_per_chunk - new_sizeOfPartialChunk);
+ yaffs_rd_data_obj(obj, last_chunk, local_buffer);
+ memset(local_buffer + new_partial, 0,
+ dev->data_bytes_per_chunk - new_partial);
- yaffs_wr_data_obj(obj, lastChunk, localBuffer,
- new_sizeOfPartialChunk, 1);
+ yaffs_wr_data_obj(obj, last_chunk, local_buffer,
+ new_partial, 1);
- yaffs_release_temp_buffer(dev, localBuffer, __LINE__);
+ yaffs_release_temp_buffer(dev, local_buffer, __LINE__);
}
obj->variant.file_variant.file_size = new_size;
@@ -3790,7 +3789,7 @@ void yaffs_resize_file_down( yaffs_obj_t *obj, loff_t new_size)
int yaffs_resize_file(yaffs_obj_t *in, loff_t new_size)
{
yaffs_dev_t *dev = in->my_dev;
- int oldFileSize = in->variant.file_variant.file_size;
+ int old_size = in->variant.file_variant.file_size;
yaffs_flush_file_cache(in);
yaffs_invalidate_whole_cache(in);
@@ -3800,14 +3799,14 @@ int yaffs_resize_file(yaffs_obj_t *in, loff_t new_size)
if (in->variant_type != YAFFS_OBJECT_TYPE_FILE)
return YAFFS_FAIL;
- if (new_size == oldFileSize)
+ if (new_size == old_size)
return YAFFS_OK;
- if(new_size > oldFileSize){
+ if(new_size > old_size){
yaffs2_handle_hole(in,new_size);
in->variant.file_variant.file_size = new_size;
} else {
- /* new_size < oldFileSize */
+ /* new_size < old_size */
yaffs_resize_file_down(in, new_size);
}
@@ -3848,11 +3847,11 @@ loff_t yaffs_get_file_size(yaffs_obj_t *obj)
int yaffs_flush_file(yaffs_obj_t *in, int update_time, int data_sync)
{
- int retVal;
+ int ret_val;
if (in->dirty) {
yaffs_flush_file_cache(in);
if(data_sync) /* Only sync data */
- retVal=YAFFS_OK;
+ ret_val=YAFFS_OK;
else {
if (update_time) {
#ifdef CONFIG_YAFFS_WINCE
@@ -3864,14 +3863,14 @@ int yaffs_flush_file(yaffs_obj_t *in, int update_time, int data_sync)
#endif
}
- retVal = (yaffs_update_oh(in, NULL, 0, 0, 0, NULL) >=
+ ret_val = (yaffs_update_oh(in, NULL, 0, 0, 0, NULL) >=
0) ? YAFFS_OK : YAFFS_FAIL;
}
} else {
- retVal = YAFFS_OK;
+ ret_val = YAFFS_OK;
}
- return retVal;
+ return ret_val;
}
@@ -3903,15 +3902,15 @@ static int yaffs_generic_obj_del(yaffs_obj_t *in)
static int yaffs_unlink_file_if_needed(yaffs_obj_t *in)
{
- int retVal;
- int immediateDeletion = 0;
+ int ret_val;
+ int del_now = 0;
yaffs_dev_t *dev = in->my_dev;
if (!in->my_inode)
- immediateDeletion = 1;
+ del_now = 1;
- if (immediateDeletion) {
- retVal =
+ if (del_now) {
+ ret_val =
yaffs_change_obj_name(in, in->my_dev->del_dir,
_Y("deleted"), 0, 0);
T(YAFFS_TRACE_TRACING,
@@ -3923,18 +3922,18 @@ static int yaffs_unlink_file_if_needed(yaffs_obj_t *in)
yaffs_resize_file(in, 0);
yaffs_soft_del_file(in);
} else {
- retVal =
+ ret_val =
yaffs_change_obj_name(in, in->my_dev->unlinked_dir,
_Y("unlinked"), 0, 0);
}
- return retVal;
+ return ret_val;
}
int yaffs_del_file(yaffs_obj_t *in)
{
- int retVal = YAFFS_OK;
+ int ret_val = YAFFS_OK;
int deleted; /* Need to cache value on stack if in is freed */
yaffs_dev_t *dev = in->my_dev;
@@ -3946,11 +3945,11 @@ int yaffs_del_file(yaffs_obj_t *in)
* That won't be the case if it has been resized to zero.
*/
if (!in->unlinked)
- retVal = yaffs_unlink_file_if_needed(in);
+ ret_val = yaffs_unlink_file_if_needed(in);
deleted = in->deleted;
- if (retVal == YAFFS_OK && in->unlinked && !in->deleted) {
+ if (ret_val == YAFFS_OK && in->unlinked && !in->deleted) {
in->deleted = 1;
deleted = 1;
in->my_dev->n_deleted_files++;
@@ -4002,10 +4001,10 @@ static int yaffs_del_link(yaffs_obj_t *in)
int yaffs_del_obj(yaffs_obj_t *obj)
{
-int retVal = -1;
+int ret_val = -1;
switch (obj->variant_type) {
case YAFFS_OBJECT_TYPE_FILE:
- retVal = yaffs_del_file(obj);
+ ret_val = yaffs_del_file(obj);
break;
case YAFFS_OBJECT_TYPE_DIRECTORY:
if(!ylist_empty(&obj->variant.dir_variant.dirty)){
@@ -4015,29 +4014,29 @@ int retVal = -1;
return yaffs_del_dir(obj);
break;
case YAFFS_OBJECT_TYPE_SYMLINK:
- retVal = yaffs_del_symlink(obj);
+ ret_val = yaffs_del_symlink(obj);
break;
case YAFFS_OBJECT_TYPE_HARDLINK:
- retVal = yaffs_del_link(obj);
+ ret_val = yaffs_del_link(obj);
break;
case YAFFS_OBJECT_TYPE_SPECIAL:
- retVal = yaffs_generic_obj_del(obj);
+ ret_val = yaffs_generic_obj_del(obj);
break;
case YAFFS_OBJECT_TYPE_UNKNOWN:
- retVal = 0;
+ ret_val = 0;
break; /* should not happen. */
}
- return retVal;
+ return ret_val;
}
static int yaffs_unlink_worker(yaffs_obj_t *obj)
{
- int immediateDeletion = 0;
+ int del_now = 0;
if (!obj->my_inode)
- immediateDeletion = 1;
+ del_now = 1;
if(obj)
yaffs_update_parent(obj->parent);
@@ -4061,7 +4060,7 @@ static int yaffs_unlink_worker(yaffs_obj_t *obj)
yaffs_obj_t *hl;
yaffs_obj_t *parent;
- int retVal;
+ int ret_val;
YCHAR name[YAFFS_MAX_NAME_LENGTH + 1];
hl = ylist_entry(obj->hard_links.next, yaffs_obj_t, hard_links);
@@ -4073,14 +4072,14 @@ static int yaffs_unlink_worker(yaffs_obj_t *obj)
yaffs_add_obj_to_dir(obj->my_dev->unlinked_dir, hl);
- retVal = yaffs_change_obj_name(obj,parent, name, 0, 0);
+ ret_val = yaffs_change_obj_name(obj,parent, name, 0, 0);
- if (retVal == YAFFS_OK)
- retVal = yaffs_generic_obj_del(hl);
+ if (ret_val == YAFFS_OK)
+ ret_val = yaffs_generic_obj_del(hl);
- return retVal;
+ return ret_val;
- } else if (immediateDeletion) {
+ } else if (del_now) {
switch (obj->variant_type) {
case YAFFS_OBJECT_TYPE_FILE:
return yaffs_del_file(obj);
@@ -4233,7 +4232,7 @@ static void yaffs_strip_deleted_objs(yaffs_dev_t *dev)
* This code assumes that we don't ever change the current relationships between
* directories:
* root_dir->parent == unlinked_dir->parent == del_dir->parent == NULL
- * lostNfound->parent == root_dir
+ * lost-n-found->parent == root_dir
*
* This fixes the problem where directories might have inadvertently been deleted
* leaving the object "hanging" without being rooted in the directory tree.
@@ -4253,7 +4252,7 @@ static void yaffs_fix_hanging_objs(yaffs_dev_t *dev)
int i;
struct ylist_head *lh;
struct ylist_head *n;
- int depthLimit;
+ int depth_limit;
int hanging;
if (dev->read_only)
@@ -4283,14 +4282,14 @@ static void yaffs_fix_hanging_objs(yaffs_dev_t *dev)
* Need to follow the parent chain to see if it is hanging.
*/
hanging = 0;
- depthLimit=100;
+ depth_limit=100;
while(parent != dev->root_dir &&
parent->parent &&
parent->parent->variant_type == YAFFS_OBJECT_TYPE_DIRECTORY &&
- depthLimit > 0){
+ depth_limit > 0){
parent = parent->parent;
- depthLimit--;
+ depth_limit--;
}
if(parent != dev->root_dir)
hanging = 1;
@@ -4345,7 +4344,7 @@ static void yaffs_empty_l_n_f(yaffs_dev_t *dev)
static void yaffs_check_obj_details_loaded(yaffs_obj_t *in)
{
- __u8 *chunkData;
+ __u8 *chunk_data;
yaffs_obj_header *oh;
yaffs_dev_t *dev;
yaffs_ext_tags tags;
@@ -4365,10 +4364,10 @@ static void yaffs_check_obj_details_loaded(yaffs_obj_t *in)
if (in->lazy_loaded && in->hdr_chunk > 0) {
in->lazy_loaded = 0;
- chunkData = yaffs_get_temp_buffer(dev, __LINE__);
+ chunk_data = yaffs_get_temp_buffer(dev, __LINE__);
- result = yaffs_rd_chunk_tags_nand(dev, in->hdr_chunk, chunkData, &tags);
- oh = (yaffs_obj_header *) chunkData;
+ result = yaffs_rd_chunk_tags_nand(dev, in->hdr_chunk, chunk_data, &tags);
+ oh = (yaffs_obj_header *) chunk_data;
in->yst_mode = oh->yst_mode;
#ifdef CONFIG_YAFFS_WINCE
@@ -4396,7 +4395,7 @@ static void yaffs_check_obj_details_loaded(yaffs_obj_t *in)
alloc_failed = 1; /* Not returned to caller */
}
- yaffs_release_temp_buffer(dev, chunkData, __LINE__);
+ yaffs_release_temp_buffer(dev, chunk_data, __LINE__);
}
}
@@ -4445,8 +4444,8 @@ void yaffs_update_dirty_dirs(yaffs_dev_t *dev)
{
struct ylist_head *link;
yaffs_obj_t *obj;
- yaffs_dir_s *dS;
- yaffs_obj_variant *oV;
+ yaffs_dir_s *d_s;
+ yaffs_obj_variant *o_v;
T(YAFFS_TRACE_BACKGROUND, (TSTR("Update dirty directories" TENDSTR)));
@@ -4454,9 +4453,9 @@ void yaffs_update_dirty_dirs(yaffs_dev_t *dev)
link = dev->dirty_dirs.next;
ylist_del_init(link);
- dS=ylist_entry(link,yaffs_dir_s,dirty);
- oV = ylist_entry(dS,yaffs_obj_variant,dir_variant);
- obj = ylist_entry(oV,yaffs_obj_t,variant);
+ d_s=ylist_entry(link,yaffs_dir_s,dirty);
+ o_v = ylist_entry(d_s,yaffs_obj_variant,dir_variant);
+ obj = ylist_entry(o_v,yaffs_obj_t,variant);
T(YAFFS_TRACE_BACKGROUND, (TSTR("Update directory %d" TENDSTR), obj->obj_id));
@@ -4662,83 +4661,83 @@ static void yaffs_fix_null_name(yaffs_obj_t * obj,YCHAR * name, int buffer_size)
{
/* Create an object name if we could not find one. */
if(yaffs_strnlen(name,YAFFS_MAX_NAME_LENGTH) == 0){
- YCHAR locName[20];
- YCHAR numString[20];
- YCHAR *x = &numString[19];
+ YCHAR local_name[20];
+ YCHAR num_string[20];
+ YCHAR *x = &num_string[19];
unsigned v = obj->obj_id;
- numString[19] = 0;
+ num_string[19] = 0;
while(v>0){
x--;
*x = '0' + (v % 10);
v /= 10;
}
/* make up a name */
- yaffs_strcpy(locName, YAFFS_LOSTNFOUND_PREFIX);
- yaffs_strcat(locName,x);
- yaffs_strncpy(name, locName, buffer_size - 1);
+ yaffs_strcpy(local_name, YAFFS_LOSTNFOUND_PREFIX);
+ yaffs_strcat(local_name,x);
+ yaffs_strncpy(name, local_name, buffer_size - 1);
}
}
-static void yaffs_load_name_from_oh(yaffs_dev_t *dev,YCHAR *name, const YCHAR *ohName, int bufferSize)
+static void yaffs_load_name_from_oh(yaffs_dev_t *dev,YCHAR *name, const YCHAR *oh_name, int buff_size)
{
#ifdef CONFIG_YAFFS_AUTO_UNICODE
if(dev->param.auto_unicode){
- if(*ohName){
+ if(*oh_name){
/* It is an ASCII name, so do an ASCII to unicode conversion */
- const char *asciiOhName = (const char *)ohName;
- int n = bufferSize - 1;
- while(n > 0 && *asciiOhName){
- *name = *asciiOhName;
+ const char *ascii_oh_name = (const char *)oh_name;
+ int n = buff_size - 1;
+ while(n > 0 && *ascii_oh_name){
+ *name = *ascii_oh_name;
name++;
- asciiOhName++;
+ ascii_oh_name++;
n--;
}
} else
- yaffs_strncpy(name,ohName+1, bufferSize -1);
+ yaffs_strncpy(name,oh_name+1, buff_size -1);
} else
#endif
- yaffs_strncpy(name, ohName, bufferSize - 1);
+ yaffs_strncpy(name, oh_name, buff_size - 1);
}
-static void yaffs_load_oh_from_name(yaffs_dev_t *dev, YCHAR *ohName, const YCHAR *name)
+static void yaffs_load_oh_from_name(yaffs_dev_t *dev, YCHAR *oh_name, const YCHAR *name)
{
#ifdef CONFIG_YAFFS_AUTO_UNICODE
- int isAscii;
+ int is_ascii;
YCHAR *w;
if(dev->param.auto_unicode){
- isAscii = 1;
+ is_ascii = 1;
w = name;
/* Figure out if the name will fit in ascii character set */
- while(isAscii && *w){
+ while(is_ascii && *w){
if((*w) & 0xff00)
- isAscii = 0;
+ is_ascii = 0;
w++;
}
- if(isAscii){
+ if(is_ascii){
/* It is an ASCII name, so do a unicode to ascii conversion */
- char *asciiOhName = (char *)ohName;
+ char *ascii_oh_name = (char *)oh_name;
int n = YAFFS_MAX_NAME_LENGTH - 1;
while(n > 0 && *name){
- *asciiOhName= *name;
+ *ascii_oh_name= *name;
name++;
- asciiOhName++;
+ ascii_oh_name++;
n--;
}
} else{
/* It is a unicode name, so save starting at the second YCHAR */
- *ohName = 0;
- yaffs_strncpy(ohName+1,name, YAFFS_MAX_NAME_LENGTH -2);
+ *oh_name = 0;
+ yaffs_strncpy(oh_name+1,name, YAFFS_MAX_NAME_LENGTH -2);
}
}
else
#endif
- yaffs_strncpy(ohName,name, YAFFS_MAX_NAME_LENGTH - 1);
+ yaffs_strncpy(oh_name,name, YAFFS_MAX_NAME_LENGTH - 1);
}
@@ -5169,7 +5168,7 @@ int yaffs_guts_initialise(yaffs_dev_t *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_PackedTags2TagsPart);
+ dev->data_bytes_per_chunk = dev->param.total_bytes_per_chunk - sizeof(yaffs_packed_tags2_tags_only);
else
dev->data_bytes_per_chunk = dev->param.total_bytes_per_chunk;
@@ -5207,7 +5206,7 @@ int yaffs_guts_initialise(yaffs_dev_t *dev)
*/
x = dev->data_bytes_per_chunk;
/* We always use dev->chunk_shift and dev->chunk_div */
- dev->chunk_shift = Shifts(x);
+ dev->chunk_shift = calc_shifts(x);
x >>= dev->chunk_shift;
dev->chunk_div = x;
/* We only use chunk mask if chunk_div is 1 */
@@ -5220,7 +5219,7 @@ int yaffs_guts_initialise(yaffs_dev_t *dev)
x = dev->param.chunks_per_block * (dev->internal_end_block + 1);
- bits = ShiftsGE(x);
+ bits = calc_shifts_ceiling(x);
/* Set up tnode width if wide tnodes are enabled. */
if (!dev->param.wide_tnodes_disabled) {
@@ -5301,17 +5300,17 @@ int yaffs_guts_initialise(yaffs_dev_t *dev)
dev->param.n_caches > 0) {
int i;
void *buf;
- int cacheBytes = dev->param.n_caches * sizeof(yaffs_cache_t);
+ int cache_bytes = dev->param.n_caches * sizeof(yaffs_cache_t);
if (dev->param.n_caches > YAFFS_MAX_SHORT_OP_CACHES)
dev->param.n_caches = YAFFS_MAX_SHORT_OP_CACHES;
- dev->cache = YMALLOC(cacheBytes);
+ dev->cache = YMALLOC(cache_bytes);
buf = (__u8 *) dev->cache;
if (dev->cache)
- memset(dev->cache, 0, cacheBytes);
+ memset(dev->cache, 0, cache_bytes);
for (i = 0; i < dev->param.n_caches && buf; i++) {
dev->cache[i].object = NULL;
@@ -5454,7 +5453,7 @@ void yaffs_deinitialise(yaffs_dev_t *dev)
int yaffs_count_free_chunks(yaffs_dev_t *dev)
{
- int nFree=0;
+ int n_free=0;
int b;
yaffs_block_info_t *blk;
@@ -5466,7 +5465,7 @@ int yaffs_count_free_chunks(yaffs_dev_t *dev)
case YAFFS_BLOCK_STATE_ALLOCATING:
case YAFFS_BLOCK_STATE_COLLECTING:
case YAFFS_BLOCK_STATE_FULL:
- nFree +=
+ n_free +=
(dev->param.chunks_per_block - blk->pages_in_use +
blk->soft_del_pages);
break;
@@ -5476,46 +5475,46 @@ int yaffs_count_free_chunks(yaffs_dev_t *dev)
blk++;
}
- return nFree;
+ return n_free;
}
int yaffs_get_n_free_chunks(yaffs_dev_t *dev)
{
/* This is what we report to the outside world */
- int nFree;
- int nDirtyCacheChunks;
- int blocksForCheckpoint;
+ int n_free;
+ int n_dirty_caches;
+ int blocks_for_checkpt;
int i;
#if 1
- nFree = dev->n_free_chunks;
+ n_free = dev->n_free_chunks;
#else
- nFree = yaffs_count_free_chunks(dev);
+ n_free = yaffs_count_free_chunks(dev);
#endif
- nFree += dev->n_deleted_files;
+ n_free += dev->n_deleted_files;
/* Now count the number of dirty chunks in the cache and subtract those */
- for (nDirtyCacheChunks = 0, i = 0; i < dev->param.n_caches; i++) {
+ for (n_dirty_caches = 0, i = 0; i < dev->param.n_caches; i++) {
if (dev->cache[i].dirty)
- nDirtyCacheChunks++;
+ n_dirty_caches++;
}
- nFree -= nDirtyCacheChunks;
+ n_free -= n_dirty_caches;
- nFree -= ((dev->param.n_reserved_blocks + 1) * dev->param.chunks_per_block);
+ n_free -= ((dev->param.n_reserved_blocks + 1) * dev->param.chunks_per_block);
/* Now we figure out how much to reserve for the checkpoint and report that... */
- blocksForCheckpoint = yaffs_calc_checkpt_blocks_required(dev);
+ blocks_for_checkpt = yaffs_calc_checkpt_blocks_required(dev);
- nFree -= (blocksForCheckpoint * dev->param.chunks_per_block);
+ n_free -= (blocks_for_checkpt * dev->param.chunks_per_block);
- if (nFree < 0)
- nFree = 0;
+ if (n_free < 0)
+ n_free = 0;
- return nFree;
+ return n_free;
}
diff --git a/yaffs_guts.h b/yaffs_guts.h
index 88075a7..2668b99 100644
--- a/yaffs_guts.h
+++ b/yaffs_guts.h
@@ -235,7 +235,7 @@ typedef enum {
YAFFS_BLOCK_STATE_NEEDS_SCANNING,
/* The block might have something on it (ie it is allocating or full, perhaps empty)
* but it needs to be scanned to determine its true state.
- * This state is only valid during yaffs_Scan.
+ * This state is only valid during scanning.
* NB We tolerate empty because the pre-scanner might be incapable of deciding
* However, if this state is returned on a YAFFS2 device, then we expect a sequence number
*/
diff --git a/yaffs_linux.h b/yaffs_linux.h
index 19d7b82..a8e3f85 100644
--- a/yaffs_linux.h
+++ b/yaffs_linux.h
@@ -19,24 +19,24 @@
#include "devextras.h"
#include "yportenv.h"
-struct yaffs_LinuxContext {
- struct ylist_head contextList; /* List of these we have mounted */
+struct yaffs_linux_context {
+ struct ylist_head context_list; /* List of these we have mounted */
struct yaffs_dev_s *dev;
- struct super_block * superBlock;
- struct task_struct *bgThread; /* Background thread for this device */
- int bgRunning;
- struct semaphore grossLock; /* Gross locking semaphore */
- __u8 *spareBuffer; /* For mtdif2 use. Don't know the size of the buffer
+ struct super_block * super;
+ struct task_struct *bg_thread; /* Background thread for this device */
+ int bg_running;
+ struct semaphore gross_lock; /* Gross locking semaphore */
+ __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 searchContexts;
- void (*putSuperFunc)(struct super_block *sb);
+ struct ylist_head search_contexts;
+ void (*put_super_fn)(struct super_block *sb);
- struct task_struct *readdirProcess;
+ struct task_struct *readdir_process;
unsigned mount_id;
};
-#define yaffs_dev_to_lc(dev) ((struct yaffs_LinuxContext *)((dev)->os_context))
+#define yaffs_dev_to_lc(dev) ((struct yaffs_linux_context *)((dev)->os_context))
#define yaffs_dev_to_mtd(dev) ((struct mtd_info *)((dev)->driver_context))
#endif
diff --git a/yaffs_list.h b/yaffs_list.h
index 09d80b8..145a1c5 100644
--- a/yaffs_list.h
+++ b/yaffs_list.h
@@ -52,27 +52,27 @@ do { \
/* Add an element to a list */
-static Y_INLINE void ylist_add(struct ylist_head *newEntry,
+static Y_INLINE void ylist_add(struct ylist_head *new_entry,
struct ylist_head *list)
{
- struct ylist_head *listNext = list->next;
+ struct ylist_head *list_next = list->next;
- list->next = newEntry;
- newEntry->prev = list;
- newEntry->next = listNext;
- listNext->prev = newEntry;
+ list->next = new_entry;
+ new_entry->prev = list;
+ new_entry->next = list_next;
+ list_next->prev = new_entry;
}
-static Y_INLINE void ylist_add_tail(struct ylist_head *newEntry,
+static Y_INLINE void ylist_add_tail(struct ylist_head *new_entry,
struct ylist_head *list)
{
- struct ylist_head *listPrev = list->prev;
+ struct ylist_head *list_prev = list->prev;
- list->prev = newEntry;
- newEntry->next = list;
- newEntry->prev = listPrev;
- listPrev->next = newEntry;
+ list->prev = new_entry;
+ new_entry->next = list;
+ new_entry->prev = list_prev;
+ list_prev->next = new_entry;
}
@@ -81,11 +81,11 @@ static Y_INLINE void ylist_add_tail(struct ylist_head *newEntry,
* reinitialising the links.of the entry*/
static Y_INLINE void ylist_del(struct ylist_head *entry)
{
- struct ylist_head *listNext = entry->next;
- struct ylist_head *listPrev = entry->prev;
+ struct ylist_head *list_next = entry->next;
+ struct ylist_head *list_prev = entry->prev;
- listNext->prev = listPrev;
- listPrev->next = listNext;
+ list_next->prev = list_prev;
+ list_prev->next = list_next;
}
@@ -119,9 +119,9 @@ static Y_INLINE int ylist_empty(struct ylist_head *entry)
#define ylist_for_each(itervar, list) \
for (itervar = (list)->next; itervar != (list); itervar = itervar->next)
-#define ylist_for_each_safe(itervar, saveVar, list) \
- for (itervar = (list)->next, saveVar = (list)->next->next; \
- itervar != (list); itervar = saveVar, saveVar = saveVar->next)
+#define ylist_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)
#endif
diff --git a/yaffs_mtdif.c b/yaffs_mtdif.c
index b2d4318..4fd8994 100644
--- a/yaffs_mtdif.c
+++ b/yaffs_mtdif.c
@@ -23,11 +23,11 @@
#include "yaffs_linux.h"
-int nandmtd_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber)
+int nandmtd_erase_block(yaffs_dev_t *dev, int block_no)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
__u32 addr =
- ((loff_t) blockNumber) * dev->param.total_bytes_per_chunk
+ ((loff_t) block_no) * dev->param.total_bytes_per_chunk
* dev->param.chunks_per_block;
struct erase_info ei;
@@ -49,7 +49,7 @@ int nandmtd_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber)
return YAFFS_FAIL;
}
-int nandmtd_InitialiseNAND(yaffs_dev_t *dev)
+int nandmtd_initialise(yaffs_dev_t *dev)
{
return YAFFS_OK;
}
diff --git a/yaffs_mtdif.h b/yaffs_mtdif.h
index 31fc383..919d354 100644
--- a/yaffs_mtdif.h
+++ b/yaffs_mtdif.h
@@ -22,6 +22,6 @@
extern struct nand_oobinfo yaffs_oobinfo;
extern struct nand_oobinfo yaffs_noeccinfo;
#endif
-int nandmtd_EraseBlockInNAND(yaffs_dev_t *dev, int blockNumber);
-int nandmtd_InitialiseNAND(yaffs_dev_t *dev);
+int nandmtd_erase_block(yaffs_dev_t *dev, int block_no);
+int nandmtd_initialise(yaffs_dev_t *dev);
#endif
diff --git a/yaffs_mtdif1.c b/yaffs_mtdif1.c
index b6d6713..6380999 100644
--- a/yaffs_mtdif1.c
+++ b/yaffs_mtdif1.c
@@ -56,7 +56,7 @@
* the 9th byte.
*
* Old-style on-NAND format: T0,T1,T2,T3,P,B,T4,T5,E0,E1,E2,T6,T7,E3,E4,E5
- * We have/need PackedTags1 plus page_status: T0,T1,T2,T3,T4,T5,T6,T7,P
+ * We have/need packed_tags1 plus page_status: T0,T1,T2,T3,T4,T5,T6,T7,P
* where Tn are the tag bytes, En are MTD's ECC bytes, P is the page_status
* byte and B is the small-page bad-block indicator byte.
*/
@@ -74,12 +74,12 @@ static struct nand_ecclayout nand_oob_16 = {
* compact (packed) form for storage in NAND. A mini-ECC runs over the
* contents of the tags meta-data; used to valid the tags when read.
*
- * - Pack ExtendedTags to PackedTags1 form
- * - Compute mini-ECC for PackedTags1
+ * - Pack ExtendedTags to packed_tags1 form
+ * - Compute mini-ECC for packed_tags1
* - Write data and packed tags to NAND.
*
- * Note: Due to the use of the PackedTags1 meta-data which does not include
- * a full sequence number (as found in the larger PackedTags2 form) it is
+ * Note: Due to the use of the packed_tags1 meta-data which does not include
+ * a full sequence number (as found in the larger packed_tags2 form) it is
* necessary for Yaffs to re-write a chunk/page (just once) to mark it as
* discarded and dirty. This is not ideal: newer NAND parts are supposed
* to be written just once. When Yaffs performs this operation, this
@@ -89,21 +89,21 @@ static struct nand_ecclayout nand_oob_16 = {
* Any underlying MTD error results in YAFFS_FAIL.
* Returns YAFFS_OK or YAFFS_FAIL.
*/
-int nandmtd1_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,
+int nandmtd1_write_chunk_tags(yaffs_dev_t *dev,
int nand_chunk, const __u8 *data, const yaffs_ext_tags *etags)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
- int chunkBytes = dev->data_bytes_per_chunk;
- loff_t addr = ((loff_t)nand_chunk) * chunkBytes;
+ int chunk_bytes = dev->data_bytes_per_chunk;
+ loff_t addr = ((loff_t)nand_chunk) * chunk_bytes;
struct mtd_oob_ops ops;
- yaffs_PackedTags1 pt1;
+ yaffs_packed_tags1 pt1;
int retval;
- /* we assume that PackedTags1 and yaffs_tags_t are compatible */
- compile_time_assertion(sizeof(yaffs_PackedTags1) == 12);
+ /* we assume that packed_tags1 and yaffs_tags_t are compatible */
+ compile_time_assertion(sizeof(yaffs_packed_tags1) == 12);
compile_time_assertion(sizeof(yaffs_tags_t) == 8);
- yaffs_PackTags1(&pt1, etags);
+ yaffs_pack_tags1(&pt1, etags);
yaffs_calc_tags_ecc((yaffs_tags_t *)&pt1);
/* When deleting a chunk, the upper layer provides only skeletal
@@ -129,7 +129,7 @@ int nandmtd1_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
- ops.len = (data) ? chunkBytes : 0;
+ ops.len = (data) ? chunk_bytes : 0;
ops.ooblen = YTAG1_SIZE;
ops.datbuf = (__u8 *)data;
ops.oobbuf = (__u8 *)&pt1;
@@ -161,27 +161,27 @@ static int rettags(yaffs_ext_tags *etags, int ecc_result, int retval)
*
* - Check ECC results for data (if applicable)
* - Check for blank/erased block (return empty ExtendedTags if blank)
- * - Check the PackedTags1 mini-ECC (correct if necessary/possible)
- * - Convert PackedTags1 to ExtendedTags
+ * - Check the packed_tags1 mini-ECC (correct if necessary/possible)
+ * - Convert packed_tags1 to ExtendedTags
* - Update ecc_result and block_bad members to refect state.
*
* Returns YAFFS_OK or YAFFS_FAIL.
*/
-int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,
+int nandmtd1_read_chunk_tags(yaffs_dev_t *dev,
int nand_chunk, __u8 *data, yaffs_ext_tags *etags)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
- int chunkBytes = dev->data_bytes_per_chunk;
- loff_t addr = ((loff_t)nand_chunk) * chunkBytes;
+ int chunk_bytes = dev->data_bytes_per_chunk;
+ loff_t addr = ((loff_t)nand_chunk) * chunk_bytes;
int eccres = YAFFS_ECC_RESULT_NO_ERROR;
struct mtd_oob_ops ops;
- yaffs_PackedTags1 pt1;
+ yaffs_packed_tags1 pt1;
int retval;
int deleted;
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
- ops.len = (data) ? chunkBytes : 0;
+ ops.len = (data) ? chunk_bytes : 0;
ops.ooblen = YTAG1_SIZE;
ops.datbuf = data;
ops.oobbuf = (__u8 *)&pt1;
@@ -261,9 +261,9 @@ int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,
}
/* Unpack the tags to extended form and set ECC result.
- * [set shouldBeFF just to keep yaffs_unpack_tags1 happy]
+ * [set should_be_ff just to keep yaffs_unpack_tags1 happy]
*/
- pt1.shouldBeFF = 0xFFFFFFFF;
+ pt1.should_be_ff = 0xFFFFFFFF;
yaffs_unpack_tags1(etags, &pt1);
etags->ecc_result = eccres;
@@ -279,7 +279,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,
*
* Returns YAFFS_OK or YAFFS_FAIL.
*/
-int nandmtd1_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no)
+int nandmtd1_mark_block_bad(struct yaffs_dev_s *dev, int block_no)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
int blocksize = dev->param.chunks_per_block * dev->data_bytes_per_chunk;
@@ -295,7 +295,7 @@ int nandmtd1_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no)
*
* Returns YAFFS_OK or YAFFS_FAIL.
*/
-static int nandmtd1_TestPrerequists(struct mtd_info *mtd)
+static int nandmtd1_test_prerequists(struct mtd_info *mtd)
{
/* 2.6.18 has mtd->ecclayout->oobavail */
/* 2.6.21 has mtd->ecclayout->oobavail and mtd->oobavail */
@@ -319,12 +319,12 @@ static int nandmtd1_TestPrerequists(struct mtd_info *mtd)
*
* Always returns YAFFS_OK.
*/
-int nandmtd1_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no,
- yaffs_block_state_t *pState, __u32 *pSequenceNumber)
+int nandmtd1_query_block(struct yaffs_dev_s *dev, int block_no,
+ yaffs_block_state_t *state_ptr, __u32 *seq_ptr)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
- int chunkNo = block_no * dev->param.chunks_per_block;
- loff_t addr = (loff_t)chunkNo * dev->data_bytes_per_chunk;
+ int chunk_num = block_no * dev->param.chunks_per_block;
+ loff_t addr = (loff_t)chunk_num * dev->data_bytes_per_chunk;
yaffs_ext_tags etags;
int state = YAFFS_BLOCK_STATE_DEAD;
int seqnum = 0;
@@ -333,10 +333,10 @@ int nandmtd1_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no,
/* We don't yet have a good place to test for MTD config prerequists.
* Do it here as we are called during the initial scan.
*/
- if (nandmtd1_TestPrerequists(mtd) != YAFFS_OK)
+ if (nandmtd1_test_prerequists(mtd) != YAFFS_OK)
return YAFFS_FAIL;
- retval = nandmtd1_ReadChunkWithTagsFromNAND(dev, chunkNo, NULL, &etags);
+ retval = nandmtd1_read_chunk_tags(dev, chunk_num, NULL, &etags);
etags.block_bad = (mtd->block_isbad)(mtd, addr);
if (etags.block_bad) {
T(YAFFS_TRACE_BAD_BLOCKS,
@@ -352,8 +352,8 @@ int nandmtd1_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no,
state = YAFFS_BLOCK_STATE_EMPTY;
}
- *pState = state;
- *pSequenceNumber = seqnum;
+ *state_ptr = state;
+ *seq_ptr = seqnum;
/* query always succeeds */
return YAFFS_OK;
diff --git a/yaffs_mtdif1.h b/yaffs_mtdif1.h
index 1b2befe..01a8ec4 100644
--- a/yaffs_mtdif1.h
+++ b/yaffs_mtdif1.h
@@ -14,15 +14,15 @@
#ifndef __YAFFS_MTDIF1_H__
#define __YAFFS_MTDIF1_H__
-int nandmtd1_WriteChunkWithTagsToNAND(yaffs_dev_t *dev, int nand_chunk,
+int nandmtd1_write_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
const __u8 *data, const yaffs_ext_tags *tags);
-int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev, int nand_chunk,
+int nandmtd1_read_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
__u8 *data, yaffs_ext_tags *tags);
-int nandmtd1_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no);
+int nandmtd1_mark_block_bad(struct yaffs_dev_s *dev, int block_no);
-int nandmtd1_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no,
+int nandmtd1_query_block(struct yaffs_dev_s *dev, int block_no,
yaffs_block_state_t *state, __u32 *seq_number);
#endif
diff --git a/yaffs_mtdif2.c b/yaffs_mtdif2.c
index c6ebdaa..1c60a44 100644
--- a/yaffs_mtdif2.c
+++ b/yaffs_mtdif2.c
@@ -27,10 +27,10 @@
#include "yaffs_linux.h"
/* NB For use with inband tags....
- * We assume that the data buffer is of size totalBytersPerChunk so that we can also
+ * We assume that the data buffer is of size total_bytes_per_chunk so that we can also
* use it to load the tags.
*/
-int nandmtd2_WriteChunkWithTagsToNAND(yaffs_dev_t *dev, int nand_chunk,
+int nandmtd2_write_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
const __u8 *data,
const yaffs_ext_tags *tags)
{
@@ -44,14 +44,14 @@ int nandmtd2_WriteChunkWithTagsToNAND(yaffs_dev_t *dev, int nand_chunk,
loff_t addr;
- yaffs_PackedTags2 pt;
+ 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;
T(YAFFS_TRACE_MTD,
(TSTR
- ("nandmtd2_WriteChunkWithTagsToNAND chunk %d data %p tags %p"
+ ("nandmtd2_write_chunk_tags chunk %d data %p tags %p"
TENDSTR), nand_chunk, data, tags));
@@ -64,11 +64,11 @@ int nandmtd2_WriteChunkWithTagsToNAND(yaffs_dev_t *dev, int nand_chunk,
if (!data || !tags)
BUG();
else if (dev->param.inband_tags) {
- yaffs_PackedTags2TagsPart *pt2tp;
- pt2tp = (yaffs_PackedTags2TagsPart *)(data + dev->data_bytes_per_chunk);
- yaffs_PackTags2TagsPart(pt2tp, tags);
+ yaffs_packed_tags2_tags_only *pt2tp;
+ pt2tp = (yaffs_packed_tags2_tags_only *)(data + dev->data_bytes_per_chunk);
+ yaffs_pack_tags2_tags_only(pt2tp, tags);
} else
- yaffs_PackTags2(&pt, tags, !dev->param.no_tags_ecc);
+ yaffs_pack_tags2(&pt, tags, !dev->param.no_tags_ecc);
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
ops.mode = MTD_OOB_AUTO;
@@ -97,7 +97,7 @@ int nandmtd2_WriteChunkWithTagsToNAND(yaffs_dev_t *dev, int nand_chunk,
return YAFFS_FAIL;
}
-int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev, int nand_chunk,
+int nandmtd2_read_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
__u8 *data, yaffs_ext_tags *tags)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
@@ -106,24 +106,24 @@ int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev, int nand_chunk,
#endif
size_t dummy;
int retval = 0;
- int localData = 0;
+ int local_data = 0;
loff_t addr = ((loff_t) nand_chunk) * dev->param.total_bytes_per_chunk;
- yaffs_PackedTags2 pt;
+ 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;
T(YAFFS_TRACE_MTD,
(TSTR
- ("nandmtd2_ReadChunkWithTagsFromNAND chunk %d data %p tags %p"
+ ("nandmtd2_read_chunk_tags chunk %d data %p tags %p"
TENDSTR), nand_chunk, data, tags));
if (dev->param.inband_tags) {
if (!data) {
- localData = 1;
+ local_data = 1;
data = yaffs_get_temp_buffer(dev, __LINE__);
}
@@ -141,14 +141,14 @@ int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev, int nand_chunk,
ops.len = data ? dev->data_bytes_per_chunk : packed_tags_size;
ops.ooboffs = 0;
ops.datbuf = data;
- ops.oobbuf = yaffs_dev_to_lc(dev)->spareBuffer;
+ ops.oobbuf = yaffs_dev_to_lc(dev)->spare_buffer;
retval = mtd->read_oob(mtd, addr, &ops);
}
#else
if (!dev->param.inband_tags && data && tags) {
retval = mtd->read_ecc(mtd, addr, dev->data_bytes_per_chunk,
- &dummy, data, dev->spareBuffer,
+ &dummy, data, dev->spare_buffer,
NULL);
} else {
if (data)
@@ -158,25 +158,25 @@ int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev, int nand_chunk,
if (!dev->param.inband_tags && tags)
retval =
mtd->read_oob(mtd, addr, mtd->oobsize, &dummy,
- dev->spareBuffer);
+ dev->spare_buffer);
}
#endif
if (dev->param.inband_tags) {
if (tags) {
- yaffs_PackedTags2TagsPart *pt2tp;
- pt2tp = (yaffs_PackedTags2TagsPart *)&data[dev->data_bytes_per_chunk];
- yaffs_unpack_tags2tags_part(tags, pt2tp);
+ yaffs_packed_tags2_tags_only *pt2tp;
+ pt2tp = (yaffs_packed_tags2_tags_only *)&data[dev->data_bytes_per_chunk];
+ yaffs_unpack_tags2_tags_only(tags, pt2tp);
}
} else {
if (tags) {
- memcpy(packed_tags_ptr, yaffs_dev_to_lc(dev)->spareBuffer, 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);
}
}
- if (localData)
+ if (local_data)
yaffs_release_temp_buffer(dev, data, __LINE__);
if (tags && retval == -EBADMSG && tags->ecc_result == YAFFS_ECC_RESULT_NO_ERROR) {
@@ -193,12 +193,12 @@ int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev, int nand_chunk,
return YAFFS_FAIL;
}
-int nandmtd2_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no)
+int nandmtd2_mark_block_bad(struct yaffs_dev_s *dev, int block_no)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
int retval;
T(YAFFS_TRACE_MTD,
- (TSTR("nandmtd2_MarkNANDBlockBad %d" TENDSTR), block_no));
+ (TSTR("nandmtd2_mark_block_bad %d" TENDSTR), block_no));
retval =
mtd->block_markbad(mtd,
@@ -212,14 +212,14 @@ int nandmtd2_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no)
}
-int nandmtd2_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no,
+int nandmtd2_query_block(struct yaffs_dev_s *dev, int block_no,
yaffs_block_state_t *state, __u32 *seq_number)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
int retval;
T(YAFFS_TRACE_MTD,
- (TSTR("nandmtd2_QueryNANDBlock %d" TENDSTR), block_no));
+ (TSTR("nandmtd2_query_block %d" TENDSTR), block_no));
retval =
mtd->block_isbad(mtd,
block_no * dev->param.chunks_per_block *
@@ -232,8 +232,7 @@ int nandmtd2_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no,
*seq_number = 0;
} else {
yaffs_ext_tags t;
- nandmtd2_ReadChunkWithTagsFromNAND(dev,
- block_no *
+ nandmtd2_read_chunk_tags(dev, block_no *
dev->param.chunks_per_block, NULL,
&t);
diff --git a/yaffs_mtdif2.h b/yaffs_mtdif2.h
index 31c8216..b33b84d 100644
--- a/yaffs_mtdif2.h
+++ b/yaffs_mtdif2.h
@@ -17,13 +17,13 @@
#define __YAFFS_MTDIF2_H__
#include "yaffs_guts.h"
-int nandmtd2_WriteChunkWithTagsToNAND(yaffs_dev_t *dev, int nand_chunk,
+int nandmtd2_write_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
const __u8 *data,
const yaffs_ext_tags *tags);
-int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev, int nand_chunk,
+int nandmtd2_read_chunk_tags(yaffs_dev_t *dev, int nand_chunk,
__u8 *data, yaffs_ext_tags *tags);
-int nandmtd2_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no);
-int nandmtd2_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no,
+int nandmtd2_mark_block_bad(struct yaffs_dev_s *dev, int block_no);
+int nandmtd2_query_block(struct yaffs_dev_s *dev, int block_no,
yaffs_block_state_t *state, __u32 *seq_number);
#endif
diff --git a/yaffs_nand.c b/yaffs_nand.c
index d1fe84a..d721fa6 100644
--- a/yaffs_nand.c
+++ b/yaffs_nand.c
@@ -22,22 +22,22 @@ int yaffs_rd_chunk_tags_nand(yaffs_dev_t *dev, int nand_chunk,
yaffs_ext_tags *tags)
{
int result;
- yaffs_ext_tags localTags;
+ yaffs_ext_tags local_tags;
- int realignedChunkInNAND = nand_chunk - dev->chunk_offset;
+ int realigned_chunk = nand_chunk - dev->chunk_offset;
dev->n_page_reads++;
/* If there are no tags provided, use local tags to get prioritised gc working */
if (!tags)
- tags = &localTags;
+ tags = &local_tags;
if (dev->param.read_chunk_tags_fn)
- result = dev->param.read_chunk_tags_fn(dev, realignedChunkInNAND, buffer,
+ result = dev->param.read_chunk_tags_fn(dev, realigned_chunk, buffer,
tags);
else
result = yaffs_tags_compat_rd(dev,
- realignedChunkInNAND,
+ realigned_chunk,
buffer,
tags);
if (tags &&
diff --git a/yaffs_packedtags1.c b/yaffs_packedtags1.c
index 3ad49a9..2ce873f 100644
--- a/yaffs_packedtags1.c
+++ b/yaffs_packedtags1.c
@@ -14,7 +14,7 @@
#include "yaffs_packedtags1.h"
#include "yportenv.h"
-void yaffs_PackTags1(yaffs_PackedTags1 *pt, const yaffs_ext_tags *t)
+void yaffs_pack_tags1(yaffs_packed_tags1 *pt, const yaffs_ext_tags *t)
{
pt->chunk_id = t->chunk_id;
pt->serial_number = t->serial_number;
@@ -22,20 +22,20 @@ void yaffs_PackTags1(yaffs_PackedTags1 *pt, const yaffs_ext_tags *t)
pt->obj_id = t->obj_id;
pt->ecc = 0;
pt->deleted = (t->is_deleted) ? 0 : 1;
- pt->unusedStuff = 0;
- pt->shouldBeFF = 0xFFFFFFFF;
+ pt->unused_stuff = 0;
+ pt->should_be_ff = 0xFFFFFFFF;
}
-void yaffs_unpack_tags1(yaffs_ext_tags *t, const yaffs_PackedTags1 *pt)
+void yaffs_unpack_tags1(yaffs_ext_tags *t, const yaffs_packed_tags1 *pt)
{
- static const __u8 allFF[] =
+ static const __u8 all_ff[] =
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff };
- if (memcmp(allFF, pt, sizeof(yaffs_PackedTags1))) {
+ if (memcmp(all_ff, pt, sizeof(yaffs_packed_tags1))) {
t->block_bad = 0;
- if (pt->shouldBeFF != 0xFFFFFFFF)
+ if (pt->should_be_ff != 0xFFFFFFFF)
t->block_bad = 1;
t->chunk_used = 1;
t->obj_id = pt->obj_id;
diff --git a/yaffs_packedtags1.h b/yaffs_packedtags1.h
index 881cc75..50f32e8 100644
--- a/yaffs_packedtags1.h
+++ b/yaffs_packedtags1.h
@@ -27,11 +27,11 @@ typedef struct {
unsigned obj_id:18;
unsigned ecc:12;
unsigned deleted:1;
- unsigned unusedStuff:1;
- unsigned shouldBeFF;
+ unsigned unused_stuff:1;
+ unsigned should_be_ff;
-} yaffs_PackedTags1;
+} yaffs_packed_tags1;
-void yaffs_PackTags1(yaffs_PackedTags1 *pt, const yaffs_ext_tags *t);
-void yaffs_unpack_tags1(yaffs_ext_tags *t, const yaffs_PackedTags1 *pt);
+void yaffs_pack_tags1(yaffs_packed_tags1 *pt, const yaffs_ext_tags *t);
+void yaffs_unpack_tags1(yaffs_ext_tags *t, const yaffs_packed_tags1 *pt);
#endif
diff --git a/yaffs_packedtags2.c b/yaffs_packedtags2.c
index 6b854cb..4873f78 100644
--- a/yaffs_packedtags2.c
+++ b/yaffs_packedtags2.c
@@ -39,19 +39,19 @@
#define EXTRA_OBJECT_TYPE_MASK ((0x0F) << EXTRA_OBJECT_TYPE_SHIFT)
-static void yaffs_DumpPackedTags2TagsPart(const yaffs_PackedTags2TagsPart *ptt)
+static void yaffs_dump_packed_tags2_tags_only(const 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_DumpPackedTags2(const yaffs_PackedTags2 *pt)
+static void yaffs_dump_packed_tags2(const yaffs_packed_tags2 *pt)
{
- yaffs_DumpPackedTags2TagsPart(&pt->t);
+ yaffs_dump_packed_tags2_tags_only(&pt->t);
}
-static void yaffs_DumpTags2(const yaffs_ext_tags *t)
+static void yaffs_dump_tags2(const yaffs_ext_tags *t)
{
T(YAFFS_TRACE_MTD,
(TSTR
@@ -62,7 +62,7 @@ static void yaffs_DumpTags2(const yaffs_ext_tags *t)
}
-void yaffs_PackTags2TagsPart(yaffs_PackedTags2TagsPart *ptt,
+void yaffs_pack_tags2_tags_only(yaffs_packed_tags2_tags_only *ptt,
const yaffs_ext_tags *t)
{
ptt->chunk_id = t->chunk_id;
@@ -92,24 +92,24 @@ void yaffs_PackTags2TagsPart(yaffs_PackedTags2TagsPart *ptt,
ptt->n_bytes = 0;
}
- yaffs_DumpPackedTags2TagsPart(ptt);
- yaffs_DumpTags2(t);
+ yaffs_dump_packed_tags2_tags_only(ptt);
+ yaffs_dump_tags2(t);
}
-void yaffs_PackTags2(yaffs_PackedTags2 *pt, const yaffs_ext_tags *t, int tagsECC)
+void yaffs_pack_tags2(yaffs_packed_tags2 *pt, const yaffs_ext_tags *t, int tags_ecc)
{
- yaffs_PackTags2TagsPart(&pt->t, t);
+ yaffs_pack_tags2_tags_only(&pt->t, t);
- if(tagsECC)
+ if(tags_ecc)
yaffs_ecc_calc_other((unsigned char *)&pt->t,
- sizeof(yaffs_PackedTags2TagsPart),
+ sizeof(yaffs_packed_tags2_tags_only),
&pt->ecc);
}
-void yaffs_unpack_tags2tags_part(yaffs_ext_tags *t,
- yaffs_PackedTags2TagsPart *ptt)
+void yaffs_unpack_tags2_tags_only(yaffs_ext_tags *t,
+ yaffs_packed_tags2_tags_only *ptt)
{
memset(t, 0, sizeof(yaffs_ext_tags));
@@ -150,28 +150,28 @@ void yaffs_unpack_tags2tags_part(yaffs_ext_tags *t,
}
}
- yaffs_DumpPackedTags2TagsPart(ptt);
- yaffs_DumpTags2(t);
+ yaffs_dump_packed_tags2_tags_only(ptt);
+ yaffs_dump_tags2(t);
}
-void yaffs_unpack_tags2(yaffs_ext_tags *t, yaffs_PackedTags2 *pt, int tagsECC)
+void yaffs_unpack_tags2(yaffs_ext_tags *t, yaffs_packed_tags2 *pt, int tags_ecc)
{
yaffs_ecc_result ecc_result = YAFFS_ECC_RESULT_NO_ERROR;
if (pt->t.seq_number != 0xFFFFFFFF &&
- tagsECC){
+ tags_ecc){
/* Chunk is in use and we need to do ECC */
- yaffs_ECCOther ecc;
+ yaffs_ecc_other ecc;
int result;
yaffs_ecc_calc_other((unsigned char *)&pt->t,
- sizeof(yaffs_PackedTags2TagsPart),
+ sizeof(yaffs_packed_tags2_tags_only),
&ecc);
result = yaffs_ecc_correct_other((unsigned char *)&pt->t,
- sizeof(yaffs_PackedTags2TagsPart),
+ sizeof(yaffs_packed_tags2_tags_only),
&pt->ecc, &ecc);
switch (result) {
case 0:
@@ -188,11 +188,11 @@ void yaffs_unpack_tags2(yaffs_ext_tags *t, yaffs_PackedTags2 *pt, int tagsECC)
}
}
- yaffs_unpack_tags2tags_part(t, &pt->t);
+ yaffs_unpack_tags2_tags_only(t, &pt->t);
t->ecc_result = ecc_result;
- yaffs_DumpPackedTags2(pt);
- yaffs_DumpTags2(t);
+ yaffs_dump_packed_tags2(pt);
+ yaffs_dump_tags2(t);
}
diff --git a/yaffs_packedtags2.h b/yaffs_packedtags2.h
index 70bd3c9..fd7a239 100644
--- a/yaffs_packedtags2.h
+++ b/yaffs_packedtags2.h
@@ -26,18 +26,18 @@ typedef struct {
unsigned obj_id;
unsigned chunk_id;
unsigned n_bytes;
-} yaffs_PackedTags2TagsPart;
+} yaffs_packed_tags2_tags_only;
typedef struct {
- yaffs_PackedTags2TagsPart t;
- yaffs_ECCOther ecc;
-} yaffs_PackedTags2;
+ yaffs_packed_tags2_tags_only t;
+ yaffs_ecc_other ecc;
+} yaffs_packed_tags2;
/* Full packed tags with ECC, used for oob tags */
-void yaffs_PackTags2(yaffs_PackedTags2 *pt, const yaffs_ext_tags *t, int tagsECC);
-void yaffs_unpack_tags2(yaffs_ext_tags *t, yaffs_PackedTags2 *pt, int tagsECC);
+void yaffs_pack_tags2(yaffs_packed_tags2 *pt, const yaffs_ext_tags *t, int tags_ecc);
+void yaffs_unpack_tags2(yaffs_ext_tags *t, yaffs_packed_tags2 *pt, int tags_ecc);
/* Only the tags part (no ECC for use with inband tags */
-void yaffs_PackTags2TagsPart(yaffs_PackedTags2TagsPart *pt, const yaffs_ext_tags *t);
-void yaffs_unpack_tags2tags_part(yaffs_ext_tags *t, yaffs_PackedTags2TagsPart *pt);
+void yaffs_pack_tags2_tags_only(yaffs_packed_tags2_tags_only *pt, const yaffs_ext_tags *t);
+void yaffs_unpack_tags2_tags_only(yaffs_ext_tags *t, yaffs_packed_tags2_tags_only *pt);
#endif
diff --git a/yaffs_tagscompat.c b/yaffs_tagscompat.c
index c04a2fb..1e910f2 100644
--- a/yaffs_tagscompat.c
+++ b/yaffs_tagscompat.c
@@ -49,9 +49,9 @@ static const char yaffs_count_bits_table[256] = {
int yaffs_count_bits(__u8 x)
{
- int retVal;
- retVal = yaffs_count_bits_table[x];
- return retVal;
+ int ret_val;
+ ret_val = yaffs_count_bits_table[x];
+ return ret_val;
}
/********** Tags ECC calculations *********/
@@ -116,39 +116,39 @@ int yaffs_check_tags_ecc(yaffs_tags_t *tags)
/********** Tags **********/
-static void yaffs_load_tags_to_spare(yaffs_spare *sparePtr,
- yaffs_tags_t *tagsPtr)
+static void yaffs_load_tags_to_spare(yaffs_spare *spare_ptr,
+ yaffs_tags_t *tags_ptr)
{
- yaffs_tags_union_t *tu = (yaffs_tags_union_t *) tagsPtr;
-
- yaffs_calc_tags_ecc(tagsPtr);
-
- sparePtr->tb0 = tu->as_bytes[0];
- sparePtr->tb1 = tu->as_bytes[1];
- sparePtr->tb2 = tu->as_bytes[2];
- sparePtr->tb3 = tu->as_bytes[3];
- sparePtr->tb4 = tu->as_bytes[4];
- sparePtr->tb5 = tu->as_bytes[5];
- sparePtr->tb6 = tu->as_bytes[6];
- sparePtr->tb7 = tu->as_bytes[7];
+ yaffs_tags_union_t *tu = (yaffs_tags_union_t *) tags_ptr;
+
+ yaffs_calc_tags_ecc(tags_ptr);
+
+ spare_ptr->tb0 = tu->as_bytes[0];
+ spare_ptr->tb1 = tu->as_bytes[1];
+ spare_ptr->tb2 = tu->as_bytes[2];
+ spare_ptr->tb3 = tu->as_bytes[3];
+ spare_ptr->tb4 = tu->as_bytes[4];
+ spare_ptr->tb5 = tu->as_bytes[5];
+ spare_ptr->tb6 = tu->as_bytes[6];
+ spare_ptr->tb7 = tu->as_bytes[7];
}
-static void yaffs_get_tags_from_spare(yaffs_dev_t *dev, yaffs_spare *sparePtr,
- yaffs_tags_t *tagsPtr)
+static void yaffs_get_tags_from_spare(yaffs_dev_t *dev, yaffs_spare *spare_ptr,
+ yaffs_tags_t *tags_ptr)
{
- yaffs_tags_union_t *tu = (yaffs_tags_union_t *) tagsPtr;
+ yaffs_tags_union_t *tu = (yaffs_tags_union_t *) tags_ptr;
int result;
- tu->as_bytes[0] = sparePtr->tb0;
- tu->as_bytes[1] = sparePtr->tb1;
- tu->as_bytes[2] = sparePtr->tb2;
- tu->as_bytes[3] = sparePtr->tb3;
- tu->as_bytes[4] = sparePtr->tb4;
- tu->as_bytes[5] = sparePtr->tb5;
- tu->as_bytes[6] = sparePtr->tb6;
- tu->as_bytes[7] = sparePtr->tb7;
+ tu->as_bytes[0] = spare_ptr->tb0;
+ tu->as_bytes[1] = spare_ptr->tb1;
+ tu->as_bytes[2] = spare_ptr->tb2;
+ tu->as_bytes[3] = spare_ptr->tb3;
+ tu->as_bytes[4] = spare_ptr->tb4;
+ tu->as_bytes[5] = spare_ptr->tb5;
+ tu->as_bytes[6] = spare_ptr->tb6;
+ tu->as_bytes[7] = spare_ptr->tb7;
- result = yaffs_check_tags_ecc(tagsPtr);
+ result = yaffs_check_tags_ecc(tags_ptr);
if (result > 0)
dev->n_tags_ecc_fixed++;
else if (result < 0)
@@ -179,31 +179,31 @@ static int yaffs_rd_chunk_nand(struct yaffs_dev_s *dev,
__u8 *data,
yaffs_spare *spare,
yaffs_ecc_result *ecc_result,
- int doErrorCorrection)
+ int correct_errors)
{
- int retVal;
- yaffs_spare localSpare;
+ int ret_val;
+ yaffs_spare local_spare;
if (!spare && data) {
/* If we don't have a real spare, then we use a local one. */
/* Need this for the calculation of the ecc */
- spare = &localSpare;
+ spare = &local_spare;
}
if (!dev->param.use_nand_ecc) {
- retVal = dev->param.read_chunk_fn(dev, nand_chunk, data, spare);
- if (data && doErrorCorrection) {
+ ret_val = dev->param.read_chunk_fn(dev, nand_chunk, data, spare);
+ if (data && correct_errors) {
/* Do ECC correction */
/* Todo handle any errors */
int ecc_result1, ecc_result2;
- __u8 calcEcc[3];
+ __u8 calc_ecc[3];
- yaffs_ecc_cacl(data, calcEcc);
+ yaffs_ecc_cacl(data, calc_ecc);
ecc_result1 =
- yaffs_ecc_correct(data, spare->ecc1, calcEcc);
- yaffs_ecc_cacl(&data[256], calcEcc);
+ yaffs_ecc_correct(data, spare->ecc1, calc_ecc);
+ yaffs_ecc_cacl(&data[256], calc_ecc);
ecc_result2 =
- yaffs_ecc_correct(&data[256], spare->ecc2, calcEcc);
+ yaffs_ecc_correct(&data[256], spare->ecc2, calc_ecc);
if (ecc_result1 > 0) {
T(YAFFS_TRACE_ERROR,
@@ -252,10 +252,10 @@ static int yaffs_rd_chunk_nand(struct yaffs_dev_s *dev,
memset(&nspare, 0, sizeof(nspare));
- retVal = dev->param.read_chunk_fn(dev, nand_chunk, data,
+ ret_val = dev->param.read_chunk_fn(dev, nand_chunk, data,
(yaffs_spare *) &nspare);
memcpy(spare, &nspare, sizeof(yaffs_spare));
- if (data && doErrorCorrection) {
+ if (data && correct_errors) {
if (nspare.eccres1 > 0) {
T(YAFFS_TRACE_ERROR,
(TSTR
@@ -294,7 +294,7 @@ static int yaffs_rd_chunk_nand(struct yaffs_dev_s *dev,
}
}
- return retVal;
+ return ret_val;
}
#ifdef NOTYET
@@ -399,28 +399,28 @@ static int yaffs_verify_cmp(const __u8 *d0, const __u8 *d1,
int yaffs_tags_compat_wr(yaffs_dev_t *dev,
int nand_chunk,
const __u8 *data,
- const yaffs_ext_tags *eTags)
+ const yaffs_ext_tags *ext_tags)
{
yaffs_spare spare;
yaffs_tags_t tags;
yaffs_spare_init(&spare);
- if (eTags->is_deleted)
+ if (ext_tags->is_deleted)
spare.page_status = 0;
else {
- tags.obj_id = eTags->obj_id;
- tags.chunk_id = eTags->chunk_id;
+ tags.obj_id = ext_tags->obj_id;
+ tags.chunk_id = ext_tags->chunk_id;
- tags.n_bytes_lsb = eTags->n_bytes & 0x3ff;
+ tags.n_bytes_lsb = ext_tags->n_bytes & 0x3ff;
if (dev->data_bytes_per_chunk >= 1024)
- tags.n_bytes_msb = (eTags->n_bytes >> 10) & 3;
+ tags.n_bytes_msb = (ext_tags->n_bytes >> 10) & 3;
else
tags.n_bytes_msb = 3;
- tags.serial_number = eTags->serial_number;
+ tags.serial_number = ext_tags->serial_number;
if (!dev->param.use_nand_ecc && data)
yaffs_calc_ecc(data, &spare);
@@ -435,48 +435,48 @@ int yaffs_tags_compat_wr(yaffs_dev_t *dev,
int yaffs_tags_compat_rd(yaffs_dev_t *dev,
int nand_chunk,
__u8 *data,
- yaffs_ext_tags *eTags)
+ yaffs_ext_tags *ext_tags)
{
yaffs_spare spare;
yaffs_tags_t tags;
yaffs_ecc_result ecc_result = YAFFS_ECC_RESULT_UNKNOWN;
- static yaffs_spare spareFF;
+ static yaffs_spare spare_ff;
static int init;
if (!init) {
- memset(&spareFF, 0xFF, sizeof(spareFF));
+ memset(&spare_ff, 0xFF, sizeof(spare_ff));
init = 1;
}
if (yaffs_rd_chunk_nand
(dev, nand_chunk, data, &spare, &ecc_result, 1)) {
- /* eTags may be NULL */
- if (eTags) {
+ /* ext_tags may be NULL */
+ if (ext_tags) {
int deleted =
(yaffs_count_bits(spare.page_status) < 7) ? 1 : 0;
- eTags->is_deleted = deleted;
- eTags->ecc_result = ecc_result;
- eTags->block_bad = 0; /* We're reading it */
+ ext_tags->is_deleted = deleted;
+ ext_tags->ecc_result = ecc_result;
+ ext_tags->block_bad = 0; /* We're reading it */
/* therefore it is not a bad block */
- eTags->chunk_used =
- (memcmp(&spareFF, &spare, sizeof(spareFF)) !=
+ ext_tags->chunk_used =
+ (memcmp(&spare_ff, &spare, sizeof(spare_ff)) !=
0) ? 1 : 0;
- if (eTags->chunk_used) {
+ if (ext_tags->chunk_used) {
yaffs_get_tags_from_spare(dev, &spare, &tags);
- eTags->obj_id = tags.obj_id;
- eTags->chunk_id = tags.chunk_id;
- eTags->n_bytes = tags.n_bytes_lsb;
+ ext_tags->obj_id = tags.obj_id;
+ ext_tags->chunk_id = tags.chunk_id;
+ ext_tags->n_bytes = tags.n_bytes_lsb;
if (dev->data_bytes_per_chunk >= 1024)
- eTags->n_bytes |= (((unsigned) tags.n_bytes_msb) << 10);
+ ext_tags->n_bytes |= (((unsigned) tags.n_bytes_msb) << 10);
- eTags->serial_number = tags.serial_number;
+ ext_tags->serial_number = tags.serial_number;
}
}
@@ -512,12 +512,12 @@ int yaffs_tags_compat_query_block(struct yaffs_dev_s *dev,
{
yaffs_spare spare0, spare1;
- static yaffs_spare spareFF;
+ static yaffs_spare spare_ff;
static int init;
yaffs_ecc_result dummy;
if (!init) {
- memset(&spareFF, 0xFF, sizeof(spareFF));
+ memset(&spare_ff, 0xFF, sizeof(spare_ff));
init = 1;
}
@@ -530,7 +530,7 @@ int yaffs_tags_compat_query_block(struct yaffs_dev_s *dev,
if (yaffs_count_bits(spare0.block_status & spare1.block_status) < 7)
*state = YAFFS_BLOCK_STATE_DEAD;
- else if (memcmp(&spareFF, &spare0, sizeof(spareFF)) == 0)
+ else if (memcmp(&spare_ff, &spare0, sizeof(spare_ff)) == 0)
*state = YAFFS_BLOCK_STATE_EMPTY;
else
*state = YAFFS_BLOCK_STATE_NEEDS_SCANNING;
diff --git a/yaffs_verify.c b/yaffs_verify.c
index 39d16e6..89e730b 100644
--- a/yaffs_verify.c
+++ b/yaffs_verify.c
@@ -37,7 +37,7 @@ static int yaffs_skip_nand_verification(yaffs_dev_t *dev)
}
-static const char *block_stateName[] = {
+static const char *block_state_name[] = {
"Unknown",
"Needs scanning",
"Scanning",
@@ -53,8 +53,8 @@ static const char *block_stateName[] = {
void yaffs_verify_blk(yaffs_dev_t *dev, yaffs_block_info_t *bi, int n)
{
- int actuallyUsed;
- int inUse;
+ int actually_used;
+ int in_use;
if (yaffs_skip_verification(dev))
return;
@@ -68,25 +68,25 @@ void yaffs_verify_blk(yaffs_dev_t *dev, yaffs_block_info_t *bi, int n)
case YAFFS_BLOCK_STATE_SCANNING:
case YAFFS_BLOCK_STATE_NEEDS_SCANNING:
T(YAFFS_TRACE_VERIFY, (TSTR("Block %d has bad run-state %s"TENDSTR),
- n, block_stateName[bi->block_state]));
+ n, block_state_name[bi->block_state]));
}
/* Check pages in use and soft deletions are legal */
- actuallyUsed = bi->pages_in_use - bi->soft_del_pages;
+ actually_used = bi->pages_in_use - bi->soft_del_pages;
if (bi->pages_in_use < 0 || bi->pages_in_use > dev->param.chunks_per_block ||
bi->soft_del_pages < 0 || bi->soft_del_pages > dev->param.chunks_per_block ||
- actuallyUsed < 0 || actuallyUsed > dev->param.chunks_per_block)
+ actually_used < 0 || actually_used > dev->param.chunks_per_block)
T(YAFFS_TRACE_VERIFY, (TSTR("Block %d has illegal values pages_in_used %d soft_del_pages %d"TENDSTR),
n, bi->pages_in_use, bi->soft_del_pages));
/* Check chunk bitmap legal */
- inUse = yaffs_count_chunk_bits(dev, n);
- if (inUse != bi->pages_in_use)
+ in_use = yaffs_count_chunk_bits(dev, n);
+ if (in_use != bi->pages_in_use)
T(YAFFS_TRACE_VERIFY, (TSTR("Block %d has inconsistent values pages_in_use %d counted chunk bits %d"TENDSTR),
- n, bi->pages_in_use, inUse));
+ n, bi->pages_in_use, in_use));
}
@@ -108,50 +108,50 @@ void yaffs_verify_collected_blk(yaffs_dev_t *dev, yaffs_block_info_t *bi, int n)
void yaffs_verify_blocks(yaffs_dev_t *dev)
{
int i;
- int nBlocksPerState[YAFFS_NUMBER_OF_BLOCK_STATES];
- int nIllegalBlockStates = 0;
+ int state_count[YAFFS_NUMBER_OF_BLOCK_STATES];
+ int illegal_states = 0;
if (yaffs_skip_verification(dev))
return;
- memset(nBlocksPerState, 0, sizeof(nBlocksPerState));
+ 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);
yaffs_verify_blk(dev, bi, i);
if (bi->block_state < YAFFS_NUMBER_OF_BLOCK_STATES)
- nBlocksPerState[bi->block_state]++;
+ state_count[bi->block_state]++;
else
- nIllegalBlockStates++;
+ illegal_states++;
}
T(YAFFS_TRACE_VERIFY, (TSTR(""TENDSTR)));
T(YAFFS_TRACE_VERIFY, (TSTR("Block summary"TENDSTR)));
- T(YAFFS_TRACE_VERIFY, (TSTR("%d blocks have illegal states"TENDSTR), nIllegalBlockStates));
- if (nBlocksPerState[YAFFS_BLOCK_STATE_ALLOCATING] > 1)
+ T(YAFFS_TRACE_VERIFY, (TSTR("%d blocks have illegal states"TENDSTR), illegal_states));
+ if (state_count[YAFFS_BLOCK_STATE_ALLOCATING] > 1)
T(YAFFS_TRACE_VERIFY, (TSTR("Too many allocating blocks"TENDSTR)));
for (i = 0; i < YAFFS_NUMBER_OF_BLOCK_STATES; i++)
T(YAFFS_TRACE_VERIFY,
(TSTR("%s %d blocks"TENDSTR),
- block_stateName[i], nBlocksPerState[i]));
+ block_state_name[i], state_count[i]));
- if (dev->blocks_in_checkpt != nBlocksPerState[YAFFS_BLOCK_STATE_CHECKPOINT])
+ if (dev->blocks_in_checkpt != state_count[YAFFS_BLOCK_STATE_CHECKPOINT])
T(YAFFS_TRACE_VERIFY,
(TSTR("Checkpoint block count wrong dev %d count %d"TENDSTR),
- dev->blocks_in_checkpt, nBlocksPerState[YAFFS_BLOCK_STATE_CHECKPOINT]));
+ dev->blocks_in_checkpt, state_count[YAFFS_BLOCK_STATE_CHECKPOINT]));
- if (dev->n_erased_blocks != nBlocksPerState[YAFFS_BLOCK_STATE_EMPTY])
+ if (dev->n_erased_blocks != state_count[YAFFS_BLOCK_STATE_EMPTY])
T(YAFFS_TRACE_VERIFY,
(TSTR("Erased block count wrong dev %d count %d"TENDSTR),
- dev->n_erased_blocks, nBlocksPerState[YAFFS_BLOCK_STATE_EMPTY]));
+ dev->n_erased_blocks, state_count[YAFFS_BLOCK_STATE_EMPTY]));
- if (nBlocksPerState[YAFFS_BLOCK_STATE_COLLECTING] > 1)
+ if (state_count[YAFFS_BLOCK_STATE_COLLECTING] > 1)
T(YAFFS_TRACE_VERIFY,
(TSTR("Too many collecting blocks %d (max is 1)"TENDSTR),
- nBlocksPerState[YAFFS_BLOCK_STATE_COLLECTING]));
+ state_count[YAFFS_BLOCK_STATE_COLLECTING]));
T(YAFFS_TRACE_VERIFY, (TSTR(""TENDSTR)));
@@ -161,7 +161,7 @@ void yaffs_verify_blocks(yaffs_dev_t *dev)
* Verify the object header. oh must be valid, but obj and tags may be NULL in which
* case those tests will not be performed.
*/
-void yaffs_verify_oh(yaffs_obj_t *obj, yaffs_obj_header *oh, yaffs_ext_tags *tags, int parentCheck)
+void yaffs_verify_oh(yaffs_obj_t *obj, yaffs_obj_header *oh, yaffs_ext_tags *tags, int parent_check)
{
if (obj && yaffs_skip_verification(obj->my_dev))
return;
@@ -186,17 +186,17 @@ void yaffs_verify_oh(yaffs_obj_t *obj, yaffs_obj_header *oh, yaffs_ext_tags *tag
/*
- * Check that the object's parent ids match if parentCheck requested.
+ * Check that the object's parent ids match if parent_check requested.
*
* Tests do not apply to the root object.
*/
- if (parentCheck && tags->obj_id > 1 && !obj->parent)
+ if (parent_check && tags->obj_id > 1 && !obj->parent)
T(YAFFS_TRACE_VERIFY,
(TSTR("Obj %d header mismatch parent_id %d obj->parent is NULL"TENDSTR),
tags->obj_id, oh->parent_obj_id));
- if (parentCheck && obj->parent &&
+ if (parent_check && obj->parent &&
oh->parent_obj_id != obj->parent->obj_id &&
(oh->parent_obj_id != YAFFS_OBJECTID_UNLINKED ||
obj->parent->obj_id != YAFFS_OBJECTID_DELETED))
@@ -243,14 +243,14 @@ int yaffs_verify_tnode_worker(yaffs_obj_t *obj, yaffs_tnode_t *tn,
chunk_offset <<= YAFFS_TNODES_LEVEL0_BITS;
for (i = 0; i < YAFFS_NTNODES_LEVEL0; i++) {
- __u32 theChunk = yaffs_get_group_base(dev, tn, i);
+ __u32 the_chunk = yaffs_get_group_base(dev, tn, i);
- if (theChunk > 0) {
- /* T(~0,(TSTR("verifying (%d:%d) %d"TENDSTR),tags.obj_id,tags.chunk_id,theChunk)); */
- yaffs_rd_chunk_tags_nand(dev, theChunk, NULL, &tags);
+ if (the_chunk > 0) {
+ /* T(~0,(TSTR("verifying (%d:%d) %d"TENDSTR),tags.obj_id,tags.chunk_id,the_chunk)); */
+ yaffs_rd_chunk_tags_nand(dev, the_chunk, NULL, &tags);
if (tags.obj_id != obj_id || tags.chunk_id != chunk_offset) {
T(~0, (TSTR("Object %d chunk_id %d NAND mismatch chunk %d tags (%d:%d)"TENDSTR),
- obj_id, chunk_offset, theChunk,
+ obj_id, chunk_offset, the_chunk,
tags.obj_id, tags.chunk_id));
}
}
@@ -267,9 +267,9 @@ int yaffs_verify_tnode_worker(yaffs_obj_t *obj, yaffs_tnode_t *tn,
void yaffs_verify_file(yaffs_obj_t *obj)
{
- int requiredTallness;
- int actualTallness;
- __u32 lastChunk;
+ int required_depth;
+ int actual_depth;
+ __u32 last_chunk;
__u32 x;
__u32 i;
yaffs_dev_t *dev;
@@ -287,15 +287,15 @@ void yaffs_verify_file(yaffs_obj_t *obj)
obj_id = obj->obj_id;
/* Check file size is consistent with tnode depth */
- lastChunk = obj->variant.file_variant.file_size / dev->data_bytes_per_chunk + 1;
- x = lastChunk >> YAFFS_TNODES_LEVEL0_BITS;
- requiredTallness = 0;
+ last_chunk = obj->variant.file_variant.file_size / dev->data_bytes_per_chunk + 1;
+ x = last_chunk >> YAFFS_TNODES_LEVEL0_BITS;
+ required_depth = 0;
while (x > 0) {
x >>= YAFFS_TNODES_INTERNAL_BITS;
- requiredTallness++;
+ required_depth++;
}
- actualTallness = obj->variant.file_variant.top_level;
+ actual_depth = obj->variant.file_variant.top_level;
/* Check that the chunks in the tnode tree are all correct.
* We do this by scanning through the tnode tree and
@@ -305,17 +305,17 @@ void yaffs_verify_file(yaffs_obj_t *obj)
if (yaffs_skip_nand_verification(dev))
return;
- for (i = 1; i <= lastChunk; i++) {
+ for (i = 1; i <= last_chunk; i++) {
tn = yaffs_find_tnode_0(dev, &obj->variant.file_variant, i);
if (tn) {
- __u32 theChunk = yaffs_get_group_base(dev, tn, i);
- if (theChunk > 0) {
- /* T(~0,(TSTR("verifying (%d:%d) %d"TENDSTR),obj_id,i,theChunk)); */
- yaffs_rd_chunk_tags_nand(dev, theChunk, NULL, &tags);
+ __u32 the_chunk = yaffs_get_group_base(dev, tn, i);
+ if (the_chunk > 0) {
+ /* T(~0,(TSTR("verifying (%d:%d) %d"TENDSTR),obj_id,i,the_chunk)); */
+ yaffs_rd_chunk_tags_nand(dev, the_chunk, NULL, &tags);
if (tags.obj_id != obj_id || tags.chunk_id != i) {
T(~0, (TSTR("Object %d chunk_id %d NAND mismatch chunk %d tags (%d:%d)"TENDSTR),
- obj_id, i, theChunk,
+ obj_id, i, the_chunk,
tags.obj_id, tags.chunk_id));
}
}
@@ -350,13 +350,13 @@ void yaffs_verify_obj(yaffs_obj_t *obj)
{
yaffs_dev_t *dev;
- __u32 chunkMin;
- __u32 chunkMax;
+ __u32 chunk_min;
+ __u32 chunk_max;
- __u32 chunk_idOk;
- __u32 chunkInRange;
- __u32 chunkShouldNotBeDeleted;
- __u32 chunkValid;
+ __u32 chunk_id_ok;
+ __u32 chunk_in_range;
+ __u32 chunk_wrongly_deleted;
+ __u32 chunk_valid;
if (!obj)
return;
@@ -371,27 +371,28 @@ void yaffs_verify_obj(yaffs_obj_t *obj)
/* Check sane object header chunk */
- chunkMin = dev->internal_start_block * dev->param.chunks_per_block;
- chunkMax = (dev->internal_end_block+1) * dev->param.chunks_per_block - 1;
+ chunk_min = dev->internal_start_block * dev->param.chunks_per_block;
+ chunk_max = (dev->internal_end_block+1) * dev->param.chunks_per_block - 1;
- chunkInRange = (((unsigned)(obj->hdr_chunk)) >= chunkMin && ((unsigned)(obj->hdr_chunk)) <= chunkMax);
- chunk_idOk = chunkInRange || (obj->hdr_chunk == 0);
- chunkValid = chunkInRange &&
+ chunk_in_range = (((unsigned)(obj->hdr_chunk)) >= chunk_min &&
+ ((unsigned)(obj->hdr_chunk)) <= chunk_max);
+ chunk_id_ok = chunk_in_range || (obj->hdr_chunk == 0);
+ chunk_valid = chunk_in_range &&
yaffs_check_chunk_bit(dev,
obj->hdr_chunk / dev->param.chunks_per_block,
obj->hdr_chunk % dev->param.chunks_per_block);
- chunkShouldNotBeDeleted = chunkInRange && !chunkValid;
+ chunk_wrongly_deleted = chunk_in_range && !chunk_valid;
if (!obj->fake &&
- (!chunk_idOk || chunkShouldNotBeDeleted)) {
+ (!chunk_id_ok || chunk_wrongly_deleted)) {
T(YAFFS_TRACE_VERIFY,
(TSTR("Obj %d has chunk_id %d %s %s"TENDSTR),
obj->obj_id, obj->hdr_chunk,
- chunk_idOk ? "" : ",out of range",
- chunkShouldNotBeDeleted ? ",marked as deleted" : ""));
+ chunk_id_ok ? "" : ",out of range",
+ chunk_wrongly_deleted ? ",marked as deleted" : ""));
}
- if (chunkValid && !yaffs_skip_nand_verification(dev)) {
+ if (chunk_valid && !yaffs_skip_nand_verification(dev)) {
yaffs_ext_tags tags;
yaffs_obj_header *oh;
__u8 *buffer = yaffs_get_temp_buffer(dev, __LINE__);
@@ -471,7 +472,7 @@ void yaffs_verify_objects(yaffs_dev_t *dev)
void yaffs_verify_obj_in_dir(yaffs_obj_t *obj)
{
struct ylist_head *lh;
- yaffs_obj_t *listObj;
+ yaffs_obj_t *list_obj;
int count = 0;
@@ -499,9 +500,9 @@ void yaffs_verify_obj_in_dir(yaffs_obj_t *obj)
ylist_for_each(lh, &obj->parent->variant.dir_variant.children) {
if (lh) {
- listObj = ylist_entry(lh, yaffs_obj_t, siblings);
- yaffs_verify_obj(listObj);
- if (obj == listObj)
+ list_obj = ylist_entry(lh, yaffs_obj_t, siblings);
+ yaffs_verify_obj(list_obj);
+ if (obj == list_obj)
count++;
}
}
@@ -515,7 +516,7 @@ void yaffs_verify_obj_in_dir(yaffs_obj_t *obj)
void yaffs_verify_dir(yaffs_obj_t *directory)
{
struct ylist_head *lh;
- yaffs_obj_t *listObj;
+ yaffs_obj_t *list_obj;
if (!directory) {
YBUG();
@@ -526,7 +527,9 @@ void yaffs_verify_dir(yaffs_obj_t *directory)
return;
if (directory->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY) {
- T(YAFFS_TRACE_ALWAYS, (TSTR("Directory has wrong type: %d" TENDSTR), directory->variant_type));
+ T(YAFFS_TRACE_ALWAYS,
+ (TSTR("Directory has wrong type: %d" TENDSTR),
+ directory->variant_type));
YBUG();
}
@@ -534,12 +537,14 @@ void yaffs_verify_dir(yaffs_obj_t *directory)
ylist_for_each(lh, &directory->variant.dir_variant.children) {
if (lh) {
- listObj = ylist_entry(lh, yaffs_obj_t, siblings);
- if (listObj->parent != directory) {
- T(YAFFS_TRACE_ALWAYS, (TSTR("Object in directory list has wrong parent %p" TENDSTR), listObj->parent));
+ list_obj = ylist_entry(lh, yaffs_obj_t, siblings);
+ if (list_obj->parent != directory) {
+ T(YAFFS_TRACE_ALWAYS, (
+ TSTR("Object in directory list has wrong parent %p" TENDSTR),
+ list_obj->parent));
YBUG();
}
- yaffs_verify_obj_in_dir(listObj);
+ yaffs_verify_obj_in_dir(list_obj);
}
}
}
@@ -571,22 +576,22 @@ int yaffs_verify_file_sane(yaffs_obj_t *in)
#if 0
int chunk;
int n_chunks;
- int fSize;
+ int file_size;
int failed = 0;
int obj_id;
yaffs_tnode_t *tn;
- yaffs_tags_t localTags;
- yaffs_tags_t *tags = &localTags;
- int theChunk;
+ yaffs_tags_t local_tags;
+ yaffs_tags_t *tags = &local_tags;
+ int the_chunk;
int is_deleted;
if (in->variant_type != YAFFS_OBJECT_TYPE_FILE)
return YAFFS_FAIL;
obj_id = in->obj_id;
- fSize = in->variant.file_variant.file_size;
+ file_size = in->variant.file_variant.file_size;
n_chunks =
- (fSize + in->my_dev->data_bytes_per_chunk - 1) / in->my_dev->data_bytes_per_chunk;
+ (file_size + in->my_dev->data_bytes_per_chunk - 1) / in->my_dev->data_bytes_per_chunk;
for (chunk = 1; chunk <= n_chunks; chunk++) {
tn = yaffs_find_tnode_0(in->my_dev, &in->variant.file_variant,
@@ -594,13 +599,13 @@ int yaffs_verify_file_sane(yaffs_obj_t *in)
if (tn) {
- theChunk = yaffs_get_group_base(dev, tn, chunk);
+ the_chunk = yaffs_get_group_base(dev, tn, chunk);
if (yaffs_check_chunk_bits
- (dev, theChunk / dev->param.chunks_per_block,
- theChunk % dev->param.chunks_per_block)) {
+ (dev, the_chunk / dev->param.chunks_per_block,
+ the_chunk % dev->param.chunks_per_block)) {
- yaffs_rd_chunk_tags_nand(in->my_dev, theChunk,
+ yaffs_rd_chunk_tags_nand(in->my_dev, the_chunk,
tags,
&is_deleted);
if (yaffs_tags_match
diff --git a/yaffs_verify.h b/yaffs_verify.h
index 02ef5fe..6118afd 100644
--- a/yaffs_verify.h
+++ b/yaffs_verify.h
@@ -22,7 +22,7 @@ void yaffs_verify_blk(yaffs_dev_t *dev, yaffs_block_info_t *bi, int n);
void yaffs_verify_collected_blk(yaffs_dev_t *dev, yaffs_block_info_t *bi, int n);
void yaffs_verify_blocks(yaffs_dev_t *dev);
-void yaffs_verify_oh(yaffs_obj_t *obj, yaffs_obj_header *oh, yaffs_ext_tags *tags, int parentCheck);
+void yaffs_verify_oh(yaffs_obj_t *obj, yaffs_obj_header *oh, yaffs_ext_tags *tags, int parent_check);
void yaffs_verify_file(yaffs_obj_t *obj);
void yaffs_verify_link(yaffs_obj_t *obj);
void yaffs_verify_symlink(yaffs_obj_t *obj);
diff --git a/yaffs_vfs.c b/yaffs_vfs.c
index acda87c..371ddd1 100644
--- a/yaffs_vfs.c
+++ b/yaffs_vfs.c
@@ -110,10 +110,10 @@ module_param(yaffs_bg_enable, uint, 0644);
static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino);
-#define yaffs_InodeToObjectLV(iptr) ((iptr)->i_private)
-#define yaffs_InodeToObject(iptr) ((yaffs_obj_t *)(yaffs_InodeToObjectLV(iptr)))
-#define yaffs_dentry_to_obj(dptr) yaffs_InodeToObject((dptr)->d_inode)
-#define yaffs_SuperToDevice(sb) ((yaffs_dev_t *)sb->s_fs_info)
+#define yaffs_inode_to_obj_lv(iptr) ((iptr)->i_private)
+#define yaffs_inode_to_obj(iptr) ((yaffs_obj_t *)(yaffs_inode_to_obj_lv(iptr)))
+#define yaffs_dentry_to_obj(dptr) yaffs_inode_to_obj((dptr)->d_inode)
+#define yaffs_super_to_dev(sb) ((yaffs_dev_t *)sb->s_fs_info)
#define update_dir_time(dir) do {\
@@ -297,14 +297,14 @@ static unsigned yaffs_gc_control_callback(yaffs_dev_t *dev)
static void yaffs_gross_lock(yaffs_dev_t *dev)
{
T(YAFFS_TRACE_LOCK, (TSTR("yaffs locking %p\n"), current));
- down(&(yaffs_dev_to_lc(dev)->grossLock));
+ down(&(yaffs_dev_to_lc(dev)->gross_lock));
T(YAFFS_TRACE_LOCK, (TSTR("yaffs locked %p\n"), current));
}
static void yaffs_gross_unlock(yaffs_dev_t *dev)
{
T(YAFFS_TRACE_LOCK, (TSTR("yaffs unlocking %p\n"), current));
- up(&(yaffs_dev_to_lc(dev)->grossLock));
+ up(&(yaffs_dev_to_lc(dev)->gross_lock));
}
@@ -338,7 +338,7 @@ struct dentry *yaffs2_get_parent(struct dentry *dentry)
yaffs_obj_t *d_obj;
yaffs_obj_t *parent_obj;
- d_obj = yaffs_InodeToObject(dentry->d_inode);
+ d_obj = yaffs_inode_to_obj(dentry->d_inode);
if (d_obj) {
parent_obj = d_obj->parent;
@@ -391,34 +391,34 @@ static struct export_operations yaffs_export_ops =
* All these functions must be called while yaffs is locked.
*/
-struct yaffs_SearchContext {
+struct yaffs_search_context {
yaffs_dev_t *dev;
- yaffs_obj_t *dirObj;
- yaffs_obj_t *nextReturn;
+ yaffs_obj_t *dir_obj;
+ yaffs_obj_t *next_return;
struct ylist_head others;
};
/*
- * yaffs_NewSearch() creates a new search context, initialises it and
+ * yaffs_new_search() creates a new search context, initialises it and
* adds it to the device's search context list.
*
* Called at start of readdir.
*/
-static struct yaffs_SearchContext * yaffs_NewSearch(yaffs_obj_t *dir)
+static struct yaffs_search_context * yaffs_new_search(yaffs_obj_t *dir)
{
yaffs_dev_t *dev = dir->my_dev;
- struct yaffs_SearchContext *sc = YMALLOC(sizeof(struct yaffs_SearchContext));
+ struct yaffs_search_context *sc = YMALLOC(sizeof(struct yaffs_search_context));
if(sc){
- sc->dirObj = dir;
+ sc->dir_obj = dir;
sc->dev = dev;
- if( ylist_empty(&sc->dirObj->variant.dir_variant.children))
- sc->nextReturn = NULL;
+ if( ylist_empty(&sc->dir_obj->variant.dir_variant.children))
+ sc->next_return = NULL;
else
- sc->nextReturn = ylist_entry(
+ sc->next_return = ylist_entry(
dir->variant.dir_variant.children.next,
yaffs_obj_t,siblings);
YINIT_LIST_HEAD(&sc->others);
- ylist_add(&sc->others,&(yaffs_dev_to_lc(dev)->searchContexts));
+ ylist_add(&sc->others,&(yaffs_dev_to_lc(dev)->search_contexts));
}
return sc;
}
@@ -426,7 +426,7 @@ static struct yaffs_SearchContext * yaffs_NewSearch(yaffs_obj_t *dir)
/*
* yaffs_search_end() disposes of a search context and cleans up.
*/
-static void yaffs_search_end(struct yaffs_SearchContext * sc)
+static void yaffs_search_end(struct yaffs_search_context * sc)
{
if(sc){
ylist_del(&sc->others);
@@ -439,21 +439,21 @@ static void yaffs_search_end(struct yaffs_SearchContext * sc)
* Called when the search iterates or when an object removal causes
* the search context to be moved to the next object.
*/
-static void yaffs_search_advance(struct yaffs_SearchContext *sc)
+static void yaffs_search_advance(struct yaffs_search_context *sc)
{
if(!sc)
return;
- if( sc->nextReturn == NULL ||
- ylist_empty(&sc->dirObj->variant.dir_variant.children))
- sc->nextReturn = NULL;
+ if( sc->next_return == NULL ||
+ ylist_empty(&sc->dir_obj->variant.dir_variant.children))
+ sc->next_return = NULL;
else {
- struct ylist_head *next = sc->nextReturn->siblings.next;
+ struct ylist_head *next = sc->next_return->siblings.next;
- if( next == &sc->dirObj->variant.dir_variant.children)
- sc->nextReturn = NULL; /* end of list */
+ if( next == &sc->dir_obj->variant.dir_variant.children)
+ sc->next_return = NULL; /* end of list */
else
- sc->nextReturn = ylist_entry(next,yaffs_obj_t,siblings);
+ sc->next_return = ylist_entry(next,yaffs_obj_t,siblings);
}
}
@@ -466,8 +466,8 @@ static void yaffs_remove_obj_callback(yaffs_obj_t *obj)
{
struct ylist_head *i;
- struct yaffs_SearchContext *sc;
- struct ylist_head *search_contexts = &(yaffs_dev_to_lc(obj->my_dev)->searchContexts);
+ struct yaffs_search_context *sc;
+ struct ylist_head *search_contexts = &(yaffs_dev_to_lc(obj->my_dev)->search_contexts);
/* Iterate through the directory search contexts.
@@ -476,8 +476,8 @@ static void yaffs_remove_obj_callback(yaffs_obj_t *obj)
*/
ylist_for_each(i, search_contexts) {
if (i) {
- sc = ylist_entry(i, struct yaffs_SearchContext,others);
- if(sc->nextReturn == obj)
+ sc = ylist_entry(i, struct yaffs_search_context,others);
+ if(sc->next_return == obj)
yaffs_search_advance(sc);
}
}
@@ -548,22 +548,22 @@ static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry,
yaffs_obj_t *obj;
struct inode *inode = NULL; /* NCB 2.5/2.6 needs NULL here */
- yaffs_dev_t *dev = yaffs_InodeToObject(dir)->my_dev;
+ yaffs_dev_t *dev = yaffs_inode_to_obj(dir)->my_dev;
- if(current != yaffs_dev_to_lc(dev)->readdirProcess)
+ if(current != yaffs_dev_to_lc(dev)->readdir_process)
yaffs_gross_lock(dev);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_lookup for %d:%s\n"),
- yaffs_InodeToObject(dir)->obj_id, dentry->d_name.name));
+ yaffs_inode_to_obj(dir)->obj_id, dentry->d_name.name));
- obj = yaffs_find_by_name(yaffs_InodeToObject(dir),
+ obj = yaffs_find_by_name(yaffs_inode_to_obj(dir),
dentry->d_name.name);
obj = yaffs_get_equivalent_obj(obj); /* in case it was a hardlink */
/* Can't hold gross lock when calling yaffs_get_inode() */
- if(current != yaffs_dev_to_lc(dev)->readdirProcess)
+ if(current != yaffs_dev_to_lc(dev)->readdir_process)
yaffs_gross_unlock(dev);
if (obj) {
@@ -620,7 +620,7 @@ static void yaffs_unstitch_obj(struct inode *inode, yaffs_obj_t *obj)
* the yaffs_obj_t.
*/
obj->my_inode = NULL;
- yaffs_InodeToObjectLV(inode) = NULL;
+ yaffs_inode_to_obj_lv(inode) = NULL;
/* If the object freeing was deferred, then the real
* free happens now.
@@ -639,7 +639,7 @@ static void yaffs_evict_inode( struct inode *inode)
yaffs_dev_t *dev;
int deleteme = 0;
- obj = yaffs_InodeToObject(inode);
+ obj = yaffs_inode_to_obj(inode);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_evict_inode: ino %d, count %d %s\n"), (int)inode->i_ino,
@@ -764,7 +764,7 @@ static int yaffs_writepage(struct page *page, struct writeback_control *wbc)
unsigned long end_index;
char *buffer;
yaffs_obj_t *obj;
- int nWritten = 0;
+ int n_written = 0;
unsigned n_bytes;
loff_t i_size;
@@ -805,7 +805,7 @@ static int yaffs_writepage(struct page *page, struct writeback_control *wbc)
buffer = kmap(page);
- obj = yaffs_InodeToObject(inode);
+ obj = yaffs_inode_to_obj(inode);
dev = obj->my_dev;
yaffs_gross_lock(dev);
@@ -816,7 +816,7 @@ static int yaffs_writepage(struct page *page, struct writeback_control *wbc)
(TSTR("writepag0: obj = %05x, ino = %05x\n"),
(int)obj->variant.file_variant.file_size, (int)inode->i_size));
- nWritten = yaffs_wr_file(obj, buffer,
+ n_written = yaffs_wr_file(obj, buffer,
page->index << PAGE_CACHE_SHIFT, n_bytes, 0);
yaffs_touch_super(dev);
@@ -833,7 +833,7 @@ static int yaffs_writepage(struct page *page, struct writeback_control *wbc)
end_page_writeback(page);
put_page(page);
- return (nWritten == n_bytes) ? 0 : -ENOSPC;
+ return (n_written == n_bytes) ? 0 : -ENOSPC;
}
@@ -1010,13 +1010,13 @@ static void yaffs_fill_inode_from_obj(struct inode *inode, yaffs_obj_t *obj)
break;
}
- yaffs_InodeToObjectLV(inode) = obj;
+ yaffs_inode_to_obj_lv(inode) = obj;
obj->my_inode = inode;
} else {
T(YAFFS_TRACE_OS,
- (TSTR("yaffs_FileInode invalid parameters\n")));
+ (TSTR("yaffs_fill_inode invalid parameters\n")));
}
}
@@ -1049,7 +1049,7 @@ struct inode *yaffs_get_inode(struct super_block *sb, int mode, int dev,
/* NB Side effect: iget calls back to yaffs_read_inode(). */
/* iget also increments the inode's i_count */
- /* NB You can't be holding grossLock or deadlock will happen! */
+ /* NB You can't be holding gross_lock or deadlock will happen! */
return inode;
}
@@ -1058,7 +1058,7 @@ static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n,
loff_t *pos)
{
yaffs_obj_t *obj;
- int nWritten, ipos;
+ int n_written, ipos;
struct inode *inode;
yaffs_dev_t *dev;
@@ -1084,7 +1084,7 @@ static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n,
"to object %d at %d(%x)\n"),
(unsigned) n, (unsigned) n, obj->obj_id, ipos,ipos));
- nWritten = yaffs_wr_file(obj, buf, ipos, n, 0);
+ n_written = yaffs_wr_file(obj, buf, ipos, n, 0);
yaffs_touch_super(dev);
@@ -1092,8 +1092,8 @@ static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n,
(TSTR("yaffs_file_write: %d(%x) bytes written\n"),
(unsigned )n,(unsigned)n));
- if (nWritten > 0) {
- ipos += nWritten;
+ if (n_written > 0) {
+ ipos += n_written;
*pos = ipos;
if (ipos > inode->i_size) {
inode->i_size = ipos;
@@ -1107,7 +1107,7 @@ static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n,
}
yaffs_gross_unlock(dev);
- return (nWritten == 0) && (n > 0) ? -ENOSPC : nWritten;
+ return (n_written == 0) && (n > 0) ? -ENOSPC : n_written;
}
/* Space holding and freeing is done to ensure we have space available for write_begin/end */
@@ -1182,11 +1182,11 @@ static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
{
yaffs_obj_t *obj;
yaffs_dev_t *dev;
- struct yaffs_SearchContext *sc;
+ struct yaffs_search_context *sc;
struct inode *inode = f->f_dentry->d_inode;
unsigned long offset, curoffs;
yaffs_obj_t *l;
- int retVal = 0;
+ int ret_val = 0;
char name[YAFFS_MAX_NAME_LENGTH + 1];
@@ -1195,13 +1195,13 @@ static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
yaffs_gross_lock(dev);
- yaffs_dev_to_lc(dev)->readdirProcess = current;
+ yaffs_dev_to_lc(dev)->readdir_process = current;
offset = f->f_pos;
- sc = yaffs_NewSearch(obj);
+ sc = yaffs_new_search(obj);
if(!sc){
- retVal = -ENOMEM;
+ ret_val = -ENOMEM;
goto out;
}
@@ -1245,9 +1245,9 @@ static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
f->f_version = inode->i_version;
}
- while(sc->nextReturn){
+ while(sc->next_return){
curoffs++;
- l = sc->nextReturn;
+ l = sc->next_return;
if (curoffs >= offset) {
int this_inode = yaffs_get_obj_inode(l);
int this_type = yaffs_get_obj_type(l);
@@ -1280,10 +1280,10 @@ static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
out:
yaffs_search_end(sc);
- yaffs_dev_to_lc(dev)->readdirProcess = NULL;
+ yaffs_dev_to_lc(dev)->readdir_process = NULL;
yaffs_gross_unlock(dev);
- return retVal;
+ return ret_val;
}
@@ -1302,7 +1302,7 @@ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
yaffs_obj_t *obj = NULL;
yaffs_dev_t *dev;
- yaffs_obj_t *parent = yaffs_InodeToObject(dir);
+ yaffs_obj_t *parent = yaffs_inode_to_obj(dir);
int error = -ENOSPC;
uid_t uid = YCRED(current)->fsuid;
@@ -1376,10 +1376,10 @@ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
{
- int retVal;
+ int ret_val;
T(YAFFS_TRACE_OS, (TSTR("yaffs_mkdir\n")));
- retVal = yaffs_mknod(dir, dentry, mode | S_IFDIR, 0);
- return retVal;
+ ret_val = yaffs_mknod(dir, dentry, mode | S_IFDIR, 0);
+ return ret_val;
}
static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode,
@@ -1391,7 +1391,7 @@ static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode,
static int yaffs_unlink(struct inode *dir, struct dentry *dentry)
{
- int retVal;
+ int ret_val;
yaffs_dev_t *dev;
yaffs_obj_t *obj;
@@ -1400,14 +1400,14 @@ static int yaffs_unlink(struct inode *dir, struct dentry *dentry)
(TSTR("yaffs_unlink %d:%s\n"),
(int)(dir->i_ino),
dentry->d_name.name));
- obj = yaffs_InodeToObject(dir);
+ obj = yaffs_inode_to_obj(dir);
dev = obj->my_dev;
yaffs_gross_lock(dev);
- retVal = yaffs_unlinker(obj, dentry->d_name.name);
+ ret_val = yaffs_unlinker(obj, dentry->d_name.name);
- if (retVal == YAFFS_OK) {
+ if (ret_val == YAFFS_OK) {
dentry->d_inode->i_nlink--;
dir->i_version++;
yaffs_gross_unlock(dev);
@@ -1432,13 +1432,13 @@ static int yaffs_link(struct dentry *old_dentry, struct inode *dir,
T(YAFFS_TRACE_OS, (TSTR("yaffs_link\n")));
- obj = yaffs_InodeToObject(inode);
+ obj = yaffs_inode_to_obj(inode);
dev = obj->my_dev;
yaffs_gross_lock(dev);
if (!S_ISDIR(inode->i_mode)) /* Don't link directories */
- link = yaffs_link_obj(yaffs_InodeToObject(dir), dentry->d_name.name,
+ link = yaffs_link_obj(yaffs_inode_to_obj(dir), dentry->d_name.name,
obj);
if (link) {
@@ -1471,9 +1471,9 @@ static int yaffs_symlink(struct inode *dir, struct dentry *dentry,
T(YAFFS_TRACE_OS, (TSTR("yaffs_symlink\n")));
- dev = yaffs_InodeToObject(dir)->my_dev;
+ dev = yaffs_inode_to_obj(dir)->my_dev;
yaffs_gross_lock(dev);
- obj = yaffs_create_symlink(yaffs_InodeToObject(dir), dentry->d_name.name,
+ obj = yaffs_create_symlink(yaffs_inode_to_obj(dir), dentry->d_name.name,
S_IFLNK | S_IRWXUGO, uid, gid, symname);
yaffs_gross_unlock(dev);
@@ -1520,16 +1520,16 @@ static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry)
{
yaffs_dev_t *dev;
- int retVal = YAFFS_FAIL;
+ int ret_val = YAFFS_FAIL;
yaffs_obj_t *target;
T(YAFFS_TRACE_OS, (TSTR("yaffs_rename\n")));
- dev = yaffs_InodeToObject(old_dir)->my_dev;
+ dev = yaffs_inode_to_obj(old_dir)->my_dev;
yaffs_gross_lock(dev);
/* Check if the target is an existing directory that is not empty. */
- target = yaffs_find_by_name(yaffs_InodeToObject(new_dir),
+ target = yaffs_find_by_name(yaffs_inode_to_obj(new_dir),
new_dentry->d_name.name);
@@ -1539,19 +1539,19 @@ static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry,
T(YAFFS_TRACE_OS, (TSTR("target is non-empty dir\n")));
- retVal = YAFFS_FAIL;
+ ret_val = YAFFS_FAIL;
} else {
/* Now does unlinking internally using shadowing mechanism */
T(YAFFS_TRACE_OS, (TSTR("calling yaffs_rename_obj\n")));
- retVal = yaffs_rename_obj(yaffs_InodeToObject(old_dir),
+ ret_val = yaffs_rename_obj(yaffs_inode_to_obj(old_dir),
old_dentry->d_name.name,
- yaffs_InodeToObject(new_dir),
+ yaffs_inode_to_obj(new_dir),
new_dentry->d_name.name);
}
yaffs_gross_unlock(dev);
- if (retVal == YAFFS_OK) {
+ if (ret_val == YAFFS_OK) {
if (target) {
new_dentry->d_inode->i_nlink--;
mark_inode_dirty(new_dentry->d_inode);
@@ -1574,7 +1574,7 @@ static int yaffs_setattr(struct dentry *dentry, struct iattr *attr)
T(YAFFS_TRACE_OS,
(TSTR("yaffs_setattr of object %d\n"),
- yaffs_InodeToObject(inode)->obj_id));
+ yaffs_inode_to_obj(inode)->obj_id));
/* Fail if a requested resize >= 2GB */
if (attr->ia_valid & ATTR_SIZE &&
@@ -1593,13 +1593,13 @@ static int yaffs_setattr(struct dentry *dentry, struct iattr *attr)
inode->i_blocks = (inode->i_size + 511) >> 9;
}
}
- dev = yaffs_InodeToObject(inode)->my_dev;
+ dev = yaffs_inode_to_obj(inode)->my_dev;
if (attr->ia_valid & ATTR_SIZE){
T(YAFFS_TRACE_OS,(TSTR("resize to %d(%x)\n"),
(int)(attr->ia_size),(int)(attr->ia_size)));
}
yaffs_gross_lock(dev);
- result = yaffs_set_attribs(yaffs_InodeToObject(inode), attr);
+ result = yaffs_set_attribs(yaffs_inode_to_obj(inode), attr);
if(result == YAFFS_OK) {
error = 0;
} else {
@@ -1622,7 +1622,7 @@ int yaffs_setxattr(struct dentry *dentry, const char *name,
struct inode *inode = dentry->d_inode;
int error = 0;
yaffs_dev_t *dev;
- yaffs_obj_t *obj = yaffs_InodeToObject(inode);
+ yaffs_obj_t *obj = yaffs_inode_to_obj(inode);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_setxattr of object %d\n"),
@@ -1654,7 +1654,7 @@ ssize_t yaffs_getxattr(struct dentry *dentry, const char *name, void *buff,
struct inode *inode = dentry->d_inode;
int error = 0;
yaffs_dev_t *dev;
- yaffs_obj_t *obj = yaffs_InodeToObject(inode);
+ yaffs_obj_t *obj = yaffs_inode_to_obj(inode);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_getxattr \"%s\" from object %d\n"),
@@ -1678,7 +1678,7 @@ int yaffs_removexattr(struct dentry *dentry, const char *name)
struct inode *inode = dentry->d_inode;
int error = 0;
yaffs_dev_t *dev;
- yaffs_obj_t *obj = yaffs_InodeToObject(inode);
+ yaffs_obj_t *obj = yaffs_inode_to_obj(inode);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_removexattr of object %d\n"),
@@ -1708,7 +1708,7 @@ ssize_t yaffs_listxattr(struct dentry *dentry, char *buff, size_t size)
struct inode *inode = dentry->d_inode;
int error = 0;
yaffs_dev_t *dev;
- yaffs_obj_t *obj = yaffs_InodeToObject(inode);
+ yaffs_obj_t *obj = yaffs_inode_to_obj(inode);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_listxattr of object %d\n"),
@@ -1747,21 +1747,21 @@ static int yaffs_statfs(struct dentry *dentry, struct kstatfs *buf)
if (dev->data_bytes_per_chunk & (dev->data_bytes_per_chunk - 1)) {
/* Do this if chunk size is not a power of 2 */
- uint64_t bytesInDev;
- uint64_t bytesFree;
+ uint64_t bytes_in_dev;
+ uint64_t bytes_free;
- bytesInDev = ((uint64_t)((dev->param.end_block - dev->param.start_block + 1))) *
+ bytes_in_dev = ((uint64_t)((dev->param.end_block - dev->param.start_block + 1))) *
((uint64_t)(dev->param.chunks_per_block * dev->data_bytes_per_chunk));
- do_div(bytesInDev, sb->s_blocksize); /* bytesInDev becomes the number of blocks */
- buf->f_blocks = bytesInDev;
+ do_div(bytes_in_dev, sb->s_blocksize); /* bytes_in_dev becomes the number of blocks */
+ buf->f_blocks = bytes_in_dev;
- bytesFree = ((uint64_t)(yaffs_get_n_free_chunks(dev))) *
+ bytes_free = ((uint64_t)(yaffs_get_n_free_chunks(dev))) *
((uint64_t)(dev->data_bytes_per_chunk));
- do_div(bytesFree, sb->s_blocksize);
+ do_div(bytes_free, sb->s_blocksize);
- buf->f_bfree = bytesFree;
+ buf->f_bfree = bytes_free;
} else if (sb->s_blocksize > dev->data_bytes_per_chunk) {
@@ -1799,7 +1799,7 @@ static void yaffs_flush_inodes(struct super_block *sb)
yaffs_obj_t *obj;
list_for_each_entry(iptr,&sb->s_inodes, i_sb_list){
- obj = yaffs_InodeToObject(iptr);
+ obj = yaffs_inode_to_obj(iptr);
if(obj){
T(YAFFS_TRACE_OS, (TSTR("flushing obj %d\n"),
obj->obj_id));
@@ -1811,7 +1811,7 @@ static void yaffs_flush_inodes(struct super_block *sb)
static void yaffs_flush_super(struct super_block *sb, int do_checkpoint)
{
- yaffs_dev_t *dev = yaffs_SuperToDevice(sb);
+ yaffs_dev_t *dev = yaffs_super_to_dev(sb);
if(!dev)
return;
@@ -1825,20 +1825,20 @@ static void yaffs_flush_super(struct super_block *sb, int do_checkpoint)
static unsigned yaffs_bg_gc_urgency(yaffs_dev_t *dev)
{
- unsigned erasedChunks = dev->n_erased_blocks * dev->param.chunks_per_block;
- struct yaffs_LinuxContext *context = yaffs_dev_to_lc(dev);
- unsigned scatteredFree = 0; /* Free chunks not in an erased block */
+ unsigned erased_chunks = dev->n_erased_blocks * dev->param.chunks_per_block;
+ struct yaffs_linux_context *context = yaffs_dev_to_lc(dev);
+ unsigned scattered = 0; /* Free chunks not in an erased block */
- if(erasedChunks < dev->n_free_chunks)
- scatteredFree = (dev->n_free_chunks - erasedChunks);
+ if(erased_chunks < dev->n_free_chunks)
+ scattered = (dev->n_free_chunks - erased_chunks);
- if(!context->bgRunning)
+ if(!context->bg_running)
return 0;
- else if(scatteredFree < (dev->param.chunks_per_block * 2))
+ else if(scattered < (dev->param.chunks_per_block * 2))
return 0;
- else if(erasedChunks > dev->n_free_chunks/2)
+ else if(erased_chunks > dev->n_free_chunks/2)
return 0;
- else if(erasedChunks > dev->n_free_chunks/4)
+ else if(erased_chunks > dev->n_free_chunks/4)
return 1;
else
return 2;
@@ -1848,7 +1848,7 @@ static int yaffs_do_sync_fs(struct super_block *sb,
int request_checkpoint)
{
- yaffs_dev_t *dev = yaffs_SuperToDevice(sb);
+ yaffs_dev_t *dev = yaffs_super_to_dev(sb);
unsigned int oneshot_checkpoint = (yaffs_auto_checkpoint & 4);
unsigned gc_urgent = yaffs_bg_gc_urgency(dev);
int do_checkpoint;
@@ -1897,14 +1897,14 @@ void yaffs_background_waker(unsigned long data)
static int yaffs_bg_thread_fn(void *data)
{
yaffs_dev_t *dev = (yaffs_dev_t *)data;
- struct yaffs_LinuxContext *context = yaffs_dev_to_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;
unsigned long expires;
unsigned int urgency;
- int gcResult;
+ int gc_result;
struct timer_list timer;
T(YAFFS_TRACE_BACKGROUND,
@@ -1912,7 +1912,7 @@ static int yaffs_bg_thread_fn(void *data)
(void *)dev));
set_freezable();
- while(context->bgRunning){
+ while(context->bg_running){
T(YAFFS_TRACE_BACKGROUND,
(TSTR("yaffs_background\n")));
@@ -1934,7 +1934,7 @@ static int yaffs_bg_thread_fn(void *data)
if(time_after(now,next_gc) && yaffs_bg_enable){
if(!dev->is_checkpointed){
urgency = yaffs_bg_gc_urgency(dev);
- gcResult = yaffs_bg_gc(dev, urgency);
+ gc_result = yaffs_bg_gc(dev, urgency);
if(urgency > 1)
next_gc = now + HZ/20+1;
else if(urgency > 0)
@@ -1971,33 +1971,33 @@ static int yaffs_bg_thread_fn(void *data)
static int yaffs_bg_start(yaffs_dev_t *dev)
{
int retval = 0;
- struct yaffs_LinuxContext *context = yaffs_dev_to_lc(dev);
+ struct yaffs_linux_context *context = yaffs_dev_to_lc(dev);
if(dev->read_only)
return -1;
- context->bgRunning = 1;
+ context->bg_running = 1;
- context->bgThread = kthread_run(yaffs_bg_thread_fn,
+ context->bg_thread = kthread_run(yaffs_bg_thread_fn,
(void *)dev,"yaffs-bg-%d",context->mount_id);
- if(IS_ERR(context->bgThread)){
- retval = PTR_ERR(context->bgThread);
- context->bgThread = NULL;
- context->bgRunning = 0;
+ if(IS_ERR(context->bg_thread)){
+ retval = PTR_ERR(context->bg_thread);
+ context->bg_thread = NULL;
+ context->bg_running = 0;
}
return retval;
}
static void yaffs_bg_stop(yaffs_dev_t *dev)
{
- struct yaffs_LinuxContext *ctxt = yaffs_dev_to_lc(dev);
+ struct yaffs_linux_context *ctxt = yaffs_dev_to_lc(dev);
- ctxt->bgRunning = 0;
+ ctxt->bg_running = 0;
- if( ctxt->bgThread){
- kthread_stop(ctxt->bgThread);
- ctxt->bgThread = NULL;
+ if( ctxt->bg_thread){
+ kthread_stop(ctxt->bg_thread);
+ ctxt->bg_thread = NULL;
}
}
@@ -2032,7 +2032,7 @@ static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino)
{
struct inode *inode;
yaffs_obj_t *obj;
- yaffs_dev_t *dev = yaffs_SuperToDevice(sb);
+ yaffs_dev_t *dev = yaffs_super_to_dev(sb);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_iget for %lu\n"), ino));
@@ -2065,7 +2065,7 @@ struct semaphore yaffs_context_lock;
static void yaffs_put_super(struct super_block *sb)
{
- yaffs_dev_t *dev = yaffs_SuperToDevice(sb);
+ yaffs_dev_t *dev = yaffs_super_to_dev(sb);
T(YAFFS_TRACE_OS, (TSTR("yaffs_put_super\n")));
@@ -2079,8 +2079,8 @@ static void yaffs_put_super(struct super_block *sb)
yaffs_flush_super(sb,1);
- if (yaffs_dev_to_lc(dev)->putSuperFunc)
- yaffs_dev_to_lc(dev)->putSuperFunc(sb);
+ if (yaffs_dev_to_lc(dev)->put_super_fn)
+ yaffs_dev_to_lc(dev)->put_super_fn(sb);
yaffs_deinitialise(dev);
@@ -2088,21 +2088,21 @@ 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)->contextList));
+ ylist_del_init(&(yaffs_dev_to_lc(dev)->context_list));
up(&yaffs_context_lock);
- if (yaffs_dev_to_lc(dev)->spareBuffer) {
- YFREE(yaffs_dev_to_lc(dev)->spareBuffer);
- yaffs_dev_to_lc(dev)->spareBuffer = 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);
}
-static void yaffs_MTDPutSuper(struct super_block *sb)
+static void yaffs_mtd_put_super(struct super_block *sb)
{
- struct mtd_info *mtd = yaffs_dev_to_mtd(yaffs_SuperToDevice(sb));
+ struct mtd_info *mtd = yaffs_dev_to_mtd(yaffs_super_to_dev(sb));
if (mtd->sync)
mtd->sync(mtd);
@@ -2113,7 +2113,7 @@ static void yaffs_MTDPutSuper(struct super_block *sb)
static void yaffs_touch_super(yaffs_dev_t *dev)
{
- struct super_block *sb = yaffs_dev_to_lc(dev)->superBlock;
+ struct super_block *sb = yaffs_dev_to_lc(dev)->super;
T(YAFFS_TRACE_OS, (TSTR("yaffs_touch_super() sb = %p\n"), sb));
if (sb)
@@ -2208,7 +2208,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
struct mtd_info *mtd;
int err;
char *data_str = (char *)data;
- struct yaffs_LinuxContext *context = NULL;
+ struct yaffs_linux_context *context = NULL;
yaffs_param_t *param;
int read_only = 0;
@@ -2217,7 +2217,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
unsigned mount_id;
int found;
- struct yaffs_LinuxContext *context_iterator;
+ struct yaffs_linux_context *context_iterator;
struct ylist_head *l;
sb->s_magic = YAFFS_MAGIC;
@@ -2371,7 +2371,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
}
dev = kmalloc(sizeof(yaffs_dev_t), GFP_KERNEL);
- context = kmalloc(sizeof(struct yaffs_LinuxContext),GFP_KERNEL);
+ context = kmalloc(sizeof(struct yaffs_linux_context),GFP_KERNEL);
if(!dev || !context ){
if(dev)
@@ -2392,11 +2392,11 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
memset(dev, 0, sizeof(yaffs_dev_t));
param = &(dev->param);
- memset(context,0,sizeof(struct yaffs_LinuxContext));
+ memset(context,0,sizeof(struct yaffs_linux_context));
dev->os_context = context;
- YINIT_LIST_HEAD(&(context->contextList));
+ YINIT_LIST_HEAD(&(context->context_list));
context->dev = dev;
- context->superBlock = sb;
+ context->super = sb;
dev->read_only = read_only;
@@ -2458,12 +2458,12 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
/* ... and the functions. */
if (yaffs_version == 2) {
param->write_chunk_tags_fn =
- nandmtd2_WriteChunkWithTagsToNAND;
+ nandmtd2_write_chunk_tags;
param->read_chunk_tags_fn =
- nandmtd2_ReadChunkWithTagsFromNAND;
- param->bad_block_fn = nandmtd2_MarkNANDBlockBad;
- param->query_block_fn = nandmtd2_QueryNANDBlock;
- yaffs_dev_to_lc(dev)->spareBuffer = YMALLOC(mtd->oobsize);
+ nandmtd2_read_chunk_tags;
+ param->bad_block_fn = nandmtd2_mark_block_bad;
+ param->query_block_fn = nandmtd2_query_block;
+ 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;
@@ -2474,23 +2474,23 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
} else {
/* use the MTD interface in yaffs_mtdif1.c */
param->write_chunk_tags_fn =
- nandmtd1_WriteChunkWithTagsToNAND;
+ nandmtd1_write_chunk_tags;
param->read_chunk_tags_fn =
- nandmtd1_ReadChunkWithTagsFromNAND;
- param->bad_block_fn = nandmtd1_MarkNANDBlockBad;
- param->query_block_fn = nandmtd1_QueryNANDBlock;
+ nandmtd1_read_chunk_tags;
+ param->bad_block_fn = nandmtd1_mark_block_bad;
+ param->query_block_fn = nandmtd1_query_block;
param->is_yaffs2 = 0;
}
/* ... and common functions */
- param->erase_fn = nandmtd_EraseBlockInNAND;
- param->initialise_flash_fn = nandmtd_InitialiseNAND;
+ param->erase_fn = nandmtd_erase_block;
+ param->initialise_flash_fn = nandmtd_initialise;
- yaffs_dev_to_lc(dev)->putSuperFunc = yaffs_MTDPutSuper;
+ 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;
- yaffs_dev_to_lc(dev)->superBlock= sb;
+ yaffs_dev_to_lc(dev)->super= sb;
#ifndef CONFIG_YAFFS_DOES_ECC
@@ -2510,21 +2510,21 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
for(mount_id=0; ! found; mount_id++){
found = 1;
ylist_for_each(l,&yaffs_context_list){
- context_iterator = ylist_entry(l,struct yaffs_LinuxContext,contextList);
+ context_iterator = ylist_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)->contextList), &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(&(yaffs_dev_to_lc(dev)->searchContexts));
+ YINIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->search_contexts));
param->remove_obj_fn = yaffs_remove_obj_callback;
- init_MUTEX(&(yaffs_dev_to_lc(dev)->grossLock));
+ init_MUTEX(&(yaffs_dev_to_lc(dev)->gross_lock));
yaffs_gross_lock(dev);
@@ -2537,7 +2537,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
if(err == YAFFS_OK)
yaffs_bg_start(dev);
- if(!context->bgThread)
+ if(!context->bg_thread)
param->defered_dir_update = 0;
@@ -2672,7 +2672,7 @@ static char *yaffs_dump_dev_part1(char *buf, yaffs_dev_t * dev)
buf += sprintf(buf, "n_gc_blocks........... %u\n", dev->n_gc_blocks);
buf += sprintf(buf, "bg_gcs................ %u\n", dev->bg_gcs);
buf += sprintf(buf, "n_retired_writes...... %u\n", dev->n_retired_writes);
- buf += sprintf(buf, "nRetireBlocks......... %u\n", dev->n_retired_blocks);
+ buf += sprintf(buf, "n_retired_blocks...... %u\n", dev->n_retired_blocks);
buf += sprintf(buf, "n_ecc_fixed........... %u\n", dev->n_ecc_fixed);
buf += sprintf(buf, "n_ecc_unfixed......... %u\n", dev->n_ecc_unfixed);
buf += sprintf(buf, "n_tags_ecc_fixed...... %u\n", dev->n_tags_ecc_fixed);
@@ -2715,7 +2715,7 @@ static int yaffs_proc_read(char *page,
/* Locate and print the Nth entry. Order N-squared but N is small. */
ylist_for_each(item, &yaffs_context_list) {
- struct yaffs_LinuxContext *dc = ylist_entry(item, struct yaffs_LinuxContext, contextList);
+ struct yaffs_linux_context *dc = ylist_entry(item, struct yaffs_linux_context, context_list);
yaffs_dev_t *dev = dc->dev;
if (n < (step & ~1)) {
@@ -2748,15 +2748,15 @@ static int yaffs_stats_proc_read(char *page,
/* Locate and print the Nth entry. Order N-squared but N is small. */
ylist_for_each(item, &yaffs_context_list) {
- struct yaffs_LinuxContext *dc = ylist_entry(item, struct yaffs_LinuxContext, contextList);
+ struct yaffs_linux_context *dc = ylist_entry(item, struct yaffs_linux_context, context_list);
yaffs_dev_t *dev = dc->dev;
- int erasedChunks;
+ int erased_chunks;
- erasedChunks = dev->n_erased_blocks * dev->param.chunks_per_block;
+ erased_chunks = dev->n_erased_blocks * dev->param.chunks_per_block;
buf += sprintf(buf,"%d, %d, %d, %u, %u, %u, %u\n",
- n, dev->n_free_chunks, erasedChunks,
+ n, dev->n_free_chunks, erased_chunks,
dev->bg_gcs, dev->oldest_dirty_gc_count,
dev->n_obj, dev->n_tnodes);
}
diff --git a/yaffs_vfs_multi.c b/yaffs_vfs_multi.c
index 0f1ecee..d6c25b5 100644
--- a/yaffs_vfs_multi.c
+++ b/yaffs_vfs_multi.c
@@ -204,18 +204,18 @@ static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino);
#endif
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 18))
-#define yaffs_InodeToObjectLV(iptr) ((iptr)->i_private)
+#define yaffs_inode_to_obj_lv(iptr) ((iptr)->i_private)
#else
-#define yaffs_InodeToObjectLV(iptr) ((iptr)->u.generic_ip)
+#define yaffs_inode_to_obj_lv(iptr) ((iptr)->u.generic_ip)
#endif
-#define yaffs_InodeToObject(iptr) ((yaffs_obj_t *)(yaffs_InodeToObjectLV(iptr)))
-#define yaffs_dentry_to_obj(dptr) yaffs_InodeToObject((dptr)->d_inode)
+#define yaffs_inode_to_obj(iptr) ((yaffs_obj_t *)(yaffs_inode_to_obj_lv(iptr)))
+#define yaffs_dentry_to_obj(dptr) yaffs_inode_to_obj((dptr)->d_inode)
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
-#define yaffs_SuperToDevice(sb) ((yaffs_dev_t *)sb->s_fs_info)
+#define yaffs_super_to_dev(sb) ((yaffs_dev_t *)sb->s_fs_info)
#else
-#define yaffs_SuperToDevice(sb) ((yaffs_dev_t *)sb->u.generic_sbp)
+#define yaffs_super_to_dev(sb) ((yaffs_dev_t *)sb->u.generic_sbp)
#endif
@@ -515,14 +515,14 @@ static unsigned yaffs_gc_control_callback(yaffs_dev_t *dev)
static void yaffs_gross_lock(yaffs_dev_t *dev)
{
T(YAFFS_TRACE_LOCK, (TSTR("yaffs locking %p\n"), current));
- down(&(yaffs_dev_to_lc(dev)->grossLock));
+ down(&(yaffs_dev_to_lc(dev)->gross_lock));
T(YAFFS_TRACE_LOCK, (TSTR("yaffs locked %p\n"), current));
}
static void yaffs_gross_unlock(yaffs_dev_t *dev)
{
T(YAFFS_TRACE_LOCK, (TSTR("yaffs unlocking %p\n"), current));
- up(&(yaffs_dev_to_lc(dev)->grossLock));
+ up(&(yaffs_dev_to_lc(dev)->gross_lock));
}
#ifdef YAFFS_COMPILE_EXPORTFS
@@ -555,7 +555,7 @@ struct dentry *yaffs2_get_parent(struct dentry *dentry)
yaffs_obj_t *d_obj;
yaffs_obj_t *parent_obj;
- d_obj = yaffs_InodeToObject(dentry->d_inode);
+ d_obj = yaffs_inode_to_obj(dentry->d_inode);
if (d_obj) {
parent_obj = d_obj->parent;
@@ -610,34 +610,34 @@ static struct export_operations yaffs_export_ops =
* All these functions must be called while yaffs is locked.
*/
-struct yaffs_SearchContext {
+struct yaffs_search_context {
yaffs_dev_t *dev;
- yaffs_obj_t *dirObj;
- yaffs_obj_t *nextReturn;
+ yaffs_obj_t *dir_obj;
+ yaffs_obj_t *next_return;
struct ylist_head others;
};
/*
- * yaffs_NewSearch() creates a new search context, initialises it and
+ * yaffs_new_search() creates a new search context, initialises it and
* adds it to the device's search context list.
*
* Called at start of readdir.
*/
-static struct yaffs_SearchContext * yaffs_NewSearch(yaffs_obj_t *dir)
+static struct yaffs_search_context * yaffs_new_search(yaffs_obj_t *dir)
{
yaffs_dev_t *dev = dir->my_dev;
- struct yaffs_SearchContext *sc = YMALLOC(sizeof(struct yaffs_SearchContext));
+ struct yaffs_search_context *sc = YMALLOC(sizeof(struct yaffs_search_context));
if(sc){
- sc->dirObj = dir;
+ sc->dir_obj = dir;
sc->dev = dev;
- if( ylist_empty(&sc->dirObj->variant.dir_variant.children))
- sc->nextReturn = NULL;
+ if( ylist_empty(&sc->dir_obj->variant.dir_variant.children))
+ sc->next_return = NULL;
else
- sc->nextReturn = ylist_entry(
+ sc->next_return = ylist_entry(
dir->variant.dir_variant.children.next,
yaffs_obj_t,siblings);
YINIT_LIST_HEAD(&sc->others);
- ylist_add(&sc->others,&(yaffs_dev_to_lc(dev)->searchContexts));
+ ylist_add(&sc->others,&(yaffs_dev_to_lc(dev)->search_contexts));
}
return sc;
}
@@ -645,7 +645,7 @@ static struct yaffs_SearchContext * yaffs_NewSearch(yaffs_obj_t *dir)
/*
* yaffs_search_end() disposes of a search context and cleans up.
*/
-static void yaffs_search_end(struct yaffs_SearchContext * sc)
+static void yaffs_search_end(struct yaffs_search_context * sc)
{
if(sc){
ylist_del(&sc->others);
@@ -658,21 +658,21 @@ static void yaffs_search_end(struct yaffs_SearchContext * sc)
* Called when the search iterates or when an object removal causes
* the search context to be moved to the next object.
*/
-static void yaffs_search_advance(struct yaffs_SearchContext *sc)
+static void yaffs_search_advance(struct yaffs_search_context *sc)
{
if(!sc)
return;
- if( sc->nextReturn == NULL ||
- ylist_empty(&sc->dirObj->variant.dir_variant.children))
- sc->nextReturn = NULL;
+ if( sc->next_return == NULL ||
+ ylist_empty(&sc->dir_obj->variant.dir_variant.children))
+ sc->next_return = NULL;
else {
- struct ylist_head *next = sc->nextReturn->siblings.next;
+ struct ylist_head *next = sc->next_return->siblings.next;
- if( next == &sc->dirObj->variant.dir_variant.children)
- sc->nextReturn = NULL; /* end of list */
+ if( next == &sc->dir_obj->variant.dir_variant.children)
+ sc->next_return = NULL; /* end of list */
else
- sc->nextReturn = ylist_entry(next,yaffs_obj_t,siblings);
+ sc->next_return = ylist_entry(next,yaffs_obj_t,siblings);
}
}
@@ -685,8 +685,8 @@ static void yaffs_remove_obj_callback(yaffs_obj_t *obj)
{
struct ylist_head *i;
- struct yaffs_SearchContext *sc;
- struct ylist_head *search_contexts = &(yaffs_dev_to_lc(obj->my_dev)->searchContexts);
+ struct yaffs_search_context *sc;
+ struct ylist_head *search_contexts = &(yaffs_dev_to_lc(obj->my_dev)->search_contexts);
/* Iterate through the directory search contexts.
@@ -695,8 +695,8 @@ static void yaffs_remove_obj_callback(yaffs_obj_t *obj)
*/
ylist_for_each(i, search_contexts) {
if (i) {
- sc = ylist_entry(i, struct yaffs_SearchContext,others);
- if(sc->nextReturn == obj)
+ sc = ylist_entry(i, struct yaffs_search_context,others);
+ if(sc->next_return == obj)
yaffs_search_advance(sc);
}
}
@@ -784,22 +784,22 @@ static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry)
yaffs_obj_t *obj;
struct inode *inode = NULL; /* NCB 2.5/2.6 needs NULL here */
- yaffs_dev_t *dev = yaffs_InodeToObject(dir)->my_dev;
+ yaffs_dev_t *dev = yaffs_inode_to_obj(dir)->my_dev;
- if(current != yaffs_dev_to_lc(dev)->readdirProcess)
+ if(current != yaffs_dev_to_lc(dev)->readdir_process)
yaffs_gross_lock(dev);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_lookup for %d:%s\n"),
- yaffs_InodeToObject(dir)->obj_id, dentry->d_name.name));
+ yaffs_inode_to_obj(dir)->obj_id, dentry->d_name.name));
- obj = yaffs_find_by_name(yaffs_InodeToObject(dir),
+ obj = yaffs_find_by_name(yaffs_inode_to_obj(dir),
dentry->d_name.name);
obj = yaffs_get_equivalent_obj(obj); /* in case it was a hardlink */
/* Can't hold gross lock when calling yaffs_get_inode() */
- if(current != yaffs_dev_to_lc(dev)->readdirProcess)
+ if(current != yaffs_dev_to_lc(dev)->readdir_process)
yaffs_gross_unlock(dev);
if (obj) {
@@ -856,7 +856,7 @@ static void yaffs_unstitch_obj(struct inode *inode, yaffs_obj_t *obj)
* the yaffs_obj_t.
*/
obj->my_inode = NULL;
- yaffs_InodeToObjectLV(inode) = NULL;
+ yaffs_inode_to_obj_lv(inode) = NULL;
/* If the object freeing was deferred, then the real
* free happens now.
@@ -876,7 +876,7 @@ static void yaffs_evict_inode( struct inode *inode)
yaffs_dev_t *dev;
int deleteme = 0;
- obj = yaffs_InodeToObject(inode);
+ obj = yaffs_inode_to_obj(inode);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_evict_inode: ino %d, count %d %s\n"), (int)inode->i_ino,
@@ -917,7 +917,7 @@ static void yaffs_clear_inode(struct inode *inode)
yaffs_obj_t *obj;
yaffs_dev_t *dev;
- obj = yaffs_InodeToObject(inode);
+ obj = yaffs_inode_to_obj(inode);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_clear_inode: ino %d, count %d %s\n"), (int)inode->i_ino,
@@ -940,7 +940,7 @@ static void yaffs_clear_inode(struct inode *inode)
*/
static void yaffs_delete_inode(struct inode *inode)
{
- yaffs_obj_t *obj = yaffs_InodeToObject(inode);
+ yaffs_obj_t *obj = yaffs_inode_to_obj(inode);
yaffs_dev_t *dev;
T(YAFFS_TRACE_OS,
@@ -1071,7 +1071,7 @@ static int yaffs_writepage(struct page *page)
unsigned long end_index;
char *buffer;
yaffs_obj_t *obj;
- int nWritten = 0;
+ int n_written = 0;
unsigned n_bytes;
loff_t i_size;
@@ -1112,7 +1112,7 @@ static int yaffs_writepage(struct page *page)
buffer = kmap(page);
- obj = yaffs_InodeToObject(inode);
+ obj = yaffs_inode_to_obj(inode);
dev = obj->my_dev;
yaffs_gross_lock(dev);
@@ -1123,7 +1123,7 @@ static int yaffs_writepage(struct page *page)
(TSTR("writepag0: obj = %05x, ino = %05x\n"),
(int)obj->variant.file_variant.file_size, (int)inode->i_size));
- nWritten = yaffs_wr_file(obj, buffer,
+ n_written = yaffs_wr_file(obj, buffer,
page->index << PAGE_CACHE_SHIFT, n_bytes, 0);
yaffs_touch_super(dev);
@@ -1140,7 +1140,7 @@ static int yaffs_writepage(struct page *page)
end_page_writeback(page);
put_page(page);
- return (nWritten == n_bytes) ? 0 : -ENOSPC;
+ return (n_written == n_bytes) ? 0 : -ENOSPC;
}
@@ -1260,7 +1260,7 @@ static int yaffs_commit_write(struct file *f, struct page *pg, unsigned offset,
loff_t pos = (((loff_t) pg->index) << PAGE_CACHE_SHIFT) + offset;
int n_bytes = to - offset;
- int nWritten;
+ int n_written;
unsigned spos = pos;
unsigned saddr;
@@ -1274,12 +1274,12 @@ static int yaffs_commit_write(struct file *f, struct page *pg, unsigned offset,
(TSTR("yaffs_commit_write addr %x pos %x n_bytes %d\n"),
saddr, spos, n_bytes));
- nWritten = yaffs_file_write(f, addr, n_bytes, &pos);
+ n_written = yaffs_file_write(f, addr, n_bytes, &pos);
- if (nWritten != n_bytes) {
+ if (n_written != n_bytes) {
T(YAFFS_TRACE_OS,
- (TSTR("yaffs_commit_write not same size nWritten %d n_bytes %d\n"),
- nWritten, n_bytes));
+ (TSTR("yaffs_commit_write not same size n_written %d n_bytes %d\n"),
+ n_written, n_bytes));
SetPageError(pg);
} else {
/* Nothing */
@@ -1289,9 +1289,9 @@ static int yaffs_commit_write(struct file *f, struct page *pg, unsigned offset,
T(YAFFS_TRACE_OS,
(TSTR("yaffs_commit_write returning %d\n"),
- nWritten == n_bytes ? 0 : nWritten));
+ n_written == n_bytes ? 0 : n_written));
- return nWritten == n_bytes ? 0 : nWritten;
+ return n_written == n_bytes ? 0 : n_written;
}
#endif
@@ -1392,13 +1392,13 @@ static void yaffs_fill_inode_from_obj(struct inode *inode, yaffs_obj_t *obj)
break;
}
- yaffs_InodeToObjectLV(inode) = obj;
+ yaffs_inode_to_obj_lv(inode) = obj;
obj->my_inode = inode;
} else {
T(YAFFS_TRACE_OS,
- (TSTR("yaffs_FileInode invalid parameters\n")));
+ (TSTR("yaffs_fill_inode invalid parameters\n")));
}
}
@@ -1431,7 +1431,7 @@ struct inode *yaffs_get_inode(struct super_block *sb, int mode, int dev,
/* NB Side effect: iget calls back to yaffs_read_inode(). */
/* iget also increments the inode's i_count */
- /* NB You can't be holding grossLock or deadlock will happen! */
+ /* NB You can't be holding gross_lock or deadlock will happen! */
return inode;
}
@@ -1440,7 +1440,7 @@ static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n,
loff_t *pos)
{
yaffs_obj_t *obj;
- int nWritten, ipos;
+ int n_written, ipos;
struct inode *inode;
yaffs_dev_t *dev;
@@ -1466,7 +1466,7 @@ static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n,
"to object %d at %d(%x)\n"),
(unsigned) n, (unsigned) n, obj->obj_id, ipos,ipos));
- nWritten = yaffs_wr_file(obj, buf, ipos, n, 0);
+ n_written = yaffs_wr_file(obj, buf, ipos, n, 0);
yaffs_touch_super(dev);
@@ -1474,8 +1474,8 @@ static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n,
(TSTR("yaffs_file_write: %d(%x) bytes written\n"),
(unsigned )n,(unsigned)n));
- if (nWritten > 0) {
- ipos += nWritten;
+ if (n_written > 0) {
+ ipos += n_written;
*pos = ipos;
if (ipos > inode->i_size) {
inode->i_size = ipos;
@@ -1489,7 +1489,7 @@ static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n,
}
yaffs_gross_unlock(dev);
- return (nWritten == 0) && (n > 0) ? -ENOSPC : nWritten;
+ return (n_written == 0) && (n > 0) ? -ENOSPC : n_written;
}
/* Space holding and freeing is done to ensure we have space available for write_begin/end */
@@ -1564,11 +1564,11 @@ static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
{
yaffs_obj_t *obj;
yaffs_dev_t *dev;
- struct yaffs_SearchContext *sc;
+ struct yaffs_search_context *sc;
struct inode *inode = f->f_dentry->d_inode;
unsigned long offset, curoffs;
yaffs_obj_t *l;
- int retVal = 0;
+ int ret_val = 0;
char name[YAFFS_MAX_NAME_LENGTH + 1];
@@ -1577,13 +1577,13 @@ static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
yaffs_gross_lock(dev);
- yaffs_dev_to_lc(dev)->readdirProcess = current;
+ yaffs_dev_to_lc(dev)->readdir_process = current;
offset = f->f_pos;
- sc = yaffs_NewSearch(obj);
+ sc = yaffs_new_search(obj);
if(!sc){
- retVal = -ENOMEM;
+ ret_val = -ENOMEM;
goto out;
}
@@ -1627,9 +1627,9 @@ static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
f->f_version = inode->i_version;
}
- while(sc->nextReturn){
+ while(sc->next_return){
curoffs++;
- l = sc->nextReturn;
+ l = sc->next_return;
if (curoffs >= offset) {
int this_inode = yaffs_get_obj_inode(l);
int this_type = yaffs_get_obj_type(l);
@@ -1662,10 +1662,10 @@ static int yaffs_readdir(struct file *f, void *dirent, filldir_t filldir)
out:
yaffs_search_end(sc);
- yaffs_dev_to_lc(dev)->readdirProcess = NULL;
+ yaffs_dev_to_lc(dev)->readdir_process = NULL;
yaffs_gross_unlock(dev);
- return retVal;
+ return ret_val;
}
@@ -1693,7 +1693,7 @@ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
yaffs_obj_t *obj = NULL;
yaffs_dev_t *dev;
- yaffs_obj_t *parent = yaffs_InodeToObject(dir);
+ yaffs_obj_t *parent = yaffs_inode_to_obj(dir);
int error = -ENOSPC;
uid_t uid = YCRED(current)->fsuid;
@@ -1772,10 +1772,10 @@ static int yaffs_mknod(struct inode *dir, struct dentry *dentry, int mode,
static int yaffs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
{
- int retVal;
+ int ret_val;
T(YAFFS_TRACE_OS, (TSTR("yaffs_mkdir\n")));
- retVal = yaffs_mknod(dir, dentry, mode | S_IFDIR, 0);
- return retVal;
+ ret_val = yaffs_mknod(dir, dentry, mode | S_IFDIR, 0);
+ return ret_val;
}
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
@@ -1791,7 +1791,7 @@ static int yaffs_create(struct inode *dir, struct dentry *dentry, int mode)
static int yaffs_unlink(struct inode *dir, struct dentry *dentry)
{
- int retVal;
+ int ret_val;
yaffs_dev_t *dev;
yaffs_obj_t *obj;
@@ -1800,14 +1800,14 @@ static int yaffs_unlink(struct inode *dir, struct dentry *dentry)
(TSTR("yaffs_unlink %d:%s\n"),
(int)(dir->i_ino),
dentry->d_name.name));
- obj = yaffs_InodeToObject(dir);
+ obj = yaffs_inode_to_obj(dir);
dev = obj->my_dev;
yaffs_gross_lock(dev);
- retVal = yaffs_unlinker(obj, dentry->d_name.name);
+ ret_val = yaffs_unlinker(obj, dentry->d_name.name);
- if (retVal == YAFFS_OK) {
+ if (ret_val == YAFFS_OK) {
dentry->d_inode->i_nlink--;
dir->i_version++;
yaffs_gross_unlock(dev);
@@ -1832,13 +1832,13 @@ static int yaffs_link(struct dentry *old_dentry, struct inode *dir,
T(YAFFS_TRACE_OS, (TSTR("yaffs_link\n")));
- obj = yaffs_InodeToObject(inode);
+ obj = yaffs_inode_to_obj(inode);
dev = obj->my_dev;
yaffs_gross_lock(dev);
if (!S_ISDIR(inode->i_mode)) /* Don't link directories */
- link = yaffs_link_obj(yaffs_InodeToObject(dir), dentry->d_name.name,
+ link = yaffs_link_obj(yaffs_inode_to_obj(dir), dentry->d_name.name,
obj);
if (link) {
@@ -1871,9 +1871,9 @@ static int yaffs_symlink(struct inode *dir, struct dentry *dentry,
T(YAFFS_TRACE_OS, (TSTR("yaffs_symlink\n")));
- dev = yaffs_InodeToObject(dir)->my_dev;
+ dev = yaffs_inode_to_obj(dir)->my_dev;
yaffs_gross_lock(dev);
- obj = yaffs_create_symlink(yaffs_InodeToObject(dir), dentry->d_name.name,
+ obj = yaffs_create_symlink(yaffs_inode_to_obj(dir), dentry->d_name.name,
S_IFLNK | S_IRWXUGO, uid, gid, symname);
yaffs_gross_unlock(dev);
@@ -1927,16 +1927,16 @@ static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry)
{
yaffs_dev_t *dev;
- int retVal = YAFFS_FAIL;
+ int ret_val = YAFFS_FAIL;
yaffs_obj_t *target;
T(YAFFS_TRACE_OS, (TSTR("yaffs_rename\n")));
- dev = yaffs_InodeToObject(old_dir)->my_dev;
+ dev = yaffs_inode_to_obj(old_dir)->my_dev;
yaffs_gross_lock(dev);
/* Check if the target is an existing directory that is not empty. */
- target = yaffs_find_by_name(yaffs_InodeToObject(new_dir),
+ target = yaffs_find_by_name(yaffs_inode_to_obj(new_dir),
new_dentry->d_name.name);
@@ -1946,19 +1946,19 @@ static int yaffs_rename(struct inode *old_dir, struct dentry *old_dentry,
T(YAFFS_TRACE_OS, (TSTR("target is non-empty dir\n")));
- retVal = YAFFS_FAIL;
+ ret_val = YAFFS_FAIL;
} else {
/* Now does unlinking internally using shadowing mechanism */
T(YAFFS_TRACE_OS, (TSTR("calling yaffs_rename_obj\n")));
- retVal = yaffs_rename_obj(yaffs_InodeToObject(old_dir),
+ ret_val = yaffs_rename_obj(yaffs_inode_to_obj(old_dir),
old_dentry->d_name.name,
- yaffs_InodeToObject(new_dir),
+ yaffs_inode_to_obj(new_dir),
new_dentry->d_name.name);
}
yaffs_gross_unlock(dev);
- if (retVal == YAFFS_OK) {
+ if (ret_val == YAFFS_OK) {
if (target) {
new_dentry->d_inode->i_nlink--;
mark_inode_dirty(new_dentry->d_inode);
@@ -1981,7 +1981,7 @@ static int yaffs_setattr(struct dentry *dentry, struct iattr *attr)
T(YAFFS_TRACE_OS,
(TSTR("yaffs_setattr of object %d\n"),
- yaffs_InodeToObject(inode)->obj_id));
+ yaffs_inode_to_obj(inode)->obj_id));
/* Fail if a requested resize >= 2GB */
if (attr->ia_valid & ATTR_SIZE &&
@@ -2000,13 +2000,13 @@ static int yaffs_setattr(struct dentry *dentry, struct iattr *attr)
inode->i_blocks = (inode->i_size + 511) >> 9;
}
}
- dev = yaffs_InodeToObject(inode)->my_dev;
+ dev = yaffs_inode_to_obj(inode)->my_dev;
if (attr->ia_valid & ATTR_SIZE){
T(YAFFS_TRACE_OS,(TSTR("resize to %d(%x)\n"),
(int)(attr->ia_size),(int)(attr->ia_size)));
}
yaffs_gross_lock(dev);
- result = yaffs_set_attribs(yaffs_InodeToObject(inode), attr);
+ result = yaffs_set_attribs(yaffs_inode_to_obj(inode), attr);
if(result == YAFFS_OK) {
error = 0;
} else {
@@ -2029,7 +2029,7 @@ int yaffs_setxattr(struct dentry *dentry, const char *name,
struct inode *inode = dentry->d_inode;
int error = 0;
yaffs_dev_t *dev;
- yaffs_obj_t *obj = yaffs_InodeToObject(inode);
+ yaffs_obj_t *obj = yaffs_inode_to_obj(inode);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_setxattr of object %d\n"),
@@ -2061,7 +2061,7 @@ ssize_t yaffs_getxattr(struct dentry *dentry, const char *name, void *buff,
struct inode *inode = dentry->d_inode;
int error = 0;
yaffs_dev_t *dev;
- yaffs_obj_t *obj = yaffs_InodeToObject(inode);
+ yaffs_obj_t *obj = yaffs_inode_to_obj(inode);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_getxattr \"%s\" from object %d\n"),
@@ -2085,7 +2085,7 @@ int yaffs_removexattr(struct dentry *dentry, const char *name)
struct inode *inode = dentry->d_inode;
int error = 0;
yaffs_dev_t *dev;
- yaffs_obj_t *obj = yaffs_InodeToObject(inode);
+ yaffs_obj_t *obj = yaffs_inode_to_obj(inode);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_removexattr of object %d\n"),
@@ -2115,7 +2115,7 @@ ssize_t yaffs_listxattr(struct dentry *dentry, char *buff, size_t size)
struct inode *inode = dentry->d_inode;
int error = 0;
yaffs_dev_t *dev;
- yaffs_obj_t *obj = yaffs_InodeToObject(inode);
+ yaffs_obj_t *obj = yaffs_inode_to_obj(inode);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_listxattr of object %d\n"),
@@ -2146,11 +2146,11 @@ static int yaffs_statfs(struct dentry *dentry, struct kstatfs *buf)
#elif (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
static int yaffs_statfs(struct super_block *sb, struct kstatfs *buf)
{
- yaffs_dev_t *dev = yaffs_SuperToDevice(sb);
+ yaffs_dev_t *dev = yaffs_super_to_dev(sb);
#else
static int yaffs_statfs(struct super_block *sb, struct statfs *buf)
{
- yaffs_dev_t *dev = yaffs_SuperToDevice(sb);
+ yaffs_dev_t *dev = yaffs_super_to_dev(sb);
#endif
T(YAFFS_TRACE_OS, (TSTR("yaffs_statfs\n")));
@@ -2164,21 +2164,21 @@ static int yaffs_statfs(struct super_block *sb, struct statfs *buf)
if (dev->data_bytes_per_chunk & (dev->data_bytes_per_chunk - 1)) {
/* Do this if chunk size is not a power of 2 */
- uint64_t bytesInDev;
- uint64_t bytesFree;
+ uint64_t bytes_in_dev;
+ uint64_t bytes_free;
- bytesInDev = ((uint64_t)((dev->param.end_block - dev->param.start_block + 1))) *
+ bytes_in_dev = ((uint64_t)((dev->param.end_block - dev->param.start_block + 1))) *
((uint64_t)(dev->param.chunks_per_block * dev->data_bytes_per_chunk));
- do_div(bytesInDev, sb->s_blocksize); /* bytesInDev becomes the number of blocks */
- buf->f_blocks = bytesInDev;
+ do_div(bytes_in_dev, sb->s_blocksize); /* bytes_in_dev becomes the number of blocks */
+ buf->f_blocks = bytes_in_dev;
- bytesFree = ((uint64_t)(yaffs_get_n_free_chunks(dev))) *
+ bytes_free = ((uint64_t)(yaffs_get_n_free_chunks(dev))) *
((uint64_t)(dev->data_bytes_per_chunk));
- do_div(bytesFree, sb->s_blocksize);
+ do_div(bytes_free, sb->s_blocksize);
- buf->f_bfree = bytesFree;
+ buf->f_bfree = bytes_free;
} else if (sb->s_blocksize > dev->data_bytes_per_chunk) {
@@ -2216,7 +2216,7 @@ static void yaffs_flush_inodes(struct super_block *sb)
yaffs_obj_t *obj;
list_for_each_entry(iptr,&sb->s_inodes, i_sb_list){
- obj = yaffs_InodeToObject(iptr);
+ obj = yaffs_inode_to_obj(iptr);
if(obj){
T(YAFFS_TRACE_OS, (TSTR("flushing obj %d\n"),
obj->obj_id));
@@ -2228,7 +2228,7 @@ static void yaffs_flush_inodes(struct super_block *sb)
static void yaffs_flush_super(struct super_block *sb, int do_checkpoint)
{
- yaffs_dev_t *dev = yaffs_SuperToDevice(sb);
+ yaffs_dev_t *dev = yaffs_super_to_dev(sb);
if(!dev)
return;
@@ -2242,20 +2242,20 @@ static void yaffs_flush_super(struct super_block *sb, int do_checkpoint)
static unsigned yaffs_bg_gc_urgency(yaffs_dev_t *dev)
{
- unsigned erasedChunks = dev->n_erased_blocks * dev->param.chunks_per_block;
- struct yaffs_LinuxContext *context = yaffs_dev_to_lc(dev);
- unsigned scatteredFree = 0; /* Free chunks not in an erased block */
+ unsigned erased_chunks = dev->n_erased_blocks * dev->param.chunks_per_block;
+ struct yaffs_linux_context *context = yaffs_dev_to_lc(dev);
+ unsigned scattered = 0; /* Free chunks not in an erased block */
- if(erasedChunks < dev->n_free_chunks)
- scatteredFree = (dev->n_free_chunks - erasedChunks);
+ if(erased_chunks < dev->n_free_chunks)
+ scattered = (dev->n_free_chunks - erased_chunks);
- if(!context->bgRunning)
+ if(!context->bg_running)
return 0;
- else if(scatteredFree < (dev->param.chunks_per_block * 2))
+ else if(scattered < (dev->param.chunks_per_block * 2))
return 0;
- else if(erasedChunks > dev->n_free_chunks/2)
+ else if(erased_chunks > dev->n_free_chunks/2)
return 0;
- else if(erasedChunks > dev->n_free_chunks/4)
+ else if(erased_chunks > dev->n_free_chunks/4)
return 1;
else
return 2;
@@ -2265,7 +2265,7 @@ static int yaffs_do_sync_fs(struct super_block *sb,
int request_checkpoint)
{
- yaffs_dev_t *dev = yaffs_SuperToDevice(sb);
+ yaffs_dev_t *dev = yaffs_super_to_dev(sb);
unsigned int oneshot_checkpoint = (yaffs_auto_checkpoint & 4);
unsigned gc_urgent = yaffs_bg_gc_urgency(dev);
int do_checkpoint;
@@ -2315,14 +2315,14 @@ void yaffs_background_waker(unsigned long data)
static int yaffs_bg_thread_fn(void *data)
{
yaffs_dev_t *dev = (yaffs_dev_t *)data;
- struct yaffs_LinuxContext *context = yaffs_dev_to_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;
unsigned long expires;
unsigned int urgency;
- int gcResult;
+ int gc_result;
struct timer_list timer;
T(YAFFS_TRACE_BACKGROUND,
@@ -2332,7 +2332,7 @@ static int yaffs_bg_thread_fn(void *data)
#ifdef YAFFS_COMPILE_FREEZER
set_freezable();
#endif
- while(context->bgRunning){
+ while(context->bg_running){
T(YAFFS_TRACE_BACKGROUND,
(TSTR("yaffs_background\n")));
@@ -2355,7 +2355,7 @@ static int yaffs_bg_thread_fn(void *data)
if(time_after(now,next_gc) && yaffs_bg_enable){
if(!dev->is_checkpointed){
urgency = yaffs_bg_gc_urgency(dev);
- gcResult = yaffs_bg_gc(dev, urgency);
+ gc_result = yaffs_bg_gc(dev, urgency);
if(urgency > 1)
next_gc = now + HZ/20+1;
else if(urgency > 0)
@@ -2396,33 +2396,33 @@ static int yaffs_bg_thread_fn(void *data)
static int yaffs_bg_start(yaffs_dev_t *dev)
{
int retval = 0;
- struct yaffs_LinuxContext *context = yaffs_dev_to_lc(dev);
+ struct yaffs_linux_context *context = yaffs_dev_to_lc(dev);
if(dev->read_only)
return -1;
- context->bgRunning = 1;
+ context->bg_running = 1;
- context->bgThread = kthread_run(yaffs_bg_thread_fn,
+ context->bg_thread = kthread_run(yaffs_bg_thread_fn,
(void *)dev,"yaffs-bg-%d",context->mount_id);
- if(IS_ERR(context->bgThread)){
- retval = PTR_ERR(context->bgThread);
- context->bgThread = NULL;
- context->bgRunning = 0;
+ if(IS_ERR(context->bg_thread)){
+ retval = PTR_ERR(context->bg_thread);
+ context->bg_thread = NULL;
+ context->bg_running = 0;
}
return retval;
}
static void yaffs_bg_stop(yaffs_dev_t *dev)
{
- struct yaffs_LinuxContext *ctxt = yaffs_dev_to_lc(dev);
+ struct yaffs_linux_context *ctxt = yaffs_dev_to_lc(dev);
- ctxt->bgRunning = 0;
+ ctxt->bg_running = 0;
- if( ctxt->bgThread){
- kthread_stop(ctxt->bgThread);
- ctxt->bgThread = NULL;
+ if( ctxt->bg_thread){
+ kthread_stop(ctxt->bg_thread);
+ ctxt->bg_thread = NULL;
}
}
#else
@@ -2485,7 +2485,7 @@ static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino)
{
struct inode *inode;
yaffs_obj_t *obj;
- yaffs_dev_t *dev = yaffs_SuperToDevice(sb);
+ yaffs_dev_t *dev = yaffs_super_to_dev(sb);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_iget for %lu\n"), ino));
@@ -2523,19 +2523,19 @@ static void yaffs_read_inode(struct inode *inode)
*/
yaffs_obj_t *obj;
- yaffs_dev_t *dev = yaffs_SuperToDevice(inode->i_sb);
+ yaffs_dev_t *dev = yaffs_super_to_dev(inode->i_sb);
T(YAFFS_TRACE_OS,
(TSTR("yaffs_read_inode for %d\n"), (int)inode->i_ino));
- if(current != yaffs_dev_to_lc(dev)->readdirProcess)
+ if(current != yaffs_dev_to_lc(dev)->readdir_process)
yaffs_gross_lock(dev);
obj = yaffs_find_by_number(dev, inode->i_ino);
yaffs_fill_inode_from_obj(inode, obj);
- if(current != yaffs_dev_to_lc(dev)->readdirProcess)
+ if(current != yaffs_dev_to_lc(dev)->readdir_process)
yaffs_gross_unlock(dev);
}
@@ -2546,7 +2546,7 @@ struct semaphore yaffs_context_lock;
static void yaffs_put_super(struct super_block *sb)
{
- yaffs_dev_t *dev = yaffs_SuperToDevice(sb);
+ yaffs_dev_t *dev = yaffs_super_to_dev(sb);
T(YAFFS_TRACE_OS, (TSTR("yaffs_put_super\n")));
@@ -2560,8 +2560,8 @@ static void yaffs_put_super(struct super_block *sb)
yaffs_flush_super(sb,1);
- if (yaffs_dev_to_lc(dev)->putSuperFunc)
- yaffs_dev_to_lc(dev)->putSuperFunc(sb);
+ if (yaffs_dev_to_lc(dev)->put_super_fn)
+ yaffs_dev_to_lc(dev)->put_super_fn(sb);
yaffs_deinitialise(dev);
@@ -2569,21 +2569,21 @@ 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)->contextList));
+ ylist_del_init(&(yaffs_dev_to_lc(dev)->context_list));
up(&yaffs_context_lock);
- if (yaffs_dev_to_lc(dev)->spareBuffer) {
- YFREE(yaffs_dev_to_lc(dev)->spareBuffer);
- yaffs_dev_to_lc(dev)->spareBuffer = 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);
}
-static void yaffs_MTDPutSuper(struct super_block *sb)
+static void yaffs_mtd_put_super(struct super_block *sb)
{
- struct mtd_info *mtd = yaffs_dev_to_mtd(yaffs_SuperToDevice(sb));
+ struct mtd_info *mtd = yaffs_dev_to_mtd(yaffs_super_to_dev(sb));
if (mtd->sync)
mtd->sync(mtd);
@@ -2594,7 +2594,7 @@ static void yaffs_MTDPutSuper(struct super_block *sb)
static void yaffs_touch_super(yaffs_dev_t *dev)
{
- struct super_block *sb = yaffs_dev_to_lc(dev)->superBlock;
+ struct super_block *sb = yaffs_dev_to_lc(dev)->super;
T(YAFFS_TRACE_OS, (TSTR("yaffs_touch_super() sb = %p\n"), sb));
if (sb)
@@ -2681,7 +2681,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
struct super_block *sb,
void *data, int silent)
{
- int nBlocks;
+ int n_blocks;
struct inode *inode = NULL;
struct dentry *root;
yaffs_dev_t *dev = 0;
@@ -2689,7 +2689,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
struct mtd_info *mtd;
int err;
char *data_str = (char *)data;
- struct yaffs_LinuxContext *context = NULL;
+ struct yaffs_linux_context *context = NULL;
yaffs_param_t *param;
int read_only = 0;
@@ -2698,7 +2698,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
unsigned mount_id;
int found;
- struct yaffs_LinuxContext *context_iterator;
+ struct yaffs_linux_context *context_iterator;
struct ylist_head *l;
sb->s_magic = YAFFS_MAGIC;
@@ -2869,7 +2869,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
}
dev = kmalloc(sizeof(yaffs_dev_t), GFP_KERNEL);
- context = kmalloc(sizeof(struct yaffs_LinuxContext),GFP_KERNEL);
+ context = kmalloc(sizeof(struct yaffs_linux_context),GFP_KERNEL);
if(!dev || !context ){
if(dev)
@@ -2890,11 +2890,11 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
memset(dev, 0, sizeof(yaffs_dev_t));
param = &(dev->param);
- memset(context,0,sizeof(struct yaffs_LinuxContext));
+ memset(context,0,sizeof(struct yaffs_linux_context));
dev->os_context = context;
- YINIT_LIST_HEAD(&(context->contextList));
+ YINIT_LIST_HEAD(&(context->context_list));
context->dev = dev;
- context->superBlock = sb;
+ context->super = sb;
dev->read_only = read_only;
@@ -2909,10 +2909,10 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
/* Set up the memory size parameters.... */
- nBlocks = YCALCBLOCKS(mtd->size, (YAFFS_CHUNKS_PER_BLOCK * YAFFS_BYTES_PER_CHUNK));
+ n_blocks = YCALCBLOCKS(mtd->size, (YAFFS_CHUNKS_PER_BLOCK * YAFFS_BYTES_PER_CHUNK));
param->start_block = 0;
- param->end_block = nBlocks - 1;
+ param->end_block = n_blocks - 1;
param->chunks_per_block = YAFFS_CHUNKS_PER_BLOCK;
param->total_bytes_per_chunk = YAFFS_BYTES_PER_CHUNK;
param->n_reserved_blocks = 5;
@@ -2960,12 +2960,12 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
/* ... and the functions. */
if (yaffs_version == 2) {
param->write_chunk_tags_fn =
- nandmtd2_WriteChunkWithTagsToNAND;
+ nandmtd2_write_chunk_tags;
param->read_chunk_tags_fn =
- nandmtd2_ReadChunkWithTagsFromNAND;
- param->bad_block_fn = nandmtd2_MarkNANDBlockBad;
- param->query_block_fn = nandmtd2_QueryNANDBlock;
- yaffs_dev_to_lc(dev)->spareBuffer = YMALLOC(mtd->oobsize);
+ nandmtd2_read_chunk_tags;
+ param->bad_block_fn = nandmtd2_mark_block_bad;
+ param->query_block_fn = nandmtd2_query_block;
+ yaffs_dev_to_lc(dev)->spare_buffer = YMALLOC(mtd->oobsize);
param->is_yaffs2 = 1;
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
param->total_bytes_per_chunk = mtd->writesize;
@@ -2974,35 +2974,35 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
param->total_bytes_per_chunk = mtd->oobblock;
param->chunks_per_block = mtd->erasesize / mtd->oobblock;
#endif
- nBlocks = YCALCBLOCKS(mtd->size, mtd->erasesize);
+ n_blocks = YCALCBLOCKS(mtd->size, mtd->erasesize);
param->start_block = 0;
- param->end_block = nBlocks - 1;
+ param->end_block = n_blocks - 1;
} else {
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
/* use the MTD interface in yaffs_mtdif1.c */
param->write_chunk_tags_fn =
- nandmtd1_WriteChunkWithTagsToNAND;
+ nandmtd1_write_chunk_tags;
param->read_chunk_tags_fn =
- nandmtd1_ReadChunkWithTagsFromNAND;
- param->bad_block_fn = nandmtd1_MarkNANDBlockBad;
- param->query_block_fn = nandmtd1_QueryNANDBlock;
+ nandmtd1_read_chunk_tags;
+ param->bad_block_fn = nandmtd1_mark_block_bad;
+ param->query_block_fn = nandmtd1_query_block;
#else
- param->write_chunk_fn = nandmtd_WriteChunkToNAND;
- param->read_chunk_fn = nandmtd_ReadChunkFromNAND;
+ param->write_chunk_fn = nandmtd_write_chunk;
+ param->read_chunk_fn = nandmtd_read_chunk;
#endif
param->is_yaffs2 = 0;
}
/* ... and common functions */
- param->erase_fn = nandmtd_EraseBlockInNAND;
- param->initialise_flash_fn = nandmtd_InitialiseNAND;
+ param->erase_fn = nandmtd_erase_block;
+ param->initialise_flash_fn = nandmtd_initialise;
- yaffs_dev_to_lc(dev)->putSuperFunc = yaffs_MTDPutSuper;
+ 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;
- yaffs_dev_to_lc(dev)->superBlock= sb;
+ yaffs_dev_to_lc(dev)->super= sb;
#ifndef CONFIG_YAFFS_DOES_ECC
@@ -3022,21 +3022,21 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
for(mount_id=0; ! found; mount_id++){
found = 1;
ylist_for_each(l,&yaffs_context_list){
- context_iterator = ylist_entry(l,struct yaffs_LinuxContext,contextList);
+ context_iterator = ylist_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)->contextList), &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(&(yaffs_dev_to_lc(dev)->searchContexts));
+ YINIT_LIST_HEAD(&(yaffs_dev_to_lc(dev)->search_contexts));
param->remove_obj_fn = yaffs_remove_obj_callback;
- init_MUTEX(&(yaffs_dev_to_lc(dev)->grossLock));
+ init_MUTEX(&(yaffs_dev_to_lc(dev)->gross_lock));
yaffs_gross_lock(dev);
@@ -3049,7 +3049,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
if(err == YAFFS_OK)
yaffs_bg_start(dev);
- if(!context->bgThread)
+ if(!context->bg_thread)
param->defered_dir_update = 0;
@@ -3229,7 +3229,7 @@ static char *yaffs_dump_dev_part1(char *buf, yaffs_dev_t * dev)
buf += sprintf(buf, "n_gc_blocks.......... %u\n", dev->n_gc_blocks);
buf += sprintf(buf, "bg_gcs............... %u\n", dev->bg_gcs);
buf += sprintf(buf, "n_retired_writes..... %u\n", dev->n_retired_writes);
- buf += sprintf(buf, "nRetireBlocks........ %u\n", dev->n_retired_blocks);
+ buf += sprintf(buf, "n_retired_blocks..... %u\n", dev->n_retired_blocks);
buf += sprintf(buf, "n_ecc_fixed.......... %u\n", dev->n_ecc_fixed);
buf += sprintf(buf, "n_ecc_unfixed........ %u\n", dev->n_ecc_unfixed);
buf += sprintf(buf, "n_tags_ecc_fixed..... %u\n", dev->n_tags_ecc_fixed);
@@ -3272,7 +3272,7 @@ static int yaffs_proc_read(char *page,
/* Locate and print the Nth entry. Order N-squared but N is small. */
ylist_for_each(item, &yaffs_context_list) {
- struct yaffs_LinuxContext *dc = ylist_entry(item, struct yaffs_LinuxContext, contextList);
+ struct yaffs_linux_context *dc = ylist_entry(item, struct yaffs_linux_context, context_list);
yaffs_dev_t *dev = dc->dev;
if (n < (step & ~1)) {
@@ -3305,15 +3305,15 @@ static int yaffs_stats_proc_read(char *page,
/* Locate and print the Nth entry. Order N-squared but N is small. */
ylist_for_each(item, &yaffs_context_list) {
- struct yaffs_LinuxContext *dc = ylist_entry(item, struct yaffs_LinuxContext, contextList);
+ struct yaffs_linux_context *dc = ylist_entry(item, struct yaffs_linux_context, context_list);
yaffs_dev_t *dev = dc->dev;
- int erasedChunks;
+ int erased_chunks;
- erasedChunks = dev->n_erased_blocks * dev->param.chunks_per_block;
+ erased_chunks = dev->n_erased_blocks * dev->param.chunks_per_block;
buf += sprintf(buf,"%d, %d, %d, %u, %u, %u, %u\n",
- n, dev->n_free_chunks, erasedChunks,
+ n, dev->n_free_chunks, erased_chunks,
dev->bg_gcs, dev->oldest_dirty_gc_count,
dev->n_obj, dev->n_tnodes);
}
diff --git a/yaffs_yaffs1.c b/yaffs_yaffs1.c
index 009ab4d..21933dc 100644
--- a/yaffs_yaffs1.c
+++ b/yaffs_yaffs1.c
@@ -23,9 +23,6 @@ int yaffs1_scan(yaffs_dev_t *dev)
{
yaffs_ext_tags tags;
int blk;
- int blockIterator;
- int startIterator;
- int endIterator;
int result;
int chunk;
@@ -41,10 +38,10 @@ int yaffs1_scan(yaffs_dev_t *dev)
int alloc_failed = 0;
- struct yaffs_shadow_fixer_s *shadowFixerList = NULL;
+ struct yaffs_shadow_fixer_s *shadow_fixers = NULL;
- __u8 *chunkData;
+ __u8 *chunk_data;
@@ -52,7 +49,7 @@ int yaffs1_scan(yaffs_dev_t *dev)
(TSTR("yaffs1_scan starts intstartblk %d intendblk %d..." TENDSTR),
dev->internal_start_block, dev->internal_end_block));
- chunkData = yaffs_get_temp_buffer(dev, __LINE__);
+ chunk_data = yaffs_get_temp_buffer(dev, __LINE__);
dev->seq_number = YAFFS_LOWEST_SEQUENCE_NUMBER;
@@ -87,19 +84,13 @@ int yaffs1_scan(yaffs_dev_t *dev)
bi++;
}
- startIterator = dev->internal_start_block;
- endIterator = dev->internal_end_block;
-
/* For each block.... */
- for (blockIterator = startIterator; !alloc_failed && blockIterator <= endIterator;
- blockIterator++) {
-
- YYIELD();
+ for (blk= dev->internal_start_block;
+ !alloc_failed && blk <= dev->internal_end_block;
+ blk++) {
YYIELD();
- blk = blockIterator;
-
bi = yaffs_get_block_info(dev, blk);
state = bi->block_state;
@@ -197,10 +188,10 @@ int yaffs1_scan(yaffs_dev_t *dev)
bi->pages_in_use++;
result = yaffs_rd_chunk_tags_nand(dev, chunk,
- chunkData,
+ chunk_data,
NULL);
- oh = (yaffs_obj_header *) chunkData;
+ oh = (yaffs_obj_header *) chunk_data;
in = yaffs_find_by_number(dev,
tags.obj_id);
@@ -228,8 +219,8 @@ int yaffs1_scan(yaffs_dev_t *dev)
struct yaffs_shadow_fixer_s *fixer;
fixer = YMALLOC(sizeof(struct yaffs_shadow_fixer_s));
if (fixer) {
- fixer->next = shadowFixerList;
- shadowFixerList = fixer;
+ fixer->next = shadow_fixers;
+ shadow_fixers = fixer;
fixer->obj_id = tags.obj_id;
fixer->shadowed_id = oh->shadows_obj;
T(YAFFS_TRACE_SCAN,
@@ -244,10 +235,10 @@ int yaffs1_scan(yaffs_dev_t *dev)
if (in && in->valid) {
/* We have already filled this one. We have a duplicate and need to resolve it. */
- unsigned existingSerial = in->serial;
- unsigned newSerial = tags.serial_number;
+ unsigned existing_serial = in->serial;
+ unsigned new_serial = tags.serial_number;
- if (((existingSerial + 1) & 3) == newSerial) {
+ if (((existing_serial + 1) & 3) == new_serial) {
/* Use new one - destroy the exisiting one */
yaffs_chunk_del(dev,
in->hdr_chunk,
@@ -434,9 +425,9 @@ int yaffs1_scan(yaffs_dev_t *dev)
struct yaffs_shadow_fixer_s *fixer;
yaffs_obj_t *obj;
- while (shadowFixerList) {
- fixer = shadowFixerList;
- shadowFixerList = fixer->next;
+ while (shadow_fixers) {
+ fixer = shadow_fixers;
+ shadow_fixers = fixer->next;
/* Complete the rename transaction by deleting the shadowed object
* then setting the object header to unshadowed.
*/
@@ -453,7 +444,7 @@ int yaffs1_scan(yaffs_dev_t *dev)
}
}
- yaffs_release_temp_buffer(dev, chunkData, __LINE__);
+ yaffs_release_temp_buffer(dev, chunk_data, __LINE__);
if (alloc_failed)
return YAFFS_FAIL;
diff --git a/yaffs_yaffs2.c b/yaffs_yaffs2.c
index 58c3600..76623ad 100644
--- a/yaffs_yaffs2.c
+++ b/yaffs_yaffs2.c
@@ -145,7 +145,7 @@ __u32 yaffs2_find_refresh_block(yaffs_dev_t *dev)
__u32 b ;
__u32 oldest = 0;
- __u32 oldestSequence = 0;
+ __u32 oldest_seq = 0;
yaffs_block_info_t *bi;
@@ -180,9 +180,9 @@ __u32 yaffs2_find_refresh_block(yaffs_dev_t *dev)
if (bi->block_state == YAFFS_BLOCK_STATE_FULL){
if(oldest < 1 ||
- bi->seq_number < oldestSequence){
+ bi->seq_number < oldest_seq){
oldest = b;
- oldestSequence = bi->seq_number;
+ oldest_seq = bi->seq_number;
}
}
bi++;
@@ -191,7 +191,7 @@ __u32 yaffs2_find_refresh_block(yaffs_dev_t *dev)
if (oldest > 0) {
T(YAFFS_TRACE_GC,
(TSTR("GC refresh count %d selected block %d with seq_number %d" TENDSTR),
- dev->refresh_count, oldest, oldestSequence));
+ dev->refresh_count, oldest, oldest_seq));
}
return oldest;
@@ -222,13 +222,13 @@ int yaffs_calc_checkpt_blocks_required(yaffs_dev_t *dev)
yaffs2_checkpt_required(dev)){
/* Not a valid value so recalculate */
int n_bytes = 0;
- int nBlocks;
- int devBlocks = (dev->param.end_block - dev->param.start_block + 1);
+ 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 += devBlocks * sizeof(yaffs_block_info_t);
- n_bytes += devBlocks * dev->chunk_bit_stride;
+ n_bytes += dev_blocks * sizeof(yaffs_block_info_t);
+ n_bytes += dev_blocks * dev->chunk_bit_stride;
n_bytes += (sizeof(yaffs_checkpt_obj_t) + sizeof(__u32)) * (dev->n_obj);
n_bytes += (dev->tnode_size + sizeof(__u32)) * (dev->n_tnodes);
n_bytes += sizeof(yaffs_checkpt_validty_t);
@@ -236,9 +236,9 @@ int yaffs_calc_checkpt_blocks_required(yaffs_dev_t *dev)
/* Round up and add 2 blocks to allow for some bad blocks, so add 3 */
- nBlocks = (n_bytes/(dev->data_bytes_per_chunk * dev->param.chunks_per_block)) + 3;
+ n_blocks = (n_bytes/(dev->data_bytes_per_chunk * dev->param.chunks_per_block)) + 3;
- dev->checkpoint_blocks_required = nBlocks;
+ dev->checkpoint_blocks_required = n_blocks;
}
retval = dev->checkpoint_blocks_required - dev->blocks_in_checkpt;
@@ -314,7 +314,7 @@ static int yaffs2_wr_checkpt_dev(yaffs_dev_t *dev)
{
yaffs_checkpt_dev_t cp;
__u32 n_bytes;
- __u32 nBlocks = (dev->internal_end_block - dev->internal_start_block + 1);
+ __u32 n_blocks = (dev->internal_end_block - dev->internal_start_block + 1);
int ok;
@@ -326,13 +326,13 @@ static int yaffs2_wr_checkpt_dev(yaffs_dev_t *dev)
/* Write block info */
if (ok) {
- n_bytes = nBlocks * sizeof(yaffs_block_info_t);
+ n_bytes = n_blocks * sizeof(yaffs_block_info_t);
ok = (yaffs2_checkpt_wr(dev, dev->block_info, n_bytes) == n_bytes);
}
/* Write chunk bits */
if (ok) {
- n_bytes = nBlocks * dev->chunk_bit_stride;
+ n_bytes = n_blocks * dev->chunk_bit_stride;
ok = (yaffs2_checkpt_wr(dev, dev->chunk_bits, n_bytes) == n_bytes);
}
return ok ? 1 : 0;
@@ -343,7 +343,7 @@ static int yaffs2_rd_checkpt_dev(yaffs_dev_t *dev)
{
yaffs_checkpt_dev_t cp;
__u32 n_bytes;
- __u32 nBlocks = (dev->internal_end_block - dev->internal_start_block + 1);
+ __u32 n_blocks = (dev->internal_end_block - dev->internal_start_block + 1);
int ok;
@@ -357,13 +357,13 @@ static int yaffs2_rd_checkpt_dev(yaffs_dev_t *dev)
yaffs_checkpt_dev_to_dev(dev, &cp);
- n_bytes = nBlocks * sizeof(yaffs_block_info_t);
+ n_bytes = n_blocks * sizeof(yaffs_block_info_t);
ok = (yaffs2_checkpt_rd(dev, dev->block_info, n_bytes) == n_bytes);
if (!ok)
return 0;
- n_bytes = nBlocks * dev->chunk_bit_stride;
+ n_bytes = n_blocks * dev->chunk_bit_stride;
ok = (yaffs2_checkpt_rd(dev, dev->chunk_bits, n_bytes) == n_bytes);
@@ -470,8 +470,9 @@ static int yaffs2_checkpt_tnode_worker(yaffs_obj_t *in, yaffs_tnode_t *tn,
}
}
} else if (level == 0) {
- __u32 baseOffset = chunk_offset << YAFFS_TNODES_LEVEL0_BITS;
- ok = (yaffs2_checkpt_wr(dev, &baseOffset, sizeof(baseOffset)) == sizeof(baseOffset));
+ __u32 base_offset = chunk_offset << YAFFS_TNODES_LEVEL0_BITS;
+ ok = (yaffs2_checkpt_wr(dev, &base_offset, sizeof(base_offset)) ==
+ sizeof(base_offset));
if (ok)
ok = (yaffs2_checkpt_wr(dev, tn, dev->tnode_size) == dev->tnode_size);
}
@@ -483,7 +484,7 @@ static int yaffs2_checkpt_tnode_worker(yaffs_obj_t *in, yaffs_tnode_t *tn,
static int yaffs2_wr_checkpt_tnodes(yaffs_obj_t *obj)
{
- __u32 endMarker = ~0;
+ __u32 end_marker = ~0;
int ok = 1;
if (obj->variant_type == YAFFS_OBJECT_TYPE_FILE) {
@@ -492,8 +493,8 @@ static int yaffs2_wr_checkpt_tnodes(yaffs_obj_t *obj)
obj->variant.file_variant.top_level,
0);
if (ok)
- ok = (yaffs2_checkpt_wr(obj->my_dev, &endMarker, sizeof(endMarker)) ==
- sizeof(endMarker));
+ ok = (yaffs2_checkpt_wr(obj->my_dev, &end_marker, sizeof(end_marker)) ==
+ sizeof(end_marker));
}
return ok ? 1 : 0;
@@ -501,16 +502,16 @@ static int yaffs2_wr_checkpt_tnodes(yaffs_obj_t *obj)
static int yaffs2_rd_checkpt_tnodes(yaffs_obj_t *obj)
{
- __u32 baseChunk;
+ __u32 base_chunk;
int ok = 1;
yaffs_dev_t *dev = obj->my_dev;
- yaffs_file_s *fileStructPtr = &obj->variant.file_variant;
+ yaffs_file_s *file_stuct_ptr = &obj->variant.file_variant;
yaffs_tnode_t *tn;
int nread = 0;
- ok = (yaffs2_checkpt_rd(dev, &baseChunk, sizeof(baseChunk)) == sizeof(baseChunk));
+ ok = (yaffs2_checkpt_rd(dev, &base_chunk, sizeof(base_chunk)) == sizeof(base_chunk));
- while (ok && (~baseChunk)) {
+ while (ok && (~base_chunk)) {
nread++;
/* Read level 0 tnode */
@@ -523,18 +524,18 @@ static int yaffs2_rd_checkpt_tnodes(yaffs_obj_t *obj)
if (tn && ok)
ok = yaffs_add_find_tnode_0(dev,
- fileStructPtr,
- baseChunk,
+ file_stuct_ptr,
+ base_chunk,
tn) ? 1 : 0;
if (ok)
- ok = (yaffs2_checkpt_rd(dev, &baseChunk, sizeof(baseChunk)) == sizeof(baseChunk));
+ ok = (yaffs2_checkpt_rd(dev, &base_chunk, sizeof(base_chunk)) == sizeof(base_chunk));
}
T(YAFFS_TRACE_CHECKPOINT, (
TSTR("Checkpoint read tnodes %d records, last %d. ok %d" TENDSTR),
- nread, baseChunk, ok));
+ nread, base_chunk, ok));
return ok ? 1 : 0;
}
@@ -807,21 +808,21 @@ int yaffs2_checkpt_restore(yaffs_dev_t *dev)
int yaffs2_handle_hole(yaffs_obj_t *obj, loff_t new_size)
{
- /* if newsSize > oldFileSize.
+ /* if new_size > old_file_size.
* We're going to be writing a hole.
* If the hole is small then write zeros otherwise write a start of hole marker.
*/
- loff_t oldFileSize;
+ loff_t old_file_size;
int increase;
- int smallHole ;
+ int small_hole ;
int result = YAFFS_OK;
yaffs_dev_t *dev = NULL;
- __u8 *localBuffer = NULL;
+ __u8 *local_buffer = NULL;
- int smallIncreaseOk = 0;
+ int small_increase_ok = 0;
if(!obj)
return YAFFS_FAIL;
@@ -835,50 +836,50 @@ int yaffs2_handle_hole(yaffs_obj_t *obj, loff_t new_size)
if(!dev->param.is_yaffs2)
return YAFFS_OK;
- oldFileSize = obj->variant.file_variant.file_size;
+ old_file_size = obj->variant.file_variant.file_size;
- if (new_size <= oldFileSize)
+ if (new_size <= old_file_size)
return YAFFS_OK;
- increase = new_size - oldFileSize;
+ increase = new_size - old_file_size;
if(increase < YAFFS_SMALL_HOLE_THRESHOLD * dev->data_bytes_per_chunk &&
yaffs_check_alloc_available(dev, YAFFS_SMALL_HOLE_THRESHOLD + 1))
- smallHole = 1;
+ small_hole = 1;
else
- smallHole = 0;
+ small_hole = 0;
- if(smallHole)
- localBuffer= yaffs_get_temp_buffer(dev, __LINE__);
+ if(small_hole)
+ local_buffer= yaffs_get_temp_buffer(dev, __LINE__);
- if(localBuffer){
+ if(local_buffer){
/* fill hole with zero bytes */
- int pos = oldFileSize;
- int thisWrite;
+ int pos = old_file_size;
+ int this_write;
int written;
- memset(localBuffer,0,dev->data_bytes_per_chunk);
- smallIncreaseOk = 1;
-
- while(increase > 0 && smallIncreaseOk){
- thisWrite = increase;
- if(thisWrite > dev->data_bytes_per_chunk)
- thisWrite = dev->data_bytes_per_chunk;
- written = yaffs_do_file_wr(obj,localBuffer,pos,thisWrite,0);
- if(written == thisWrite){
- pos += thisWrite;
- increase -= thisWrite;
+ memset(local_buffer,0,dev->data_bytes_per_chunk);
+ small_increase_ok = 1;
+
+ while(increase > 0 && small_increase_ok){
+ this_write = increase;
+ if(this_write > dev->data_bytes_per_chunk)
+ this_write = dev->data_bytes_per_chunk;
+ written = yaffs_do_file_wr(obj,local_buffer,pos,this_write,0);
+ if(written == this_write){
+ pos += this_write;
+ increase -= this_write;
} else
- smallIncreaseOk = 0;
+ small_increase_ok = 0;
}
- yaffs_release_temp_buffer(dev,localBuffer,__LINE__);
+ yaffs_release_temp_buffer(dev,local_buffer,__LINE__);
/* If we were out of space then reverse any chunks we've added */
- if(!smallIncreaseOk)
- yaffs_resize_file_down(obj, oldFileSize);
+ if(!small_increase_ok)
+ yaffs_resize_file_down(obj, old_file_size);
}
- if (!smallIncreaseOk &&
+ if (!small_increase_ok &&
obj->parent &&
obj->parent->obj_id != YAFFS_OBJECTID_UNLINKED &&
obj->parent->obj_id != YAFFS_OBJECTID_DELETED){
@@ -894,15 +895,15 @@ int yaffs2_handle_hole(yaffs_obj_t *obj, loff_t new_size)
typedef struct {
int seq;
int block;
-} yaffs_BlockIndex;
+} yaffs_block_index;
static int yaffs2_ybicmp(const void *a, const void *b)
{
- register int aseq = ((yaffs_BlockIndex *)a)->seq;
- register int bseq = ((yaffs_BlockIndex *)b)->seq;
- register int ablock = ((yaffs_BlockIndex *)a)->block;
- register int bblock = ((yaffs_BlockIndex *)b)->block;
+ register int aseq = ((yaffs_block_index *)a)->seq;
+ register int bseq = ((yaffs_block_index *)b)->seq;
+ register int ablock = ((yaffs_block_index *)a)->block;
+ register int bblock = ((yaffs_block_index *)b)->block;
if (aseq == bseq)
return ablock - bblock;
else
@@ -913,10 +914,10 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
{
yaffs_ext_tags tags;
int blk;
- int blockIterator;
- int startIterator;
- int endIterator;
- int nBlocksToScan = 0;
+ int block_iter;
+ int start_iter;
+ int end_iter;
+ int n_to_scan = 0;
int chunk;
int result;
@@ -929,19 +930,19 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
yaffs_obj_header *oh;
yaffs_obj_t *in;
yaffs_obj_t *parent;
- int nBlocks = dev->internal_end_block - dev->internal_start_block + 1;
- int itsUnlinked;
- __u8 *chunkData;
+ int n_blocks = dev->internal_end_block - dev->internal_start_block + 1;
+ int is_unlinked;
+ __u8 *chunk_data;
int file_size;
int is_shrink;
- int foundChunksInBlock;
+ int found_chunks;
int equiv_id;
int alloc_failed = 0;
- yaffs_BlockIndex *blockIndex = NULL;
- int altBlockIndex = 0;
+ yaffs_block_index *block_index = NULL;
+ int alt_block_index = 0;
T(YAFFS_TRACE_SCAN,
(TSTR
@@ -951,14 +952,14 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
dev->seq_number = YAFFS_LOWEST_SEQUENCE_NUMBER;
- blockIndex = YMALLOC(nBlocks * sizeof(yaffs_BlockIndex));
+ block_index = YMALLOC(n_blocks * sizeof(yaffs_block_index));
- if (!blockIndex) {
- blockIndex = YMALLOC_ALT(nBlocks * sizeof(yaffs_BlockIndex));
- altBlockIndex = 1;
+ if (!block_index) {
+ block_index = YMALLOC_ALT(n_blocks * sizeof(yaffs_block_index));
+ alt_block_index = 1;
}
- if (!blockIndex) {
+ if (!block_index) {
T(YAFFS_TRACE_SCAN,
(TSTR("yaffs2_scan_backwards() could not allocate block index!" TENDSTR)));
return YAFFS_FAIL;
@@ -966,7 +967,7 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
dev->blocks_in_checkpt = 0;
- chunkData = yaffs_get_temp_buffer(dev, __LINE__);
+ chunk_data = yaffs_get_temp_buffer(dev, __LINE__);
/* Scan all the blocks to determine their state */
bi = dev->block_info;
@@ -1007,10 +1008,10 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
if (seq_number >= YAFFS_LOWEST_SEQUENCE_NUMBER &&
seq_number < YAFFS_HIGHEST_SEQUENCE_NUMBER) {
- blockIndex[nBlocksToScan].seq = seq_number;
- blockIndex[nBlocksToScan].block = blk;
+ block_index[n_to_scan].seq = seq_number;
+ block_index[n_to_scan].block = blk;
- nBlocksToScan++;
+ n_to_scan++;
if (seq_number >= dev->seq_number)
dev->seq_number = seq_number;
@@ -1027,34 +1028,34 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
}
T(YAFFS_TRACE_SCAN,
- (TSTR("%d blocks to be sorted..." TENDSTR), nBlocksToScan));
+ (TSTR("%d blocks to be sorted..." TENDSTR), n_to_scan));
YYIELD();
/* Sort the blocks by sequence number*/
- yaffs_qsort(blockIndex, nBlocksToScan, sizeof(yaffs_BlockIndex), yaffs2_ybicmp);
+ yaffs_qsort(block_index, n_to_scan, sizeof(yaffs_block_index), yaffs2_ybicmp);
YYIELD();
T(YAFFS_TRACE_SCAN, (TSTR("...done" TENDSTR)));
/* Now scan the blocks looking at the data. */
- startIterator = 0;
- endIterator = nBlocksToScan - 1;
+ start_iter = 0;
+ end_iter = n_to_scan - 1;
T(YAFFS_TRACE_SCAN_DEBUG,
- (TSTR("%d blocks to be scanned" TENDSTR), nBlocksToScan));
+ (TSTR("%d blocks to be scanned" TENDSTR), n_to_scan));
/* For each block.... backwards */
- for (blockIterator = endIterator; !alloc_failed && blockIterator >= startIterator;
- blockIterator--) {
+ for (block_iter = end_iter; !alloc_failed && block_iter >= start_iter;
+ block_iter--) {
/* Cooperative multitasking! This loop can run for so
long that watchdog timers expire. */
YYIELD();
/* get the block to scan in the correct order */
- blk = blockIndex[blockIterator].block;
+ blk = block_index[block_iter].block;
bi = yaffs_get_block_info(dev, blk);
@@ -1064,7 +1065,7 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
deleted = 0;
/* For each chunk in each block that needs scanning.... */
- foundChunksInBlock = 0;
+ found_chunks = 0;
for (c = dev->param.chunks_per_block - 1;
!alloc_failed && c >= 0 &&
(state == YAFFS_BLOCK_STATE_NEEDS_SCANNING ||
@@ -1090,7 +1091,7 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
* this is the one being allocated from
*/
- if (foundChunksInBlock) {
+ if (found_chunks) {
/* This is a chunk that was skipped due to failing the erased check */
} else if (c == 0) {
/* We're looking at the first chunk in the block so the block is unused */
@@ -1145,10 +1146,10 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
} else if (tags.chunk_id > 0) {
/* chunk_id > 0 so it is a data chunk... */
unsigned int endpos;
- __u32 chunkBase =
+ __u32 chunk_base =
(tags.chunk_id - 1) * dev->data_bytes_per_chunk;
- foundChunksInBlock = 1;
+ found_chunks = 1;
yaffs_set_chunk_bit(dev, blk, c);
@@ -1165,7 +1166,7 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
if (in &&
in->variant_type == YAFFS_OBJECT_TYPE_FILE
- && chunkBase < in->variant.file_variant.shrink_size) {
+ && chunk_base < in->variant.file_variant.shrink_size) {
/* This has not been invalidated by a resize */
if (!yaffs_put_chunk_in_file(in, tags.chunk_id, chunk, -1)) {
alloc_failed = 1;
@@ -1174,7 +1175,7 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
/* File size is calculated by looking at the data chunks if we have not
* seen an object header yet. Stop this practice once we find an object header.
*/
- endpos = chunkBase + tags.n_bytes;
+ endpos = chunk_base + tags.n_bytes;
if (!in->valid && /* have not got an object header yet */
in->variant.file_variant.scanned_size < endpos) {
@@ -1192,7 +1193,7 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
/* chunk_id == 0, so it is an ObjectHeader.
* Thus, we read in the object header and make the object
*/
- foundChunksInBlock = 1;
+ found_chunks = 1;
yaffs_set_chunk_bit(dev, blk, c);
bi->pages_in_use++;
@@ -1222,10 +1223,10 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
result = yaffs_rd_chunk_tags_nand(dev,
chunk,
- chunkData,
+ chunk_data,
NULL);
- oh = (yaffs_obj_header *) chunkData;
+ oh = (yaffs_obj_header *) chunk_data;
if (dev->param.inband_tags) {
/* Fix up the header if they got corrupted by inband tags */
@@ -1261,7 +1262,7 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
oh->type == YAFFS_OBJECT_TYPE_FILE) ||
(tags.extra_available &&
tags.extra_obj_type == YAFFS_OBJECT_TYPE_FILE))) {
- __u32 thisSize =
+ __u32 this_size =
(oh) ? oh->file_size : tags.
extra_length;
__u32 parent_obj_id =
@@ -1281,12 +1282,12 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
YAFFS_OBJECTID_DELETED
|| parent_obj_id ==
YAFFS_OBJECTID_UNLINKED) {
- thisSize = 0;
+ this_size = 0;
is_shrink = 1;
}
- if (is_shrink && in->variant.file_variant.shrink_size > thisSize)
- in->variant.file_variant.shrink_size = thisSize;
+ if (is_shrink && in->variant.file_variant.shrink_size > this_size)
+ in->variant.file_variant.shrink_size = this_size;
if (is_shrink)
bi->has_shrink_hdr = 1;
@@ -1429,11 +1430,11 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
yaffs_add_obj_to_dir(parent, in);
- itsUnlinked = (parent == dev->del_dir) ||
+ is_unlinked = (parent == dev->del_dir) ||
(parent == dev->unlinked_dir);
if (is_shrink) {
- /* Mark the block as having a shrinkHeader */
+ /* Mark the block as having a shrink header */
bi->has_shrink_hdr = 1;
}
@@ -1467,7 +1468,7 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
break;
case YAFFS_OBJECT_TYPE_HARDLINK:
- if (!itsUnlinked) {
+ if (!is_unlinked) {
in->variant.hardlink_variant.equiv_id =
equiv_id;
in->hard_links.next =
@@ -1516,10 +1517,10 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
yaffs_skip_rest_of_block(dev);
- if (altBlockIndex)
- YFREE_ALT(blockIndex);
+ if (alt_block_index)
+ YFREE_ALT(block_index);
else
- YFREE(blockIndex);
+ YFREE(block_index);
/* Ok, we've done all the scanning.
* Fix up the hard link chains.
@@ -1529,7 +1530,7 @@ int yaffs2_scan_backwards(yaffs_dev_t *dev)
yaffs_link_fixup(dev, hard_list);
- yaffs_release_temp_buffer(dev, chunkData, __LINE__);
+ yaffs_release_temp_buffer(dev, chunk_data, __LINE__);
if (alloc_failed)
return YAFFS_FAIL;
diff --git a/yaffsinterface.h b/yaffsinterface.h
deleted file mode 100644
index 62694d8..0000000
--- a/yaffsinterface.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
- *
- * Copyright (C) 2002-2010 Aleph One Ltd.
- * for Toby Churchill Ltd and Brightstar Engineering
- *
- * Created by Charles Manning <charles@aleph1.co.uk>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 2.1 as
- * published by the Free Software Foundation.
- *
- * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
- */
-
-#ifndef __YAFFSINTERFACE_H__
-#define __YAFFSINTERFACE_H__
-
-int yaffs_initialise(unsigned nBlocks);
-
-#endif