History log of /haiku/src/add-ons/kernel/file_systems/packagefs/package/PackageNode.cpp
Revision Date Author Comments
# c8eaa6f9 17-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

packagefs: Use WeakReference in PackageNode.

This allows us to stop storing the package flags, which saves 4
bytes per package node (a value that really adds up when there
are thousands upon thousands of PackageNodes), at the cost of an extra
sizeof(int32) allocation for the WeakPointer object per-package (of
which there are are much fewer, of course.)

This also is safer overall, as now consumers of GetPackage() or VFSInit()
will now hit a NULL dereference if they have failed to check if the
package still exists, instead of a use-after-free.

Change-Id: Iea97ffcd491c6e2da7093730a7fa951b84dcefdf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4478
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>


# d8ad2d6f 08-Aug-2018 Augustin Cavalier <waddlesplash@gmail.com>

packagefs: Rename operator< to HasPrecendenceOver().

As suggested by weinhold on the mailing list.


# abf0c287 05-Aug-2018 Augustin Cavalier <waddlesplash@gmail.com>

packagefs: system_packages take precedence over non-system packages.

Affects *all* nodes, i.e., both directories and files. It is still possible
to override these, but it must be done in another system_package, not just by
mounting a package with newer datestamps on the conflicting files.

This is the pure version of axeld's proposal 2(d) from #10071. However,
as the haiku_secondary packages contain application mime_db entires and
are also 'system_package's, it does not fully solve that ticket.


# 5753ed55 03-Aug-2018 Augustin Cavalier <waddlesplash@gmail.com>

packagefs: Move PackageNode comparison into an operator<.

This commit does not amount to any functional change: we still compare
purely by modification date alone. But it does de-duplify the code somewhat,
and makes it possible to easily implement changes to the comparison.


# 11802867 31-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Fix reading attributes of directories

When reading an attribute of a directory there was no guarantee that the
underlying package would be open. When it wasn't reading an attribute
would fail, unless the attribute data were already cached. The reasons
for this are:
* UnpackingDirectory didn't forward the {Init,Uninit}VFS() calls to the
underlying PackageDirectory.
* Only PackageFile was actually opening the package in InitVFS().

Now we forward the {Init,Uninit}VFS() calls in all cases -- even in
{Add,Remove}PackageNode(), when the active package node changes -- and
opening/closing the package is now done in
PackageNode::{Init,Uninit}VFS().


# d07c930c 11-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

packagefs: Share string instances globally

Introduce a class String which refers to shared private data that is
registered in a global hash table (in class StringPool) and use the
class consequently. This eliminates duplicate allocations for the same
string and also speeds up tests for equality. There's quite a bit
overhead for the management structures (apparently even more than for
the string data itself), but due to almost all strings being used
multiple times this still almost halves the memory usage for string
data.


# 1e7416d9 11-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

packagefs: Organize sources into subdirectories


# 118028674c77ec4ba5725a097dfbc9fd99b181b8 31-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Fix reading attributes of directories

When reading an attribute of a directory there was no guarantee that the
underlying package would be open. When it wasn't reading an attribute
would fail, unless the attribute data were already cached. The reasons
for this are:
* UnpackingDirectory didn't forward the {Init,Uninit}VFS() calls to the
underlying PackageDirectory.
* Only PackageFile was actually opening the package in InitVFS().

Now we forward the {Init,Uninit}VFS() calls in all cases -- even in
{Add,Remove}PackageNode(), when the active package node changes -- and
opening/closing the package is now done in
PackageNode::{Init,Uninit}VFS().


# d07c930c1eb710289922edd3abf5244c259a86c6 11-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

packagefs: Share string instances globally

Introduce a class String which refers to shared private data that is
registered in a global hash table (in class StringPool) and use the
class consequently. This eliminates duplicate allocations for the same
string and also speeds up tests for equality. There's quite a bit
overhead for the management structures (apparently even more than for
the string data itself), but due to almost all strings being used
multiple times this still almost halves the memory usage for string
data.


# 1e7416d9b3846396e2f7d6552e37d72664cd6853 11-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

packagefs: Organize sources into subdirectories