From bc0784acc6972de6529d2c506d1d708e461b5cb3 Mon Sep 17 00:00:00 2001 From: Falk Werner Date: Sun, 27 Nov 2022 20:27:32 +0100 Subject: [PATCH] added timens to provider --- script/provider.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/script/provider.py b/script/provider.py index 15d6d04..26083b7 100755 --- a/script/provider.py +++ b/script/provider.py @@ -263,8 +263,9 @@ class FilesystemProvider: 0x11: FilesystemProvider.write, 0x12: FilesystemProvider.mkdir, 0x13: FilesystemProvider.readdir, - 0x14: FilesystemProvider.rmdir, - 0x15: FilesystemProvider.statfs + 0x14: FilesystemProvider.rmdir, + 0x15: FilesystemProvider.statfs, + 0x15: FilesystemProvider.utimens, } async def run(self): @@ -411,6 +412,21 @@ class FilesystemProvider: result = -ex.errno writer.write_result(result) + def utimens(self, reader, writer): + path = reader.read_path(self.root) + atime = reader.read_u64() + atime_ns = reader.read_u32() + mtime = reader.read_u64() + mtime_ns = reader.read_u32() + fd = reader.read_u64() + result = 0 + try: + os.utime(path, (atime, mtime), ns = (atime_ns, mtime_ns)) + except OSError as ex: + result = -ex.errno + writer.write_result(result) + + def open(self, reader, writer): path = reader.read_path(self.root) flags = reader.read_openflags()