From 09775743724b5455ac093566512a8c5e13ea2047 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Mon, 31 Aug 2020 14:38:45 +0200 Subject: [PATCH] vfs/rtc: return timestamp size on stat() --- repos/os/src/lib/vfs/rtc_file_system.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/repos/os/src/lib/vfs/rtc_file_system.h b/repos/os/src/lib/vfs/rtc_file_system.h index c7db29acc2..1921a5ae03 100644 --- a/repos/os/src/lib/vfs/rtc_file_system.h +++ b/repos/os/src/lib/vfs/rtc_file_system.h @@ -27,6 +27,9 @@ class Vfs::Rtc_file_system : public Single_file_system { private: + /* "1970-01-01 00:00\n" */ + enum { TIMESTAMP_LEN = 17 }; + class Rtc_vfs_handle : public Single_vfs_handle { private: @@ -51,8 +54,6 @@ class Vfs::Rtc_file_system : public Single_file_system Read_result read(char *dst, file_size count, file_size &out_count) override { - enum { TIMESTAMP_LEN = 17 }; - if (seek() >= TIMESTAMP_LEN) { out_count = 0; return READ_OK; @@ -137,7 +138,13 @@ class Vfs::Rtc_file_system : public Single_file_system Stat_result stat(char const *path, Stat &out) override { - return Single_file_system::stat(path, out); + Stat_result result = Single_file_system::stat(path, out); + + if (result == STAT_OK) { + out.size = TIMESTAMP_LEN; + } + + return result; } Watch_result watch(char const *path,