Documentation ¶
Index ¶
- Constants
- func AttachVhd(path string) (err error)
- func AttachVirtualDisk(handle syscall.Handle, attachVirtualDiskFlag AttachVirtualDiskFlag, ...) (err error)
- func CreateDiffVhd(diffVhdPath, baseVhdPath string, blockSizeInMB uint32) error
- func CreateVhdx(path string, maxSizeInGb, blockSizeInMb uint32) error
- func CreateVirtualDisk(path string, virtualDiskAccessMask VirtualDiskAccessMask, ...) (syscall.Handle, error)
- func DetachVhd(path string) error
- func DetachVirtualDisk(handle syscall.Handle) (err error)
- func GetVirtualDiskPhysicalPath(handle syscall.Handle) (_ string, err error)
- func OpenVirtualDisk(vhdPath string, virtualDiskAccessMask VirtualDiskAccessMask, ...) (syscall.Handle, error)
- func OpenVirtualDiskWithParameters(vhdPath string, virtualDiskAccessMask VirtualDiskAccessMask, ...) (syscall.Handle, error)
- type AttachVersion2
- type AttachVirtualDiskFlag
- type AttachVirtualDiskParameters
- type CreateVersion2
- type CreateVirtualDiskFlag
- type CreateVirtualDiskParameters
- type DetachVirtualDiskFlag
- type OpenVersion2
- type OpenVirtualDiskParameters
- type VirtualDiskAccessMask
- type VirtualDiskFlag
- type VirtualStorageType
Constants ¶
const ( //revive:disable-next-line:var-naming ALL_CAPS VIRTUAL_STORAGE_TYPE_DEVICE_VHDX = 0x3 // Access Mask for opening a VHD. VirtualDiskAccessNone VirtualDiskAccessMask = 0x00000000 VirtualDiskAccessAttachRO VirtualDiskAccessMask = 0x00010000 VirtualDiskAccessAttachRW VirtualDiskAccessMask = 0x00020000 VirtualDiskAccessDetach VirtualDiskAccessMask = 0x00040000 VirtualDiskAccessGetInfo VirtualDiskAccessMask = 0x00080000 VirtualDiskAccessCreate VirtualDiskAccessMask = 0x00100000 VirtualDiskAccessMetaOps VirtualDiskAccessMask = 0x00200000 VirtualDiskAccessRead VirtualDiskAccessMask = 0x000d0000 VirtualDiskAccessAll VirtualDiskAccessMask = 0x003f0000 VirtualDiskAccessWritable VirtualDiskAccessMask = 0x00320000 // Flags for creating a VHD. CreateVirtualDiskFlagNone CreateVirtualDiskFlag = 0x0 CreateVirtualDiskFlagFullPhysicalAllocation CreateVirtualDiskFlag = 0x1 CreateVirtualDiskFlagPreventWritesToSourceDisk CreateVirtualDiskFlag = 0x2 CreateVirtualDiskFlagDoNotCopyMetadataFromParent CreateVirtualDiskFlag = 0x4 CreateVirtualDiskFlagCreateBackingStorage CreateVirtualDiskFlag = 0x8 CreateVirtualDiskFlagUseChangeTrackingSourceLimit CreateVirtualDiskFlag = 0x10 CreateVirtualDiskFlagPreserveParentChangeTrackingState CreateVirtualDiskFlag = 0x20 CreateVirtualDiskFlagVhdSetUseOriginalBackingStorage CreateVirtualDiskFlag = 0x40 //revive:disable-line:var-naming VHD, not Vhd CreateVirtualDiskFlagSparseFile CreateVirtualDiskFlag = 0x80 CreateVirtualDiskFlagPmemCompatible CreateVirtualDiskFlag = 0x100 //revive:disable-line:var-naming PMEM, not Pmem CreateVirtualDiskFlagSupportCompressedVolumes CreateVirtualDiskFlag = 0x200 // Flags for opening a VHD. OpenVirtualDiskFlagNone VirtualDiskFlag = 0x00000000 OpenVirtualDiskFlagNoParents VirtualDiskFlag = 0x00000001 OpenVirtualDiskFlagBlankFile VirtualDiskFlag = 0x00000002 OpenVirtualDiskFlagBootDrive VirtualDiskFlag = 0x00000004 OpenVirtualDiskFlagCachedIO VirtualDiskFlag = 0x00000008 OpenVirtualDiskFlagCustomDiffChain VirtualDiskFlag = 0x00000010 OpenVirtualDiskFlagParentCachedIO VirtualDiskFlag = 0x00000020 OpenVirtualDiskFlagVhdsetFileOnly VirtualDiskFlag = 0x00000040 OpenVirtualDiskFlagIgnoreRelativeParentLocator VirtualDiskFlag = 0x00000080 OpenVirtualDiskFlagNoWriteHardening VirtualDiskFlag = 0x00000100 OpenVirtualDiskFlagSupportCompressedVolumes VirtualDiskFlag = 0x00000200 // Flags for attaching a VHD. AttachVirtualDiskFlagNone AttachVirtualDiskFlag = 0x00000000 AttachVirtualDiskFlagReadOnly AttachVirtualDiskFlag = 0x00000001 AttachVirtualDiskFlagNoDriveLetter AttachVirtualDiskFlag = 0x00000002 AttachVirtualDiskFlagPermanentLifetime AttachVirtualDiskFlag = 0x00000004 AttachVirtualDiskFlagNoLocalHost AttachVirtualDiskFlag = 0x00000008 AttachVirtualDiskFlagNoSecurityDescriptor AttachVirtualDiskFlag = 0x00000010 AttachVirtualDiskFlagBypassDefaultEncryptionPolicy AttachVirtualDiskFlag = 0x00000020 AttachVirtualDiskFlagNonPnp AttachVirtualDiskFlag = 0x00000040 AttachVirtualDiskFlagRestrictedRange AttachVirtualDiskFlag = 0x00000080 AttachVirtualDiskFlagSinglePartition AttachVirtualDiskFlag = 0x00000100 AttachVirtualDiskFlagRegisterVolume AttachVirtualDiskFlag = 0x00000200 // Flags for detaching a VHD. DetachVirtualDiskFlagNone DetachVirtualDiskFlag = 0x0 )
Variables ¶
This section is empty.
Functions ¶
func AttachVhd ¶
AttachVhd attaches a virtual hard disk at `path` for use. Attaches using version 2 of the ATTACH_VIRTUAL_DISK_PARAMETERS.
func AttachVirtualDisk ¶
func AttachVirtualDisk( handle syscall.Handle, attachVirtualDiskFlag AttachVirtualDiskFlag, parameters *AttachVirtualDiskParameters, ) (err error)
AttachVirtualDisk attaches a virtual hard disk for use.
func CreateDiffVhd ¶
CreateDiffVhd is a helper function to create a differencing virtual disk.
func CreateVhdx ¶
CreateVhdx is a helper function to create a simple vhdx file at the given path using default values.
func CreateVirtualDisk ¶
func CreateVirtualDisk( path string, virtualDiskAccessMask VirtualDiskAccessMask, createVirtualDiskFlags CreateVirtualDiskFlag, parameters *CreateVirtualDiskParameters, ) (syscall.Handle, error)
CreateVirtualDisk creates a virtual harddisk and returns a handle to the disk.
func DetachVirtualDisk ¶
DetachVirtualDisk detaches a virtual hard disk by handle.
func GetVirtualDiskPhysicalPath ¶
GetVirtualDiskPhysicalPath takes a handle to a virtual hard disk and returns the physical path of the disk on the machine. This path is in the form \\.\PhysicalDriveX where X is an integer that represents the particular enumeration of the physical disk on the caller's system.
func OpenVirtualDisk ¶
func OpenVirtualDisk( vhdPath string, virtualDiskAccessMask VirtualDiskAccessMask, openVirtualDiskFlags VirtualDiskFlag, ) (syscall.Handle, error)
OpenVirtualDisk obtains a handle to a VHD opened with supplied access mask and flags.
func OpenVirtualDiskWithParameters ¶
func OpenVirtualDiskWithParameters( vhdPath string, virtualDiskAccessMask VirtualDiskAccessMask, openVirtualDiskFlags VirtualDiskFlag, parameters *OpenVirtualDiskParameters, ) (syscall.Handle, error)
OpenVirtualDiskWithParameters obtains a handle to a VHD opened with supplied access mask, flags and parameters.
Types ¶
type AttachVersion2 ¶
type AttachVirtualDiskFlag ¶
type AttachVirtualDiskFlag uint32
type AttachVirtualDiskParameters ¶
type AttachVirtualDiskParameters struct { Version uint32 Version2 AttachVersion2 }
type CreateVersion2 ¶
type CreateVersion2 struct { UniqueID guid.GUID MaximumSize uint64 BlockSizeInBytes uint32 SectorSizeInBytes uint32 PhysicalSectorSizeInByte uint32 ParentPath *uint16 // string SourcePath *uint16 // string OpenFlags uint32 ParentVirtualStorageType VirtualStorageType SourceVirtualStorageType VirtualStorageType ResiliencyGUID guid.GUID }
type CreateVirtualDiskFlag ¶
type CreateVirtualDiskFlag uint32
type CreateVirtualDiskParameters ¶
type CreateVirtualDiskParameters struct { Version uint32 // Must always be set to 2 Version2 CreateVersion2 }
type DetachVirtualDiskFlag ¶
type DetachVirtualDiskFlag uint32
type OpenVersion2 ¶
type OpenVirtualDiskParameters ¶
type OpenVirtualDiskParameters struct { Version uint32 // Must always be set to 2 Version2 OpenVersion2 }
type VirtualDiskAccessMask ¶
type VirtualDiskAccessMask uint32
type VirtualDiskFlag ¶
type VirtualDiskFlag uint32