History log of /haiku/headers/private/package/hpkg/ReaderImplBase.h
Revision Date Author Comments
# 6c331fc7 05-Aug-2019 Alexander von Gluck IV <kallisti5@unixzen.com>

kit/package: Error on short file read

* It's safe to assume that if the file is shorter than
the provided header, things will go poorly.
* Avoids a random vauge ReadBuffer error.
* This doesn't fix #15230, but makes the issue clearer.

Change-Id: I3471e6de384a0c9be94049ad891c01be980f7846
Reviewed-on: https://review.haiku-os.org/c/1679
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 1606450b 12-Jul-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

ReaderImplBase::Init(): Make file size check optional

If the file doesn't support GetSize(), skip the header total size file
size check.


# e527b796 12-Jul-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

Switch package file accessor classes to use BPositionIO

* PackageFileHeap{Reader,Writer} as well as Package{Reader,Writer} and
their implementation and super classes do now internally use a
BPositionIO instead of a FD to access the package file. This provides
more flexibility needed for features to come.
* BPackageReader has already grown a new Init() version with a
BPositionIO* parameter.


# b3263ad3 30-Jun-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

Switch package kit to BZlibCompressionAlgorithm

... and remove the Zlib{Compressor,Decompressor} API.


# 0dab9e5c 29-Jun-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package kit: ReaderImplBase: Remove superfluous scratch buffer


# e07b8bd2 25-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

package kit: ReaderImplBase: Add public attrs section accessor


# 0a345af7 18-Sep-2013 Oliver Tappe <zooey@hirschkaefer.de>

Separate notification from deletion in repository-handlers.

* Add NotifyDone() to all repository-attribute handlers and invoke that
to notify any listeners.
* Unify deletion to a single implementation of Delete() in the base
class. Before, the root handler for a repository didn't do that, but
just triggered the notification.


# 4489c88b 05-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

hpkg format: Generalize user/global settings file attributes

* For all identifiers: Rename global settings file to global writable
file. We want to use the respective attribute also for other writable
files, not only settings files.
* User settings file/global writable file info/attribute: Add
isDirectory property/child attribute. This allows declaring global/
user settings directories associated with the package.


# 0f4e11e7 23-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

hpkg format: Add attributes for declaring users and groups


# 79d5ddb7 23-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

ReaderImplBase: Verify that the attribute type matches

... the one expected for the respective attribute. Before it was
possible that e.g. a uint was read and then interpreted as a
const char*, if a string was expected for that attribute.


# fe707a23 23-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

hpkg format: Add attributes for declaring settings files

Global and user settings files can be declared. For global ones an
update policy can be specified. If not specified, the settings file is
not included in the package, but created by the program (or user) later.
If an update type is specified, it defines what to do with the settings
file when updating the package to a newer version.

User settings files are never included in the package; they are always
created by the program or the user. If the package contains a template/
default settings file, it can be declared, but for informative purposes
only.


# 47039b85 21-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Package/repository file format: Add a minor version header field

* Add minor_version to hpkg_header and hpkg_repo_header and make
heap_compression uint16.
* If the minor version of a package/repository file is greater than the
current one unknown attributes are ignored without error. This allows
introducing new harmless attributes without making the resulting files
unreadable for older package kit versions.


# 46122852 21-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

packagefs: Add caching for the package file heap reader

* ReaderImplBase:
- Add virtual CreateCachedHeapReader() which can create a cached
reader based on the given heap reader.
- Rename HeapReader() to RawHeapReader() and add HeapReader() for the
cached heap reader.
- Add DetachHeapReader() to allow a clients to remove the heap
reader(s) after deleting the ReaderImplBase object.
* packagefs:
- Add CachedDataReader class, which wraps a given
BAbstractBufferedDataReader and provides caching for it using a
VMCache. The implementation is based on the IOCache implementation.
- Use CachedDataReader to wrap the heap reader. For file data that
means they are cached twice -- in the heap reader cache and in the
file cache -- but due to the heap reader using a VMCache as well,
the pages will be recycled automatically anyway. For attribute data
the cache should be very helpful, since they weren't cached at all
before.


# d59e0feb 20-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

package: Suppress version mismatch errors where V1 is supported

* Add flags parameter to Init() of BPackageReader and friends.
* Introduce flag B_HPKG_READER_DONT_PRINT_VERSION_MISMATCH_MESSAGE and
don't print a version mismatch error when given.
* package extract/list: Use the new flag.


# d03ac965 19-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

ReaderImplBase: Fix gcc 4 build


# 1f633814 17-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

hpkg format: compress the whole heap

