qcow2

package
v0.0.0-...-ec8d7ed Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_QCOW2_SIZE                     = 1 << 42 //single qcow2 file limit within 4TiB
	QCOW_EXTL2_SUBCLUSTERS_PER_CLUSTER = uint64(32)
	QCOW_L2_BITMAP_ALL_ALLOC           = uint64(1)<<32 - 1
	QCOW_L2_BITMAP_ALL_ZEROES          = QCOW_L2_BITMAP_ALL_ALLOC << 32
	QCOW_MAX_REFTABLE_SIZE             = (8 * 1024 * 1024)
)
View Source
const (
	L1E_OFFSET_MASK  = uint64(0x00fffffffffffe00)
	L2E_OFFSET_MASK  = uint64(0x00fffffffffffe00)
	REFT_OFFSET_MASK = uint64(0xfffffffffffffe00)
	INV_OFFSET       = uint64(0xff00000000000000)
)

L1 & L2 & Refcount masks

View Source
const (
	DEFAULT_CLUSTER_SIZE = 65536
	DEFAULT_SECTOR_SIZE  = 512
	DEFAULT_CLUSTER_BITS = 16
	//1 refcount block can hold 2GiB data (64k * 32k),
	//1 refcount table holds 8k refcount blocks,
	//so 1 table can hold up to 16TiB data (including refcount blocks and l2 blocks and data blocks)
	DEFAULT_REFCOUNT_TABLE_CLUSTERS = 1
	QCOW2_VERSION2                  = 2
	QCOW2_VERSION3                  = 3
	QCOW2_REFCOUNT_ORDER            = 4
	QCOW2_CRYPT_METHOD              = 0
	//	DEFAULT_ALIGNMENT               = 4096    //align to 4k
	DEFAULT_ALIGNMENT    = DEFAULT_SECTOR_SIZE //align to sector
	DEFAULT_MAX_TRANSFER = 1 << 31             //2G
	DEFAULT_L2_CACHE     = 1024 * 1024         //default 1MiB for l2 cache
)
View Source
const (
	L1_TABLE_OFFSET = 65536 * 3
	L1_TABLE_SIZE   = 65536 >> 3
)

L1 table offset

View Source
const (
	REFCOUNT_TABLE_OFFSET = 65536
	REFCOUNT_TABLE_SIZE   = 65536 >> 3
)

refcount table offset

View Source
const (
	QCOW_OFLAG_COPIED     = 1 << 63
	QCOW_OFLAG_COMPRESSED = 1 << 62
	QCOW_OFLAG_ZERO       = 1 << 0
)

L1 & L2 bit options

View Source
const (
	QCOW2_INCOMPAT_DIRTY_BITNR       = 0
	QCOW2_INCOMPAT_CORRUPT_BITNR     = 1
	QCOW2_INCOMPAT_DATA_FILE_BITNR   = 2
	QCOW2_INCOMPAT_COMPRESSION_BITNR = 3
	QCOW2_INCOMPAT_EXTL2_BITNR       = 4
	QCOW2_INCOMPAT_DIRTY             = 1 << QCOW2_INCOMPAT_DIRTY_BITNR
	QCOW2_INCOMPAT_CORRUPT           = 1 << QCOW2_INCOMPAT_CORRUPT_BITNR
	QCOW2_INCOMPAT_DATA_FILE         = 1 << QCOW2_INCOMPAT_DATA_FILE_BITNR
	QCOW2_INCOMPAT_COMPRESSION       = 1 << QCOW2_INCOMPAT_COMPRESSION_BITNR
	QCOW2_INCOMPAT_EXTL2             = 1 << QCOW2_INCOMPAT_EXTL2_BITNR
	QCOW2_INCOMPAT_MASK              = QCOW2_INCOMPAT_DIRTY | QCOW2_INCOMPAT_CORRUPT | QCOW2_INCOMPAT_DATA_FILE | QCOW2_INCOMPAT_COMPRESSION | QCOW2_INCOMPAT_EXTL2
)
View Source
const (
	QCOW2_AUTOCLEAR_BITMAPS_BITNR       = 0
	QCOW2_AUTOCLEAR_DATA_FILE_RAW_BITNR = 1
	QCOW2_AUTOCLEAR_BITMAPS             = 1 << QCOW2_AUTOCLEAR_BITMAPS_BITNR
	QCOW2_AUTOCLEAR_DATA_FILE_RAW       = 1 << QCOW2_AUTOCLEAR_DATA_FILE_RAW_BITNR
	QCOW2_AUTOCLEAR_MASK                = QCOW2_AUTOCLEAR_BITMAPS | QCOW2_AUTOCLEAR_DATA_FILE_RAW
)

