dmg

package
v0.7.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dmg opens Apple UDIF disk images (.dmg) as a read-only virtual disk.

A UDIF file ends with a 512-byte "koly" trailer that points at an XML property list describing the image layout. Each "blkx" entry in that list carries one "mish" block table: a list of chunks, each mapping a sector range of the virtual disk to a byte range in the data fork, compressed with zlib, bzip2, LZFSE, LZMA or Apple's ADC, or stored raw or zero-filled.

Disk implements io.ReaderAt over that virtual disk; the filesystem probes and partition-table parsing then see it exactly like a raw image.

Index

Constants

View Source
const Sector = 512

Sector is the UDIF sector size: chunk tables count 512-byte sectors.

Variables

This section is empty.

Functions

This section is empty.

Types

type Disk

type Disk struct {
	// contains filtered or unexported fields
}

Disk is an opened UDIF image: a read-only view of its virtual disk. It implements io.ReaderAt and is safe for concurrent use.

func Open

func Open(ra io.ReaderAt, size int64) (*Disk, error)

Open reads the trailer, property list and block tables of the UDIF image in ra (whose file length is size) and returns its virtual disk.

func (*Disk) Close

func (d *Disk) Close() error

Close releases nothing; the caller owns the underlying reader.

func (*Disk) ReadAt

func (d *Disk) ReadAt(p []byte, off int64) (int, error)

ReadAt reads len(p) bytes at off from the virtual disk, following the io.ReaderAt contract (a read that reaches the end returns io.EOF after the bytes it could provide).

func (*Disk) Size

func (d *Disk) Size() int64

Size returns the virtual disk size in bytes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL