<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">Hello.</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">I've discovered a possible bug with RFS, though I have no idea why does it happening. </div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">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.</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">Now let's forget about ring buffer and consider a simple example:</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><span class="Apple-style-span" style="font-size: 16px; "><span class="Apple-tab-span" style="white-space:pre"> </span>FILE* test = fopen("/nv/testfile","wb");</span><br></div><div><div><font
class="Apple-style-span" face="'times new roman', 'new york', times, serif"><span class="Apple-tab-span" style="white-space:pre"> </span>void* buf = malloc(2048);</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><span class="Apple-tab-span" style="white-space:pre"> </span>memset(buf,0,2048);</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><span class="Apple-tab-span" style="white-space:pre"> </span>fwrite(buf,2048,1,test);</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><span class="Apple-tab-span" style="white-space:pre"> </span></font><span class="Apple-style-span" style="font-family: 'times new roman', 'new york', times, serif; ">fclose(test);</span></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><span class="Apple-tab-span" style="white-space:pre">
</span>test = fopen("/nv/testfile","wb");</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><span class="Apple-tab-span" style="white-space:pre"> </span>rewind(test);</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><span class="Apple-tab-span" style="white-space:pre"> </span>fwrite(buf,1700,1,test);</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><span class="Apple-tab-span" style="white-space: pre; "> </span>fclose(test);</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">Size of "test" after such operations will be equal to 1700. But if u replace</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-tab-span"
style="white-space: pre; "> </span>fwrite(buf,1700,1,test);<br></font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">with</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif"><span class="Apple-tab-span" style="white-space:pre"> </span>fwrite(buf,1200,1,test);</font></div><div><font class="Apple-style-span" face="'times new roman', 'new york', times, serif">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.</font></div></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">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. </div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; ">Best regards, Oleg Moroz.</div></div></body></html>