Documentation
¶
Overview ¶
Package superlp reads Android "super" partitions: the LP metadata that describes dynamic partitions (system, vendor, product, …) as an extent list over one block device.
A super partition starts with two copies of a geometry block, then the metadata slots (two by default, plus backups), then the partitions' data. Every logical partition is a list of extents — each either a range of the super partition or a run of zeroes — so reading one means stitching those ranges together, which is what Mapping does.
The layout is the one liblp writes; Open validates it against the geometry rather than trusting the numbers, because a corrupt super should be reported as unreadable, not read as garbage.
Index ¶
Constants ¶
const ( // GeometryMagic ("gDla") and HeaderMagic ("0PLA") are the two magics liblp // writes; the geometry sits at GeometryOffset and is written twice. GeometryMagic = 0x616c4467 HeaderMagic = 0x414c5030 GeometryOffset = 4096 GeometrySize = 4096 SectorSize = 512 // Target types of an extent. TargetLinear = 0 TargetZero = 1 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Extent ¶
Extent is one range of a logical partition: NumSectors sectors starting at TargetData on block device TargetSource, or—when TargetType is TargetZero— NumSectors sectors that read as zeroes.
type Mapping ¶
type Mapping struct {
// contains filtered or unexported fields
}
Mapping exposes one logical partition as a byte range: reads are served from the extents that make it up, and zero-type extents read as zeroes.
type Metadata ¶
Metadata is a parsed super partition.
func Open ¶
Open parses the metadata at origin. The primary slot is used, falling back to the other slots (and their backups) when a copy does not validate, so a super with one damaged slot still opens.
type Partition ¶
Partition is one logical partition: a name and the extents that hold it.
func (Partition) Contiguous ¶
Contiguous reports whether the partition is a single uninterrupted run of the super partition, and returns the run's byte offset and size when it is.