kvp

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Timeout amount of time in ms to poll the hyperv kernel device
	Timeout                   = 1000
	KvpOpRegister1            = 100
	HvSOk                     = 0
	HvKvpExchangeMaxValueSize = 2048
	HvKvpExchangeMaxKeySize   = 512
	KvpOpSet                  = 1
	// KvpKernelDevice s the hyperv kernel device used for communicating key-values pairs
	// on hyperv between the host and guest
	KvpKernelDevice = "/dev/vmbus/hv_kvp"
	// DefaultKVPPoolID is where Windows host write to for Linux VMs
	DefaultKVPPoolID = 0
)

Variables

View Source
var (
	// ErrUnableToWriteToKVP is used when we are unable to write to the kernel
	// device for hyperv
	ErrUnableToWriteToKVP = errors.New("failed to write to hv_kvp")
	// ErrUnableToReadFromKVP is used when we are unable to read from the kernel
	// device for hyperv
	ErrUnableToReadFromKVP = errors.New("failed to read from hv_kvp")
	// ErrNoKeyValuePairsFound means we were unable to find key-value pairs as passed
	// from the hyperv host to this guest.
	ErrNoKeyValuePairsFound = errors.New("unable to find kvp keys")
)

Functions

func GetKeyValuePairs

func GetKeyValuePairs() (map[string]ValuePair, error)

GetKeyValuePairs reads the key value pairs from the wmi hyperv kernel device and returns them in map form. the map value is a ValuePair which contains the value string and the poolid

func GetSplitKeyValues

func GetSplitKeyValues(key string, pool PoolID, kvps map[string]ValuePair) (string, map[string]ValuePair, error)

GetSplitKeyValues "filters" KVPs looking for split values using a key and pool_id. Returns the assembled split values as a key as well as a new KVP that no longer has the split keys in question

Types

type PoolID

type PoolID uint8

type ValuePair

type ValuePair struct {
	Value string
	Pool  PoolID
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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