1.1 --- a/libfsserver/lib/files/file_pager.cc Sat Sep 04 23:23:32 2021 +0200
1.2 +++ b/libfsserver/lib/files/file_pager.cc Wed Sep 08 01:18:00 2021 +0200
1.3 @@ -54,7 +54,10 @@
1.4
1.5 /* Notify other users of the file. */
1.6
1.7 - _paging->notify_others(_endpoint, NOTIFY_PEER_CLOSED);
1.8 + FileNotification *notifier = _paging->notifier(fileid);
1.9 +
1.10 + if (notifier != NULL)
1.11 + notifier->notify_others(_endpoint, NOTIFY_PEER_CLOSED);
1.12 }
1.13
1.14
1.15 @@ -67,7 +70,11 @@
1.16
1.17 if (_resized)
1.18 {
1.19 - _paging->notify_others(_endpoint, NOTIFY_CONTENT_AVAILABLE);
1.20 + FileNotification *notifier = _paging->notifier(fileid);
1.21 +
1.22 + if (notifier != NULL)
1.23 + notifier->notify_others(_endpoint, NOTIFY_CONTENT_AVAILABLE);
1.24 +
1.25 _resized = false;
1.26 }
1.27
1.28 @@ -109,18 +116,27 @@
1.29
1.30 /* Subscribe to notifications. */
1.31
1.32 -long FilePager::subscribe(l4_cap_idx_t notifier, notify_flags_t flags)
1.33 +long FilePager::subscribe(l4_cap_idx_t endpoint, notify_flags_t flags)
1.34 {
1.35 /* Readers can subscribe to new data (at end), and pipe closed events.
1.36 Writers can subscribe to new space and pipe closed events. */
1.37
1.38 - _endpoint = _paging->subscribe(notifier, flags);
1.39 + FileNotification *notifier = _paging->notifier(fileid);
1.40 +
1.41 + if (notifier == NULL)
1.42 + return -L4_ENOSYS;
1.43 +
1.44 + _endpoint = notifier->subscribe(endpoint, flags);
1.45 return L4_EOK;
1.46 }
1.47
1.48 -long FilePager::unsubscribe(l4_cap_idx_t notifier)
1.49 +long FilePager::unsubscribe(l4_cap_idx_t endpoint)
1.50 {
1.51 - _paging->unsubscribe(_endpoint, notifier);
1.52 + FileNotification *notifier = _paging->notifier(fileid);
1.53 +
1.54 + if (notifier != NULL)
1.55 + notifier->unsubscribe(_endpoint, endpoint);
1.56 +
1.57 return L4_EOK;
1.58 }
1.59