- if (bi->blockState >= YAFFS_NUMBER_OF_BLOCK_STATES)
- T(YAFFS_TRACE_VERIFY, (TSTR("Block %d has undefined state %d"TENDSTR), n, bi->blockState));
+ if (bi->block_state >= YAFFS_NUMBER_OF_BLOCK_STATES)
+ T(YAFFS_TRACE_VERIFY, (TSTR("Block %d has undefined state %d"TENDSTR), n, bi->block_state));
case YAFFS_BLOCK_STATE_UNKNOWN:
case YAFFS_BLOCK_STATE_SCANNING:
case YAFFS_BLOCK_STATE_NEEDS_SCANNING:
T(YAFFS_TRACE_VERIFY, (TSTR("Block %d has bad run-state %s"TENDSTR),
case YAFFS_BLOCK_STATE_UNKNOWN:
case YAFFS_BLOCK_STATE_SCANNING:
case YAFFS_BLOCK_STATE_NEEDS_SCANNING:
T(YAFFS_TRACE_VERIFY, (TSTR("Block %d has bad run-state %s"TENDSTR),
- if (bi->pagesInUse < 0 || bi->pagesInUse > dev->param.nChunksPerBlock ||
- bi->softDeletions < 0 || bi->softDeletions > dev->param.nChunksPerBlock ||
- actuallyUsed < 0 || actuallyUsed > dev->param.nChunksPerBlock)
- T(YAFFS_TRACE_VERIFY, (TSTR("Block %d has illegal values pagesInUsed %d softDeletions %d"TENDSTR),
- n, bi->pagesInUse, bi->softDeletions));
+ 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 ||
+ 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));
- inUse = yaffs_count_chunk_bits(dev, n);
- if (inUse != bi->pagesInUse)
- T(YAFFS_TRACE_VERIFY, (TSTR("Block %d has inconsistent values pagesInUse %d counted chunk bits %d"TENDSTR),
- n, bi->pagesInUse, inUse));
+ 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, in_use));
{
yaffs_verify_blk(dev, bi, n);
/* After collection the block should be in the erased state */
{
yaffs_verify_blk(dev, bi, n);
/* After collection the block should be in the erased state */
- if (bi->blockState != YAFFS_BLOCK_STATE_COLLECTING &&
- bi->blockState != YAFFS_BLOCK_STATE_EMPTY) {
+ if (bi->block_state != YAFFS_BLOCK_STATE_COLLECTING &&
+ bi->block_state != YAFFS_BLOCK_STATE_EMPTY) {
T(YAFFS_TRACE_ERROR, (TSTR("Block %d is in state %d after gc, should be erased"TENDSTR),
T(YAFFS_TRACE_ERROR, (TSTR("Block %d is in state %d after gc, should be erased"TENDSTR),
- for (i = dev->internalStartBlock; i <= dev->internalEndBlock; i++) {
- yaffs_BlockInfo *bi = yaffs_get_block_info(dev, i);
+ for (i = dev->internal_start_block; i <= dev->internal_end_block; i++) {
+ yaffs_block_info_t *bi = yaffs_get_block_info(dev, i);
}
T(YAFFS_TRACE_VERIFY, (TSTR(""TENDSTR)));
T(YAFFS_TRACE_VERIFY, (TSTR("Block summary"TENDSTR)));
}
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),
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),
* Verify the object header. oh must be valid, but obj and tags may be NULL in which
* case those tests will not be performed.
*/
* 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_Object *obj, yaffs_ObjectHeader *oh, yaffs_ExtendedTags *tags, int parentCheck)
+void yaffs_verify_oh(yaffs_obj_t *obj, yaffs_obj_header *oh, yaffs_ext_tags *tags, int parent_check)
oh->type > YAFFS_OBJECT_TYPE_MAX)
T(YAFFS_TRACE_VERIFY,
(TSTR("Obj %d header type is illegal value 0x%x"TENDSTR),
oh->type > YAFFS_OBJECT_TYPE_MAX)
T(YAFFS_TRACE_VERIFY,
(TSTR("Obj %d header type is illegal value 0x%x"TENDSTR),
- (TSTR("Obj %d header mismatch objectId %d"TENDSTR),
- tags->objectId, obj->objectId));
+ (TSTR("Obj %d header mismatch obj_id %d"TENDSTR),
+ tags->obj_id, obj->obj_id));
- (TSTR("Obj %d header mismatch parentId %d obj->parent is NULL"TENDSTR),
- tags->objectId, oh->parentObjectId));
+ (TSTR("Obj %d header mismatch parent_id %d obj->parent is NULL"TENDSTR),
+ tags->obj_id, oh->parent_obj_id));
- if (parentCheck && obj->parent &&
- oh->parentObjectId != obj->parent->objectId &&
- (oh->parentObjectId != YAFFS_OBJECTID_UNLINKED ||
- obj->parent->objectId != YAFFS_OBJECTID_DELETED))
+ 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))
- (TSTR("Obj %d header mismatch parentId %d parentObjectId %d"TENDSTR),
- tags->objectId, oh->parentObjectId, obj->parent->objectId));
+ (TSTR("Obj %d header mismatch parent_id %d parent_obj_id %d"TENDSTR),
+ tags->obj_id, oh->parent_obj_id, obj->parent->obj_id));
-int yaffs_verify_tnode_worker(yaffs_Object *obj, yaffs_Tnode *tn,
- __u32 level, int chunkOffset)
+int yaffs_verify_tnode_worker(yaffs_obj_t *obj, yaffs_tnode_t *tn,
+ __u32 level, int chunk_offset)
- __u32 theChunk = yaffs_get_group_base(dev, tn, i);
-
- if (theChunk > 0) {
- /* T(~0,(TSTR("verifying (%d:%d) %d"TENDSTR),tags.objectId,tags.chunkId,theChunk)); */
- yaffs_rd_chunk_tags_nand(dev, theChunk, NULL, &tags);
- if (tags.objectId != objectId || tags.chunkId != chunkOffset) {
- T(~0, (TSTR("Object %d chunkId %d NAND mismatch chunk %d tags (%d:%d)"TENDSTR),
- objectId, chunkOffset, theChunk,
- tags.objectId, tags.chunkId));
+ __u32 the_chunk = yaffs_get_group_base(dev, tn, i);
+
+ 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, the_chunk,
+ tags.obj_id, tags.chunk_id));
- lastChunk = obj->variant.fileVariant.fileSize / dev->nDataBytesPerChunk + 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;
/* Check that the chunks in the tnode tree are all correct.
* We do this by scanning through the tnode tree and
/* Check that the chunks in the tnode tree are all correct.
* We do this by scanning through the tnode tree and
- for (i = 1; i <= lastChunk; i++) {
- tn = yaffs_find_tnode_0(dev, &obj->variant.fileVariant, i);
+ for (i = 1; i <= last_chunk; i++) {
+ tn = yaffs_find_tnode_0(dev, &obj->variant.file_variant, i);
- __u32 theChunk = yaffs_get_group_base(dev, tn, i);
- if (theChunk > 0) {
- /* T(~0,(TSTR("verifying (%d:%d) %d"TENDSTR),objectId,i,theChunk)); */
- yaffs_rd_chunk_tags_nand(dev, theChunk, NULL, &tags);
- if (tags.objectId != objectId || tags.chunkId != i) {
- T(~0, (TSTR("Object %d chunkId %d NAND mismatch chunk %d tags (%d:%d)"TENDSTR),
- objectId, i, theChunk,
- tags.objectId, tags.chunkId));
+ __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, the_chunk,
+ tags.obj_id, tags.chunk_id));
- chunkMin = dev->internalStartBlock * dev->param.nChunksPerBlock;
- chunkMax = (dev->internalEndBlock+1) * dev->param.nChunksPerBlock - 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->hdrChunk)) >= chunkMin && ((unsigned)(obj->hdrChunk)) <= chunkMax);
- chunkIdOk = chunkInRange || (obj->hdrChunk == 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 &&
- obj->hdrChunk / dev->param.nChunksPerBlock,
- obj->hdrChunk % dev->param.nChunksPerBlock);
- chunkShouldNotBeDeleted = chunkInRange && !chunkValid;
+ obj->hdr_chunk / dev->param.chunks_per_block,
+ obj->hdr_chunk % dev->param.chunks_per_block);
+ chunk_wrongly_deleted = chunk_in_range && !chunk_valid;
- (TSTR("Obj %d has chunkId %d %s %s"TENDSTR),
- obj->objectId, obj->hdrChunk,
- chunkIdOk ? "" : ",out of range",
- chunkShouldNotBeDeleted ? ",marked as deleted" : ""));
+ (TSTR("Obj %d has chunk_id %d %s %s"TENDSTR),
+ obj->obj_id, obj->hdr_chunk,
+ chunk_id_ok ? "" : ",out of range",
+ chunk_wrongly_deleted ? ",marked as deleted" : ""));
- yaffs_rd_chunk_tags_nand(dev, obj->hdrChunk, buffer,
+ yaffs_rd_chunk_tags_nand(dev, obj->hdr_chunk, buffer,
&tags);
yaffs_verify_oh(obj, oh, &tags, 1);
&tags);
yaffs_verify_oh(obj, oh, &tags, 1);
T(YAFFS_TRACE_ALWAYS, (TSTR("Parent is not directory" TENDSTR)));
YBUG();
}
/* Iterate through the objects in each hash entry */
T(YAFFS_TRACE_ALWAYS, (TSTR("Parent is not directory" TENDSTR)));
YBUG();
}
/* Iterate through the objects in each hash entry */
- listObj = ylist_entry(lh, yaffs_Object, 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)
- if (directory->variantType != YAFFS_OBJECT_TYPE_DIRECTORY) {
- T(YAFFS_TRACE_ALWAYS, (TSTR("Directory has wrong type: %d" TENDSTR), directory->variantType));
+ if (directory->variant_type != YAFFS_OBJECT_TYPE_DIRECTORY) {
+ T(YAFFS_TRACE_ALWAYS,
+ (TSTR("Directory has wrong type: %d" TENDSTR),
+ directory->variant_type));
- listObj = ylist_entry(lh, yaffs_Object, 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));
- int objId;
- yaffs_Tnode *tn;
- yaffs_Tags localTags;
- yaffs_Tags *tags = &localTags;
- int theChunk;
- int chunkDeleted;
-
- if (in->variantType != YAFFS_OBJECT_TYPE_FILE)
+ int obj_id;
+ yaffs_tnode_t *tn;
+ 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)
- objId = in->objectId;
- fSize = in->variant.fileVariant.fileSize;
- nChunks =
- (fSize + in->myDev->nDataBytesPerChunk - 1) / in->myDev->nDataBytesPerChunk;
+ obj_id = in->obj_id;
+ file_size = in->variant.file_variant.file_size;
+ n_chunks =
+ (file_size + in->my_dev->data_bytes_per_chunk - 1) / in->my_dev->data_bytes_per_chunk;
- for (chunk = 1; chunk <= nChunks; chunk++) {
- tn = yaffs_find_tnode_0(in->myDev, &in->variant.fileVariant,
+ for (chunk = 1; chunk <= n_chunks; chunk++) {
+ tn = yaffs_find_tnode_0(in->my_dev, &in->variant.file_variant,
- (dev, theChunk / dev->param.nChunksPerBlock,
- theChunk % dev->param.nChunksPerBlock)) {
+ (dev, the_chunk / dev->param.chunks_per_block,
+ the_chunk % dev->param.chunks_per_block)) {
- (tags, in->objectId, chunk, chunkDeleted)) {
+ (tags, in->obj_id, chunk, is_deleted)) {