* Write test buffer
*/
if (kfile_write(f, buf, size) != size)
+ {
+ LOG_ERR("error writing buf");
return false;
+ }
kfile_seek(f, -(kfile_off_t)size, KSM_SEEK_CUR);
* Read file in test buffer
*/
if (kfile_read(f, buf, size) != size)
+ {
+ LOG_ERR("error reading buf");
return false;
+ }
+
kfile_seek(f, -(kfile_off_t)size, KSM_SEEK_CUR);
* Check test result
*/
for (size_t i = 0; i < size; i++)
+ {
if (buf[i] != (i & 0xff))
+ {
+ LOG_ERR("error comparing at index [%d] read [%02x] expected [%02x]\n", i, buf[i], i);
return false;
+ }
+ }
return true;
}