Autoclear feature bits

View Source
const (
	QCOW2_CLUSTER_UNALLOCATED = iota
	QCOW2_CLUSTER_ZERO_PLAIN
	QCOW2_CLUSTER_ZERO_ALLOC
	QCOW2_CLUSTER_NORMAL
	QCOW2_CLUSTER_COMPRESSED
)

cluster type

View Source
const (
	//used features
	BDRV_O_RDWR   = 0x0002
	BDRV_O_UNMAP  = 0x4000  /* execute guest UNMAP/TRIM operations */
	BDRV_O_CREATE = 0x80000 /* create of non-exist */

	//unused feratures
	BDRV_O_NO_SHARE     = 0x0001 /* don't share permissions */
	BDRV_O_RESIZE       = 0x0004 /* request permission for resizing the node */
	BDRV_O_SNAPSHOT     = 0x0008 /* open the file read only and save writes in a snapshot */
	BDRV_O_TEMPORARY    = 0x0010 /* delete the file after use */
	BDRV_O_NOCACHE      = 0x0020 /* do not use the host page cache */
	BDRV_O_NATIVE_AIO   = 0x0080 /* use native AIO instead of the thread pool */
	BDRV_O_NO_BACKING   = 0x0100 /* don't open the backing file */
	BDRV_O_NO_FLUSH     = 0x0200 /* disable flushing on this disk */
	BDRV_O_COPY_ON_READ = 0x0400 /* copy read backing sectors into image */
	BDRV_O_INACTIVE     = 0x0800 /* consistency hint for migration handoff */
	BDRV_O_CHECK        = 0x1000 /* open solely for consistency check */
	BDRV_O_ALLOW_RDWR   = 0x2000 /* allow reopen to change from r/o to r/w */
	BDRV_O_PROTOCOL     = 0x8000
	BDRV_O_NO_IO        = 0x10000 /* don't initialize for I/O */
	BDRV_O_AUTO_RDONLY  = 0x20000 /* degrade to read-only if opening read-write fails */
	BDRV_O_IO_URING     = 0x40000 /* use io_uring instead of the thread pool */

	BDRV_O_CACHE_MASK = (BDRV_O_NOCACHE | BDRV_O_NO_FLUSH)
)
View Source
const (
	BDRV_SECTOR_BITS = 9
	BDRV_SECTOR_SIZE = (1 << BDRV_SECTOR_BITS)
)
View Source
const (
	BDRV_BLOCK_DATA         = 0x01
	BDRV_BLOCK_ZERO         = 0x02
	BDRV_BLOCK_OFFSET_VALID = 0x04
	BDRV_BLOCK_RAW          = 0x08
	BDRV_BLOCK_ALLOCATED    = 0x10
	BDRV_BLOCK_EOF          = 0x20
	BDRV_BLOCK_RECURSE      = 0x40
)

