[Yaffs] [Yaffs-archive] RE: What's so special about device b…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Nick Bane
Date:  
To: guxm, Jacob Dall, yaffs
Subject: [Yaffs] [Yaffs-archive] RE: What's so special about device block 0?
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.
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;
> Subject: Re: What's so special about device block 0?
>
>
> 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 = 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(=1) is mapped to
> physical block 0. It's OK now.
>
> For example:
> yaffs_PutChunkIntoFile()
> {
>     existingChunk = tn->level0[chunkInInode & 
> YAFFS_TNODES_LEVEL0_MASK];        

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

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

>
> yaffs_GetObjectName()
> {
>     else if(obj->chunkId <= 0)
>     {
>         char locName[20];

>         
> sprintf(locName,"%s%d",YAFFS_LOSTNFOUND_PREFIX,obj->objectId);
>         strncpy(name,locName,buffSize - 1);
>     }
> }

>     
>
> Best regards
> guxm
>
>
> ======= 2004-06-15 21:39:00 您在来信中写道:=======
>
> >In lots of the source files, the following line of code is used
> >
> ><code>
> >    device.startBlock = 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 with the text "unsubscribe"
>(without the quotes) as the subject.


= = = = = = = = = = = = = = = = = = = =




---------------------------------------------------------------------------------------
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 with the text "unsubscribe"
(without the quotes) as the subject.


---------------------------------------------------------------------------------------
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 with the text "unsubscribe"
(without the quotes) as the subject.