History log of /haiku/src/kits/storage/MergedDirectory.cpp
Revision Date Author Comments
# 2532a287 23-Nov-2021 Augustin Cavalier <waddlesplash@gmail.com>

Avoid using unions for LongDirEntry.

GCC still assumes that the dirent has no data past the end for some
scenarios here and still mis-optimizes things. Therefore, drop the
usages of unions altogether, and instead use a casted character array.

Additionally, use B_FILE_NAME_LENGTH for the array, not B_PATH_NAME_LENGTH,
and make sure to add 1 for the NULL terminator.


# 8f03af00 18-Nov-2021 Augustin Cavalier <waddlesplash@gmail.com>

Storage: Rework LongDirEntry to be a union.

Our dirent structure is "slim": it has a flexible-length array at the
end which must be allocated to whatever size the consumer wants. However,
we use [1] there and not [0] or [], which meant GCC thought it was not
a flexible-length array, and so it optimized various string accesses
that it assumed must be always false. Among these was BDirectory's
check for "." and "..", and so that resulted in infinite loops.

When changing our dirent structure to a proper FLA instead of [1],
GCC then throws errors on LongDirEntry as it has data "after" the
FLA; which is what we want, but there is no way to tell GCC that.
So now we use a union instead, which is the proper way to statically
allocate a FLA.

This is part of #17389, but the real fix requires changing our dirent
structure, which is coming in a separate commit.


# a36a1666 04-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

MergedDirectory: missing include


# 2752612b 19-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BMergedDirectory::GetNextDirents(): fix end-of-list return value


# 38e3973e 06-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add private class BMergedDirectory to storage kit

An arbitrary number of directories can be added, which the implemented
BEntryList interface presents as a single merged entry list. Three
different merge policies are supported which define how entries that
appear in more than one directory are treated.


# a36a1666321e745015b44de49ed74d6109111282 04-Aug-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

MergedDirectory: missing include


# 2752612bc60b08174c98181b33b7be3a7b93c3e3 19-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

BMergedDirectory::GetNextDirents(): fix end-of-list return value


# 38e3973ecf429e27da158c823369f47f4addf869 06-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Add private class BMergedDirectory to storage kit

An arbitrary number of directories can be added, which the implemented
BEntryList interface presents as a single merged entry list. Three
different merge policies are supported which define how entries that
appear in more than one directory are treated.