+/**
+ * Generic implementation of kfile_seek.
+ */
+kfile_off_t kfile_genericSeek(struct KFile *fd, kfile_off_t offset, KSeekMode whence);
+
+/**
+ * Generic implementation of kfile_reopen.
+ */
+struct KFile * kfile_genericReopen(struct KFile *fd);
+
+int kfile_putc(int c, struct KFile *fd); ///< Generic putc implementation using kfile_write.
+int kfile_getc(struct KFile *fd); ///< Generic getc implementation using kfile_read.
+int kfile_printf(struct KFile *fd, const char *format, ...);
+int kfile_print(struct KFile *fd, const char *s);
+int kfile_gets(struct KFile *fd, char *buf, int size);
+int kfile_gets_echo(struct KFile *fd, char *buf, int size, bool echo);
+
+/**
+ * Interface functions for KFile access.
+ * \note Remember to change following functions if KFile interface changes.
+ * \{
+ */
+INLINE size_t kfile_read(struct KFile *fd, void *buf, size_t size)
+{
+ ASSERT(fd->read);
+ return fd->read(fd, buf, size);
+}
+
+INLINE size_t kfile_write(struct KFile *fd, const void *buf, size_t size)
+{
+ ASSERT(fd->write);
+ return fd->write(fd, buf, size);
+}
+
+INLINE KFile * kfile_reopen(struct KFile *fd)
+{
+ ASSERT(fd->reopen);
+ return fd->reopen(fd);
+}
+
+INLINE int kfile_close(struct KFile *fd)
+{
+ ASSERT(fd->close);
+ return fd->close(fd);
+}
+
+INLINE kfile_off_t kfile_seek(struct KFile *fd, kfile_off_t offset, KSeekMode whence)
+{
+ ASSERT(fd->seek);
+ return fd->seek(fd, offset, whence);
+}
+
+INLINE int kfile_flush(struct KFile *fd)
+{
+ ASSERT(fd->flush);
+ return fd->flush(fd);
+}
+
+INLINE int kfile_error(struct KFile *fd)
+{
+ ASSERT(fd->error);
+ return fd->error(fd);
+}
+
+INLINE void kfile_clearerr(struct KFile *fd)
+{
+ ASSERT(fd->clearerr);
+ fd->clearerr(fd);
+}
+/* \} */
+
+/**
+ * Kfile test function.
+ */
+bool kfile_test(KFile *fd, uint8_t *test_buf, uint8_t *save_buf, size_t size);
+
+#endif /* KERN_KFILE_H */