- /* TEST 1 BEGIN. */
- kprintf("Test 1: write from pos 0 to [%lu]\n", fd.size);
-
- /*
- * Seek to addr 0
- */
- if (fd.seek(&fd, 0, KSM_SEEK_SET) != 0)
- goto kfile_test_end;
-
- kprintf("Seek to [%lu], expected[0]\n", fd.seek_pos);
-
- /*
- * Test flash read/write to address 0..size
- */
- if (!Kfile_rwTest(&fd, test_buf, size))
- goto kfile_test_end;
-
- kprintf("Test 1: ok!\n");
-
- /*
- * Restore previous read content
- */
- if (save_buf != NULL)
- {
- fd.seek(&fd, 0, KSM_SEEK_SET);
-
- if (fd.write(&fd, save_buf, save_buf_size) != size)
- goto kfile_test_end;
-
- kprintf("Restore content..form [%lu] to [%lu]\n", fd.seek_pos, fd.seek_pos + save_buf_size);
- }
- /* TEST 1 END. */
-
- /* TEST 2 BEGIN. */
- kprintf("Test 2: write from pos [%lu] to [%lu]\n", fd.size/2 , size);
-
- /*
- * Go to half test size.
- */
- fd.seek(&fd, (fd.size/ 2), KSM_SEEK_SET);
-
- kprintf("Seek to [%lu], expected[%lu]\n", fd.seek_pos, fd.size/2);
-
- /*
- * If necessary, user could save content,
- * for later restore.
- */
- if (save_buf != NULL)
- {
- fd.read(&fd, save_buf, save_buf_size);
- fd.seek(&fd, -size, KSM_SEEK_CUR);
- kprintf("Saved content..form [%lu] to [%lu]\n", fd.seek_pos, fd.seek_pos + save_buf_size);
- }
+#if CONFIG_KFILE_GETS
+/**
+ * Read a line long at most as size and put it
+ * in buf.
+ * \return number of chars read or EOF in case
+ * of error.
+ */
+int kfile_gets(struct KFile *fd, char *buf, int size)
+{
+ return kfile_gets_echo(fd, buf, size, false);
+}