Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


change to device configuration syntax
Jack Lange [Fri, 13 Aug 2010 23:01:12 +0000 (18:01 -0500)]
37 files changed:
palacios/src/devices/8254.c
palacios/src/devices/8259a.c
palacios/src/devices/apic.c
palacios/src/devices/bochs_debug.c
palacios/src/devices/cga.c
palacios/src/devices/cirrus_gfx_card.c
palacios/src/devices/curses_cons.c
palacios/src/devices/disk_model.c
palacios/src/devices/filedisk.c
palacios/src/devices/generic.c
palacios/src/devices/i440fx.c
palacios/src/devices/icc_bus.c
palacios/src/devices/ide.c
palacios/src/devices/io_apic.c
palacios/src/devices/keyboard.c
palacios/src/devices/lnx_virtio_balloon.c
palacios/src/devices/lnx_virtio_blk.c
palacios/src/devices/lnx_virtio_nic.c
palacios/src/devices/lnx_virtio_sym.c
palacios/src/devices/lnx_virtio_symmod.c
palacios/src/devices/lnx_virtio_vnet.c
palacios/src/devices/netdisk.c
palacios/src/devices/nvram.c
palacios/src/devices/os_debug.c
palacios/src/devices/para_net.c
palacios/src/devices/pci.c
palacios/src/devices/pci_passthrough.c
palacios/src/devices/piix3.c
palacios/src/devices/ramdisk.c
palacios/src/devices/serial.c
palacios/src/devices/swapbypass_cache.c
palacios/src/devices/swapbypass_cache2.c
palacios/src/devices/telnet_cons.c
palacios/src/devices/tmpdisk.c
palacios/src/devices/vnet_nic.c
palacios/src/palacios/vmm_config.c
utils/guest_creator/default.xml

index a7c7398..0c3608b 100644 (file)
@@ -643,7 +643,7 @@ static struct v3_device_ops dev_ops = {
 static int pit_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct pit * pit_state = NULL;
     struct vm_device * dev = NULL;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
     
     // PIT is only usable in non-multicore environments
     // just hardcode the core context
@@ -655,10 +655,10 @@ static int pit_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     pit_state = (struct pit *)V3_Malloc(sizeof(struct pit));
     V3_ASSERT(pit_state != NULL);
 
-    dev = v3_allocate_device(name, &dev_ops, pit_state);
+    dev = v3_allocate_device(dev_id, &dev_ops, pit_state);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 498ab76..c13292e 100644 (file)
@@ -746,7 +746,7 @@ static struct v3_device_ops dev_ops = {
 static int pic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct pic_internal * state = NULL;
     state = (struct pic_internal *)V3_Malloc(sizeof(struct pic_internal));
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     // PIC is only usable in non-multicore environments
     // just hardcode the core context
@@ -754,10 +754,10 @@ static int pic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
     V3_ASSERT(state != NULL);
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, state);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index ad684f1..902bebe 100644 (file)
@@ -1106,13 +1106,13 @@ static struct v3_icc_ops icc_ops = {
 
 static int apic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     PrintDebug("apic: creating an APIC for each core\n");
-    char * name = v3_cfg_val(cfg, "name");
-    char * icc_name = v3_cfg_val(cfg,"bus");
-    struct vm_device * icc = v3_find_dev(vm, icc_name);
+    char * dev_id = v3_cfg_val(cfg, "ID");
+    char * icc_bus_id = v3_cfg_val(cfg,"bus");
+    struct vm_device * icc = v3_find_dev(vm, icc_bus_id);
     int i;
 
     if (!icc) {
-        PrintError("apic: Cannot find ICC Bus (%s)\n", icc_name);
+        PrintError("apic: Cannot find ICC Bus (%s)\n", icc_bus_id);
         return -1;
     }
 
@@ -1121,10 +1121,10 @@ static int apic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     // 0..num_cores-1   at num_cores is the ioapic (one only)
     struct apic_state * apic = (struct apic_state *)V3_Malloc(sizeof(struct apic_state) * vm->num_cores);
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, apic);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, apic);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("apic: Could not attach device %s\n", name);
+       PrintError("apic: Could not attach device %s\n", dev_id);
        return -1;
     }
 
index cced2eb..a240988 100644 (file)
@@ -136,17 +136,17 @@ static struct v3_device_ops dev_ops = {
 
 static int debug_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct debug_state * state = NULL;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     state = (struct debug_state *)V3_Malloc(sizeof(struct debug_state));
 
     V3_ASSERT(state != NULL);
 
     PrintDebug("Creating Bochs Debug Device\n");
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, state);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 6c82c58..ec75d53 100644 (file)
@@ -115,7 +115,7 @@ static void passthrough_out(uint16_t port, void * src, uint_t length) {
     }
 }
 
