[libvirt] [PATCH 10/23] Add support for USB host device passthrough with LXC
Daniel P. Berrange
berrange at redhat.com
Mon Dec 17 17:13:17 UTC 2012
On Fri, Dec 14, 2012 at 03:31:39PM +0800, Gao feng wrote:
> 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/
Yep, will change that
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list