mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
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:
committed by
Kevin Wolf
parent
7b370f5130
commit
666daa6823
+1
-1
@@ -44,7 +44,7 @@ fsdev-obj-$(CONFIG_LINUX) += $(addprefix fsdev/, $(fsdev-nested-y))
|
|||||||
# system emulation, i.e. a single QEMU executable should support all
|
# system emulation, i.e. a single QEMU executable should support all
|
||||||
# CPUs and machines.
|
# 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 += $(net-obj-y)
|
||||||
common-obj-y += $(qobject-obj-y)
|
common-obj-y += $(qobject-obj-y)
|
||||||
common-obj-$(CONFIG_LINUX) += $(fsdev-obj-$(CONFIG_LINUX))
|
common-obj-$(CONFIG_LINUX) += $(fsdev-obj-$(CONFIG_LINUX))
|
||||||
|
|||||||
+600
File diff suppressed because it is too large
Load Diff
+71
@@ -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
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "pm_smbus.h"
|
#include "pm_smbus.h"
|
||||||
#include "pci.h"
|
#include "pci.h"
|
||||||
#include "acpi.h"
|
#include "acpi.h"
|
||||||
|
#include "sysemu.h"
|
||||||
|
|
||||||
//#define DEBUG
|
//#define DEBUG
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "pci_host.h"
|
#include "pci_host.h"
|
||||||
#include "rwhandler.h"
|
#include "rwhandler.h"
|
||||||
#include "apb_pci.h"
|
#include "apb_pci.h"
|
||||||
|
#include "sysemu.h"
|
||||||
|
|
||||||
/* debug APB */
|
/* debug APB */
|
||||||
//#define DEBUG_APB
|
//#define DEBUG_APB
|
||||||
|
|||||||
@@ -25,8 +25,6 @@
|
|||||||
#include "hw.h"
|
#include "hw.h"
|
||||||
#include "boards.h"
|
#include "boards.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "block_int.h"
|
|
||||||
#include "sysemu.h"
|
|
||||||
|
|
||||||
DriveInfo *add_init_drive(const char *optstr)
|
DriveInfo *add_init_drive(const char *optstr)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
|
|
||||||
#include "hw.h"
|
#include "hw.h"
|
||||||
#include "fdc.h"
|
#include "fdc.h"
|
||||||
#include "block.h"
|
|
||||||
#include "qemu-timer.h"
|
#include "qemu-timer.h"
|
||||||
#include "isa.h"
|
#include "isa.h"
|
||||||
#include "sysbus.h"
|
#include "sysbus.h"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#define HW_FDC_H
|
#define HW_FDC_H
|
||||||
|
|
||||||
/* fdc.c */
|
/* fdc.c */
|
||||||
#include "sysemu.h"
|
#include "blockdev.h"
|
||||||
#define MAX_FD 2
|
#define MAX_FD 2
|
||||||
|
|
||||||
typedef struct FDCtrl FDCtrl;
|
typedef struct FDCtrl FDCtrl;
|
||||||
|
|||||||
@@ -26,8 +26,6 @@
|
|||||||
#include <hw/pc.h>
|
#include <hw/pc.h>
|
||||||
#include <hw/pci.h>
|
#include <hw/pci.h>
|
||||||
#include <hw/scsi.h>
|
#include <hw/scsi.h>
|
||||||
#include "block.h"
|
|
||||||
#include "block_int.h"
|
|
||||||
#include "qemu-timer.h"
|
#include "qemu-timer.h"
|
||||||
#include "sysemu.h"
|
#include "sysemu.h"
|
||||||
#include "dma.h"
|
#include "dma.h"
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include <hw/hw.h>
|
#include <hw/hw.h>
|
||||||
#include "sysemu.h"
|
|
||||||
#include "dma.h"
|
#include "dma.h"
|
||||||
|
|
||||||
#include <hw/ide/internal.h>
|
#include <hw/ide/internal.h>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "sysbus.h"
|
#include "sysbus.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "devices.h"
|
#include "devices.h"
|
||||||
|
#include "sysemu.h"
|
||||||
/* For crc32 */
|
/* For crc32 */
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,8 @@
|
|||||||
|
|
||||||
# include "hw.h"
|
# include "hw.h"
|
||||||
# include "flash.h"
|
# include "flash.h"
|
||||||
# include "block.h"
|
# include "blockdev.h"
|
||||||
/* FIXME: Pass block device as an argument. */
|
/* FIXME: Pass block device as an argument. */
|
||||||
# include "sysemu.h"
|
|
||||||
|
|
||||||
# define NAND_CMD_READ0 0x00
|
# define NAND_CMD_READ0 0x00
|
||||||
# define NAND_CMD_READ1 0x01
|
# define NAND_CMD_READ1 0x01
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
* You should have received a copy of the GNU General Public License along
|
* You should have received a copy of the GNU General Public License along
|
||||||
* with this program; if not, see <http://www.gnu.org/licenses/>.
|
* with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "blockdev.h"
|
||||||
#include "hw.h"
|
#include "hw.h"
|
||||||
#include "arm-misc.h"
|
#include "arm-misc.h"
|
||||||
#include "omap.h"
|
#include "omap.h"
|
||||||
|
|||||||
+1
-2
@@ -21,8 +21,7 @@
|
|||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
#include "irq.h"
|
#include "irq.h"
|
||||||
#include "sysemu.h"
|
#include "blockdev.h"
|
||||||
#include "block.h"
|
|
||||||
|
|
||||||
/* 11 for 2kB-page OneNAND ("2nd generation") and 10 for 1kB-page chips */
|
/* 11 for 2kB-page OneNAND ("2nd generation") and 10 for 1kB-page chips */
|
||||||
#define PAGE_SHIFT 11
|
#define PAGE_SHIFT 11
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include "qemu-char.h"
|
#include "qemu-char.h"
|
||||||
#include "isa.h"
|
#include "isa.h"
|
||||||
#include "pc.h"
|
#include "pc.h"
|
||||||
|
#include "sysemu.h"
|
||||||
|
|
||||||
//#define DEBUG_PARALLEL
|
//#define DEBUG_PARALLEL
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "elf.h"
|
#include "elf.h"
|
||||||
#include "multiboot.h"
|
#include "multiboot.h"
|
||||||
#include "mc146818rtc.h"
|
#include "mc146818rtc.h"
|
||||||
|
#include "sysemu.h"
|
||||||
|
|
||||||
/* output Bochs bios info messages */
|
/* output Bochs bios info messages */
|
||||||
//#define DEBUG_BIOS
|
//#define DEBUG_BIOS
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include "boards.h"
|
#include "boards.h"
|
||||||
#include "ide.h"
|
#include "ide.h"
|
||||||
#include "kvm.h"
|
#include "kvm.h"
|
||||||
|
#include "sysemu.h"
|
||||||
|
|
||||||
#define MAX_IDE_BUS 2
|
#define MAX_IDE_BUS 2
|
||||||
|
|
||||||
|
|||||||
@@ -26,10 +26,8 @@
|
|||||||
#include "boards.h"
|
#include "boards.h"
|
||||||
#include "pci.h"
|
#include "pci.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "sysemu.h"
|
|
||||||
#include "pc.h"
|
#include "pc.h"
|
||||||
#include "monitor.h"
|
#include "monitor.h"
|
||||||
#include "block_int.h"
|
|
||||||
#include "scsi.h"
|
#include "scsi.h"
|
||||||
#include "virtio-blk.h"
|
#include "virtio-blk.h"
|
||||||
#include "qemu-config.h"
|
#include "qemu-config.h"
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/* PCMCIA/Cardbus */
|
/* PCMCIA/Cardbus */
|
||||||
|
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
#include "sysemu.h"
|
#include "blockdev.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
qemu_irq irq;
|
qemu_irq irq;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#include "sysemu.h"
|
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "qdev.h"
|
#include "qdev.h"
|
||||||
#include "qerror.h"
|
#include "qerror.h"
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user