1.1 --- a/libfsserver/include/fsserver/directory_resource.h Sun Sep 26 23:54:05 2021 +0200
1.2 +++ b/libfsserver/include/fsserver/directory_resource.h Mon Sep 27 00:12:18 2021 +0200
1.3 @@ -28,8 +28,7 @@
1.4
1.5
1.6
1.7 -/* Support for providing access to directories.
1.8 - NOTE: Notification methods to be added when DirectoryObject is extended. */
1.9 +/* Support for providing access to directories. */
1.10
1.11 class DirectoryResource : public Resource, public DirectoryObject
1.12 {
1.13 @@ -37,6 +36,10 @@
1.14 FileRegistry *_registry;
1.15 DirectoryProvider *_provider;
1.16
1.17 + /* Notification endpoint for event subscription. */
1.18 +
1.19 + unsigned int _endpoint;
1.20 +
1.21 public:
1.22 fileid_t fileid;
1.23
1.24 @@ -60,6 +63,12 @@
1.25
1.26 virtual long opendir(offset_t *size, l4_cap_idx_t *cap,
1.27 object_flags_t *object_flags);
1.28 +
1.29 + /* Notification methods. */
1.30 +
1.31 + virtual long subscribe(l4_cap_idx_t endpoint, notify_flags_t flags);
1.32 +
1.33 + virtual long unsubscribe(l4_cap_idx_t endpoint);
1.34 };
1.35
1.36 // vim: tabstop=4 expandtab shiftwidth=4
2.1 --- a/libfsserver/lib/Makefile Sun Sep 26 23:54:05 2021 +0200
2.2 +++ b/libfsserver/lib/Makefile Mon Sep 27 00:12:18 2021 +0200
2.3 @@ -16,7 +16,7 @@
2.4 # Compound interfaces.
2.5
2.6 directory_object_NAME = DirectoryObject
2.7 -directory_object_INTERFACES = directory # notification
2.8 +directory_object_INTERFACES = directory notification
2.9
2.10 filesystem_object_NAME = FilesystemObject
2.11 filesystem_object_INTERFACES = filesystem filesystem_factory
3.1 --- a/libfsserver/lib/directories/directory_resource.cc Sun Sep 26 23:54:05 2021 +0200
3.2 +++ b/libfsserver/lib/directories/directory_resource.cc Mon Sep 27 00:12:18 2021 +0200
3.3 @@ -126,4 +126,22 @@
3.4 return IPC_MESSAGE_SENT;
3.5 }
3.6
3.7 +
3.8 +
3.9 +/* NOTE: These methods are effectively the same as the FilePager methods. */
3.10 +
3.11 +/* Subscribe to notifications. */
3.12 +
3.13 +long DirectoryResource::subscribe(l4_cap_idx_t endpoint, notify_flags_t flags)
3.14 +{
3.15 + _endpoint = _provider->subscribe(endpoint, flags);
3.16 + return L4_EOK;
3.17 +}
3.18 +
3.19 +long DirectoryResource::unsubscribe(l4_cap_idx_t endpoint)
3.20 +{
3.21 + _provider->unsubscribe(_endpoint, endpoint);
3.22 + return L4_EOK;
3.23 +}
3.24 +
3.25 // vim: tabstop=4 expandtab shiftwidth=4