blockdev: Collect block device code in new blockdev.c

Anything that moves hundreds of lines out of vl.c can't be all bad.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Markus Armbruster
2010-06-04 15:20:47 +02:00
committed by Kevin Wolf
parent 7b370f5130
commit 666daa6823
34 changed files with 692 additions and 660 deletions
+1 -1
View File
@@ -44,7 +44,7 @@ fsdev-obj-$(CONFIG_LINUX) += $(addprefix fsdev/, $(fsdev-nested-y))
# system emulation, i.e. a single QEMU executable should support all
# CPUs and machines.
common-obj-y = $(block-obj-y)
common-obj-y = $(block-obj-y) blockdev.o
common-obj-y += $(net-obj-y)
common-obj-y += $(qobject-obj-y)
common-obj-$(CONFIG_LINUX) += $(fsdev-obj-$(CONFIG_LINUX))
+600
View File
File diff suppressed because it is too large Load Diff
+71
View File
@@ -0,0 +1,71 @@
/*
* QEMU host block devices
*
* Copyright (c) 2003-2008 Fabrice Bellard
*
* This work is licensed under the terms of the GNU GPL, version 2 or
* later. See the COPYING file in the top-level directory.
*/
#ifndef BLOCKDEV_H
#define BLOCKDEV_H
#include "block.h"
#include "qemu-queue.h"
typedef enum {
IF_NONE,
IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD, IF_VIRTIO, IF_XEN,
IF_COUNT
} BlockInterfaceType;
typedef enum {
BLOCK_ERR_REPORT, BLOCK_ERR_IGNORE, BLOCK_ERR_STOP_ENOSPC,
BLOCK_ERR_STOP_ANY
} BlockInterfaceErrorAction;
#define BLOCK_SERIAL_STRLEN 20
typedef struct DriveInfo {
BlockDriverState *bdrv;
char *id;
const char *devaddr;
BlockInterfaceType type;
int bus;
int unit;
QemuOpts *opts;
BlockInterfaceErrorAction on_read_error;
BlockInterfaceErrorAction on_write_error;
char serial[BLOCK_SERIAL_STRLEN + 1];
QTAILQ_ENTRY(DriveInfo) next;
} DriveInfo;
#define MAX_IDE_DEVS 2
#define MAX_SCSI_DEVS 7
extern QTAILQ_HEAD(drivelist, DriveInfo) drives;
extern DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit);
extern DriveInfo *drive_get_by_id(const char *id);
extern int drive_get_max_bus(BlockInterfaceType type);
extern void drive_uninit(DriveInfo *dinfo);
extern const char *drive_get_serial(BlockDriverState *bdrv);
extern BlockInterfaceErrorAction drive_get_on_error(
BlockDriverState *bdrv, int is_read);
extern QemuOpts *drive_add(const char *file, const char *fmt, ...);
extern DriveInfo *drive_init(QemuOpts *arg, int default_to_scsi,
int *fatal_error);
/* device-hotplug */
DriveInfo *add_init_drive(const char *opts);
void do_commit(Monitor *mon, const QDict *qdict);
int do_eject(Monitor *mon, const QDict *qdict, QObject **ret_data);
int do_block_set_passwd(Monitor *mon, const QDict *qdict, QObject **ret_data);
int do_change_block(Monitor *mon, const char *device,
const char *filename, const char *fmt);
#endif
+1
View File
@@ -21,6 +21,7 @@
#include "pm_smbus.h"
#include "pci.h"
#include "acpi.h"
#include "sysemu.h"
//#define DEBUG
+1
View File
@@ -31,6 +31,7 @@
#include "pci_host.h"
#include "rwhandler.h"
#include "apb_pci.h"
#include "sysemu.h"
/* debug APB */
//#define DEBUG_APB
-2
View File
@@ -25,8 +25,6 @@
#include "hw.h"
#include "boards.h"
#include "net.h"
#include "block_int.h"
#include "sysemu.h"
DriveInfo *add_init_drive(const char *optstr)
{
-1
View File
@@ -29,7 +29,6 @@
#include "hw.h"
#include "fdc.h"
#include "block.h"
#include "qemu-timer.h"
#include "isa.h"
#include "sysbus.h"
+1 -1
View File
@@ -2,7 +2,7 @@
#define HW_FDC_H
/* fdc.c */
#include "sysemu.h"
#include "blockdev.h"
#define MAX_FD 2
typedef struct FDCtrl FDCtrl;
-2
View File
@@ -26,8 +26,6 @@
#include <hw/pc.h>
#include <hw/pci.h>
#include <hw/scsi.h>
#include "block.h"
#include "block_int.h"
#include "qemu-timer.h"
#include "sysemu.h"
#include "dma.h"
-1
View File
@@ -17,7 +17,6 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include <hw/hw.h>
#include "sysemu.h"
#include "dma.h"
#include <hw/ide/internal.h>
+1
View File
@@ -10,6 +10,7 @@
#include "sysbus.h"
#include "net.h"
#include "devices.h"
#include "sysemu.h"
/* For crc32 */
#include <zlib.h>
+1 -2
View File
@@ -13,9 +13,8 @@
# include "hw.h"
# include "flash.h"
# include "block.h"
# include "blockdev.h"
/* FIXME: Pass block device as an argument. */
# include "sysemu.h"
# define NAND_CMD_READ0 0x00
# define NAND_CMD_READ1 0x01
+2
View File
@@ -17,6 +17,8 @@
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "blockdev.h"
#include "hw.h"
#include "arm-misc.h"
#include "omap.h"
+1 -2
View File
@@ -21,8 +21,7 @@
#include "qemu-common.h"
#include "flash.h"
#include "irq.h"
#include "sysemu.h"
#include "block.h"
#include "blockdev.h"
/* 11 for 2kB-page OneNAND ("2nd generation") and 10 for 1kB-page chips */
#define PAGE_SHIFT 11
+1
View File
@@ -26,6 +26,7 @@
#include "qemu-char.h"
#include "isa.h"
#include "pc.h"
#include "sysemu.h"
//#define DEBUG_PARALLEL
+1
View File
@@ -35,6 +35,7 @@
#include "elf.h"
#include "multiboot.h"
#include "mc146818rtc.h"
#include "sysemu.h"
/* output Bochs bios info messages */
//#define DEBUG_BIOS
+1
View File
@@ -32,6 +32,7 @@
#include "boards.h"
#include "ide.h"
#include "kvm.h"
#include "sysemu.h"
#define MAX_IDE_BUS 2
-2
View File
@@ -26,10 +26,8 @@
#include "boards.h"
#include "pci.h"
#include "net.h"
#include "sysemu.h"
#include "pc.h"
#include "monitor.h"
#include "block_int.h"
#include "scsi.h"
#include "virtio-blk.h"
#include "qemu-config.h"
+1 -1
View File
@@ -1,7 +1,7 @@
/* PCMCIA/Cardbus */
#include "qemu-common.h"
#include "sysemu.h"
#include "blockdev.h"
typedef struct {
qemu_irq irq;
-1
View File
@@ -1,4 +1,3 @@
#include "sysemu.h"
#include "net.h"
#include "qdev.h"
#include "qerror.h"

Some files were not shown because too many files have changed in this diff Show More