qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Machine description as data prototype, take 3


From: Anthony Liguori
Subject: Re: [Qemu-devel] Machine description as data prototype, take 3
Date: Thu, 19 Feb 2009 08:49:12 -0600
User-agent: Thunderbird 2.0.0.19 (X11/20090105)


diff --git a/hw/dt.c b/hw/dt.c
+

Please remove the ^Ls.  They don't render properly in my mail client.

+/* Host Configuration */
+
+typedef struct dt_host {
+    /* connection NICs <-> VLAN */
+    tree *nic[MAX_NICS];
+    VLANState *nic_vlan[MAX_NICS];
+    /* connection drives <-> controller */
+    tree *drive_ctrl[MAX_DRIVES];
+    BlockDriverState *drive_state[MAX_DRIVES];
+} dt_host;


typedef struct DeviceTreeHost
{
} DeviceTreeHost.

I'm not sure this structure is going to scale well as we introduce more types of host devices. You don't necessarily need to address the host configuration file part of this at this stage.

For instance, I think it would be perfectly fine to require to start with that the command line configuration matches the describe machine file. For instance, if you see:

-net tap -net nic,model=rtl8139

Then you should search for an rtl8139 and configure the node to be on vlan=0. If an rtl8139 doesn't exist, throw an error.

The long term goal, would be to have a mechanism to modify the tree in a generic way and the -net nic code would end up looking like:

node = find_next_device("type=nic,model=rtl8139");
if (!node) {
  node = find_bus("type=pcibus");
  if (!node)
      bail out
node = add_node_to_bus(node, "type=nic,model=rtl8139,remaining_description_of_rtl8139");
  if (!node)
      bail out
}

attach_nic_to_vlan(vlan, node);

+static dt_driver *
+dt_driver_by_name(const char *name)

While I'm not wildly opposed to this style (it's nice for grepping), most of the rest of the code doesn't do this (it keeps it on the same line).

Regards,

Anthony Liguori




reply via email to

[Prev in Thread] Current Thread [Next in Thread]