Trouble with RFS
oleg_moroz at yahoo.com
Thu Jun 9 14:14:47 UTC 2011
I've discovered a possible bug with RFS, though I have no idea why does it happening.
My goal was to develop event logger based on ring buffer, which is stored in a file of static size (say, 2048 bytes). It didn't take a lot of time, and I've tested it on debian linux first, so I'm pretty much sured my logger is OK. After that, I've reconfigured it for using with RTEMS. Everything did work fine while I was using IMFS or dosfs to store the file with logs. But when I tried to use it with RFS, I experienced the following case: it truncates my file, when I try to write more than 1536 bytes of data. For example, if I write 1024 bytes and close the file, it's size stays unchanged and equals 2048. But if I write 1700 bytes, RFS truncates my file to size of 1700. That doesn't fit me at all, since I need my ring buffer size to be fixed for obvious reasons.
Now let's forget about ring buffer and consider a simple example:
FILE* test = fopen("/nv/testfile","wb");
void* buf = malloc(2048);
test = fopen("/nv/testfile","wb");
Size of "test" after such operations will be equal to 1700. But if u replace
the size of file will remain unchanged and will be equal to 2048. So it seems that RFS truncates the file, if file pointer stops in last block (in my example size of block is 512 bytes). Personally, I don't think that it's normal, since no other FS does change the size of file in such case.
As I've said, I have no idea, why and what for does it happening. I'm going to use another FS for further development, but I hope this information about RFS can be usefull.
Best regards, Oleg Moroz.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the users