* Allocation status flags for bdrv_block_status() and friends. * * Public flags: * BDRV_BLOCK_DATA: allocation for data at offset is tied to this layer * BDRV_BLOCK_ZERO: offset reads as zero * BDRV_BLOCK_OFFSET_VALID: an associated offset exists for accessing raw data * BDRV_BLOCK_ALLOCATED: the content of the block is determined by this * layer rather than any backing, set by block layer * BDRV_BLOCK_EOF: the returned pnum covers through end of file for this * layer, set by block layer * * Internal flags: * BDRV_BLOCK_RAW: for use by passthrough drivers, such as raw, to request * that the block layer recompute the answer from the returned * BDS; must be accompanied by just BDRV_BLOCK_OFFSET_VALID. * BDRV_BLOCK_RECURSE: request that the block layer will recursively search for * zeroes in file child of current block node inside * returned region. Only valid together with both * BDRV_BLOCK_DATA and BDRV_BLOCK_OFFSET_VALID. Should not * appear with BDRV_BLOCK_ZERO. * * If BDRV_BLOCK_OFFSET_VALID is set, the map parameter represents the * host offset within the returned BDS that is allocated for the * corresponding raw guest data. However, whether that offset * actually contains data also depends on BDRV_BLOCK_DATA, as follows: * * DATA ZERO OFFSET_VALID * t t t sectors read as zero, returned file is zero at offset * t f t sectors read as valid from file at offset * f t t sectors preallocated, read as zero, returned file not * necessarily zero at offset * f f t sectors preallocated but read from backing_hd, * returned file contains garbage at offset * t t f sectors preallocated, read as zero, unknown offset * t f f sectors read from unknown file or offset * f t f not allocated or unknown offset, read as zero * f f f not allocated or unknown offset, read from backing_hd

View Source
const (
	OPT_FMT         = "fmt"
	OPT_SIZE        = "size"
	OPT_FILENAME    = "filename"
	OPT_BACKING     = "backing"
	OPT_SUBCLUSTER  = "enable-subcluster"
	OPT_L2CACHESIZE = "l2-cache-size"
	OPT_DATAFILE    = "datafile"
)

options

View Source
const (
	PERM_READ     = 0x01
	PERM_WRITE    = 0x02
	PERM_RESIZE   = 0x04
	PERM_ALL      = PERM_READ | PERM_WRITE | PERM_RESIZE
	PERM_READABLE = PERM_READ
	PERM_WRITABLE = PERM_WRITE | PERM_RESIZE
)

permission constants

View Source
const (
	TYPE_RAW = iota
	TYPE_QCOW2
)

bdev type

View Source
const (
	TYPE_RAW_NAME   = "raw"
	TYPE_QCOW2_NAME = "qcow2"
)
View Source
const (
	/* Size of L1 table entries */
	L1E_SIZE = 8
	/* Size of reftable entries */
	REFTABLE_ENTRY_SIZE = 8
	/* Size of normal and extended L2 entries */
	L2E_SIZE_NORMAL   = 8
	L2E_SIZE_EXTENDED = 8 * 2
	SIZE_UINT64       = uint64(unsafe.Sizeof(uint64(0)))
	SIZE_UINT32       = uint32(unsafe.Sizeof(uint32(0)))
	SIZE_INT          = int(unsafe.Sizeof(int(0)))
)
View Source
const (
	QCOW2_SUBCLUSTER_UNALLOCATED_PLAIN = iota
	QCOW2_SUBCLUSTER_UNALLOCATED_ALLOC
	QCOW2_SUBCLUSTER_ZERO_PLAIN
	QCOW2_SUBCLUSTER_ZERO_ALLOC
	QCOW2_SUBCLUSTER_NORMAL
	QCOW2_SUBCLUSTER_COMPRESSED
	QCOW2_SUBCLUSTER_INVALID
)

subcluster type

View Source
const (
	BDRV_REQ_COPY_ON_READ     = 0x1
	BDRV_REQ_ZERO_WRITE       = 0x2
	BDRV_REQ_MAY_UNMAP        = 0x4
	BDRV_REQ_FUA              = 0x10
	BDRV_REQ_WRITE_COMPRESSED = 0x20
	BDRV_REQ_WRITE_UNCHANGED  = 0x40
	BDRV_REQ_SERIALISING      = 0x80
	BDRV_REQ_NO_FALLBACK      = 0x100
	BDRV_REQ_PREFETCH         = 0x200
	BDRV_REQ_NO_WAIT          = 0x400
	BDRV_REQ_MASK             = 0x7ff
)

