projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add flus, close, read; almost complete open.
[bertos.git]
/
kern
/
kfile.c
diff --git
a/kern/kfile.c
b/kern/kfile.c
index ab8016c32cda080421fd2ba2bb03103a0a50758c..1e542a333a66e2a44060a9491f6640aa9fb4278b 100644
(file)
--- a/
kern/kfile.c
+++ b/
kern/kfile.c
@@
-170,7
+170,7
@@
int kfile_gets_echo(struct KFile *fd, char *buf, int size, bool echo)
* Move \a fd file seek position of \a offset bytes from \a whence.
*
* This is a generic implementation of seek function, you can redefine
* Move \a fd file seek position of \a offset bytes from \a whence.
*
* This is a generic implementation of seek function, you can redefine
- * it in your local module i
s
needed.
+ * it in your local module i
f
needed.
*/
kfile_off_t kfile_genericSeek(struct KFile *fd, kfile_off_t offset, KSeekMode whence)
{
*/
kfile_off_t kfile_genericSeek(struct KFile *fd, kfile_off_t offset, KSeekMode whence)
{
@@
-206,6
+206,18
@@
kfile_off_t kfile_genericSeek(struct KFile *fd, kfile_off_t offset, KSeekMode wh
return fd->seek_pos;
}
return fd->seek_pos;
}
+/**
+ * Reopen file \a fd.
+ * This is a generic implementation that only flush file
+ * and reset seek_pos to 0.
+ */
+struct KFile * kfile_genericReopen(struct KFile *fd)
+{
+ kfile_flush(fd);
+ kfile_seek(fd, 0, KSM_SEEK_SET);
+ return fd;
+}
+
#if CONFIG_TEST
/**
#if CONFIG_TEST
/**