-static int video_write_mem(addr_t guest_addr, void * dest, uint_t length, void * priv_data) {
+static int video_write_mem(struct guest_info * core, addr_t guest_addr, void * dest, uint_t length, void * priv_data) {
     struct vm_device * dev = (struct vm_device *)priv_data;
     struct video_internal * state = (struct video_internal *)dev->private_data;
     uint_t fb_offset = guest_addr - START_ADDR;
@@ -148,7 +148,7 @@ static int video_write_mem(addr_t guest_addr, void * dest, uint_t length, void *
     return length;
 }
 
-static int video_read_port(uint16_t port, void * dest, uint_t length, struct vm_device * dev) {
+static int video_read_port(struct guest_info * core, uint16_t port, void * dest, uint_t length, struct vm_device * dev) {
     struct video_internal * video_state = (struct video_internal *)dev->private_data;
 
 
@@ -163,7 +163,7 @@ static int video_read_port(uint16_t port, void * dest, uint_t length, struct vm_
 
 
 
-static int video_write_port(uint16_t port, void * src, uint_t length, struct vm_device * dev) {
+static int video_write_port(struct guest_info * core, uint16_t port, void * src, uint_t length, struct vm_device * dev) {
     struct video_internal * video_state = (struct video_internal *)dev->private_data;
 
 
@@ -178,7 +178,7 @@ static int video_write_port(uint16_t port, void * src, uint_t length, struct vm_
 
 
 
-static int crtc_data_write(uint16_t port, void * src, uint_t length, struct vm_device * dev) {
+static int crtc_data_write(struct guest_info * core, uint16_t port, void * src, uint_t length, struct vm_device * dev) {
     struct video_internal * video_state = (struct video_internal *)dev->private_data;
     uint8_t val = *(uint8_t *)src;
     uint_t index = video_state->crtc_index_reg;
@@ -257,7 +257,7 @@ static int crtc_data_write(uint16_t port, void * src, uint_t length, struct vm_d
 }
 
 
-static int crtc_index_write(uint16_t port, void * src, uint_t length, struct vm_device * dev) {
+static int crtc_index_write(struct guest_info * core, uint16_t port, void * src, uint_t length, struct vm_device * dev) {
     struct video_internal * video_state = (struct video_internal *)dev->private_data;
     
     if (length > 2) {
@@ -276,7 +276,7 @@ static int crtc_index_write(uint16_t port, void * src, uint_t length, struct vm_
     }
 
     if (length == 2) {
-       if (crtc_data_write(port + 1, src + 1, length - 1, dev) != (length - 1)) {
+       if (crtc_data_write(core, port + 1, src + 1, length - 1, dev) != (length - 1)) {
            PrintError("could not handle implicit crtc data write\n");
            return -1;
        }
@@ -302,7 +302,7 @@ int v3_cons_get_fb(struct vm_device * frontend_dev, uint8_t * dst, uint_t offset
 
 
 static int free_device(struct vm_device * dev) {
-    v3_unhook_mem(dev->vm, START_ADDR);
+    v3_unhook_mem(dev->vm, V3_MEM_CORE_ANY, START_ADDR);
     return 0;
 }
 
@@ -315,20 +315,20 @@ static struct v3_device_ops dev_ops = {
     .stop = NULL,
 };
 
-static int cga_init(struct guest_info * vm, v3_cfg_tree_t * cfg) {
+static int cga_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct video_internal * video_state = (struct video_internal *)V3_Malloc(sizeof(struct video_internal));
     addr_t frame_buf_pa = 0;
     int enable_passthrough = 0;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     enable_passthrough = (strcasecmp(v3_cfg_val(cfg, "passthrough"), "enable") == 0) ? 1 : 0;
 
     PrintDebug("video: init_device\n");
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, video_state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, video_state);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
@@ -347,11 +347,11 @@ static int cga_init(struct guest_info * vm, v3_cfg_tree_t * cfg) {
     if (enable_passthrough) {
        PrintDebug("Enabling CGA Passthrough\n");
 
-       if (v3_hook_write_mem(vm, START_ADDR, END_ADDR, START_ADDR, &video_write_mem, dev) == -1) {
+       if (v3_hook_write_mem(vm, V3_MEM_CORE_ANY, START_ADDR, END_ADDR, START_ADDR, &video_write_mem, dev) == -1) {
            PrintDebug("\n\nVideo Hook failed.\n\n");
        }
     } else {
-       if (v3_hook_write_mem(vm, START_ADDR, END_ADDR, frame_buf_pa, &video_write_mem, dev) == -1) {
+       if (v3_hook_write_mem(vm, V3_MEM_CORE_ANY, START_ADDR, END_ADDR, frame_buf_pa, &video_write_mem, dev) == -1) {
            PrintDebug("\n\nVideo Hook failed.\n\n");
        }
     }
index 25bf720..d3b09c3 100644 (file)
@@ -423,12 +423,12 @@ static struct v3_device_ops dev_ops = {
 static int cirrus_gfx_card_init(struct guest_info * vm, v3_cfg_tree_t * cfg){
     struct video_internal * video_state = (struct video_internal *)V3_Malloc(sizeof(struct video_internal));
     struct vm_device * pci_bus = v3_find_dev(vm, (char *)cfg_data);
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
-    struct vm_device * dev = v3_allocate_device("TEXT_GFX_CARD", &dev_ops, video_state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, video_state);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", "TEXT_GFX_CARD");
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index b18b9d9..b30ee02 100644 (file)
@@ -170,28 +170,25 @@ static struct v3_device_ops dev_ops = {
     .stop = NULL,
 };
 
-static int cons_init(struct guest_info * vm, v3_cfg_tree_t * cfg) 
+static int cons_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) 
 {
-       struct cons_state * state;
-       v3_cfg_tree_t * frontend_cfg;
-       const char *frontend_tag;
-       struct vm_device * frontend;
-       char *name, *ttypath;
+       struct cons_state * state = NULL;
+       v3_cfg_tree_t * frontend_cfg = v3_cfg_subtree(cfg, "frontend");
+       const char * frontend_tag = v3_cfg_val(frontend_cfg, "tag");
+       struct vm_device * frontend = v3_find_dev(vm, frontend_tag);
+       char * dev_id = v3_cfg_val(cfg, "ID");
+       char * ttypath = v3_cfg_val(cfg, "tty");
 
        /* read configuration */
-       frontend_cfg = v3_cfg_subtree(cfg, "frontend");
        V3_ASSERT(frontend_cfg);
-       frontend_tag = v3_cfg_val(frontend_cfg, "tag");
        V3_ASSERT(frontend_tag);
-       frontend = v3_find_dev(vm, frontend_tag);
        V3_ASSERT(frontend);
-       name = v3_cfg_val(cfg, "name");
+
 
        /* allocate state */
-       state = (struct cons_state *) V3_Malloc(sizeof(struct cons_state));
+       state = (struct cons_state *)V3_Malloc(sizeof(struct cons_state));
        V3_ASSERT(state);
        state->frontend_dev = frontend;
-       ttypath = v3_cfg_val(cfg, "tty");
        V3_ASSERT(ttypath);
 
        /* open tty for screen display */
@@ -203,12 +200,12 @@ static int cons_init(struct guest_info * vm, v3_cfg_tree_t * cfg)
        }
 
        /* allocate device */
-       struct vm_device *dev = v3_allocate_device(name, &dev_ops, state);
+       struct vm_device *dev = v3_allocate_device(dev_id, &dev_ops, state);
        V3_ASSERT(dev);
 
        /* attach device to virtual machine */
        if (v3_attach_device(vm, dev) == -1) {
-               PrintError("Could not attach device %s\n", name);
+               PrintError("Could not attach device %s\n", dev_id);
                V3_Free(state);
                return -1;
        }
index 0eec5bf..4bc4433 100644 (file)
@@ -107,17 +107,17 @@ static int connect_fn(struct v3_vm_info * vm,
 
 static int model_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, NULL);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, NULL);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
-    if (v3_dev_add_blk_frontend(vm, name, connect_fn, NULL) == -1) {
-       PrintError("Could not register %s as block frontend\n", name);
+    if (v3_dev_add_blk_frontend(vm, dev_id, connect_fn, NULL) == -1) {
+       PrintError("Could not register %s as block frontend\n", dev_id);
        return -1;
     }
 
index d58c30f..6e9e5d7 100644 (file)
@@ -90,37 +90,39 @@ static struct v3_device_ops dev_ops = {
 
 static int disk_init(struct guest_info * vm, v3_cfg_tree_t * cfg) {
     struct disk_state * disk = NULL;
-    char * name = v3_cfg_val(cfg, "filename");
+    char * path = v3_cfg_val(cfg, "path");
+    char * dev_id = v3_cfg_val(cfg, "ID");
     char * filename = v3_cfg_val(cfg, "file");
 
+
     v3_cfg_tree_t * frontend_cfg = v3_cfg_subtree(cfg, "frontend");
 
     disk = (struct disk_state *)V3_Malloc(sizeof(struct disk_state));
     memset(disk, 0, sizeof(struct disk_state));
 
 
-    if (!filename) {
-       PrintError("Missing filename (%s) for %s\n", filename, name);
+    if (!path) {
+       PrintError("Missing path (%s) for %s\n", path, dev_id);
        return -1;
     }
     
-    disk->fd = V3_FileOpen(filename, 0);
+    disk->fd = V3_FileOpen(path, 0);
     disk->capacity = V3_FileSize(disk->fd);
 
     PrintDebug("Registering RAMDISK at %p (size=%d)\n", 
               (void *)file->data, (uint32_t)file->size);
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, disk);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, disk);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
     if (v3_dev_connect_blk(vm, v3_cfg_val(frontend_cfg, "tag"), 
                           &blk_ops, frontend_cfg, disk) == -1) {
        PrintError("Could not connect %s to frontend %s\n", 
-                  name, v3_cfg_val(frontend_cfg, "tag"));
+                  dev_id, v3_cfg_val(frontend_cfg, "tag"));
        return -1;
     }
     
index b30098f..924de7c 100644 (file)
@@ -254,7 +254,7 @@ static int add_port_range(struct vm_device * dev, uint_t start, uint_t end, gene
 
 static int generic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct generic_internal * state = (struct generic_internal *)V3_Malloc(sizeof(struct generic_internal));
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     v3_cfg_tree_t * port_cfg = v3_cfg_subtree(cfg, "ports");
 
@@ -263,10 +263,10 @@ static int generic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     state->num_port_ranges = 0;
 
     
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, state);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 618a8ca..ddd169c 100644 (file)
@@ -63,7 +63,7 @@ static int i440_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     int i;
     struct i440_state * state = NULL;
     struct vm_device * pci = v3_find_dev(vm, v3_cfg_val(cfg, "bus"));
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     if (!pci) {
        PrintError("could not find PCI Device\n");
@@ -74,10 +74,10 @@ static int i440_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
     state->pci = pci;
        
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, state);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index c02e7f5..a1ade14 100644 (file)
@@ -312,15 +312,15 @@ int v3_icc_register_ioapic(struct v3_vm_info *vm, struct vm_device * icc_bus, ui
 static int icc_bus_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     PrintDebug("icc_bus: Creating ICC_BUS\n");
 
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     struct icc_bus_state * icc_bus = (struct icc_bus_state *)V3_Malloc(sizeof(struct icc_bus_state));
     memset(icc_bus, 0, sizeof(struct icc_bus_state));
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, icc_bus);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, icc_bus);
 
     if (v3_attach_device(vm, dev) == -1) {
-        PrintError("icc_bus: Could not attach device %s\n", name);
+        PrintError("icc_bus: Could not attach device %s\n", dev_id);
         return -1;
     }
 
index 67a8928..a31aec2 100644 (file)
@@ -1521,7 +1521,7 @@ static int connect_fn(struct v3_vm_info * vm,
 
 static int ide_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct ide_internal * ide  = (struct ide_internal *)V3_Malloc(sizeof(struct ide_internal));  
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     PrintDebug("IDE: Initializing IDE\n");
     memset(ide, 0, sizeof(struct ide_internal));
@@ -1542,10 +1542,10 @@ static int ide_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
     PrintDebug("IDE: Creating IDE bus x 2\n");
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, ide);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, ide);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
@@ -1660,8 +1660,8 @@ static int ide_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
     }
 
-    if (v3_dev_add_blk_frontend(vm, name, connect_fn, (void *)ide) == -1) {
-       PrintError("Could not register %s as frontend\n", name);
+    if (v3_dev_add_blk_frontend(vm, dev_id, connect_fn, (void *)ide) == -1) {
+       PrintError("Could not register %s as frontend\n", dev_id);
        return -1;
     }
     
@@ -1694,6 +1694,3 @@ int v3_ide_get_geometry(struct vm_device * ide_dev, int channel_num, int drive_n
 
     return 0;
 }
-
-
-
index ad238f3..94c8ce9 100644 (file)
@@ -328,7 +328,7 @@ static struct v3_device_ops dev_ops = {
 
 static int ioapic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct vm_device * icc_bus = v3_find_dev(vm, v3_cfg_val(cfg, "bus"));
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     if (!icc_bus) {
        PrintError("ioapic: Could not locate ICC BUS device (%s)\n", v3_cfg_val(cfg, "bus"));
@@ -341,11 +341,11 @@ static int ioapic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
     ioapic->icc_bus = icc_bus;
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, ioapic);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, ioapic);
 
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("ioapic: Could not attach device %s\n", name);
+       PrintError("ioapic: Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 2935c43..375a625 100644 (file)
@@ -1015,7 +1015,7 @@ static struct v3_device_ops dev_ops = {
 
 static int keyboard_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct keyboard_internal * keyboard_state = NULL;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     PrintDebug("keyboard: init_device\n");
 
@@ -1031,10 +1031,10 @@ static int keyboard_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
     keyboard_state->mouse_enabled = 0;
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, keyboard_state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, keyboard_state);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 2e2cee1..de25807 100644 (file)
@@ -418,7 +418,7 @@ static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct vm_device * pci_bus = v3_find_dev(vm, v3_cfg_val(cfg, "bus"));
     struct virtio_balloon_state * virtio_state = NULL;
     struct pci_device * pci_dev = NULL;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     PrintDebug("Initializing VIRTIO Balloon device\n");
 
@@ -432,9 +432,9 @@ static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     memset(virtio_state, 0, sizeof(struct virtio_balloon_state));
 
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, virtio_state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, virtio_state);
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 5651b7e..ffb8c24 100644 (file)
@@ -606,7 +606,7 @@ static int connect_fn(struct v3_vm_info * vm,
 static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct vm_device * pci_bus = v3_find_dev(vm, v3_cfg_val(cfg, "bus"));
     struct virtio_dev_state * virtio_state = NULL;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     PrintDebug("Initializing VIRTIO Block device\n");
 
@@ -623,14 +623,14 @@ static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     virtio_state->pci_bus = pci_bus;
 
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, virtio_state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, virtio_state);
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
-    if (v3_dev_add_blk_frontend(vm, name, connect_fn, (void *)virtio_state) == -1) {
-       PrintError("Could not register %s as block frontend\n", name);
+    if (v3_dev_add_blk_frontend(vm, dev_id, connect_fn, (void *)virtio_state) == -1) {
+       PrintError("Could not register %s as block frontend\n", dev_id);
        return -1;
     }
 
index 8721962..8993066 100644 (file)
@@ -686,9 +686,9 @@ static int connect_fn(struct v3_vm_info * info,
 static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct vm_device * pci_bus = v3_find_dev(vm, v3_cfg_val(cfg, "bus"));
     struct virtio_dev_state * virtio_state = NULL;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
-    PrintDebug("Virtio NIC: Initializing VIRTIO Network device: %s\n", name);
+    PrintDebug("Virtio NIC: Initializing VIRTIO Network device: %s\n", dev_id);
 
     if (pci_bus == NULL) {
        PrintError("Virtio NIC: VirtIO devices require a PCI Bus");
@@ -702,14 +702,14 @@ static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     virtio_state->pci_bus = pci_bus;
     virtio_state->vm = vm;
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, virtio_state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, virtio_state);
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Virtio NIC: Could not attach device %s\n", name);
+       PrintError("Virtio NIC: Could not attach device %s\n", dev_id);
        return -1;
     }
 
-    if (v3_dev_add_net_frontend(vm, name, connect_fn, (void *)virtio_state) == -1) {
-       PrintError("Virtio NIC: Could not register %s as net frontend\n", name);
+    if (v3_dev_add_net_frontend(vm, dev_id, connect_fn, (void *)virtio_state) == -1) {
+       PrintError("Virtio NIC: Could not register %s as net frontend\n", dev_id);
        return -1;
     }
        
index 0acd87f..6bd3ff4 100644 (file)
@@ -354,7 +354,7 @@ static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct vm_device * pci_bus = v3_find_dev(vm, v3_cfg_val(cfg, "bus"));
     struct virtio_sym_state * virtio_state = NULL;
     struct pci_device * pci_dev = NULL;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     PrintDebug("Initializing VIRTIO Symbiotic device\n");
 
@@ -368,9 +368,9 @@ static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     memset(virtio_state, 0, sizeof(struct virtio_sym_state));
 
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, virtio_state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, virtio_state);
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 3a27ca4..4e55c79 100644 (file)
@@ -607,7 +607,7 @@ static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct virtio_sym_state * virtio_state = NULL;
     struct v3_symmod_state * symmod_state = &(vm->sym_vm_state.symmod_state);
     struct pci_device * pci_dev = NULL;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     PrintDebug("SYMMOD: Initializing VIRTIO Symbiotic Module device\n");
 
@@ -625,10 +625,10 @@ static int virtio_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
 
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, virtio_state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, virtio_state);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 215e664..c29b006 100644 (file)
@@ -624,9 +624,9 @@ static int dev_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct vm_device * pci_bus = v3_find_dev(vm, v3_cfg_val(cfg, "bus"));
     struct virtio_vnet_state * vnet_state = NULL;
     struct pci_device * pci_dev = NULL;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
-    PrintDebug("VNET Bridge: Initializing VNET Bridge Control device: %s\n", name);
+    PrintDebug("VNET Bridge: Initializing VNET Bridge Control device: %s\n", dev_id);
 
     if (pci_bus == NULL) {
        PrintError("VNET Bridge device require a PCI Bus");
@@ -638,10 +638,10 @@ static int dev_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
        
     vnet_state->vm = vm;
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, vnet_state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, vnet_state);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 521f543..ec042d6 100644 (file)
@@ -276,7 +276,7 @@ static int disk_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     char * ip_str = v3_cfg_val(cfg, "IP");
     char * port_str = v3_cfg_val(cfg, "port");
     char * disk_tag = v3_cfg_val(cfg, "tag");
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     v3_cfg_tree_t * frontend_cfg = v3_cfg_subtree(cfg, "frontend");
 
@@ -286,10 +286,10 @@ static int disk_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     disk->ip_addr = v3_inet_addr(ip_str);
     disk->port = atoi(port_str);
        
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, disk);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, disk);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
@@ -302,7 +302,7 @@ static int disk_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
     if (v3_dev_connect_blk(vm, v3_cfg_val(frontend_cfg, "tag"), 
                           &blk_ops, frontend_cfg, disk) == -1) {
-       PrintError("Could not connect %s to frontend\n", name);
+       PrintError("Could not connect %s to frontend\n", dev_id);
        return -1;
     }
 
index fb9b319..e2d1e05 100644 (file)
@@ -791,7 +791,7 @@ static struct v3_device_ops dev_ops = {
 static int nvram_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct nvram_internal * nvram_state = NULL;
     struct vm_device * ide = v3_find_dev(vm, v3_cfg_val(cfg, "storage"));
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     if (!ide) {
        PrintError("Could not find IDE device\n");
@@ -805,11 +805,11 @@ static int nvram_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
     nvram_state->ide = ide;
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, nvram_state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, nvram_state);
 
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 963fd88..9e6ceba 100644 (file)
@@ -104,17 +104,17 @@ static struct v3_device_ops dev_ops = {
 
 static int debug_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct debug_state * state = NULL;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     state = (struct debug_state *)V3_Malloc(sizeof(struct debug_state));
 
     PrintDebug("Creating OS Debug Device\n");
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, state);
 
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 0bb7698..a42d99a 100644 (file)
@@ -102,16 +102,16 @@ static struct v3_device_ops dev_ops = {
 
 static int net_init(struct guest_info * vm, v3_cfg_tree_t * cfg) {
     struct nic_state * state = NULL;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     state = (struct nic_state *)V3_Malloc(sizeof(struct nic_state));
 
     PrintDebug("Creating VMNet Device\n");
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, state);
 
     if (v3_attach_device(vm, dev) == -1) {
-        PrintError("Could not attach device %s\n", name);
+        PrintError("Could not attach device %s\n", dev_id);
         return -1;
     }
 
index f43d36d..267eca1 100644 (file)
@@ -655,14 +655,14 @@ static struct v3_device_ops dev_ops = {
 static int pci_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct pci_internal * pci_state = V3_Malloc(sizeof(struct pci_internal));
     int i = 0;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
     
     PrintDebug("PCI internal at %p\n",(void *)pci_state);
     
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, pci_state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, pci_state);
     
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 3eee1d2..8552112 100644 (file)
@@ -779,7 +779,7 @@ static int passthrough_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct pt_dev_state * state = V3_Malloc(sizeof(struct pt_dev_state));
     struct vm_device * dev = NULL;
     struct vm_device * pci = v3_find_dev(vm, v3_cfg_val(cfg, "bus"));
-    char * name = v3_cfg_val(cfg, "name");    
+    char * dev_id = v3_cfg_val(cfg, "ID");    
 
 
     memset(state, 0, sizeof(struct pt_dev_state));
@@ -790,13 +790,13 @@ static int passthrough_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     }
     
     state->pci_bus = pci;
-    strncpy(state->name, name, 32);
+    strncpy(state->name, dev_id, 32);
 
 
-    dev = v3_allocate_device(name, &dev_ops, state);
+    dev = v3_allocate_device(dev_id, &dev_ops, state);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 493e3c5..89f021f 100644 (file)
@@ -449,7 +449,7 @@ static int piix3_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct v3_southbridge * piix3 = (struct v3_southbridge *)V3_Malloc(sizeof(struct v3_southbridge));
     struct vm_device * dev = NULL;
     struct vm_device * pci = v3_find_dev(vm, v3_cfg_val(cfg, "bus"));
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     if (!pci) {
        PrintError("Could not find PCI device\n");
@@ -459,10 +459,10 @@ static int piix3_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     piix3->pci_bus = pci;
     piix3->type = V3_SB_PIIX3;
     
-    dev = v3_allocate_device(name, &dev_ops, piix3);
+    dev = v3_allocate_device(dev_id, &dev_ops, piix3);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 8930620..fe45da0 100644 (file)
@@ -89,7 +89,7 @@ static struct v3_device_ops dev_ops = {
 static int disk_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct disk_state * disk = NULL;
     struct v3_cfg_file * file = NULL;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
     char * filename = v3_cfg_val(cfg, "file");
 
     v3_cfg_tree_t * frontend_cfg = v3_cfg_subtree(cfg, "frontend");
@@ -99,7 +99,7 @@ static int disk_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
 
     if (!filename) {
-       PrintError("Missing filename (%s) for %s\n", filename, name);
+       PrintError("Missing filename (%s) for %s\n", filename, dev_id);
        return -1;
     }
 
@@ -115,17 +115,17 @@ static int disk_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     PrintDebug("Registering RAMDISK at %p (size=%d)\n", 
               (void *)file->data, (uint32_t)file->size);
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, disk);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, disk);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
     if (v3_dev_connect_blk(vm, v3_cfg_val(frontend_cfg, "tag"), 
                           &blk_ops, frontend_cfg, disk) == -1) {
        PrintError("Could not connect %s to frontend %s\n", 
-                  name, v3_cfg_val(frontend_cfg, "tag"));
+                  dev_id, v3_cfg_val(frontend_cfg, "tag"));
        return -1;
     }
     
index e7f11da..3f0085e 100644 (file)
@@ -914,7 +914,7 @@ static int init_serial_port(struct serial_port * com) {
 
 static int serial_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct serial_state * state = (struct serial_state *)V3_Malloc(sizeof(struct serial_state));
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     PrintDebug("UART: init_device\n");
     init_serial_port(&(state->com1));
@@ -928,10 +928,10 @@ static int serial_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     state->com4.irq_number = COM4_IRQ;
 
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, state);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 7d6dd80..951590e 100644 (file)
@@ -273,7 +273,7 @@ static int swap_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct swap_state * swap = NULL;
     v3_cfg_tree_t * frontend_cfg = v3_cfg_subtree(cfg, "frontend");
     uint32_t capacity = atoi(v3_cfg_val(cfg, "size")) * 1024 * 1024;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
     if (!frontend_cfg) {
        PrintError("Initializing sym swap without a frontend device\n");
@@ -300,17 +300,17 @@ static int swap_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
     memset(swap->usage_map, 0, ((swap->capacity / 4096) / 8));
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, swap);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, swap);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
     if (v3_dev_connect_blk(vm, v3_cfg_val(frontend_cfg, "tag"), 
                           &blk_ops, frontend_cfg, swap) == -1) {
        PrintError("Could not connect %s to frontend %s\n", 
-                  name, v3_cfg_val(frontend_cfg, "tag"));
+                  dev_id, v3_cfg_val(frontend_cfg, "tag"));
        return -1;
     }
 
index 72ff58f..bc83762 100644 (file)
@@ -599,17 +599,17 @@ static int connect_fn(struct v3_vm_info * vm,
 
 static int swap_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, NULL);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, NULL);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
-    if (v3_dev_add_blk_frontend(vm, name, connect_fn, NULL) == -1) {
-       PrintError("Could not register %s as block frontend\n", name);
+    if (v3_dev_add_blk_frontend(vm, dev_id, connect_fn, NULL) == -1) {
+       PrintError("Could not register %s as block frontend\n", dev_id);
        return -1;
     }
 
index d0c2b1f..00415c5 100644 (file)
@@ -523,11 +523,11 @@ static int cons_server(void * arg) {
 }
 
 
-static int cons_init(struct guest_info * vm, v3_cfg_tree_t * cfg) {
+static int cons_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct cons_state * state = (struct cons_state *)V3_Malloc(sizeof(struct cons_state));
     v3_cfg_tree_t * frontend_cfg = v3_cfg_subtree(cfg, "frontend");
-    struct vm_device * frontend = v3_find_dev(vm, v3_cfg_val(frontend_cfg, "id"));
-    char * name = v3_cfg_val(cfg, "name");
+    struct vm_device * frontend = v3_find_dev(vm, v3_cfg_val(frontend_cfg, "tag"));
+    char * dev_id = v3_cfg_val(cfg, "ID");
 
 
     state->server_fd = 0;
@@ -537,10 +537,10 @@ static int cons_init(struct guest_info * vm, v3_cfg_tree_t * cfg) {
     v3_lock_init(&(state->cons_lock));
 
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, state);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
index 1a917ab..bf582e7 100644 (file)
@@ -99,7 +99,7 @@ static struct v3_device_ops dev_ops = {
 static int blk_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct blk_state * blk = NULL;
     v3_cfg_tree_t * frontend_cfg = v3_cfg_subtree(cfg, "frontend");
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
     uint64_t capacity = atoi(v3_cfg_val(cfg, "size")) * 1024 * 1024;
     
     if (!frontend_cfg) {
@@ -119,17 +119,17 @@ static int blk_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     memset(blk->blk_space, 0, capacity);
 
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, blk);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, blk);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
     if (v3_dev_connect_blk(vm, v3_cfg_val(frontend_cfg, "tag"), 
                           &blk_ops, frontend_cfg, blk) == -1) {
        PrintError("Could not connect %s to frontend %s\n", 
-                  name, v3_cfg_val(frontend_cfg, "tag"));
+                  dev_id, v3_cfg_val(frontend_cfg, "tag"));
        return -1;
     }
 
index 7a7dac0..2aa3ac4 100644 (file)
@@ -120,10 +120,10 @@ static int str2mac(char *macstr, char mac[6]){
 
 static int vnet_nic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct vnet_nic_state * vnetnic = NULL;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
     char * macstr = NULL;
     char mac[6];
-    int vnet_dev_id;
+    int vnet_dev_id = 0;
 
     v3_cfg_tree_t * frontend_cfg = v3_cfg_subtree(cfg, "frontend");
     macstr = v3_cfg_val(frontend_cfg, "mac");
@@ -137,10 +137,10 @@ static int vnet_nic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     vnetnic = (struct vnet_nic_state *)V3_Malloc(sizeof(struct vnet_nic_state));
     memset(vnetnic, 0, sizeof(struct vnet_nic_state));
 
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, vnetnic);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, vnetnic);
 
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
@@ -151,19 +151,19 @@ static int vnet_nic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     if (v3_dev_connect_net(vm, v3_cfg_val(frontend_cfg, "tag"), 
                           &(vnetnic->net_ops), frontend_cfg, vnetnic) == -1) {
        PrintError("Could not connect %s to frontend %s\n", 
-                  name, v3_cfg_val(frontend_cfg, "tag"));
+                  dev_id, v3_cfg_val(frontend_cfg, "tag"));
        return -1;
     }
 
     PrintDebug("Vnet-nic: Connect %s to frontend %s\n", 
-                  name, v3_cfg_val(frontend_cfg, "tag"));
+                  dev_id, v3_cfg_val(frontend_cfg, "tag"));
 
-    if ((vnet_dev_id = register_to_vnet(vm, vnetnic, name, vnetnic->mac)) == -1) {
-       PrintError("Vnet-nic device %s (mac: %s) fails to registered to VNET\n", name, macstr);
+    if ((vnet_dev_id = register_to_vnet(vm, vnetnic, dev_id, vnetnic->mac)) == -1) {
+       PrintError("Vnet-nic device %s (mac: %s) fails to registered to VNET\n", dev_id, macstr);
     }
     vnetnic->vnet_dev_id = vnet_dev_id;
 
-    PrintDebug("Vnet-nic device %s (mac: %s, %ld) registered to VNET\n", name, macstr, *((ulong_t *)vnetnic->mac));
+    PrintDebug("Vnet-nic device %s (mac: %s, %ld) registered to VNET\n", dev_id, macstr, *((ulong_t *)vnetnic->mac));
 
 
 //for temporary hack for vnet bridge test
@@ -171,7 +171,7 @@ static int vnet_nic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     {
        uchar_t zeromac[6] = {0,0,0,0,0,0};
                
-       if(!strcmp(name, "vnet_nic")){
+       if(!strcmp(dev_id, "vnet_nic")){
            struct v3_vnet_route route;
                
            route.dst_id = vnet_dev_id;
@@ -206,10 +206,10 @@ static int vnet_nic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
        static int vnet_nic_dom0 = -1;
        uchar_t zeromac[6] = {0,0,0,0,0,0};
                
-       if(!strcmp(name, "vnet_nic")){ //domu
+       if(!strcmp(dev_id, "vnet_nic")){ //domu
            vnet_nic_guestid = vnet_dev_id;
        }
-       if (!strcmp(name, "vnet_nic_dom0")){
+       if (!strcmp(dev_id, "vnet_nic_dom0")){
            vnet_nic_dom0 = vnet_dev_id;
        }\r
 
index 7a596d2..e65563c 100644 (file)
@@ -546,12 +546,12 @@ static int setup_devices(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
 
     
     while (device) {
-       char * id = v3_cfg_val(device, "id");
+       char * dev_class = v3_cfg_val(device, "class");
 
-       V3_Print("configuring device %s\n", id);
+       V3_Print("configuring device %s\n", dev_class);
 
-       if (v3_create_device(vm, id, device) == -1) {
-           PrintError("Error creating device %s\n", id);
+       if (v3_create_device(vm, dev_class, device) == -1) {
+           PrintError("Error creating device %s\n", dev_class);
            return -1;
        }
        
index 3e60cd6..ff3dd71 100644 (file)
 
 
        <!-- List of devices attached to guest -->
-       <!-- The device 'ID' is the device name in the global device registry -->
-       <!-- The device 'name' is the reference to the device instance associated with a VM -->
+       <!-- The device 'class' is the device name in the global device registry -->
+       <!-- The device 'id' is the reference to the device instance associated with a VM -->
        <!--    The name can be used as a reference by other devices -->
        <devices>
-               <device id="8259A" name="PIC"/>
-               <device id="KEYBOARD" name="keyboard"/>
-               <device id="8254_PIT" name="PIT" />
-               <device id="BOCHS_DEBUG" name="bochs debug"/>
-               <device id="OS_DEBUG" name="os debug" />
-               <device id="ICC_BUS" name="icc"/>
-               <device id="LAPIC" name="apic">
+               <device class="8259A" id="PIC"/>
+               <device class="KEYBOARD" id="keyboard"/>
+               <device class="8254_PIT" id="PIT" />
+               <device class="BOCHS_DEBUG" id="bochs debug"/>
+               <device class="OS_DEBUG" id="os debug" />
+               <device class="ICC_BUS" id="icc"/>
+               <device class="LAPIC" id="apic">
                        <bus>icc</bus>
                </device>
-               <device id="IOAPIC" name="ioapic">
+               <device class="IOAPIC" id="ioapic">
                        <bus>icc</bus>
                </device>
 
 <!--
-               <device id="CGA_VIDEO" name="cga" passthrough="enable" />
-               <device id="TELNET_CONSOLE" name="telnet console">
+               <device class="CGA_VIDEO" id="cga" passthrough="enable" />
+               <device class="TELNET_CONSOLE" id="telnet console">
                        <frontend tag="CGA_VIDEO" />
                        <port>19997</port>
                </device>
 -->
-               <device id="PCI" name="pci0" />
+               <device class="PCI" id="pci0" />
 
-               <device id="i440FX" name="northbridge">
+               <device class="i440FX" id="northbridge">
                        <bus>pci0</bus>
                </device>
 
-               <device id="PIIX3" name="southbridge">
+               <device class="PIIX3" id="southbridge">
                        <bus>pci0</bus>
                </device>
 
-               <device id="IDE" name="ide">
+               <device class="IDE" id="ide">
                        <bus>pci0</bus>
                        <controller>southbridge</controller>
                </device>
 
 
 <!--
-               <device id="LNX_VIRTIO_SYM" name="sym_pci">
+               <device class="LNX_VIRTIO_SYM" id="sym_pci">
                        <bus>pci0</bus>
                </device>
 
-               <device id="LNX_VIRTIO_BLK" name="blk_virtio">
+               <device class="LNX_VIRTIO_BLK" id="blk_virtio">
                        <bus>pci0</bus>
                </device>
 
-               <device id="LNX_VIRTIO_BALLOON" name="balloon">
+               <device class="LNX_VIRTIO_BALLOON" id="balloon">
                        <bus>pci0</bus>
                </device>
 
-               <device id="PCI_PASSTHROUGH" name="e1000">
+               <device class="PCI_PASSTHROUGH" id="e1000">
                        <bus>pci0</bus>
                        <vendor_id>0x8086</vendor_id>
                        <device_id>0x100e</device_id>
                        <irq>59</irq>
                </device>
 
-               <device id="PCI_PASSTHROUGH" name="e1000-hw">
+               <device class="PCI_PASSTHROUGH" id="e1000-hw">
                        <bus>pci0</bus>
                        <vendor_id>0x8086</vendor_id>
                        <device_id>0x107c</device_id>
                <!-- This is a Storage Backend that connects to a frontend -->
                <!-- The frontend section is passed to the frontend when the backend connects -->
                <!-- The file tag refers to an 'id' already listed in the file list section above -->
-               <device id="RAMDISK" name="CD0">
+               <device class="RAMDISK" id="CD0">
                        <file>boot-cd</file>
                        <frontend tag="ide">
                                <model>V3Vee CDROM</model>
 
 
 <!---
-               <device id="SYM_SWAP" name="sym swap">
+               <device class="SYM_SWAP" id="sym swap">
                        <frontend tag="blk_virtio" />
                        <size>150</size>
                </device>
 
-               <device id="RAMDISK" name="HD0">
+               <device class="RAMDISK" id="HD0">
                        <file>harddisk</file>
                        <frontend tag="blk_virtio" />
                </device>
 -->
 
-               <device id="NVRAM" name="nvram">
+               <device class="NVRAM" id="nvram">
                        <storage>ide</storage>
                </device>
 
-               <device id="GENERIC" name="generic">
+               <device class="GENERIC" id="generic">
                        <ports>
                                <start>0x00</start>
                                <end>0x07</end>