1.1 --- a/docs/wiki/Server_Library Thu Oct 20 23:08:28 2022 +0200
1.2 +++ b/docs/wiki/Server_Library Fri Oct 21 19:03:05 2022 +0200
1.3 @@ -68,7 +68,6 @@
1.4 ProviderRegistry *registry();
1.5 long make_resource(offset_t *size, object_flags_t *object_flags, Resource **resource);
1.6 bool removal_pending();
1.7 -void remove();
1.8 void remove_pending(bool remove);
1.9 }}}
1.10
1.11 @@ -79,12 +78,11 @@
1.12 provider exercises its use of that provider. The `make_resource` operation
1.13 performs the creation and returns size, flags and resource instance details.
1.14
1.15 -The removal of providers can be directed using the `remove_pending` and
1.16 -`remove` operations. Where `remove_pending` has been called with a true value
1.17 -as its parameter, the `removal_pending` operation will also return a true
1.18 -value, and upon the provider being discarded, the `remove` operation will be
1.19 -invoked. The `remove` operation performs the appropriate underlying operation
1.20 -to remove the object being provided.
1.21 +The removal of providers can be directed using the `remove_pending` operation.
1.22 +Where `remove_pending` has been called with a true value as its parameter, the
1.23 +`removal_pending` operation will also return a true value, and upon the
1.24 +provider being discarded, a removal operation will be invoked on the
1.25 +underlying object being provided.
1.26
1.27 Typically, removal of providers is managed by the provider registry when
1.28 resources are closed and detached from providers.
1.29 @@ -101,7 +99,7 @@
1.30
1.31 ResourceServer -> Resource [label="close"];
1.32 Resource -> ProviderRegistry [label="detach"];
1.33 - ProviderRegistry -> Provider [label="remove"];
1.34 + ProviderRegistry -> Provider [label="delete"];
1.35 }
1.36 }}}
1.37
2.1 --- a/libfsserver/include/fsserver/file_provider.h Thu Oct 20 23:08:28 2022 +0200
2.2 +++ b/libfsserver/include/fsserver/file_provider.h Fri Oct 21 19:03:05 2022 +0200
2.3 @@ -32,7 +32,6 @@
2.4 {
2.5 protected:
2.6 PageMapper *_mapper;
2.7 - bool _to_remove = false;
2.8
2.9 public:
2.10 explicit FileProvider(fileid_t fileid, ProviderRegistry *registry,
2.11 @@ -45,8 +44,6 @@
2.12 virtual long make_resource(flags_t flags, offset_t *size,
2.13 object_flags_t *object_flags,
2.14 Resource **resource);
2.15 -
2.16 - virtual void remove();
2.17 };
2.18
2.19 // vim: tabstop=4 expandtab shiftwidth=4
3.1 --- a/libfsserver/include/fsserver/provider.h Thu Oct 20 23:08:28 2022 +0200
3.2 +++ b/libfsserver/include/fsserver/provider.h Fri Oct 21 19:03:05 2022 +0200
3.3 @@ -52,8 +52,6 @@
3.4
3.5 virtual bool removal_pending();
3.6
3.7 - virtual void remove();
3.8 -
3.9 virtual void remove_pending(bool remove);
3.10 };
3.11
4.1 --- a/libfsserver/lib/files/file_provider.cc Thu Oct 20 23:08:28 2022 +0200
4.2 +++ b/libfsserver/lib/files/file_provider.cc Fri Oct 21 19:03:05 2022 +0200
4.3 @@ -44,7 +44,7 @@
4.4
4.5 accessor->close();
4.6
4.7 - if (_to_remove)
4.8 + if (_remove)
4.9 accessor->remove();
4.10
4.11 delete accessor;
4.12 @@ -79,13 +79,4 @@
4.13 return L4_EOK;
4.14 }
4.15
4.16 -/* Lifecycle methods. */
4.17 -
4.18 -/* Remove the file using the accessor. */
4.19 -
4.20 -void FileProvider::remove()
4.21 -{
4.22 - _to_remove = true;
4.23 -}
4.24 -
4.25 // vim: tabstop=4 expandtab shiftwidth=4
5.1 --- a/libfsserver/lib/generic/provider.cc Thu Oct 20 23:08:28 2022 +0200
5.2 +++ b/libfsserver/lib/generic/provider.cc Fri Oct 21 19:03:05 2022 +0200
5.3 @@ -42,10 +42,6 @@
5.4 return _remove;
5.5 }
5.6
5.7 -void Provider::remove()
5.8 -{
5.9 -}
5.10 -
5.11 void Provider::remove_pending(bool remove)
5.12 {
5.13 _remove = remove;
6.1 --- a/libfsserver/lib/generic/provider_registry.cc Thu Oct 20 23:08:28 2022 +0200
6.2 +++ b/libfsserver/lib/generic/provider_registry.cc Fri Oct 21 19:03:05 2022 +0200
6.3 @@ -73,17 +73,11 @@
6.4 {
6.5 std::lock_guard<std::mutex> guard(_lock);
6.6
6.7 - if (!provider->detach())
6.8 - {
6.9 - /* Remove any underlying object if pending. */
6.10 + /* Remove from the registry, also removing any underlying object if removal
6.11 + is pending. */
6.12
6.13 - if (provider->removal_pending())
6.14 - provider->remove();
6.15 -
6.16 - /* Remove from the registry. */
6.17 -
6.18 + if (!provider->detach())
6.19 remove(fileid, provider);
6.20 - }
6.21 }
6.22
6.23 // vim: tabstop=4 expandtab shiftwidth=4