Re: [kvm-devel] [PATCH 1/3] virtio interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 25 Sep 2007 09:37:38 +1000,
Rusty Russell <rusty@xxxxxxxxxxxxxxx> wrote:

> On Tue, 2007-09-25 at 00:18 +0200, Arnd Bergmann wrote:
> > On Monday 24 September 2007, Rusty Russell wrote:
> > > +
> > > +struct virtio_bus {
> > > +	struct bus_type bus;
> > > +	struct device dev;
> > > +};
> > > +
> > > +static struct virtio_bus virtio_bus = {
> > > +	.bus = {
> > > +		.name  = "virtio",
> > > +		.match = virtio_dev_match,
> > > +		.dev_attrs = virtio_dev_attrs,
> > > +	},
> > > +	.dev = {
> > > +		/* Can override this if you have a real bus behind it. */
> > > +		.parent = NULL,
> > > +		.bus_id = "virtio",
> > > +	}
> > > +};
> > 
> > This is a pattern I've seen a few times before, but could never understand
> > what it's good for. What is your reason for defining a new data structure
> > that is used only once, instead of just
> > 
> > static struct bus_type virtio_bus_type;
> > static struct device virtio_root_dev;
> 
> It's copied from the lguest bus which was copied from somewhere else.
> Creating a struct like this is a quiet complaint about the requirements
> to do so: it's not clear to me why I need to create a fake device,
> rather than making the bus the parent of the device if it needs one.

You may want to have different busses, all having their own root
device, which share the same bus type.

Or you may want to embed the root device into a more complex structure.
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/virtualization

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux