# HG changeset patch # User Paul Boddie # Date 1632694338 -7200 # Node ID 5e038d939c9589285bca4eb24784eeb2f36aba4e # Parent 0d2ae38e514204d8fcf1c1c0a570f3fc826af0b0 Added the notification interface to directory resources. diff -r 0d2ae38e5142 -r 5e038d939c95 libfsserver/include/fsserver/directory_resource.h --- a/libfsserver/include/fsserver/directory_resource.h Sun Sep 26 23:54:05 2021 +0200 +++ b/libfsserver/include/fsserver/directory_resource.h Mon Sep 27 00:12:18 2021 +0200 @@ -28,8 +28,7 @@ -/* Support for providing access to directories. - NOTE: Notification methods to be added when DirectoryObject is extended. */ +/* Support for providing access to directories. */ class DirectoryResource : public Resource, public DirectoryObject { @@ -37,6 +36,10 @@ FileRegistry *_registry; DirectoryProvider *_provider; + /* Notification endpoint for event subscription. */ + + unsigned int _endpoint; + public: fileid_t fileid; @@ -60,6 +63,12 @@ virtual long opendir(offset_t *size, l4_cap_idx_t *cap, object_flags_t *object_flags); + + /* Notification methods. */ + + virtual long subscribe(l4_cap_idx_t endpoint, notify_flags_t flags); + + virtual long unsubscribe(l4_cap_idx_t endpoint); }; // vim: tabstop=4 expandtab shiftwidth=4 diff -r 0d2ae38e5142 -r 5e038d939c95 libfsserver/lib/Makefile --- a/libfsserver/lib/Makefile Sun Sep 26 23:54:05 2021 +0200 +++ b/libfsserver/lib/Makefile Mon Sep 27 00:12:18 2021 +0200 @@ -16,7 +16,7 @@ # Compound interfaces. directory_object_NAME = DirectoryObject -directory_object_INTERFACES = directory # notification +directory_object_INTERFACES = directory notification filesystem_object_NAME = FilesystemObject filesystem_object_INTERFACES = filesystem filesystem_factory diff -r 0d2ae38e5142 -r 5e038d939c95 libfsserver/lib/directories/directory_resource.cc --- a/libfsserver/lib/directories/directory_resource.cc Sun Sep 26 23:54:05 2021 +0200 +++ b/libfsserver/lib/directories/directory_resource.cc Mon Sep 27 00:12:18 2021 +0200 @@ -126,4 +126,22 @@ return IPC_MESSAGE_SENT; } + + +/* NOTE: These methods are effectively the same as the FilePager methods. */ + +/* Subscribe to notifications. */ + +long DirectoryResource::subscribe(l4_cap_idx_t endpoint, notify_flags_t flags) +{ + _endpoint = _provider->subscribe(endpoint, flags); + return L4_EOK; +} + +long DirectoryResource::unsubscribe(l4_cap_idx_t endpoint) +{ + _provider->unsubscribe(_endpoint, endpoint); + return L4_EOK; +} + // vim: tabstop=4 expandtab shiftwidth=4