[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [6599] qemu: net/drive add/remove tweaks (Marcelo Tosatti)
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [6599] qemu: net/drive add/remove tweaks (Marcelo Tosatti) |
Date: |
Wed, 11 Feb 2009 15:20:47 +0000 |
Revision: 6599
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6599
Author: aliguori
Date: 2009-02-11 15:20:46 +0000 (Wed, 11 Feb 2009)
Log Message:
-----------
qemu: net/drive add/remove tweaks (Marcelo Tosatti)
Export net/drive add/remove functions for device hotplug usage.
Return the table index on add.
Return failure instead of exiting if limit has been reached
on drive_add.
Signed-off-by: Marcelo Tosatti <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>
Modified Paths:
--------------
trunk/net.c
trunk/sysemu.h
trunk/vl.c
Modified: trunk/net.c
===================================================================
--- trunk/net.c 2009-02-11 15:20:37 UTC (rev 6598)
+++ trunk/net.c 2009-02-11 15:20:46 UTC (rev 6599)
@@ -1597,7 +1597,7 @@
name = NULL;
nb_nics++;
vlan->nb_guest_devs++;
- ret = 0;
+ ret = idx;
} else
if (!strcmp(device, "none")) {
/* does nothing. It is needed to signal that no network cards
Modified: trunk/sysemu.h
===================================================================
--- trunk/sysemu.h 2009-02-11 15:20:37 UTC (rev 6598)
+++ trunk/sysemu.h 2009-02-11 15:20:46 UTC (rev 6599)
@@ -163,6 +163,9 @@
extern struct drive_opt drives_opt[MAX_DRIVES];
extern int nb_drives_opt;
+extern int drive_add(const char *file, const char *fmt, ...);
+extern int drive_init(struct drive_opt *arg, int snapshot, void *machine);
+
/* serial ports */
#define MAX_SERIAL_PORTS 4
Modified: trunk/vl.c
===================================================================
--- trunk/vl.c 2009-02-11 15:20:37 UTC (rev 6598)
+++ trunk/vl.c 2009-02-11 15:20:46 UTC (rev 6599)
@@ -2158,14 +2158,14 @@
return -1;
}
-static int drive_add(const char *file, const char *fmt, ...)
+int drive_add(const char *file, const char *fmt, ...)
{
va_list ap;
int index = drive_opt_get_free_idx();
if (nb_drives_opt >= MAX_DRIVES || index == -1) {
fprintf(stderr, "qemu: too many drives\n");
- exit(1);
+ return -1;
}
drives_opt[index].file = file;
@@ -2255,8 +2255,7 @@
}
}
-static int drive_init(struct drive_opt *arg, int snapshot,
- QEMUMachine *machine)
+int drive_init(struct drive_opt *arg, int snapshot, void *opaque)
{
char buf[128];
char file[1024];
@@ -2269,6 +2268,7 @@
int cyls, heads, secs, translation;
BlockDriverState *bdrv;
BlockDriver *drv = NULL;
+ QEMUMachine *machine = opaque;
int max_devs;
int index;
int cache;
@@ -2535,7 +2535,7 @@
*/
if (drive_get_index(type, bus_id, unit_id) != -1)
- return 0;
+ return -2;
/* init */
@@ -2585,7 +2585,7 @@
break;
}
if (!file[0])
- return 0;
+ return -2;
bdrv_flags = 0;
if (snapshot) {
bdrv_flags |= BDRV_O_SNAPSHOT;
@@ -2602,7 +2602,7 @@
file);
return -1;
}
- return 0;
+ return drives_table_idx;
}
/***********************************************************/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [6599] qemu: net/drive add/remove tweaks (Marcelo Tosatti),
Anthony Liguori <=