Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] Re: Cheap SD Flash File System

2005-11-11 by Bogdan Teodorescu

Hello,
I am not able to open http://alumnus.caltech.edu/~pje/rdcf2.txt`
Does anybody knows were to find those files ?
Thanks
Bogdan
----- Original Message ----- 
From: "rtstofer" <rstofer@...>
To: <lpc2000@yahoogroups.com>
Sent: Friday, November 11, 2005 1:17 AM
Subject: [lpc2000] Re: Cheap SD Flash File System


> --- In lpc2000@yahoogroups.com, "Dan Beadle" <dan.beadle@i...> wrote:
>>
>> When you delete an entry in the DIR by writing E5 to the first
> byte, you
>> must first deallocate all used sectors.
>
> I don't think so.  If you deallocate at that point, you can never
> recover the file and an entire aftermarket software industry would
> crash and burn.  I gotta think about this...  Perhaps the sectors
> are unallocated when the directory entry is used for a new file.
>
> Anyway, deallocating a used cluster would be done by writing
> 0x00000000 to the cluster entry in the FAT?
>
>>
>>
>> (If you don't, you have to old DOS problem of lost clusters)
>>
>>
>>
>> Delete File:
>>
>>             Starting at First Cluster,  (from Dir entry)
>>
>>                         Walk through the cluster allocation table,
>> unlinking each cluster from the file (returning to free)
>
> Again, by writing 0x00000000?  Or is there a linked list of free
> clusters?  If so, I missed that somehow!  Or do I just wander around
> in the FAT looking for a 0x00000000 entry?  Maybe the closest one
> above the current cluster?
>
>>
>>             Then mark first byte of file name to E5.
>>
>>
>>
>>
>>
>> As for writing, it is just the reverse...
>>
>>
>>
>> Make sure the files does not exist, if it does, delete it per
> above.
>>
>>
>>
>> Search the directory for an entry starting in NULL or 0xE5
> (previously
>> deleted)
>>
>> Fill in your information in that structure. (File names are fixed
> size,
>> not null terminated. Pad with blanks)
>>
>> Find a free cluster from the Cluster Allocation Table.
>>
>> Put that entry into the Dir.
>>
>> Mark that cluster as EOF (FFFF) in the CAT
>>
>> Write the first cluster of information.
>
> Dealing with sectors per cluster along the way...
>
>>
>> If there is more, find another free cluster
>>
>>             Mark the new cluster as EOF in the Cat
>>
>>             Change the EOF on the prior cluster from EOF to point
> to
>> this cluster
>>
>>
>>
>> Repeat till end of file...
>
> No questions here...
>
>>
>> Update the directory structure with file size, time (if desired).
>>
>>
>
> Yes, do this in close();  So, what do you do with the remaining
> bytes in a partially filled sector and the remaining sectors in a
> partially filled cluster?  My tendency from a security point of view
> would be to fill them with 0's, or my personal favorite 0x5A.
>
> Richard
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.