VFS: watch result is ERR_UNACCESSIBLE by default

Ref #2745
This commit is contained in:
Emery Hemingway
2018-04-04 12:33:53 +02:00
committed by Christian Helmuth
parent 97f50e8e15
commit 3c07860aad
2 changed files with 8 additions and 7 deletions

View File

@ -762,19 +762,21 @@ class Vfs::Dir_file_system : public File_system
Vfs_watch_handle **handle, Vfs_watch_handle **handle,
Allocator &alloc) override Allocator &alloc) override
{ {
/* static by default, no allocations */ Watch_result res = WATCH_ERR_UNACCESSIBLE;
Watch_result r = WATCH_ERR_STATIC;
Dir_watch_handle *meta_handle = nullptr; Dir_watch_handle *meta_handle = nullptr;
char const *sub_path = _sub_path(path);
if (!sub_path) return res;
for (File_system *fs = _first_file_system; fs; fs = fs->next) { for (File_system *fs = _first_file_system; fs; fs = fs->next) {
Vfs_watch_handle *sub_handle; Vfs_watch_handle *sub_handle;
if (fs->watch(path, &sub_handle, alloc) == WATCH_OK) { if (fs->watch(sub_path, &sub_handle, alloc) == WATCH_OK) {
if (meta_handle == nullptr) { if (meta_handle == nullptr) {
/* at least one non-static FS, allocate handle */ /* at least one non-static FS, allocate handle */
meta_handle = new (alloc) Dir_watch_handle(*this, alloc); meta_handle = new (alloc) Dir_watch_handle(*this, alloc);
*handle = meta_handle; *handle = meta_handle;
r = WATCH_OK; res = WATCH_OK;
} }
/* attach child FS handle to returned handle */ /* attach child FS handle to returned handle */
@ -784,7 +786,7 @@ class Vfs::Dir_file_system : public File_system
} }
} }
return r; return res;
} }
void close(Vfs_watch_handle *handle) override void close(Vfs_watch_handle *handle) override

View File

@ -128,8 +128,7 @@ struct Vfs::Directory_service : Interface
Allocator&) Allocator&)
{ {
/* default implementation for static file-systems */ /* default implementation for static file-systems */
Genode::warning("'", path, "' is static and cannot be watched"); return (leaf_path(path)) ? WATCH_ERR_STATIC : WATCH_ERR_UNACCESSIBLE;
return WATCH_ERR_STATIC;
} }
virtual void close(Vfs_watch_handle *) virtual void close(Vfs_watch_handle *)