Instead of handling compression for individual file/attribute data we
do now compress the whole heap where they are stored. This
significantly improves compression ratios. We still divide the
uncompressed data into 64 KiB chunks and use a chunk offset array for
the compressed chunks to allow for quick random access without too much
overhead. The tradeoff is a limited possible compression ratio -- i.e.
we won't be as good as tar.gz (though surprisingly with my test
archives we did better than zip).

The other package file sections (package attributes and TOC) are no
longer compressed individually. Their uncompressed data are simply
pushed onto the heap where the usual compression strategy applies. To
simplify things the repository format has been changed in the same
manner although it doesn't otherwise use the heap, since it only stores
meta data.

Due to the data compression having been exposed in public and private
API, this change touches a lot of package kit using code, including
packagefs and the boot loader packagefs support. The latter two haven't
been tested yet. Moreover packagefs needs a new kind of cache so we
avoid re-reading the same heap chunk for two different data items it
contains.


# 78811461 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add BLowLevelPackageContentHandler section hooks

* Add hooks HandleSectionStart() and HandleSectionEnd(). They are
invoked to bracket package file section, so the handler can
discriminate which section the attributes belong to.
HandleSectionStart() features a return parameter _handleSection, which
allows to handler to pick which sections it wants to handle.
* "package dump" does now print the section names.


# 2fce2018 01-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

BLowLevelPackageContentHandler interface extension

HandleAttributeDone(): Add parentToken parameter.


# 97aabbed 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add BLowLevelPackageContentHandler section hooks

* Add hooks HandleSectionStart() and HandleSectionEnd(). They are
invoked to bracket package file section, so the handler can
discriminate which section the attributes belong to.
HandleSectionStart() features a return parameter _handleSection, which
allows to handler to pick which sections it wants to handle.
* "package dump" does now print the section names.


# 697b9545 01-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

BLowLevelPackageContentHandler interface extension

HandleAttributeDone(): Add parentToken parameter.


# ad6a8dbe 14-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

Pulled reusable stuff from PackageReaderImpl into new class ReaderImplBase.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40485 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1606450b3215f4644aced4e37b01b84e2d5dd718 12-Jul-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

ReaderImplBase::Init(): Make file size check optional

If the file doesn't support GetSize(), skip the header total size file
size check.


# e527b796319f21ca025f68e1964df140daa6de35 12-Jul-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

Switch package file accessor classes to use BPositionIO

* PackageFileHeap{Reader,Writer} as well as Package{Reader,Writer} and
their implementation and super classes do now internally use a
BPositionIO instead of a FD to access the package file. This provides
more flexibility needed for features to come.
* BPackageReader has already grown a new Init() version with a
BPositionIO* parameter.


# b3263ad3e1662cc419849a2d2cf539f9636613dc 30-Jun-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

Switch package kit to BZlibCompressionAlgorithm

... and remove the Zlib{Compressor,Decompressor} API.


# 0dab9e5cb4e244814a39d562cef87f9508780760 29-Jun-2014 Ingo Weinhold <ingo_weinhold@gmx.de>

package kit: ReaderImplBase: Remove superfluous scratch buffer


# e07b8bd2df230fca16cfc21aae6a554b73d120af 25-Oct-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

package kit: ReaderImplBase: Add public attrs section accessor


# 0a345af77e01131647b1017ee4631b602119f5c9 18-Sep-2013 Oliver Tappe <zooey@hirschkaefer.de>

Separate notification from deletion in repository-handlers.

* Add NotifyDone() to all repository-attribute handlers and invoke that
to notify any listeners.
* Unify deletion to a single implementation of Delete() in the base
class. Before, the root handler for a repository didn't do that, but
just triggered the notification.


# 4489c88b61bd4b70ff3a91d24ef5a0088e9c4691 05-Jun-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

hpkg format: Generalize user/global settings file attributes

* For all identifiers: Rename global settings file to global writable
file. We want to use the respective attribute also for other writable
files, not only settings files.
* User settings file/global writable file info/attribute: Add
isDirectory property/child attribute. This allows declaring global/
user settings directories associated with the package.


# 0f4e11e75c244fd61da150011f1eae5fe79fc2a9 23-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

hpkg format: Add attributes for declaring users and groups


# 79d5ddb77bd498e2975ceed8360c06cf709ff618 23-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

ReaderImplBase: Verify that the attribute type matches

... the one expected for the respective attribute. Before it was
possible that e.g. a uint was read and then interpreted as a
const char*, if a string was expected for that attribute.


# fe707a23fc6dc0bccb3e80201bf3e4146dcde74e 23-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

hpkg format: Add attributes for declaring settings files

Global and user settings files can be declared. For global ones an
update policy can be specified. If not specified, the settings file is
not included in the package, but created by the program (or user) later.
If an update type is specified, it defines what to do with the settings
file when updating the package to a newer version.