Bdrv request flag

View Source
const (
	QCOW2_DISCARD_NEVER = iota
	QCOW2_DISCARD_ALWAYS
	QCOW2_DISCARD_REQUEST
	QCOW2_DISCARD_SNAPSHOT
	QCOW2_DISCARD_OTHER
	QCOW2_DISCARD_MAX
)
View Source
const (
	BACKING_FILE_OFFSET = 32768
)

backing file offset

View Source
const (
	IOV_MAX = 1024
)
View Source
const MAX_BOUNCE_BUFFER = uint64(32768 << 9)
View Source
const Max_WRITE_ZEROS = uint64(65536)
View Source
const QCOW2_EXT_MAGIC_DATA_FILE = uint32(0x44415441)

external data file magic number

Variables

View Source
var (
	ERR_EIO     = syscall.EIO
	ERR_E2BIG   = syscall.E2BIG
	ERR_EFBIG   = syscall.EFBIG
	ERR_EINTR   = syscall.EINTR
	ERR_ENOTSUP = syscall.ENOTSUP
	ERR_ENOSPC  = syscall.ENOSPC
	ERR_EINVAL  = syscall.EINVAL
	ERR_EAGAIN  = syscall.EAGAIN

	Err_IdxOutOfRange        = fmt.Errorf("index is out of range")
	Err_NoDriverFound        = fmt.Errorf("no driver found")
	Err_NullObject           = fmt.Errorf("null object")
	Err_IncompleteParameters = fmt.Errorf("incomplete parameters")
	Err_L2Alloc              = fmt.Errorf("allocate l2 table fails")
	Err_RefcountAlloc        = fmt.Errorf("allocate refcount block fails")
	Err_NoWritePerm          = fmt.Errorf("no write permission")
	Err_NoReadPerm           = fmt.Errorf("no read permission")
	Err_Misaligned           = fmt.Errorf("misaligned")
)
View Source
var (
	QCOW_MAGIC = []byte{0x51, 0x46, 0x49, 0xFB} //magic ("QFI\xfb").
)

Functions

func Assert

func Assert(expr bool)

func Blk_Close

func Blk_Close(child *BdrvChild)

func Blk_Create

func Blk_Create(filename string, options map[string]any) error

func Blk_Discard

func Blk_Discard(child *BdrvChild, offset uint64, bytes uint64) error

func Blk_Flush

func Blk_Flush(child *BdrvChild) error

func Blk_Getlength

func Blk_Getlength(child *BdrvChild) (uint64, error)

*

  • Return length in bytes on success, -errno on error.

  • The length is always a multiple of BDRV_SECTOR_SIZE.

    int64_t bdrv_getlength(BlockDriverState *bs)

func Blk_Info

func Blk_Info(child *BdrvChild, detail bool, pretty bool) string

func Blk_Pread

func Blk_Pread(root *BdrvChild, offset uint64, buf []uint8, bytes uint64) (uint64, error)

func Blk_Pread_Object

func Blk_Pread_Object(child *BdrvChild, offset uint64, object any, size uint64) (uint64, error)

read object from the file, the object's size must be obtainable

func Blk_Probe

func Blk_Probe(filename string) (string, error)

func Blk_Pwrite

func Blk_Pwrite(root *BdrvChild, offset uint64, buf []uint8,
	bytes uint64, flags BdrvRequestFlags) (uint64, error)

* default write cache model is 'writeback', * to use 'writethough' model, set 'flags |= BDRV_REQ_FUA' * Note: if the BDRV_REQ_FUA flag has been set in the openflags when open the block dev * the flag take effects for all writes as well

func Blk_Pwrite_Object

func Blk_Pwrite_Object(child *BdrvChild, offset uint64, object any, size uint64) (uint64, error)

