[Yaffs] [Yaffs-archive] RE: What's so special about device block 0?
Nick Bane
nick@cecomputing.co.uk
Thu, 17 Jun 2004 09:11:39 +0100
Yaffs is logical block based.
Due to a need for an explicitly unused block index number, index 0 is =
used anmd is therefore unavailable as a usable logical block.
Physical blocks can be wherever you want them to be.=20
See multi-nand-chip mtd driver for linux for one example (a virtual nand =
device from an array of identical nand chips) and partitioning nand =
devices (bootldr example on husaberg) as another.
The only problen I can see is if you use removable media (eg =
SmartMedia), have an unexpected logical to physical mapping and want =
interoperability with systems that assume a one to one mapping.
Nick Bane
> -----Original Message-----
> From: guxm [mailto:guxm@utstar.com]
> Sent: 17 June 2004 02:35
> To: Jacob Dall; yaffs@toby-churchill.org
> Subject: Re: What's so special about device block 0?
>=20
>=20
> Further,
> So I think such design is deliberate, strict, or to say correct.=20
> The dev->startBlock or endBlock is only a digital number. As for=20
> which physical block we map it to, we can just do it.
>=20
> Best regards
> GUXM
>=20
> Hi,
>=20
> I have the same question. I have tried to modify=20
> device.startBlock =3D 0, But I found that there is much code use 0=20
> to check chunkId validation. So I have to map logical block n to=20
> physical block n-1. That is the dev->startBlock(=3D1) is mapped to=20
> physical block 0. It's OK now.
>=20
> For example:
> yaffs_PutChunkIntoFile()
> {
> existingChunk =3D tn->level0[chunkInInode &=20
> YAFFS_TNODES_LEVEL0_MASK]; =09
>=20
> ... ...
> if(existingChunk =3D=3D 0)
> {
> in->nDataChunks++;
> }
> =09
> }
>=20
> yaffs_DeleteChunk()
> {
> if( chunkId <=3D 0 )
> return;
> }
>=20
> yaffs_GetObjectName()
> {
> else if(obj->chunkId <=3D 0)
> {
> char locName[20];
> =09
> sprintf(locName,"%s%d",YAFFS_LOSTNFOUND_PREFIX,obj->objectId);
> strncpy(name,locName,buffSize - 1);
> }
> }
> =09
>=20
> Best regards
> guxm
>=20
>=20
> =3D=3D=3D=3D=3D=3D=3D 2004-06-15 21:39:00 =
=C4=FA=D4=DA=C0=B4=D0=C5=D6=D0=D0=B4=B5=C0=A3=BA=3D=3D=3D=3D=3D=3D=3D
>=20
> >In lots of the source files, the following line of code is used
> >
> ><code>
> > device.startBlock =3D 1; // Don't use block 0
> ></code>
> >
> >Having searched through the docs and sources, I've found no clue=20
> why block=20
> >0 is different that the rest of the device blocks.
> >
> >Please, anyone, enlighten me.
> >
> >Thanks,
> >Jacob Dall
> >
> >
> >
> >-----------------------------------------------------------------
> ----------------------
> >This mailing list is hosted by Toby Churchill open software=20
(www.toby-churchill.org).
>If mailing list membership is no longer wanted you can remove yourself =
from the list by=20
>sending an email to yaffs-request@toby-churchill.org with the text =
"unsubscribe"=20
>(without the quotes) as the subject.=20
=3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =3D =
=3D =3D
-------------------------------------------------------------------------=
--------------
This mailing list is hosted by Toby Churchill open software =
(www.toby-churchill.org).
If mailing list membership is no longer wanted you can remove yourself =
from the list by=20
sending an email to yaffs-request@toby-churchill.org with the text =
"unsubscribe"=20
(without the quotes) as the subject.=20
---------------------------------------------------------------------------------------
This mailing list is hosted by Toby Churchill open software (www.toby-churchill.org).
If mailing list membership is no longer wanted you can remove yourself from the list by
sending an email to yaffs-request@toby-churchill.org with the text "unsubscribe"
(without the quotes) as the subject.