RAM-DISK / RTEMS4.10 patched with FIX for ramdisk

Rohner Thomas Thomas.Rohner at nanotronic.ch
Tue Jul 15 12:43:09 UTC 2014


Hello,

 

Recently I wrote an email (original text is on bottom of email!)

 

I found what was wrong. In my code there was no control of the fwrite() command!

If I check the return-value an treat the cases, then writing over the size of RAM-Disk is not possible anymore!

 

The amount of files is restricted by FAT.

In the root-directory are less files possible than in folders !

 

-> see 

http://de.wikipedia.org/wiki/File_Allocation_Table

or

http://forum.sysprofile.de/computerfragen/54579-durch-ist-die-maximal-moegliche-anzahl-dateien-bei-fat-begrenzt.html

 

 

 

So, every one can close my old queries/askings.

 

 

 

 

 

Here comes the original text!

________________________________

 

I'm using RTEMS 4.10 for LEON3 (Gaisler)

 

I generate my RAMDISK like this

 

               @dd if=/dev/zero of=$(NAME3) bs=1024 count=4096 > /dev/null

               /sbin/mkfs.vfat -n RD3test -i Ca551509 -F 16 -S 512 -s 1 -r 512 -f 1 -v $(NAME3)

               mcopy -b/ -i $(NAME3) content3/* ::/

               @xxd -i $(NAME3) > $(NAME3).c

               @echo [CC]  $@

               @$(CC) -c $(CFLAGS) -o $@ $(NAME3).c

 

 

I mount this as /dev/rdc on mounting point   /mntD3

 

File functions seemed to work, but I had to do some tests....

 

... result:  my RAM-Disk is 4MB in 8192 Blocks, 8095 of them may be used -> 8095 * 512 (Blocksize) = 4011008 Bytes. Correct?

 

I tried to create files (fopen()), write data (e.g. fwrite() 50000 Bytes) until the function fails. I thought that is when Disk is FULL.

But my result is like this:

 

I can either create   (there are always 185 Files !!!!, even when Disk-space is not used, can't be a limitation of FAT16)

 

155 Files @ 20'000 Bytes, and 30 files with less than 500 Bytes:  Total amount  3'237'162 Bytes      (this could be correct)

or

155 Files @ 50'000 Bytes, and 30 files with less than 500 Bytes:  Total amount  7'887'162 Bytes      (this is more than 4MB)

or

155 Files @ 100'000 Bytes, and 30 files with less than 500 Bytes:  Total amount  15'637'162 Bytes      (this is more than 4MB)

or

155 Files @ 200'000 Bytes, and 30 files with less than 500 Bytes:  Total amount  31'137'162 Bytes      (this is more than 4MB)

or

155 Files @ 500'000 Bytes, and 30 files with less than 500 Bytes:  Total amount  77'637'162 Bytes      (this is more than 4MB)

 

After creation of the file and read out the directory, I can delete/remove the files without problem, and RAM-DISK seems work correct.

 

 

I think that file-systems are not very secure to use in that case.

Who has already experiences using file-systems, especially when fail-safe is recommended.

 

 

 

Questions: 

1.      Is me generation of RAM-Disk correct?

2.      Why can I create not more than 185 files?

3.      Why can I create/use more space than RAM-Disk is generated for?

 

 

 

Thanks a lot in advance for any informations.

 

 

 

Freundliche Grüsse / Kind regards,

 

 

Thomas Rohner

Entwicklungsingenieur Software

 

nanoTRONIC GmbH

Werkstrasse 27, CH - 3250 Lyss 

 

 

T: +41 32 384 69 30, F: +41 32 384 69 31

www.nanotronic.ch <http://www.nanotronic.ch/>  | thomas.rohner at nanotronic.ch 

 

 

 

 

 

 

Freundliche Grüsse / Kind regards,



 

Thomas Rohner

Entwicklungsingenieur Software

 

nanoTRONIC GmbH

Werkstrasse 27, CH - 3250 Lyss 

 

 

T: +41 32 384 69 30, F: +41 32 384 69 31

www.nanotronic.ch <http://www.nanotronic.ch/>  | thomas.rohner at nanotronic.ch <mailto:thomas.rohner at nanotronic.ch>  

 

 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20140715/47c55ce6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 4023 bytes
Desc: image001.jpg
URL: <http://lists.rtems.org/pipermail/users/attachments/20140715/47c55ce6/attachment-0001.jpg>


More information about the users mailing list