Write the object to the file in the bigendian manner, return -1 if error occurs

func Blk_Pwrite_Zeroes

func Blk_Pwrite_Zeroes(root *BdrvChild, offset uint64,
	bytes uint64, flags BdrvRequestFlags) (uint64, error)

Types

type AioTaskFunc

type AioTaskFunc func(task *Qcow2Task) error

type AioTaskRoutineFunc

type AioTaskRoutineFunc func(ctx context.Context, taskList *SignalList)

type BDRVQcow2State

type BDRVQcow2State struct {
	ClusterBits       uint32
	ClusterSize       uint32
	L2Bits            uint32
	L2Size            uint32
	L1Size            uint32
	RefcountBlockBits uint32
	RefcountBlockSize uint32

	ClusterOffsetMask uint64
	L1TableOffset     uint64
	L1Table           []uint64

	L2TableCache       *Qcow2Cache
	RefcountBlockCache *Qcow2Cache

	RefcountTable       []uint64
	RefcountTableOffset uint64
	RefcountTableSize   uint32

	MaxRefcountTableIndex uint32
	FreeClusterIndex      uint64
	QcowVersion           int

	FreeByteOffset uint64 //not used
	Lock           *sync.Mutex
	Flags          int //not used

	L2SliceSize int

	L2eOffsetMask uint64

	//variables for subcluster feature
	SubclusterBits        uint64
	SubclustersPerCluster uint64
	SubclusterSize        uint64

	ClusterAllocs *list.List
	Discards      *list.List

	DataFile *BdrvChild

	CacheDiscards      bool
	DiscardPassthrough [QCOW2_DISCARD_MAX]bool

	AioTaskList    *SignalList
	AioTaskRoutine AioTaskRoutineFunc

	/* The following fields are only valid for version >= 3 */
	IncompatibleFeatures uint64
	CompatibleFeatures   uint64
	AutoclearFeatures    uint64
	// contains filtered or unexported fields
}

for qcow2 file state

func (*BDRVQcow2State) Qlock

func (s *BDRVQcow2State) Qlock()

func (*BDRVQcow2State) Qunlock

func (s *BDRVQcow2State) Qunlock()

type BDRVRawState

type BDRVRawState struct {
	File      *os.File
	OpenFlags int
	BufAlign  uint64

	/* The current permissions. */
	Perm       uint64
	SharedPerm uint64
}

type BdrvChild

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

func Blk_Open

func Blk_Open(filename string, options map[string]any, flags int) (*BdrvChild, error)
this function return root BdrvChild

* default cache model is 'writeback', * to use cache model 'none', set flags |= (BDRV_O_NOCACHE|BDRV_REQ_FUA) * to use cache model 'writethrough', set flags |= BDRV_REQ_FUA

func (*BdrvChild) GetBS

func (child *BdrvChild) GetBS() *BlockDriverState

func (*BdrvChild) SetBS

func (child *BdrvChild) SetBS(bs *BlockDriverState)

type BdrvRequestFlags

type BdrvRequestFlags int

type BdrvRequestPadding

type BdrvRequestPadding struct {
	Buf        []uint8
	BufLen     uint64
	TailBuf    []uint8
	Head       uint64
	Tail       uint64
	MergeReads bool
	LocalQiov  QEMUIOVector
}

* Request padding * * |<---- align ----->| |<----- align ---->| * |<- head ->|<------------- bytes ------------->|<-- tail -->| * | | | | | | * -*----------$-------*-------- ... --------*-----$------------*--- * | | | | | | * | offset | | end | * ALIGN_DOWN(offset) ALIGN_UP(offset) ALIGN_DOWN(end) ALIGN_UP(end) * [buf ... ) [tail_buf ) * * @buf is an aligned allocation needed to store @head and @tail paddings. @head * is placed at the beginning of @buf and @tail at the @end. * * @tail_buf is a pointer to sub-buffer, corresponding to align-sized chunk * around tail, if tail exists. * * @merge_reads is true for small requests, * if @buf_len == @head + bytes + @tail. In this case it is possible that both * head and tail exist but @buf_len == align and @tail_buf == @buf.

