Changes between Version 1 and Version 2 of Obsolete/MovedToTree/PackageManagement/FileFormat


Ignore:
Timestamp:
Nov 14, 2009 7:42:34 AM (10 years ago)
Author:
bonefish
Comment:

Fixed typos and semantical errors. Extended the B_HPKG_COMPRESSION_ZLIB section -- allowing for uncompressed chunks.

Legend:

Unmodified
Added
Removed
Modified
  • Obsolete/MovedToTree/PackageManagement/FileFormat

    v1 v2  
    22= Haiku Package Format =
    33
    4 This document specifies the Haiku Package (HPKG) file format, which was designed for efficient use by Haiku's package file system. It is somewhat inspired by the [http://code.google.com/p/xar/ XAR format] (separate TOC and data heap), but aims for greater compactness (not XML for the TOC).
     4This document specifies the Haiku Package (HPKG) file format, which was designed for efficient use by Haiku's package file system. It is somewhat inspired by the [http://code.google.com/p/xar/ XAR format] (separate TOC and data heap), but aims for greater compactness (no XML for the TOC).
    55
    66Three stacked format layers can be identified:
     
    2121 TOC (table of contents)::
    2222   The main section, containing structured data with references to unstructured
    23    data in the Heap.
     23   data in the heap section.
    2424 Package Attributes::
    2525   A section similar to the TOC. Rather than describing the data contained in
     
    108108     - "count" : int : 100
    109109
    110 Attributes often share the same name and data type, particularly when a list of some kind are stored. In order to save space each unique name and data type pair is stored as an attribute type in a separate subsection and is referenced by an index.
     110Attributes often share the same name and data type, particularly when lists of some kind are stored. In order to save space each unique name and data type pair is stored as an attribute type in a separate subsection and is referenced by an index.
    111111
    112112A similar optimization exists for shared string attribute values. A string value used by more than one attribute is stored in the strings subsection and is referenced by an index as well.
     
    150150 Attribute value::
    151151   The value of the attribute encoded as described below.
    152  Attribute child list:
     152 Attribute child list::
    153153   Only if this attribute is marked to have children: A list of attribute
    154154   entries terminated by a 0 byte.
     
    194194 Has children::
    195195   A uint8: non 0, if the attribute has children, 0 otherwise.
    196  Attribute name:
     196 Attribute name::
    197197   A null-terminated UTF-8 string.
    198198 Attribute value::
    199199   The value of the attribute encoded as described in the Main TOC section.
    200  Attribute child list:
     200 Attribute child list::
    201201   Only if this attribute is marked to have children: A list of attribute
    202202   entries terminated by a 0 byte.
     
    261261   - B_HPKG_ATTRIBUTE_NAME_DATA: Only if the entry is a file: The file data.
    262262   - B_HPKG_ATTRIBUTE_NAME_SYMLINK_PATH: Only if the entry is a symlink: The path the symlink points to.
    263    - B_HPKG_ATTRIBUTE_NAME_DIRECTORY_ENTRY: Only if the entry is a directory: The child entries in that directory.
     263   - B_HPKG_ATTRIBUTE_NAME_DIRECTORY_ENTRY: Only if the entry is a directory: A child entry in that directory.
    264264
    265265==== B_HPKG_ATTRIBUTE_NAME_FILE_TYPE ("file:type") ====
     
    306306 - '''Value:''' The nano seconds fraction of the file access time.
    307307 - '''Allowed Values:''' Any value in [0, 999999999].
     308 - '''Default Value:''' 0
    308309 - '''Child Attributes:''' none
    309310
     
    318319 - '''Value:''' The nano seconds fraction of the file modified time.
    319320 - '''Allowed Values:''' Any value in [0, 999999999].
     321 - '''Default Value:''' 0
    320322 - '''Child Attributes:''' none
    321323
     
    330332 - '''Value:''' The nano seconds fraction of the file creation time.
    331333 - '''Allowed Values:''' Any value in [0, 999999999].
     334 - '''Default Value:''' 0
    332335 - '''Child Attributes:''' none
    333336
     
    354357     storing the data.
    355358   - B_HPKG_ATTRIBUTE_NAME_DATA_SIZE: The size of the uncompressed data.
     359   - B_HPKG_ATTRIBUTE_NAME_DATA_CHUNK_SIZE: The size of an uncompressed data chunk.
    356360
    357361==== B_HPKG_ATTRIBUTE_NAME_DATA_COMPRESSION ("data:compression") ====
     
    374378==== B_HPKG_ATTRIBUTE_NAME_DATA_CHUNK_SIZE ("data:chunk_size") ====
    375379 - '''Type:''' uint
    376  - '''Value:''' Size of a compressed data chunk.
     380 - '''Value:''' Size of an uncompressed data chunk.
    377381 - '''Allowed Values:''': Any value.
    378382 - '''Default Value:'''
     
    400404==== B_HPKG_COMPRESSION_ZLIB ====
    401405
    402 The original data are split into equally sized chunks and compressed individually. The compressed data chunks are stored (in order) without padding, preceded by an uint64 array specifying the relative positions of the compressed data of each chunk. The positions are relative to the first byte following the position array. Since the first chunk is always at position 0, it's array element is omitted. Therefore a uncompressed data split into n chunks will have n - 1 position array elements.
     406The original data are split into equally sized chunks and compressed individually. The compressed data chunks are stored (in order) without padding, preceded by an uint64 array specifying the relative offsets of the compressed data of each chunk. The offsets are relative to the first byte following the offset array. Since the first chunk is always at offset 0, its array element is omitted. Therefore uncompressed data split into n chunks will have n - 1 offset array elements.
     407
     408The size of the compressed chunks is implied by the offset differences (respectively for the last chunk the difference to the total size). A compressed chunk is always shorter than the uncompressed chunk. If the chunk data couldn't be compressed, the data are stored uncompressed and the size of the stored chunk will be equal to the uncompressed chunk size.
    403409
    404410