[libvirt] [PATCH 10/23] Add support for USB host device passthrough with LXC
Gao feng
gaofeng at cn.fujitsu.com
Fri Dec 14 07:31:39 UTC 2012
On 2012/12/01 04:26, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
>
> This adds support for host device passthrough with the
> LXC driver. Since there is only a single kernel image,
> it doesn't make sense to pass through PCI devices, but
> USB devices are fine. For the latter we merely need to
> make the /dev/bus/usb/NNN/MMM character device exist
> in the container's /dev
>
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
[...]
>
>
> +static int lxcContainerSetupHostdevSubsysUSB(virDomainDefPtr vmDef ATTRIBUTE_UNUSED,
> + virDomainHostdevDefPtr def ATTRIBUTE_UNUSED,
> + const char *dstprefix ATTRIBUTE_UNUSED,
> + virSecurityManagerPtr securityDriver ATTRIBUTE_UNUSED)
> +{
> + int ret = -1;
> + char *src = NULL;
> + char *dstdir = NULL;
> + char *dstfile = NULL;
> + struct stat sb;
> + mode_t mode;
> +
> + if (virAsprintf(&dstdir, "/dev/bus/usb/%03d",
> + def->source.subsys.u.usb.bus) < 0) {
better to use USB_DEVFS instead of /dev/bus/usb/
More information about the libvir-list
mailing list