type Bdrv_Block_Status_Func

type Bdrv_Block_Status_Func func(bs *BlockDriverState, want_zero bool, offset uint64, bytes uint64,
	pnum *uint64, tmap *uint64, file **BlockDriverState) (uint64, error)

type Bdrv_Close_Func

type Bdrv_Close_Func func(bs *BlockDriverState)

type Bdrv_Copy_Range_From_Func

type Bdrv_Copy_Range_From_Func func(bs *BlockDriverState, src *BdrvChild, srcOffset uint64,
	dst *BdrvChild, dstOffset uint64, bytes uint64,
	readFlags BdrvRequestFlags, writeFlags BdrvRequestFlags) error

type Bdrv_Copy_Range_To_Func

type Bdrv_Copy_Range_To_Func func(bs *BlockDriverState, src *BdrvChild, srcOffset uint64,
	dst *BdrvChild, dstOffset uint64, bytes uint64,
	readFlags BdrvRequestFlags, writeFlags BdrvRequestFlags) error

type Bdrv_Create_Func

type Bdrv_Create_Func func(filename string, options map[string]any) error

type Bdrv_Flush_Func

type Bdrv_Flush_Func func(bs *BlockDriverState) error

type Bdrv_Flush_To_Disk_Func

type Bdrv_Flush_To_Disk_Func func(bs *BlockDriverState) error

type Bdrv_Flush_To_Os_Func

type Bdrv_Flush_To_Os_Func func(bs *BlockDriverState) error

type Bdrv_Getlength_Func

type Bdrv_Getlength_Func func(bs *BlockDriverState) (uint64, error)

type Bdrv_Open_Func

type Bdrv_Open_Func func(filename string, options map[string]any, flags int) (*BlockDriverState, error)

type Bdrv_Pdiscard_Func

type Bdrv_Pdiscard_Func func(bs *BlockDriverState, offset uint64, bytes uint64) error

type Bdrv_Preadv_Func

type Bdrv_Preadv_Func func(bs *BlockDriverState, offset uint64, bytes uint64,
	qiov *QEMUIOVector, flags BdrvRequestFlags) error

type Bdrv_Preadv_Part_Func

type Bdrv_Preadv_Part_Func func(bs *BlockDriverState, offset uint64, bytes uint64,
	qiov *QEMUIOVector, qiovOffset uint64, flags BdrvRequestFlags) error

type Bdrv_Pwrite_Zeroes_Func

type Bdrv_Pwrite_Zeroes_Func func(bs *BlockDriverState, offset uint64, bytes uint64, flags BdrvRequestFlags) error

type Bdrv_Pwritev_Func

type Bdrv_Pwritev_Func func(bs *BlockDriverState, offset uint64, bytes uint64,
	qiov *QEMUIOVector, flags BdrvRequestFlags) error

type Bdrv_Pwritev_Part_Func

type Bdrv_Pwritev_Part_Func func(bs *BlockDriverState, offset uint64, bytes uint64,
	qiov *QEMUIOVector, qiovOffset uint64, flags BdrvRequestFlags) error

type BlockDriver

type BlockDriver struct {
	FormatName     string
	InstanceSize   int
	SupportBacking bool
	IsFormat       bool
	// contains filtered or unexported fields
}

type BlockDriverState

type BlockDriverState struct {

	//static configuration
	RequestAlignment  uint32
	PdiscardAlignment uint32
	MaxTransfer       uint32
	//statistic information
	InFlight            uint64
	SupportedWriteFlags uint64
	SupportedReadFlags  uint64
	SupportedZeroFlags  uint64
	OpenFlags           int /* flags used to open the file, re-used for re-open */
	TotalSectors        uint64
	InheritsFrom        *BlockDriverState
	Drv                 *BlockDriver
	// contains filtered or unexported fields
}

