[Yaffs] [Yaffs-archive] Re: What's so special about device block 0?

guxm guxm@utstar.com
Thu, 17 Jun 2004 9:34:44 +0800


Further,
So I think such design is deliberate, strict, or to say correct.=
 The dev->startBlock or endBlock is only a digital number. As for=
 which physical block we map it to, we can just do it.

Best regards
GUXM

Hi,

I have the same question. I have tried to modify=
 device.startBlock =3D 0, But I found that there is much code use 0=
 to check chunkId validation. So I have to map logical block n to=
 physical block n-1. That is the dev->startBlock(=3D1) is mapped to=
 physical block 0. It's OK now.

For example:
yaffs_PutChunkIntoFile()
{
=09existingChunk =3D tn->level0[chunkInInode &=
 YAFFS_TNODES_LEVEL0_MASK];=09=09

    ... ...
=09if(existingChunk =3D=3D 0)
=09{
=09=09in->nDataChunks++;
=09}
=09
}

yaffs_DeleteChunk()
{
    if( chunkId <=3D 0 )
        return;
}

yaffs_GetObjectName()
{
=09else if(obj->chunkId <=3D 0)
=09{
=09=09char locName[20];
=09=09sprintf(locName,"%s%d",YAFFS_LOSTNFOUND_PREFIX,obj->objectId);
=09=09strncpy(name,locName,buffSize - 1);
=09}
}
=09

Best regards
guxm


=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

>In lots of the source files, the following line of code is used
>
><code>
>=09device.startBlock =3D 1;  // Don't use block 0
></code>
>
>Having searched through the docs and sources, I've found no clue=
 why block 
>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=
 (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. 

=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 
sending an email to yaffs-request@toby-churchill.org with the text "unsubscribe" 
(without the quotes) as the subject.