The refactored version of Unflatten() encapsulated the raw buffer
into a BMemoryIO with a specified size of SIZE_MAX, since the total
size of the messageisn't known up front. On 32-bit this was no problem,
but on x86_64, this would lead to an overflow in BMemoryIO, since it
stores its internal length as a size_t, which on that platform is the same
size as off_t. Consequently, when it would cast its length to off_t to
compare against the requested seek position in ReadAt/WriteAt, this would
overflow to a negative, leading it to reject all requests, which
subsequently caused Unflatten() to fail.
As a result of the refactoring for OpenHashTable, the iterator semantics
have changed a bit, such that the end of the table is no longer signalled
by the iterator returning NULL. This wasn't taken into account during
refactoring, which would lead to various places returning the last item
in the list in the case where no matching item was found, causing e.g.
drivers not to be loaded properly. This fixes the boot hang regressions
introduced in hrev48640.
Most changes were in the PackageContentOutliner and its HandleEntry() method
to make it work correctly. The parent entry of a visited entry may not be
the last parent entry, but some other previously added entry. We need a
PackageEntryItem class to also store the BPackageEntry together with the
list item.
Other small fixes.
* Replaced the hash function as it wasn't really useful. It seems better
to use the full in_addr_t as a hash as it is a 32bit value. Shuffling it
like the previous hash function did can only increase the number of
collisions.
* BOpenHashTable lacks the "range" parameter to the hash function, so we
can't know which bits from the hash are actually going to be used.
* Notifier::HeaderFetched(): fixed the method signature (go figure how it could
build on x86).
* POP3: fSizes type is now std::vector<size_t> instead of BList. Please review.
off_t might be a better choice.
* added the mail_daemon add-ons to the Haiku package again.
* The state was usually 0 once there was more than one battery
slot.
* We now ignore missing batteries completely, instead of taking
eventually bogus data into account.
* Fixed how to determine fOnline, and fHasBattery, and when to ignore
probes.
* Made it more strict when to show the notification, ie. it's now only
shown when actually discharging.
* This fixes all spurious notifications for me.
* ioctl() does not return a status_t; fixed its usage.
* Do not overwrite the cached battery info with bogus data (this is
quite strict, though).
* Improved DriverInterface API with a more "natural" argument order.
* Simplified some code.
* Since the power status outages only happen on load, it's likely
that we run some code too late (I haven't looked at the ACPI specs,
though).
* In any case, I now get wrong results much less often.
For the time being, exclude the new mail_daemon add-ons from the image,
as they break both the x86 and x86_64 builds by failing to compile in a
variety of ways.
I missed the fact that the BDataIO based Unflatten didn't handle this.
Restore the code from the recently removed buffer-based unflatten, so
it's possible to pass a message by area again.