func (*BlockDriverState) GetInfo

func (bs *BlockDriverState) GetInfo() *BlockInfo

func (*BlockDriverState) Info

func (bs *BlockDriverState) Info(detail bool, pretty bool) string

type BlockInfo

type BlockInfo struct {
	//based information
	FileFormat   string `json:"file format"`
	VirtualSize  uint64 `json:"virtual size"`
	DiskSize     uint64 `json:"disk size"`
	ClusterSize  uint32 `json:"cluster size"`
	RefcountBits uint16 `json:"refcount bits"`
	ExtendedL2   bool   `json:"extend l2"`
	//backing chain
	BakcingFileChain []string        `json:"backing chain"`
	DataFile         string          `json:"data file,omitempty"`
	Statistic        *BlockStatistic `json:"stat,omitempty"`
}

type BlockStatistic

type BlockStatistic struct {
	TotalBlocks         uint64 `json:"total blocks,omitempty"`
	HeadBlocks          uint64 `json:"head blocks,omitempty"`
	L1Blocks            uint64 `json:"l1 blocks,omitempty"`
	RefcountTableBlocks uint64 `json:"refcount table blocks,omitempty"`
	L2Blocks            uint64 `json:"l2 blocks,omitempty"`
	RecountBlocks       uint64 `json:"refcount blocks,omitempty"`
	DataBlocks          uint64 `json:"data blocks,omitempty"`
}

type FileType

type FileType int

type Get_Refcount_Func

type Get_Refcount_Func func(refcountArray unsafe.Pointer, index uint64) uint16

type QCow2ClusterType

type QCow2ClusterType int

type QCow2SubclusterType

type QCow2SubclusterType int

type QCowExtension

type QCowExtension struct {
	Magic  uint32
	Length uint32
}

type QCowHeader

type QCowHeader struct {
	Magic                 uint32
	Version               uint32
	BackingFileOffset     uint64
	BackingFileSize       uint32
	ClusterBits           uint32
	Size                  uint64 /* in bytes */
	CryptMethod           uint32
	L1Size                uint32
	L1TableOffset         uint64
	RefcountTableOffset   uint64
	RefcountTableClusters uint32
	NbSnapshots           uint32
	SnapshotsOffset       uint64

	/* The following fields are only valid for version >= 3 */
	IncompatibleFeatures uint64
	CompatibleFeatures   uint64
	AutoclearFeatures    uint64

	RefcountOrder uint32
	HeaderLength  uint32

	/* Additional fields */
	CompressionType uint8

	/* header must be a multiple of 8 */
	Padding [7]uint8 `json:"-"`
}

the qcow2 header struct, compatible with version 3

type QCowL2Meta

type QCowL2Meta struct {
	Offset          uint64
	AllocOffset     uint64
	NbClusters      int
	KeepOldClusters bool
	CowStart        Qcow2COWRegion
	CowEnd          Qcow2COWRegion
	SkipCow         bool

	DataQiov       *QEMUIOVector
	DataQiovOffset uint64

	/** Pointer to next L2Meta of the same write request */
	Next         *QCowL2Meta
	NextInFlight *list.Element
}

type QEMUIOVector

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

func New_QEMUIOVector

func New_QEMUIOVector() *QEMUIOVector

type Qcow2COWRegion

type Qcow2COWRegion struct {
	Offset  uint64
	NbBytes uint64
}

type Qcow2Cache

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

type Qcow2CachedTable

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

type Qcow2DiscardRegion

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

type Qcow2DiscardType

type Qcow2DiscardType int

type Qcow2Task

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

type Set_Refcount_Func

type Set_Refcount_Func func(refcountArray unsafe.Pointer, index uint64, value uint16)

type SignalList

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

func NewSignalList

func NewSignalList() *SignalList

func (*SignalList) Pop

func (l *SignalList) Pop() any

func (*SignalList) Push

func (l *SignalList) Push(ele any)

Jump to

Keyboard shortcuts

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