package devices

import "github.com/Microsoft/hcsshim/internal/devices"

Index

Functions

func AddDevice

func AddDevice(ctx context.Context, vm *uvm.UtilityVM, idType, deviceID string, index uint16, deviceUtilPath string) (vpci *uvm.VPCIDevice, locationPaths []string, err error)

AddDevice is the api exposed to oci/hcsoci to handle assigning a device on a WCOW UVM

`idType` refers to the specified device's type.

`deviceID` refers to the specified device's identifier. This must refer to a device instance id for hyper-v isolated device assignment.

`deviceUtilPath` refers to the path in the UVM of the device-util tool used for finding the given device's location path(s).

Returns the allocated vpci device in `vpci` to be tracked for release by the caller. On failure in this function, `vpci` is released and nil is returned for that value.

Returns a slice of strings representing the resulting location path(s) for the specified device.

func GetDeviceInfoFromPath

func GetDeviceInfoFromPath(rawDevicePath string) (string, uint16)

GetDeviceInfoFromPath takes a device path and parses it into the PCI ID and virtual function index if one is specified.

func InstallDrivers

func InstallDrivers(ctx context.Context, vm *uvm.UtilityVM, share string) (closer resources.ResourceCloser, err error)

InstallDriver mounts a share from the host into the UVM, installs any kernel drivers in the share, and configures the environment for library files and/or binaries in the share.

InstallDriver mounts a specified kernel driver, then installs it in the UVM.

`share` is a directory path on the host that contains files for standard driver installation. For windows this means files for pnp installation (.inf, .cat, .sys, .cert files). For linux this means a vhd file that contains the drivers under /lib/modules/`uname -r` for use with depmod and modprobe.

Returns a ResourceCloser for the added mount. On failure, the mounted share will be released, the returned ResourceCloser will be nil, and an error will be returned.

Source Files

assigned_devices.go doc.go drivers.go pnp.go

Version
v0.13.0 (latest)
Published
Apr 21, 2025
Platform
windows/amd64
Imports
19 packages
Last checked
16 hours ago

Tools for package owners.