diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2009-07-22 16:42:57 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-07-27 14:08:23 -0500 |
commit | 751c6a17042b5d011013d6963c0505d671cf708e (patch) | |
tree | 61a769ed1a1c16ebdfc1397ce9d775222dfa8e57 /sysemu.h | |
parent | 8a14daa5a1ae22fcfc317f4727a88d6c15c39aae (diff) | |
download | qemu-751c6a17042b5d011013d6963c0505d671cf708e.zip qemu-751c6a17042b5d011013d6963c0505d671cf708e.tar.gz qemu-751c6a17042b5d011013d6963c0505d671cf708e.tar.bz2 |
kill drives_table
First step cleaning up the drives handling. This one does nothing but
removing drives_table[], still it became seriously big.
drive_get_index() is gone and is replaced by drives_get() which hands
out DriveInfo pointers instead of a table index. This needs adaption in
*tons* of places all over.
The drives are now maintained as linked list.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'sysemu.h')
-rw-r--r-- | sysemu.h | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -3,6 +3,7 @@ /* Misc. things related to the system emulator. */ #include "qemu-common.h" +#include "sys-queue.h" #ifdef _WIN32 #include <windows.h> @@ -164,20 +165,19 @@ typedef struct DriveInfo { BlockInterfaceType type; int bus; int unit; - int used; int drive_opt_idx; BlockInterfaceErrorAction onerror; char serial[BLOCK_SERIAL_STRLEN + 1]; + TAILQ_ENTRY(DriveInfo) next; } DriveInfo; #define MAX_IDE_DEVS 2 #define MAX_SCSI_DEVS 7 #define MAX_DRIVES 32 -extern int nb_drives; -extern DriveInfo drives_table[MAX_DRIVES+1]; +extern TAILQ_HEAD(drivelist, DriveInfo) drives; -extern int drive_get_index(BlockInterfaceType type, int bus, int unit); +extern DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit); extern int drive_get_max_bus(BlockInterfaceType type); extern void drive_uninit(BlockDriverState *bdrv); extern void drive_remove(int index); @@ -196,7 +196,8 @@ 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); +extern DriveInfo *drive_init(struct drive_opt *arg, int snapshot, void *machine, + int *fatal_error); /* acpi */ typedef void (*qemu_system_device_hot_add_t)(int pcibus, int slot, int state); @@ -207,7 +208,7 @@ void qemu_system_device_hot_add(int pcibus, int slot, int state); typedef int (dev_match_fn)(void *dev_private, void *arg); -int add_init_drive(const char *opts); +DriveInfo *add_init_drive(const char *opts); void destroy_nic(dev_match_fn *match_fn, void *arg); void destroy_bdrvs(dev_match_fn *match_fn, void *arg); |