From 399487c85dc60b1d7e5a80235019f2871d7771d8 Mon Sep 17 00:00:00 2001 From: Sebastian Sumpf Date: Thu, 18 Apr 2019 12:53:12 +0200 Subject: [PATCH] gems: add direct fs constructor to Watch_handler issue #3294 --- repos/gems/include/gems/vfs.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/repos/gems/include/gems/vfs.h b/repos/gems/include/gems/vfs.h index 2aac9cce1..49823cba9 100644 --- a/repos/gems/include/gems/vfs.h +++ b/repos/gems/include/gems/vfs.h @@ -570,6 +570,12 @@ class Genode::Watcher Directory::join(dir._path, rel_path), handler); } + Watcher(Vfs::File_system &fs, Directory::Path const &rel_path, + Genode::Allocator &alloc, Vfs::Watch_response_handler &handler) + { + _watch(fs, alloc, rel_path, handler); + } + ~Watcher() { _handle->fs().close(_handle); } }; @@ -592,6 +598,12 @@ class Genode::Watch_handler : public Vfs::Watch_response_handler, Watcher(dir, rel_path, *this), _obj(obj), _member(member) { } + Watch_handler(Vfs::File_system &fs, Directory::Path const &rel_path, + Genode::Allocator &alloc, T &obj, void (T::*member)()) + : + Watcher(fs,rel_path, alloc, *this), _obj(obj), _member(member) + { } + void watch_response() override { (_obj.*_member)(); } };