Often, a possibility of the storage of miscellaneous data and information is required in smaller appliances.
A small File-System was exactly the correct solution there. Only, professional solutions for appliances with low storage often are to big.
MS-DOS compatible systems come fast on 150kB codes already once there. Only the data once simply so any where controls casts off... ?
The here introduced Tiny-File-System is based on hierarchical, lists double-interlinked, through what no limitation is available in number of the files within a table or file size (max 4GB). Each file can produce on that occasion in fragmented or none-fragmented form, administers and is deleted.
This file-system handles all names of directories/files as a STRING, so can used special characters in the names. Not to use are two points in series and the slashes.
.. - one directory back
/ - on the beginning of the Path: for from ROOT
/ - in middle of the Path: as separation for directory/file-names
The whole file-system works case-sensitive !
Parallel battery-buffered sRAM, EEPROM, FRAM, MRAM or 256byte-page NOR-flash as hardware are tested and port's produces. For critical applications, one variation each with Roll-Back-Buffering arrived for a sure letter however, which leads to the duplication of the writing accesses.
The application of other Flash-Memory became on reason of the sector size of >=64kB, the necessary buffering of a such against the update, as well as the long programming time of a whole side intended not. Furthermore, a safeguarding would be to be timewise hardly represented like by an above-mentioned Roll-Back-mechanism.
A use of modern data Flashes with PAGE sizes of 128byte .. 64kbytes can be made possible at any time by means of a "ReadPageToBuffer-UpdateBuffer-ErasePage-WriteBufferToPage" mechanism, however the TinyFileSystem does not examine for optimized (summarized) PageWrite.
When using NOR-Flash, however, it is important to remember that 10.000 .. 100.000 cycles is a very short life with frequent updates in the same page.
In addition, the TinyFileSystem do not respect hot spots (high-update files).
memory consumption of the pC/TFS V2.38b:
ROM: approximately 14 kBytes on a 32bit CPU
approximately 22 kBytes on a 8bit CPU
RAM: approximately 24 bytes global + 16..24 bytes per user + 9 bytes * TFS_HANDLES
plus approximately 100 bytes stack
battery-buffered IS62WV51216, EM7644SU16
AT91SAM7SE512 / ATSAM3SD8B
plus some special processors and their NOR or EEPROM based internal memory
But no mechanisms of the File-sharing are deposited. So a file can be opened simultaneously from many Users to reading but only from one User to writing.
As directory and File-Attribute, Read-Only and Hidden(System) to the disposal, stand. Hidden entries are not declared on that occasion with a TFS_GetFirst.. or TFS_GetNext.., can be grabbed directly, however.
The entire File-System does 4 GBytes on a linear storage area of maximum. The utilization of a MMU is included possible without further.
The optional functions TFS_Defrag to the defragmentation of the drive and TFS_Repair to repairing defect hierarchical concatenations are ready.
Since V2.00 can used links (to files or directories). Since V2.01 are some parameters of functions changed.
download pC/TFS 2.38b (as ZIP)
some little bug-fixes in TFS_GetFirstEntry() und TFS_GetNextEntry() and two additional fileattributes. Directories havn't attribs. Optimising code.
alpha-release with links. Tripple-source for Keil, gcc and Microsoft-C
Changed return-parameter of TFS_OpenFile(), TFS_FileRead() and TFS_FileWrite(). Implementation of TFS_GetErrNo(). Implementation of a additional LINUX-Host port's to simulate the TFS in RAM of a PC.
handling of users changed - every Task can only be one User, but every User can open TFS_HANDLES files. Adaption of API-Calls. Function of TFS_ExpandFile() changed, new function TFS_ResizeFile() added. For a FileSystem smaller than 64kByte TFSLONG for all length-parameter implemented to minimize the API- and Memory- Overhead. Now a file can opened simultaneously from many Users to reading - but only one User can open a file to writing. If a file opened (more than once) to reading, an other User can't open this file to writing - if a file from one User opened to writing, no other User can open this file for reading or writing.
TFS_GetFileSize(), TFS_GetFileAttrib() and TFS_TellFile() added. Little bugfix in internal function TFSChange_Entry().
TFS_GetFreeSize() and TFS_MoveFile() added. Bugfix in TFS_RenameFile() and TFS_RenameDir().
TFS_WriteFileE() added. SpeedUp in internal function TFSChange_Entry().
complete update to U08..U32 types. Typechanges from HANDLE to TFS_HANDLE, TFSLONG to TFS_LONG and ATTR to TFS_ATTR. Small correction in TFS_SeekFile(). Better portability for RTOS-less use implemented. Clean-Up in comments and some code-lines.
TFS_GetFirstEntry() and TFS_GetNextEntry() renamed to TFS_GetFirstName() and TFS_GetNextName(). TFS_GetFirst() and TFS_GetNext() added, this functions returns all informations about an entry (DIR/FILE) in the given structure. TFS_GetRev() added.
TFS_BecomeUserSubROOT(), TFS_GetCurrentPath(), TFS_ChangeDirTemp() and TFS_BackDirTemp() added.
change to task-ID on use of pC/OS for unique identify of running task, TFS_SetEOF() added.
correct user-check for GCC & unknown user.
TFS_GetEntry added and small correction in internal function TFSChange_Entry.
TFS_PATHNAME central for all strings added, internal functions as static as far as possible
Services of the pC/TFS version 2.38b (abbreviation)
This here presented function overview only serves as short overview.
For detailed information, you please look in Reference-Manual about pC/TFS.
Initialization of the File-System
It returns a pointer on TFS revision
save the TFS as image into a LINUX-file
Format the drive
As User announce
As User in a subdirectory as user-ROOT announce
As User cancel
Return the brutto free-memory of the drive
Create a directory
Remove a directory
Rename a directory
Change current path
Change current path temorary
returns from temporary path
Return the name of current directory
Return the complete current path from (user-)ROOT
Create a file
Remove a file
Rename a file
Move a file
Change the attributes of a file
It returns the attributes of a file
Resize a file
It returns the size of a file
Open a file in "mode"
Close the opened file
Place the pointer in opened file absolutely
It returns the pointer in opened file
Expand the size of opened file
Set EndOfFile in opened file to actual R/W-pointer
Read data from opened file
Write data into opened file
Write data into opened file, expand this file if its needed
read the error-code from Open, Read, Write ...
Create a Link to a directory or file
Remove a Link
Rename a Link
It returns the name of the linked directory or file
It returns the name of first entry in current directory
It returns the name of next entry in current directory
It returns all infos of first entry in current directory into a struct
It returns all infos of next entry in current directory into a struct
It returns all infos of the given entry (dir/file/link) into a struct
Defragment the drive
Repair the hierarchical pointer-system