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

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: guxm
Date:  
To: Jacob Dall, yaffs@toby-churchill.org
Subject: [Yaffs-archive] 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.