User settings files are never included in the package; they are always
created by the program or the user. If the package contains a template/
default settings file, it can be declared, but for informative purposes
only.


# 47039b852eeebb91396d19e0f9313cf23bf535ee 21-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Package/repository file format: Add a minor version header field

* Add minor_version to hpkg_header and hpkg_repo_header and make
heap_compression uint16.
* If the minor version of a package/repository file is greater than the
current one unknown attributes are ignored without error. This allows
introducing new harmless attributes without making the resulting files
unreadable for older package kit versions.


# 46122852f1dfbbf4bac6f5a634452ff90c5635ce 21-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

packagefs: Add caching for the package file heap reader

* ReaderImplBase:
- Add virtual CreateCachedHeapReader() which can create a cached
reader based on the given heap reader.
- Rename HeapReader() to RawHeapReader() and add HeapReader() for the
cached heap reader.
- Add DetachHeapReader() to allow a clients to remove the heap
reader(s) after deleting the ReaderImplBase object.
* packagefs:
- Add CachedDataReader class, which wraps a given
BAbstractBufferedDataReader and provides caching for it using a
VMCache. The implementation is based on the IOCache implementation.
- Use CachedDataReader to wrap the heap reader. For file data that
means they are cached twice -- in the heap reader cache and in the
file cache -- but due to the heap reader using a VMCache as well,
the pages will be recycled automatically anyway. For attribute data
the cache should be very helpful, since they weren't cached at all
before.


# d59e0feb59b92ca19ecda2935369fd0fcc5a4f56 20-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

package: Suppress version mismatch errors where V1 is supported

* Add flags parameter to Init() of BPackageReader and friends.
* Introduce flag B_HPKG_READER_DONT_PRINT_VERSION_MISMATCH_MESSAGE and
don't print a version mismatch error when given.
* package extract/list: Use the new flag.


# d03ac965a23ea05a1a771a4e80c5d15f7f042ce4 19-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

ReaderImplBase: Fix gcc 4 build


# 1f633814fa347b0bd822f683af731615df600347 17-May-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

hpkg format: compress the whole heap

Instead of handling compression for individual file/attribute data we
do now compress the whole heap where they are stored. This
significantly improves compression ratios. We still divide the
uncompressed data into 64 KiB chunks and use a chunk offset array for
the compressed chunks to allow for quick random access without too much
overhead. The tradeoff is a limited possible compression ratio -- i.e.
we won't be as good as tar.gz (though surprisingly with my test
archives we did better than zip).

The other package file sections (package attributes and TOC) are no
longer compressed individually. Their uncompressed data are simply
pushed onto the heap where the usual compression strategy applies. To
simplify things the repository format has been changed in the same
manner although it doesn't otherwise use the heap, since it only stores
meta data.

Due to the data compression having been exposed in public and private
API, this change touches a lot of package kit using code, including
packagefs and the boot loader packagefs support. The latter two haven't
been tested yet. Moreover packagefs needs a new kind of cache so we
avoid re-reading the same heap chunk for two different data items it
contains.


# 78811461b1831f6fdc07203e54cab60bd16af834 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add BLowLevelPackageContentHandler section hooks

* Add hooks HandleSectionStart() and HandleSectionEnd(). They are
invoked to bracket package file section, so the handler can
discriminate which section the attributes belong to.
HandleSectionStart() features a return parameter _handleSection, which
allows to handler to pick which sections it wants to handle.
* "package dump" does now print the section names.


# 2fce201893210a48fb65ac7b35969c5dbe68e5e3 01-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

BLowLevelPackageContentHandler interface extension

HandleAttributeDone(): Add parentToken parameter.


# 97aabbede911b549e50d7ad753b4755d5c8d85a7 02-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Add BLowLevelPackageContentHandler section hooks

* Add hooks HandleSectionStart() and HandleSectionEnd(). They are
invoked to bracket package file section, so the handler can
discriminate which section the attributes belong to.
HandleSectionStart() features a return parameter _handleSection, which
allows to handler to pick which sections it wants to handle.
* "package dump" does now print the section names.


# 697b9545b17b6a29237523f6e5aac14a1cab5684 01-Jul-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

BLowLevelPackageContentHandler interface extension

HandleAttributeDone(): Add parentToken parameter.


# ad6a8dbe2bffcac6a1df7a59ee6119f240a8edee 14-Feb-2011 Oliver Tappe <zooey@hirschkaefer.de>

Pulled reusable stuff from PackageReaderImpl into new class ReaderImplBase.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40485 a95241bf-73f2-0310-859d-f6bbb57e9c96