Отв.: Trouble with RFS

Oleg Moroz oleg_moroz at yahoo.com
Fri Jun 10 06:52:59 UTC 2011

От: Joel Sherrill <joel.sherrill at oarcorp.com>
Кому: Oleg Moroz <oleg_moroz at yahoo.com>
Копия: Rtems <rtems-users at rtems.org>
Отправлено: четверг, 9 июня 2011 18:56
Тема: Re: Trouble with RFS

Is this with 4.10.0?  There is a bug which sounds
like this.



On 06/09/2011 09:14 AM, Oleg Moroz wrote:
> Hello.
> 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);
> memset(buf,0,2048);
> fwrite(buf,2048,1,test);
> fclose(test);
> test = fopen("/nv/testfile","wb");
> rewind(test);
> fwrite(buf,1700,1,test);
> fclose(test);
> Size of "test" after such operations will be equal to 1700. But if u replace
> fwrite(buf,1700,1,test);
> with
> fwrite(buf,1200,1,test);
> 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.

-- Joel Sherrill, Ph.D.             Director of Research&  Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

it's looks the same. I will try to apply the patch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20110610/7aeb4568/attachment-0001.html>

More information about the users mailing list