Documentation ¶
Index ¶
Constants ¶
const ( Magic = 0x564d444b SectorSize = 0x200 GrainSize = 0x10000 SectorsPerGrain = GrainSize / SectorSize TableMaxRows = 512 TableRowSize = 4 TableSectors = TableMaxRows * TableRowSize / SectorSize )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Header ¶
type Header struct { MagicNumber uint32 // 0 Version uint32 // 4 Flags uint32 // 8 Capacity uint64 // 12 GrainSize uint64 // 20 DescriptorOffset uint64 // 28 DescriptorSize uint64 // 36 NumGTEsPerGT uint32 // 44 RGDOffset uint64 // 48 GDOffset uint64 // 56 OverHead uint64 // 64 UncleanShutdown byte // 72 SingleEndLineChar byte // 73 NonEndLineChar byte // 74 DoubleEndLineChar1 byte // 75 DoubleEndLineChar2 byte // 76 CompressAlgorithm uint16 // 77 Pad [433]uint8 }
type HolePredictor ¶
type Sizer ¶
type Sizer interface {
Size() int64
}
Sizer is an interface that shouldn't exist in a vacuum, but does because our other image formats follow a similar patten and need more information. A Sizer should return the true and final RAW size of the image and be callable before the first byte of data is written to the Writer. Note that our vimg.Builder implements this interface and is the intended argument in most cases.
type SparseWriter ¶
type SparseWriter struct {
// contains filtered or unexported fields
}
func NewSparseWriter ¶
func NewSparseWriter(w io.WriteSeeker, h HolePredictor) (*SparseWriter, error)
func (*SparseWriter) Close ¶
func (w *SparseWriter) Close() error
type StreamOptimizedWriter ¶
type StreamOptimizedWriter struct {
// contains filtered or unexported fields
}
StreamOptimizedWriter implements io.Closer, io.Writer, and io.Seeker interfaces. Creating a stream-optimized VMDK image is as simple as getting one of these writers and copying a raw image into it.
func NewStreamOptimizedWriter ¶
func NewStreamOptimizedWriter(w io.WriteSeeker, h Sizer) (*StreamOptimizedWriter, error)
NewStreamOptimizedWriter returns a StreamOptimizedWriter to which a RAW image can be copied in order to create an XVA format disk image. The Sizer 'h' must accurately return the true and final RAW size of the image.
func (*StreamOptimizedWriter) Close ¶
func (w *StreamOptimizedWriter) Close() error
Close implements io.Closer.