1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-29 07:05:06 +00:00

Automatically call Inode::flush_metadata() before an Inode is destroyed.

Use a little template magic to have Retainable::release() call out to
T::will_be_destroyed() if such a function exists before actually calling
the destructor. This gives us full access to virtual functions in the
pre-destruction code.
This commit is contained in:
Andreas Kling 2018-12-19 22:28:09 +01:00
parent 1f44cd9dd9
commit d0f06e5f3f
6 changed files with 41 additions and 17 deletions

View file

@ -83,7 +83,7 @@ ByteBuffer procfs$pid_vmo(Process& process)
region->vmo().is_anonymous() ? "anonymous" : "file-backed",
region->vmo().name().characters(),
&region->vmo(),
region->vmo().retainCount());
region->vmo().retain_count());
for (size_t i = 0; i < region->vmo().page_count(); ++i) {
auto& physical_page = region->vmo().physical_pages()[i];
ptr += ksprintf(ptr, "P%x%s(%u) ",
@ -205,7 +205,7 @@ ByteBuffer procfs$mm()
ptr += ksprintf(ptr, "VMO: %p %s(%u): p:%4u %s\n",
vmo,
vmo->is_anonymous() ? "anon" : "file",
vmo->retainCount(),
vmo->retain_count(),
vmo->page_count(),
vmo->name().characters());
}