projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
yaffs Further name changes and file reorganisation
[yaffs2.git]
/
yaffs_mtdif1.c
diff --git
a/yaffs_mtdif1.c
b/yaffs_mtdif1.c
index 99653e2bff4e2b442a289e0bd7b725ce883d60a7..638099960735b34f4db90fb944fa68b07e6669c9 100644
(file)
--- a/
yaffs_mtdif1.c
+++ b/
yaffs_mtdif1.c
@@
-1,10
+1,11
@@
/*
* YAFFS: Yet another FFS. A NAND-flash specific file system.
/*
* YAFFS: Yet another FFS. A NAND-flash specific file system.
- * yaffs_mtdif1.c NAND mtd interface functions for small-page NAND.
*
*
- * Copyright (C) 2002 Aleph One Ltd.
+ * Copyright (C) 2002
-2010
Aleph One Ltd.
* for Toby Churchill Ltd and Brightstar Engineering
*
* 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 General Public License version 2 as
* published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
@@
-18,15
+19,17
@@
*
* These functions are invoked via function pointers in yaffs_nand.c.
* This replaces functionality provided by functions in yaffs_mtdif.c
*
* These functions are invoked via function pointers in yaffs_nand.c.
* This replaces functionality provided by functions in yaffs_mtdif.c
- * and the yaffs_
Tags
Compatability functions in yaffs_tagscompat.c that are
+ * and the yaffs_
tags_t
Compatability functions in yaffs_tagscompat.c that are
* called in yaffs_mtdif.c when the function pointers are NULL.
* called in yaffs_mtdif.c when the function pointers are NULL.
- * We assume the MTD layer is performing ECC (use
NANDECC
is true).
+ * We assume the MTD layer is performing ECC (use
_nand_ecc
is true).
*/
#include "yportenv.h"
*/
#include "yportenv.h"
+#include "yaffs_trace.h"
#include "yaffs_guts.h"
#include "yaffs_packedtags1.h"
#include "yaffs_guts.h"
#include "yaffs_packedtags1.h"
-#include "yaffs_tagscompat.h" // for yaffs_CalcTagsECC
+#include "yaffs_tagscompat.h" /* for yaffs_calc_tags_ecc */
+#include "yaffs_linux.h"
#include "linux/kernel.h"
#include "linux/version.h"
#include "linux/kernel.h"
#include "linux/version.h"
@@
-34,9
+37,7
@@
#include "linux/mtd/mtd.h"
/* Don't compile this module if we don't have MTD's mtd_oob_ops interface */
#include "linux/mtd/mtd.h"
/* Don't compile this module if we don't have MTD's mtd_oob_ops interface */
-#if (MTD_VERSION_CODE > MTD_VERSION(2,6,17))
-
-const char *yaffs_mtdif1_c_version = "$Id: yaffs_mtdif1.c,v 1.6 2007-12-12 18:08:15 colin Exp $";
+#if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17))
#ifndef CONFIG_YAFFS_9BYTE_TAGS
# define YTAG1_SIZE 8
#ifndef CONFIG_YAFFS_9BYTE_TAGS
# define YTAG1_SIZE 8
@@
-51,12
+52,12
@@
const char *yaffs_mtdif1_c_version = "$Id: yaffs_mtdif1.c,v 1.6 2007-12-12 18:08
* adjust 'oobfree' to match your existing Yaffs data.
*
* This nand_ecclayout scatters/gathers to/from the old-yaffs layout with the
* adjust 'oobfree' to match your existing Yaffs data.
*
* This nand_ecclayout scatters/gathers to/from the old-yaffs layout with the
- * page
S
tatus byte (at NAND spare offset 4) scattered/gathered from/to
+ * page
_s
tatus byte (at NAND spare offset 4) scattered/gathered from/to
* the 9th byte.
*
* Old-style on-NAND format: T0,T1,T2,T3,P,B,T4,T5,E0,E1,E2,T6,T7,E3,E4,E5
* 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 pageS
tatus: 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
S
tatus
+ * We have/need
packed_tags1 plus page_s
tatus: 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
_s
tatus
* byte and B is the small-page bad-block indicator byte.
*/
static struct nand_ecclayout nand_oob_16 = {
* byte and B is the small-page bad-block indicator byte.
*/
static struct nand_ecclayout nand_oob_16 = {
@@
-73,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.
*
* 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
PackedT
ags1 form
- * - Compute mini-ECC for
PackedT
ags1
+ * - Pack ExtendedTags to
packed_t
ags1 form
+ * - Compute mini-ECC for
packed_t
ags1
* - Write data and packed tags to NAND.
*
* - Write data and packed tags to NAND.
*
- * Note: Due to the use of the
PackedT
ags1 meta-data which does not include
- * a full sequence number (as found in the larger
PackedT
ags2 form) it is
+ * Note: Due to the use of the
packed_t
ags1 meta-data which does not include
+ * a full sequence number (as found in the larger
packed_t
ags2 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
* 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
@@
-88,69
+89,67
@@
static struct nand_ecclayout nand_oob_16 = {
* Any underlying MTD error results in YAFFS_FAIL.
* Returns YAFFS_OK or YAFFS_FAIL.
*/
* Any underlying MTD error results in YAFFS_FAIL.
* Returns YAFFS_OK or YAFFS_FAIL.
*/
-int nandmtd1_
WriteChunkWithTagsToNAND(yaffs_Device
*dev,
- int
chunkInNAND, const __u8 * data, const yaffs_ExtendedTags *
etags)
+int nandmtd1_
write_chunk_tags(yaffs_dev_t
*dev,
+ int
nand_chunk, const __u8 *data, const yaffs_ext_tags *
etags)
{
{
- struct mtd_info *
mtd = dev->genericDevice
;
- int chunk
Bytes = dev->nDataBytesPerC
hunk;
- loff_t addr = ((loff_t)
chunkInNAND) * chunkB
ytes;
+ struct mtd_info *
mtd = yaffs_dev_to_mtd(dev)
;
+ int chunk
_bytes = dev->data_bytes_per_c
hunk;
+ loff_t addr = ((loff_t)
nand_chunk) * chunk_b
ytes;
struct mtd_oob_ops ops;
struct mtd_oob_ops ops;
- yaffs_
PackedT
ags1 pt1;
+ yaffs_
packed_t
ags1 pt1;
int retval;
int retval;
- /* we assume that PackedTags1 and yaffs_Tags are compatible */
- compile_time_assertion(sizeof(yaffs_PackedTags1) == 12);
- compile_time_assertion(sizeof(yaffs_Tags) == 8);
-
- dev->nPageWrites++;
+ /* 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_
PackT
ags1(&pt1, etags);
- yaffs_
CalcTagsECC((yaffs_Tags
*)&pt1);
+ yaffs_
pack_t
ags1(&pt1, etags);
+ yaffs_
calc_tags_ecc((yaffs_tags_t
*)&pt1);
/* When deleting a chunk, the upper layer provides only skeletal
/* When deleting a chunk, the upper layer provides only skeletal
- * etags, one with
chunkD
eleted set. However, we need to update the
+ * etags, one with
is_d
eleted set. However, we need to update the
* tags, not erase them completely. So we use the NAND write property
* that only zeroed-bits stick and set tag bytes to all-ones and
* zero just the (not) deleted bit.
*/
#ifndef CONFIG_YAFFS_9BYTE_TAGS
* tags, not erase them completely. So we use the NAND write property
* that only zeroed-bits stick and set tag bytes to all-ones and
* zero just the (not) deleted bit.
*/
#ifndef CONFIG_YAFFS_9BYTE_TAGS
- if (etags->
chunkD
eleted) {
+ if (etags->
is_d
eleted) {
memset(&pt1, 0xff, 8);
/* clear delete status bit to indicate deleted */
pt1.deleted = 0;
}
#else
((__u8 *)&pt1)[8] = 0xff;
memset(&pt1, 0xff, 8);
/* clear delete status bit to indicate deleted */
pt1.deleted = 0;
}
#else
((__u8 *)&pt1)[8] = 0xff;
- if (etags->
chunkD
eleted) {
+ if (etags->
is_d
eleted) {
memset(&pt1, 0xff, 8);
memset(&pt1, 0xff, 8);
- /* zero page
S
tatus byte to indicate deleted */
+ /* zero page
_s
tatus byte to indicate deleted */
((__u8 *)&pt1)[8] = 0;
}
#endif
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
((__u8 *)&pt1)[8] = 0;
}
#endif
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
- ops.len = (data) ? chunk
B
ytes : 0;
+ ops.len = (data) ? chunk
_b
ytes : 0;
ops.ooblen = YTAG1_SIZE;
ops.datbuf = (__u8 *)data;
ops.oobbuf = (__u8 *)&pt1;
retval = mtd->write_oob(mtd, addr, &ops);
if (retval) {
ops.ooblen = YTAG1_SIZE;
ops.datbuf = (__u8 *)data;
ops.oobbuf = (__u8 *)&pt1;
retval = mtd->write_oob(mtd, addr, &ops);
if (retval) {
-
yaffs_trace
(YAFFS_TRACE_MTD,
-
"write_oob failed, chunk %d, mtd error %d\n"
,
-
chunkInNAND, retval
);
+
T
(YAFFS_TRACE_MTD,
+
(TSTR("write_oob failed, chunk %d, mtd error %d"TENDSTR)
,
+
nand_chunk, retval)
);
}
return retval ? YAFFS_FAIL : YAFFS_OK;
}
}
return retval ? YAFFS_FAIL : YAFFS_OK;
}
-/* Return with empty ExtendedTags but add ecc
R
esult.
+/* Return with empty ExtendedTags but add ecc
_r
esult.
*/
*/
-static int rettags(yaffs_
ExtendedTags * etags, int eccR
esult, int retval)
+static int rettags(yaffs_
ext_tags *etags, int ecc_r
esult, int retval)
{
if (etags) {
memset(etags, 0, sizeof(*etags));
{
if (etags) {
memset(etags, 0, sizeof(*etags));
- etags->ecc
Result = eccR
esult;
+ etags->ecc
_result = ecc_r
esult;
}
return retval;
}
}
return retval;
}
@@
-158,38
+157,36
@@
static int rettags(yaffs_ExtendedTags * etags, int eccResult, int retval)
/* Read a chunk (page) from NAND.
*
* Caller expects ExtendedTags data to be usable even on error; that is,
/* Read a chunk (page) from NAND.
*
* Caller expects ExtendedTags data to be usable even on error; that is,
- * all members except ecc
Result and blockB
ad are zeroed.
+ * all members except ecc
_result and block_b
ad are zeroed.
*
* - Check ECC results for data (if applicable)
* - Check for blank/erased block (return empty ExtendedTags if blank)
*
* - Check ECC results for data (if applicable)
* - Check for blank/erased block (return empty ExtendedTags if blank)
- * - Check the
PackedT
ags1 mini-ECC (correct if necessary/possible)
- * - Convert
PackedT
ags1 to ExtendedTags
- * - Update ecc
Result and blockB
ad members to refect state.
+ * - Check the
packed_t
ags1 mini-ECC (correct if necessary/possible)
+ * - Convert
packed_t
ags1 to ExtendedTags
+ * - Update ecc
_result and block_b
ad members to refect state.
*
* Returns YAFFS_OK or YAFFS_FAIL.
*/
*
* Returns YAFFS_OK or YAFFS_FAIL.
*/
-int nandmtd1_
ReadChunkWithTagsFromNAND(yaffs_Device
*dev,
- int
chunkInNAND, __u8 * data, yaffs_ExtendedTags *
etags)
+int nandmtd1_
read_chunk_tags(yaffs_dev_t
*dev,
+ int
nand_chunk, __u8 *data, yaffs_ext_tags *
etags)
{
{
- struct mtd_info *
mtd = dev->genericDevice
;
- int chunk
Bytes = dev->nDataBytesPerC
hunk;
- loff_t addr = ((loff_t)
chunkInNAND) * chunkB
ytes;
+ struct mtd_info *
mtd = yaffs_dev_to_mtd(dev)
;
+ int chunk
_bytes = dev->data_bytes_per_c
hunk;
+ loff_t addr = ((loff_t)
nand_chunk) * chunk_b
ytes;
int eccres = YAFFS_ECC_RESULT_NO_ERROR;
struct mtd_oob_ops ops;
int eccres = YAFFS_ECC_RESULT_NO_ERROR;
struct mtd_oob_ops ops;
- yaffs_
PackedT
ags1 pt1;
+ yaffs_
packed_t
ags1 pt1;
int retval;
int deleted;
int retval;
int deleted;
- dev->nPageReads++;
-
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
- ops.len = (data) ? chunk
B
ytes : 0;
+ ops.len = (data) ? chunk
_b
ytes : 0;
ops.ooblen = YTAG1_SIZE;
ops.datbuf = data;
ops.oobbuf = (__u8 *)&pt1;
ops.ooblen = YTAG1_SIZE;
ops.datbuf = data;
ops.oobbuf = (__u8 *)&pt1;
-#if (MTD_VERSION_CODE < MTD_VERSION(2,
6,
20))
+#if (MTD_VERSION_CODE < MTD_VERSION(2,
6,
20))
/* In MTD 2.6.18 to 2.6.19 nand_base.c:nand_do_read_oob() has a bug;
* help it out with ops.len = ops.ooblen when ops.datbuf == NULL.
*/
/* In MTD 2.6.18 to 2.6.19 nand_base.c:nand_do_read_oob() has a bug;
* help it out with ops.len = ops.ooblen when ops.datbuf == NULL.
*/
@@
-200,9
+197,9
@@
int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_Device *dev,
*/
retval = mtd->read_oob(mtd, addr, &ops);
if (retval) {
*/
retval = mtd->read_oob(mtd, addr, &ops);
if (retval) {
-
yaffs_trace
(YAFFS_TRACE_MTD,
-
"read_oob failed, chunk %d, mtd error %d\n"
,
-
chunkInNAND, retval
);
+
T
(YAFFS_TRACE_MTD,
+
(TSTR("read_oob failed, chunk %d, mtd error %d"TENDSTR)
,
+
nand_chunk, retval)
);
}
switch (retval) {
}
switch (retval) {
@@
-213,23
+210,23
@@
int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_Device *dev,
case -EUCLEAN:
/* MTD's ECC fixed the data */
eccres = YAFFS_ECC_RESULT_FIXED;
case -EUCLEAN:
/* MTD's ECC fixed the data */
eccres = YAFFS_ECC_RESULT_FIXED;
- dev->
eccF
ixed++;
+ dev->
n_ecc_f
ixed++;
break;
case -EBADMSG:
/* MTD's ECC could not fix the data */
break;
case -EBADMSG:
/* MTD's ECC could not fix the data */
- dev->
eccU
nfixed++;
+ dev->
n_ecc_u
nfixed++;
/* fall into... */
default:
rettags(etags, YAFFS_ECC_RESULT_UNFIXED, 0);
/* fall into... */
default:
rettags(etags, YAFFS_ECC_RESULT_UNFIXED, 0);
- etags->block
B
ad = (mtd->block_isbad)(mtd, addr);
+ etags->block
_b
ad = (mtd->block_isbad)(mtd, addr);
return YAFFS_FAIL;
}
/* Check for a blank/erased chunk.
*/
return YAFFS_FAIL;
}
/* Check for a blank/erased chunk.
*/
- if (yaffs_
CheckFF
((__u8 *)&pt1, 8)) {
- /* when blank, upper layers want ecc
R
esult to be <= NO_ERROR */
+ if (yaffs_
check_ff
((__u8 *)&pt1, 8)) {
+ /* when blank, upper layers want ecc
_r
esult to be <= NO_ERROR */
return rettags(etags, YAFFS_ECC_RESULT_NO_ERROR, YAFFS_OK);
}
return rettags(etags, YAFFS_ECC_RESULT_NO_ERROR, YAFFS_OK);
}
@@
-241,37
+238,37
@@
int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_Device *dev,
deleted = !pt1.deleted;
pt1.deleted = 1;
#else
deleted = !pt1.deleted;
pt1.deleted = 1;
#else
- deleted = (yaffs_
CountB
its(((__u8 *)&pt1)[8]) < 7);
+ deleted = (yaffs_
count_b
its(((__u8 *)&pt1)[8]) < 7);
#endif
/* Check the packed tags mini-ECC and correct if necessary/possible.
*/
#endif
/* Check the packed tags mini-ECC and correct if necessary/possible.
*/
- retval = yaffs_
CheckECCOnTags((yaffs_Tags
*)&pt1);
+ retval = yaffs_
check_tags_ecc((yaffs_tags_t
*)&pt1);
switch (retval) {
case 0:
/* no tags error, use MTD result */
break;
case 1:
/* recovered tags-ECC error */
switch (retval) {
case 0:
/* no tags error, use MTD result */
break;
case 1:
/* recovered tags-ECC error */
- dev->
tagsEccF
ixed++;
+ dev->
n_tags_ecc_f
ixed++;
if (eccres == YAFFS_ECC_RESULT_NO_ERROR)
eccres = YAFFS_ECC_RESULT_FIXED;
break;
default:
/* unrecovered tags-ECC error */
if (eccres == YAFFS_ECC_RESULT_NO_ERROR)
eccres = YAFFS_ECC_RESULT_FIXED;
break;
default:
/* unrecovered tags-ECC error */
- dev->
tagsEccU
nfixed++;
+ dev->
n_tags_ecc_u
nfixed++;
return rettags(etags, YAFFS_ECC_RESULT_UNFIXED, YAFFS_FAIL);
}
/* Unpack the tags to extended form and set ECC result.
return rettags(etags, YAFFS_ECC_RESULT_UNFIXED, YAFFS_FAIL);
}
/* Unpack the tags to extended form and set ECC result.
- * [set should
BeFF just to keep yaffs_UnpackT
ags1 happy]
+ * [set should
_be_ff just to keep yaffs_unpack_t
ags1 happy]
*/
*/
- pt1.should
BeFF
= 0xFFFFFFFF;
- yaffs_
UnpackT
ags1(etags, &pt1);
- etags->ecc
R
esult = eccres;
+ pt1.should
_be_ff
= 0xFFFFFFFF;
+ yaffs_
unpack_t
ags1(etags, &pt1);
+ etags->ecc
_r
esult = eccres;
/* Set deleted state */
/* Set deleted state */
- etags->
chunkD
eleted = deleted;
+ etags->
is_d
eleted = deleted;
return YAFFS_OK;
}
return YAFFS_OK;
}
@@
-282,32
+279,32
@@
int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_Device *dev,
*
* Returns YAFFS_OK or YAFFS_FAIL.
*/
*
* Returns YAFFS_OK or YAFFS_FAIL.
*/
-int nandmtd1_
MarkNANDBlockBad(struct yaffs_DeviceStruct *dev, int blockN
o)
+int nandmtd1_
mark_block_bad(struct yaffs_dev_s *dev, int block_n
o)
{
{
- struct mtd_info *
mtd = dev->genericDevice
;
- int blocksize = dev->
nChunksPerBlock * dev->nDataBytesPerC
hunk;
+ struct mtd_info *
mtd = yaffs_dev_to_mtd(dev)
;
+ int blocksize = dev->
param.chunks_per_block * dev->data_bytes_per_c
hunk;
int retval;
int retval;
-
yaffs_trace(YAFFS_TRACE_BAD_BLOCKS, "marking block %d bad\n", blockNo
);
+
T(YAFFS_TRACE_BAD_BLOCKS,(TSTR("marking block %d bad"TENDSTR), block_no)
);
- retval = mtd->block_markbad(mtd, (loff_t)blocksize * block
N
o);
+ retval = mtd->block_markbad(mtd, (loff_t)blocksize * block
_n
o);
return (retval) ? YAFFS_FAIL : YAFFS_OK;
}
/* Check any MTD prerequists.
return (retval) ? YAFFS_FAIL : YAFFS_OK;
}
/* Check any MTD prerequists.
- *
+ *
* Returns YAFFS_OK or YAFFS_FAIL.
*/
* 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 */
int oobavail = mtd->ecclayout->oobavail;
if (oobavail < YTAG1_SIZE) {
{
/* 2.6.18 has mtd->ecclayout->oobavail */
/* 2.6.21 has mtd->ecclayout->oobavail and mtd->oobavail */
int oobavail = mtd->ecclayout->oobavail;
if (oobavail < YTAG1_SIZE) {
-
yaffs_trace
(YAFFS_TRACE_ERROR,
-
"mtd device has only %d bytes for tags, need %d\n"
,
- oobavail, YTAG1_SIZE);
+
T
(YAFFS_TRACE_ERROR,
+
(TSTR("mtd device has only %d bytes for tags, need %d"TENDSTR)
,
+ oobavail, YTAG1_SIZE)
)
;
return YAFFS_FAIL;
}
return YAFFS_OK;
return YAFFS_FAIL;
}
return YAFFS_OK;
@@
-322,13
+319,13
@@
static int nandmtd1_TestPrerequists(struct mtd_info * mtd)
*
* Always returns YAFFS_OK.
*/
*
* Always returns YAFFS_OK.
*/
-int nandmtd1_
QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockN
o,
- yaffs_
BlockState * pState, int *pSequenceNumbe
r)
+int nandmtd1_
query_block(struct yaffs_dev_s *dev, int block_n
o,
+ yaffs_
block_state_t *state_ptr, __u32 *seq_pt
r)
{
{
- struct mtd_info *
mtd = dev->genericDevice
;
- int chunk
No = blockNo * dev->nChunksPerB
lock;
- loff_t addr = (loff_t)chunk
No * dev->nDataBytesPerC
hunk;
- yaffs_
ExtendedT
ags etags;
+ struct mtd_info *
mtd = yaffs_dev_to_mtd(dev)
;
+ int chunk
_num = block_no * dev->param.chunks_per_b
lock;
+ loff_t addr = (loff_t)chunk
_num * dev->data_bytes_per_c
hunk;
+ yaffs_
ext_t
ags etags;
int state = YAFFS_BLOCK_STATE_DEAD;
int seqnum = 0;
int retval;
int state = YAFFS_BLOCK_STATE_DEAD;
int seqnum = 0;
int retval;
@@
-336,31
+333,27
@@
int nandmtd1_QueryNANDBlock(struct yaffs_DeviceStruct *dev, int blockNo,
/* 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.
*/
/* 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;
return YAFFS_FAIL;
- }
- retval = nandmtd1_
ReadChunkWithTagsFromNAND(dev, chunkNo
, NULL, &etags);
- etags.block
B
ad = (mtd->block_isbad)(mtd, addr);
- if (etags.block
B
ad) {
-
yaffs_trace
(YAFFS_TRACE_BAD_BLOCKS,
-
"block %d is marked bad\n", blockNo
);
+ retval = nandmtd1_
read_chunk_tags(dev, chunk_num
, NULL, &etags);
+ etags.block
_b
ad = (mtd->block_isbad)(mtd, addr);
+ if (etags.block
_b
ad) {
+
T
(YAFFS_TRACE_BAD_BLOCKS,
+
(TSTR("block %d is marked bad"TENDSTR), block_no)
);
state = YAFFS_BLOCK_STATE_DEAD;
state = YAFFS_BLOCK_STATE_DEAD;
- }
- else if (etags.eccResult != YAFFS_ECC_RESULT_NO_ERROR) {
+ } else if (etags.ecc_result != YAFFS_ECC_RESULT_NO_ERROR) {
/* bad tags, need to look more closely */
state = YAFFS_BLOCK_STATE_NEEDS_SCANNING;
/* bad tags, need to look more closely */
state = YAFFS_BLOCK_STATE_NEEDS_SCANNING;
- }
- else if (etags.chunkUsed) {
+ } else if (etags.chunk_used) {
state = YAFFS_BLOCK_STATE_NEEDS_SCANNING;
state = YAFFS_BLOCK_STATE_NEEDS_SCANNING;
- seqnum = etags.sequenceNumber;
- }
- else {
+ seqnum = etags.seq_number;
+ } else {
state = YAFFS_BLOCK_STATE_EMPTY;
}
state = YAFFS_BLOCK_STATE_EMPTY;
}
- *
pState
= state;
- *
pSequenceNumbe
r = seqnum;
+ *
state_ptr
= state;
+ *
seq_pt
r = seqnum;
/* query always succeeds */
return YAFFS_OK;
/* query always succeeds */
return YAFFS_OK;