Skip to contentSkip to conversation

Collect block device code in new blockdev.c

PATCH Superseded Markus Armbruster 2 participants 9 messages Jun 2, 2010 – Jun 4, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Collect block device code in new blockdev.c

Based on Kevin's block branch[*], commit f4e0fa33.

Code motion like this is a conflict magnet. Speedy merge would be nice.

[*] http://repo.or.cz/w/qemu/kevin.git/shortlog/refs/heads/block

Markus Armbruster (3):
blockdev: Hide QEMUMachine from drive_init()
qdev: Move declaration of qdev_init_bdrv() into qdev.h
blockdev: Collect block device code in new blockdev.c

 Makefile.objs        |    2 +-
 blockdev.c           |  591 ++++++++++++++++++++++++++++++++++++++++++++++++++
 blockdev.h           |   62 ++++++
 hw/acpi_piix4.c      |    1 +
 hw/apb_pci.c         |    1 +
 hw/device-hotplug.c  |    4 +-
 hw/fdc.c             |    1 -
 hw/fdc.h             |    2 +-
 hw/ide/core.c        |    2 -
 hw/ide/qdev.c        |    1 -
 hw/lan9118.c         |    1 +
 hw/nand.c            |    3 +-
 hw/omap2.c           |    2 +
 hw/onenand.c         |    3 +-
 hw/parallel.c        |    1 +
 hw/pc.c              |    1 +
 hw/pc_piix.c         |    1 +
 hw/pci-hotplug.c     |    2 -
 hw/pcmcia.h          |    2 +-
 hw/pl181.c           |    1 -
 hw/qdev-properties.c |    1 -
 hw/qdev.h            |    4 +-
 hw/scsi-bus.c        |    1 -
 hw/scsi-disk.c       |    2 +-
 hw/scsi-generic.c    |    1 -
 hw/serial.c          |    1 +
 hw/ssi-sd.c          |    1 -
 hw/usb-hid.c         |    1 +
 hw/usb-msd.c         |    4 +-
 hw/virtio-blk.c      |    2 -
 hw/virtio-pci.c      |    1 -
 monitor.c            |  104 +---------
 qemu-char.c          |    1 -
 savevm.c             |    2 +-
 sysemu.h             |   50 -----
 vl.c                 |  491 +-----------------------------------------
 36 files changed, 681 insertions(+), 670 deletions(-)
 create mode 100644 blockdev.c
 create mode 100644 blockdev.h
#1 lore raw

PATCH 1/3 blockdev: Hide QEMUMachine from drive_init()

To pave the way for moving it out of vl.c.

---
 hw/device-hotplug.c |    2 +-
 hw/usb-msd.c        |    2 +-
 sysemu.h            |    3 ++-
 vl.c                |   12 +++++-------
 4 files changed, 9 insertions(+), 10 deletions(-)
hw/device-hotplug.c +1 -1
index 9cc8376..a3fe99e 100644
@@ -38,7 +38,7 @@ DriveInfo *add_init_drive(const char *optstr)
     if (!opts)
         return NULL;
 
-    dinfo = drive_init(opts, current_machine, &fatal_error);
+    dinfo = drive_init(opts, current_machine->use_scsi, &fatal_error);
     if (!dinfo) {
         qemu_opts_del(opts);
         return NULL;
hw/usb-msd.c +1 -1
index c1c2537..0ba4a64 100644
@@ -584,7 +584,7 @@ static USBDevice *usb_msd_init(const char *filename)
     qemu_opt_set(opts, "if", "none");
 
     /* create host drive */
-    dinfo = drive_init(opts, NULL, &fatal_error);
+    dinfo = drive_init(opts, 0, &fatal_error);
     if (!dinfo) {
         qemu_opts_del(opts);
         return NULL;
sysemu.h +2 -1
index fd83b7d..46a1b2f 100644
@@ -191,7 +191,8 @@ extern BlockInterfaceErrorAction drive_get_on_error(
 BlockDriverState *qdev_init_bdrv(DeviceState *dev, BlockInterfaceType type);
 
 extern QemuOpts *drive_add(const char *file, const char *fmt, ...);
-extern DriveInfo *drive_init(QemuOpts *arg, void *machine, int *fatal_error);
+extern DriveInfo *drive_init(QemuOpts *arg, int default_to_scsi,
+                             int *fatal_error);
 
 /* device-hotplug */
 
vl.c +5 -7
index 551138f..db1fefd 100644
@@ -767,8 +767,7 @@ static int parse_block_error_action(const char *buf, int is_read)
     }
 }
 
-DriveInfo *drive_init(QemuOpts *opts, void *opaque,
-                      int *fatal_error)
+DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, int *fatal_error)
 {
     const char *buf;
     const char *file = NULL;
@@ -780,7 +779,6 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
     int bus_id, unit_id;
     int cyls, heads, secs, translation;
     BlockDriver *drv = NULL;
-    QEMUMachine *machine = opaque;
     int max_devs;
     int index;
     int ro = 0;
@@ -795,7 +793,7 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
 
     translation = BIOS_ATA_TRANSLATION_AUTO;
 
-    if (machine && machine->use_scsi) {
+    if (default_to_scsi) {
         type = IF_SCSI;
         max_devs = MAX_SCSI_DEVS;
         pstrcpy(devname, sizeof(devname), "scsi");
@@ -1135,10 +1133,10 @@ DriveInfo *drive_init(QemuOpts *opts, void *opaque,
 
 static int drive_init_func(QemuOpts *opts, void *opaque)
 {
-    QEMUMachine *machine = opaque;
+    int *use_scsi = opaque;
     int fatal_error = 0;
 
-    if (drive_init(opts, machine, &fatal_error) == NULL) {
+    if (drive_init(opts, *use_scsi, &fatal_error) == NULL) {
         if (fatal_error)
             return 1;
     }
@@ -3641,7 +3639,7 @@ int main(int argc, char **argv, char **envp)
     /* open the virtual block devices */
     if (snapshot)
         qemu_opts_foreach(&qemu_drive_opts, drive_enable_snapshot, NULL, 0);
-    if (qemu_opts_foreach(&qemu_drive_opts, drive_init_func, machine, 1) != 0)
+    if (qemu_opts_foreach(&qemu_drive_opts, drive_init_func, &machine->use_scsi, 1) != 0)
         exit(1);
 
     register_savevm_live("ram", 0, 3, NULL, ram_save_live, NULL, 
Signature · 1 line
1.6.6.1
#2 lore raw

PATCH 2/3 qdev: Move declaration of qdev_init_bdrv() into qdev.h

In reply to Markus Armbruster
---
 hw/pl181.c  |    1 -
 hw/qdev.h   |    2 ++
 hw/ssi-sd.c |    1 -
 sysemu.h    |    2 --
 4 files changed, 2 insertions(+), 4 deletions(-)
hw/pl181.c +0 -1
index 1924053..85cadc4 100644
@@ -9,7 +9,6 @@
 
 #include "sysbus.h"
 #include "sd.h"
-#include "sysemu.h"
 
 //#define DEBUG_PL181 1
 
hw/qdev.h +2 -0
index 51a24e2..0ad6c95 100644
@@ -125,6 +125,8 @@ void qdev_machine_creation_done(void);
 qemu_irq qdev_get_gpio_in(DeviceState *dev, int n);
 void qdev_connect_gpio_out(DeviceState *dev, int n, qemu_irq pin);
 
+BlockDriverState *qdev_init_bdrv(DeviceState *dev, BlockInterfaceType type);
+
 BusState *qdev_get_child_bus(DeviceState *dev, const char *name);
 
 /*** Device API.  ***/
hw/ssi-sd.c +0 -1
index 5e74e5d..96b33ed 100644
@@ -9,7 +9,6 @@
 
 #include "ssi.h"
 #include "sd.h"
-#include "sysemu.h"
 
 //#define DEBUG_SSI_SD 1
 
sysemu.h +0 -2
index 46a1b2f..dce13c1 100644
@@ -188,8 +188,6 @@ extern const char *drive_get_serial(BlockDriverState *bdrv);
 extern BlockInterfaceErrorAction drive_get_on_error(
     BlockDriverState *bdrv, int is_read);
 
-BlockDriverState *qdev_init_bdrv(DeviceState *dev, BlockInterfaceType type);
-
 extern QemuOpts *drive_add(const char *file, const char *fmt, ...);
 extern DriveInfo *drive_init(QemuOpts *arg, int default_to_scsi,
                              int *fatal_error);
Signature · 1 line
1.6.6.1
#3 lore raw

PATCH 3/3 blockdev: Collect block device code in new blockdev.c

In reply to Markus Armbruster

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

---
 Makefile.objs        |    2 +-
 blockdev.c           |  591 ++++++++++++++++++++++++++++++++++++++++++++++++++
 blockdev.h           |   62 ++++++
 hw/acpi_piix4.c      |    1 +
 hw/apb_pci.c         |    1 +
 hw/device-hotplug.c  |    2 -
 hw/fdc.c             |    1 -
 hw/fdc.h             |    2 +-
 hw/ide/core.c        |    2 -
 hw/ide/qdev.c        |    1 -
 hw/lan9118.c         |    1 +
 hw/nand.c            |    3 +-
 hw/omap2.c           |    2 +
 hw/onenand.c         |    3 +-
 hw/parallel.c        |    1 +
 hw/pc.c              |    1 +
 hw/pc_piix.c         |    1 +
 hw/pci-hotplug.c     |    2 -
 hw/pcmcia.h          |    2 +-
 hw/qdev-properties.c |    1 -
 hw/qdev.h            |    2 +-
 hw/scsi-bus.c        |    1 -
 hw/scsi-disk.c       |    2 +-
 hw/scsi-generic.c    |    1 -
 hw/serial.c          |    1 +
 hw/usb-hid.c         |    1 +
 hw/usb-msd.c         |    2 +-
 hw/virtio-blk.c      |    2 -
 hw/virtio-pci.c      |    1 -
 monitor.c            |  104 +---------
 qemu-char.c          |    1 -
 savevm.c             |    2 +-
 sysemu.h             |   49 ----
 vl.c                 |  483 +----------------------------------------
 34 files changed, 674 insertions(+), 660 deletions(-)
 create mode 100644 blockdev.c
 create mode 100644 blockdev.h
Makefile.objs +1 -1
index 9796dcb..54dec26 100644
@@ -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))
blockdev.c new file +591 -0

591 lines not on this page · raw message

blockdev.h new file +62 -0

62 lines not on this page · raw message

hw/acpi_piix4.c +1 -0
index 0fce958..a87286b 100644
@@ -21,6 +21,7 @@
 #include "pm_smbus.h"
 #include "pci.h"
 #include "acpi.h"
+#include "sysemu.h"
 
 //#define DEBUG
 
hw/apb_pci.c +1 -0
index b53e3c3..31c8d70 100644
@@ -31,6 +31,7 @@
 #include "pci_host.h"
 #include "rwhandler.h"
 #include "apb_pci.h"
+#include "sysemu.h"
 
 /* debug APB */
 //#define DEBUG_APB
hw/device-hotplug.c +0 -2
index a3fe99e..c1a9a56 100644
@@ -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)
 {
hw/fdc.c +0 -1
index 6306496..b978957 100644
@@ -29,7 +29,6 @@
 
 #include "hw.h"
 #include "fdc.h"
-#include "block.h"
 #include "qemu-timer.h"
 #include "isa.h"
 #include "sysbus.h"
hw/fdc.h +1 -1
index c48b5e0..b6b3772 100644
@@ -2,7 +2,7 @@
 #define HW_FDC_H
 
 /* fdc.c */
-#include "sysemu.h"
+#include "blockdev.h"
 #define MAX_FD 2
 
 typedef struct FDCtrl FDCtrl;
hw/ide/core.c +0 -2
index 70af1b6..045d18d 100644
@@ -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"
hw/ide/qdev.c +0 -1
index 6231d77..0f9f22e 100644
@@ -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>
hw/lan9118.c +1 -0
index 16d3330..b996dc4 100644
@@ -10,6 +10,7 @@
 #include "sysbus.h"
 #include "net.h"
 #include "devices.h"
+#include "sysemu.h"
 /* For crc32 */
 #include <zlib.h>
 
hw/nand.c +1 -2
index 40d5a6a..cd7444f 100644
@@ -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
hw/omap2.c +2 -0
index bd1b35e..666c15a 100644
@@ -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"
hw/onenand.c +1 -2
index c1e7e4d..4118db9 100644
@@ -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
hw/parallel.c +1 -0
index be8e2d5..6b11672 100644
@@ -26,6 +26,7 @@
 #include "qemu-char.h"
 #include "isa.h"
 #include "pc.h"
+#include "sysemu.h"
 
 //#define DEBUG_PARALLEL
 
hw/pc.c +1 -0
index 9b85c42..6e7c468 100644
@@ -35,6 +35,7 @@
 #include "elf.h"
 #include "multiboot.h"
 #include "mc146818rtc.h"
+#include "sysemu.h"
 
 /* output Bochs bios info messages */
 //#define DEBUG_BIOS
hw/pc_piix.c +1 -0
index 70f563a..dc46846 100644
@@ -32,6 +32,7 @@
 #include "boards.h"
 #include "ide.h"
 #include "kvm.h"
+#include "sysemu.h"
 
 #define MAX_IDE_BUS 2
 
hw/pci-hotplug.c +0 -2
index a8f3df1..c39e640 100644
@@ -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"
hw/pcmcia.h +1 -1
index cf2db9d..3602923 100644
@@ -1,7 +1,7 @@
 /* PCMCIA/Cardbus */
 
 #include "qemu-common.h"
-#include "sysemu.h"
+#include "blockdev.h"
 
 typedef struct {
     qemu_irq irq;
hw/qdev-properties.c +0 -1
index 48a6b45..5a8739d 100644
@@ -1,4 +1,3 @@
-#include "sysemu.h"
 #include "net.h"
 #include "qdev.h"
 #include "qerror.h"
hw/qdev.h +1 -1
index 0ad6c95..be5ad67 100644
@@ -2,7 +2,7 @@
 #define QDEV_H
 
 #include "hw.h"
-#include "sysemu.h"
+#include "blockdev.h"
 #include "qemu-queue.h"
 #include "qemu-char.h"
 #include "qemu-option.h"
hw/scsi-bus.c +0 -1
index 383240b..055a94d 100644
@@ -2,7 +2,6 @@
 #include "qemu-error.h"
 #include "scsi.h"
 #include "scsi-defs.h"
-#include "block.h"
 #include "qdev.h"
 
 static struct BusInfo scsi_bus_info = {
hw/scsi-disk.c +1 -1
index a3559d1..a9bf7d2 100644
@@ -33,9 +33,9 @@ do { fprintf(stderr, "scsi-disk: " fmt , ## __VA_ARGS__); } while (0)
 
 #include "qemu-common.h"
 #include "qemu-error.h"
-#include "block.h"
 #include "scsi.h"
 #include "scsi-defs.h"
+#include "sysemu.h"
 
 #define SCSI_DMA_BUF_SIZE    131072
 #define SCSI_MAX_INQUIRY_LEN 256
hw/scsi-generic.c +0 -1
index c9aa853..e31060e 100644
@@ -13,7 +13,6 @@
 
 #include "qemu-common.h"
 #include "qemu-error.h"
-#include "block.h"
 #include "scsi.h"
 
 #ifdef __linux__
hw/serial.c +1 -0
index 9102edb..c7e4e77 100644
@@ -27,6 +27,7 @@
 #include "isa.h"
 #include "pc.h"
 #include "qemu-timer.h"
+#include "sysemu.h"
 
 //#define DEBUG_SERIAL
 
hw/usb-hid.c +1 -0
index 8e6c6e0..228d0a0 100644
@@ -25,6 +25,7 @@
 #include "hw.h"
 #include "console.h"
 #include "usb.h"
+#include "sysemu.h"
 
 /* HID interface requests */
 #define GET_REPORT   0xa101
hw/usb-msd.c +1 -1
index 0ba4a64..003bd8a 100644
@@ -11,10 +11,10 @@
 #include "qemu-option.h"
 #include "qemu-config.h"
 #include "usb.h"
-#include "block.h"
 #include "scsi.h"
 #include "console.h"
 #include "monitor.h"
+#include "sysemu.h"
 
 //#define DEBUG_MSD
 
hw/virtio-blk.c +0 -2
index 80d51c4..cdcb492 100644
@@ -12,9 +12,7 @@
  */
 
 #include <qemu-common.h>
-#include <sysemu.h>
 #include "virtio-blk.h"
-#include "block_int.h"
 #ifdef __linux__
 # include <scsi/sg.h>
 #endif
hw/virtio-pci.c +0 -1
index 7ddf612..e101fa0 100644
@@ -22,7 +22,6 @@
 #include "qemu-error.h"
 #include "msix.h"
 #include "net.h"
-#include "block_int.h"
 #include "loader.h"
 #include "kvm.h"
 
monitor.c +1 -103

122 lines not on this page · raw message

qemu-char.c +0 -1
index faaf624..87628ea 100644
@@ -28,7 +28,6 @@
 #include "sysemu.h"
 #include "qemu-timer.h"
 #include "qemu-char.h"
-#include "block.h"
 #include "hw/usb.h"
 #include "hw/baum.h"
 #include "hw/msmouse.h"
savevm.c +1 -1
index dc20390..18852cd 100644
@@ -77,7 +77,7 @@
 #include "sysemu.h"
 #include "qemu-timer.h"
 #include "qemu-char.h"
-#include "block.h"
+#include "blockdev.h"
 #include "audio/audio.h"
 #include "migration.h"
 #include "qemu_socket.h"
sysemu.h +0 -49

55 lines not on this page · raw message

vl.c +1 -482

501 lines not on this page · raw message

Signature · 1 line
1.6.6.1
#4 lore raw

[Qemu-devel] Re: [PATCH 3/3] blockdev: Collect block device code in new blockdev.c

Am 02.06.2010 13:31, schrieb Markus Armbruster:

Quoted 3 lines

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

New files need a license header, otherwise it looks ok.

I have applied this patch (and the other ones, too) to the block branch anyway to avoid conflicts with other people basing their patches on that branch. However, it requires a v2 before I can propose this to be merged into master.

Kevin

#5 lore raw

[Qemu-devel] Re: [PATCH 3/3] blockdev: Collect block device code in new blockdev.c

Quoted 11 lines · Kevin Wolf

Am 02.06.2010 13:31, schrieb Markus Armbruster:

Quoted 3 lines

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

New files need a license header, otherwise it looks ok.

I have applied this patch (and the other ones, too) to the block branch anyway to avoid conflicts with other people basing their patches on that branch. However, it requires a v2 before I can propose this to be merged into master.

vl.c has "Copyright (c) 2003-2008 Fabrice Bellard". monitor.c has "Copyright (c) 2003-2004 Fabrice Bellard". Would the following header do?

/*
* 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. */

#6 lore raw

[Qemu-devel] Re: [PATCH 3/3] blockdev: Collect block device code in new blockdev.c

Am 02.06.2010 18:16, schrieb Markus Armbruster:

Quoted 18 lines
Quoted 11 lines · Kevin Wolf

Am 02.06.2010 13:31, schrieb Markus Armbruster:

Quoted 3 lines

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

New files need a license header, otherwise it looks ok.

I have applied this patch (and the other ones, too) to the block branch anyway to avoid conflicts with other people basing their patches on that branch. However, it requires a v2 before I can propose this to be merged into master.

vl.c has "Copyright (c) 2003-2008 Fabrice Bellard". monitor.c has "Copyright (c) 2003-2004 Fabrice Bellard". Would the following header do?

Quoted 8 lines

/*
* 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. */

Should be good enough, I think.

vl.c and monitor.c are BSD licensed, though. Not sure if anyone minds if the license is changed to GPL. Probably not, just want to have it mentioned.

Kevin

#7 lore raw

[Qemu-devel] Re: [PATCH 3/3] blockdev: Collect block device code in new blockdev.c

Quoted 28 lines · Kevin Wolf

Am 02.06.2010 18:16, schrieb Markus Armbruster:

Quoted 18 lines
Quoted 11 lines · Kevin Wolf

Am 02.06.2010 13:31, schrieb Markus Armbruster:

Quoted 3 lines

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

New files need a license header, otherwise it looks ok.

I have applied this patch (and the other ones, too) to the block branch anyway to avoid conflicts with other people basing their patches on that branch. However, it requires a v2 before I can propose this to be merged into master.

vl.c has "Copyright (c) 2003-2008 Fabrice Bellard". monitor.c has "Copyright (c) 2003-2004 Fabrice Bellard". Would the following header do?

Quoted 8 lines

/*
* 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. */

Quoted 4 lines

Should be good enough, I think.

vl.c and monitor.c are BSD licensed, though. Not sure if anyone minds if the license is changed to GPL. Probably not, just want to have it mentioned.

If this were not okay, I'd split blockdev.c, because I want my new code GPL'ed.

#8 lore raw

PATCH v2 3/3 blockdev: Collect block device code in new blockdev.c

In reply to Markus Armbruster

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

---
v2: Licence boilerplate

 Makefile.objs        |    2 +-
 blockdev.c           |  600 ++++++++++++++++++++++++++++++++++++++++++++++++++
 blockdev.h           |   71 ++++++
 hw/acpi_piix4.c      |    1 +
 hw/apb_pci.c         |    1 +
 hw/device-hotplug.c  |    2 -
 hw/fdc.c             |    1 -
 hw/fdc.h             |    2 +-
 hw/ide/core.c        |    2 -
 hw/ide/qdev.c        |    1 -
 hw/lan9118.c         |    1 +
 hw/nand.c            |    3 +-
 hw/omap2.c           |    2 +
 hw/onenand.c         |    3 +-
 hw/parallel.c        |    1 +
 hw/pc.c              |    1 +
 hw/pc_piix.c         |    1 +
 hw/pci-hotplug.c     |    2 -
 hw/pcmcia.h          |    2 +-
 hw/qdev-properties.c |    1 -
 hw/qdev.h            |    2 +-
 hw/scsi-bus.c        |    1 -
 hw/scsi-disk.c       |    2 +-
 hw/scsi-generic.c    |    1 -
 hw/serial.c          |    1 +
 hw/usb-hid.c         |    1 +
 hw/usb-msd.c         |    2 +-
 hw/virtio-blk.c      |    2 -
 hw/virtio-pci.c      |    1 -
 monitor.c            |  104 +---------
 qemu-char.c          |    1 -
 savevm.c             |    2 +-
 sysemu.h             |   49 ----
 vl.c                 |  483 +----------------------------------------
 34 files changed, 692 insertions(+), 660 deletions(-)
 create mode 100644 blockdev.c
 create mode 100644 blockdev.h
Makefile.objs +1 -1
index 9796dcb..54dec26 100644
@@ -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))
blockdev.c new file +600 -0

600 lines not on this page · raw message

blockdev.h new file +71 -0

71 lines not on this page · raw message

hw/acpi_piix4.c +1 -0
index 0fce958..a87286b 100644
@@ -21,6 +21,7 @@
 #include "pm_smbus.h"
 #include "pci.h"
 #include "acpi.h"
+#include "sysemu.h"
 
 //#define DEBUG
 
hw/apb_pci.c +1 -0
index b53e3c3..31c8d70 100644
@@ -31,6 +31,7 @@
 #include "pci_host.h"
 #include "rwhandler.h"
 #include "apb_pci.h"
+#include "sysemu.h"
 
 /* debug APB */
 //#define DEBUG_APB
hw/device-hotplug.c +0 -2
index a3fe99e..c1a9a56 100644
@@ -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)
 {
hw/fdc.c +0 -1
index 6306496..b978957 100644
@@ -29,7 +29,6 @@
 
 #include "hw.h"
 #include "fdc.h"
-#include "block.h"
 #include "qemu-timer.h"
 #include "isa.h"
 #include "sysbus.h"
hw/fdc.h +1 -1
index c48b5e0..b6b3772 100644
@@ -2,7 +2,7 @@
 #define HW_FDC_H
 
 /* fdc.c */
-#include "sysemu.h"
+#include "blockdev.h"
 #define MAX_FD 2
 
 typedef struct FDCtrl FDCtrl;
hw/ide/core.c +0 -2
index 70af1b6..045d18d 100644
@@ -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"
hw/ide/qdev.c +0 -1
index 6231d77..0f9f22e 100644
@@ -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>
hw/lan9118.c +1 -0
index 16d3330..b996dc4 100644
@@ -10,6 +10,7 @@
 #include "sysbus.h"
 #include "net.h"
 #include "devices.h"
+#include "sysemu.h"
 /* For crc32 */
 #include <zlib.h>
 
hw/nand.c +1 -2
index 40d5a6a..cd7444f 100644
@@ -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
hw/omap2.c +2 -0
index bd1b35e..666c15a 100644
@@ -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"
hw/onenand.c +1 -2
index c1e7e4d..4118db9 100644
@@ -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
hw/parallel.c +1 -0
index be8e2d5..6b11672 100644
@@ -26,6 +26,7 @@
 #include "qemu-char.h"
 #include "isa.h"
 #include "pc.h"
+#include "sysemu.h"
 
 //#define DEBUG_PARALLEL
 
hw/pc.c +1 -0
index 9b85c42..6e7c468 100644
@@ -35,6 +35,7 @@
 #include "elf.h"
 #include "multiboot.h"
 #include "mc146818rtc.h"
+#include "sysemu.h"
 
 /* output Bochs bios info messages */
 //#define DEBUG_BIOS
hw/pc_piix.c +1 -0
index 70f563a..dc46846 100644
@@ -32,6 +32,7 @@
 #include "boards.h"
 #include "ide.h"
 #include "kvm.h"
+#include "sysemu.h"
 
 #define MAX_IDE_BUS 2
 
hw/pci-hotplug.c +0 -2
index a8f3df1..c39e640 100644
@@ -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"
hw/pcmcia.h +1 -1
index cf2db9d..3602923 100644
@@ -1,7 +1,7 @@
 /* PCMCIA/Cardbus */
 
 #include "qemu-common.h"
-#include "sysemu.h"
+#include "blockdev.h"
 
 typedef struct {
     qemu_irq irq;
hw/qdev-properties.c +0 -1
index 48a6b45..5a8739d 100644
@@ -1,4 +1,3 @@
-#include "sysemu.h"
 #include "net.h"
 #include "qdev.h"
 #include "qerror.h"
hw/qdev.h +1 -1
index 0ad6c95..be5ad67 100644
@@ -2,7 +2,7 @@
 #define QDEV_H
 
 #include "hw.h"
-#include "sysemu.h"
+#include "blockdev.h"
 #include "qemu-queue.h"
 #include "qemu-char.h"
 #include "qemu-option.h"
hw/scsi-bus.c +0 -1
index 383240b..055a94d 100644
@@ -2,7 +2,6 @@
 #include "qemu-error.h"
 #include "scsi.h"
 #include "scsi-defs.h"
-#include "block.h"
 #include "qdev.h"
 
 static struct BusInfo scsi_bus_info = {
hw/scsi-disk.c +1 -1
index a3559d1..a9bf7d2 100644
@@ -33,9 +33,9 @@ do { fprintf(stderr, "scsi-disk: " fmt , ## __VA_ARGS__); } while (0)
 
 #include "qemu-common.h"
 #include "qemu-error.h"
-#include "block.h"
 #include "scsi.h"
 #include "scsi-defs.h"
+#include "sysemu.h"
 
 #define SCSI_DMA_BUF_SIZE    131072
 #define SCSI_MAX_INQUIRY_LEN 256
hw/scsi-generic.c +0 -1
index c9aa853..e31060e 100644
@@ -13,7 +13,6 @@
 
 #include "qemu-common.h"
 #include "qemu-error.h"
-#include "block.h"
 #include "scsi.h"
 
 #ifdef __linux__
hw/serial.c +1 -0
index 9102edb..c7e4e77 100644
@@ -27,6 +27,7 @@
 #include "isa.h"
 #include "pc.h"
 #include "qemu-timer.h"
+#include "sysemu.h"
 
 //#define DEBUG_SERIAL
 
hw/usb-hid.c +1 -0
index 8e6c6e0..228d0a0 100644
@@ -25,6 +25,7 @@
 #include "hw.h"
 #include "console.h"
 #include "usb.h"
+#include "sysemu.h"
 
 /* HID interface requests */
 #define GET_REPORT   0xa101
hw/usb-msd.c +1 -1
index 0ba4a64..003bd8a 100644
@@ -11,10 +11,10 @@
 #include "qemu-option.h"
 #include "qemu-config.h"
 #include "usb.h"
-#include "block.h"
 #include "scsi.h"
 #include "console.h"
 #include "monitor.h"
+#include "sysemu.h"
 
 //#define DEBUG_MSD
 
hw/virtio-blk.c +0 -2
index 80d51c4..cdcb492 100644
@@ -12,9 +12,7 @@
  */
 
 #include <qemu-common.h>
-#include <sysemu.h>
 #include "virtio-blk.h"
-#include "block_int.h"
 #ifdef __linux__
 # include <scsi/sg.h>
 #endif
hw/virtio-pci.c +0 -1
index 7ddf612..e101fa0 100644
@@ -22,7 +22,6 @@
 #include "qemu-error.h"
 #include "msix.h"
 #include "net.h"
-#include "block_int.h"
 #include "loader.h"
 #include "kvm.h"
 
monitor.c +1 -103

122 lines not on this page · raw message

qemu-char.c +0 -1
index faaf624..87628ea 100644
@@ -28,7 +28,6 @@
 #include "sysemu.h"
 #include "qemu-timer.h"
 #include "qemu-char.h"
-#include "block.h"
 #include "hw/usb.h"
 #include "hw/baum.h"
 #include "hw/msmouse.h"
savevm.c +1 -1
index dc20390..18852cd 100644
@@ -77,7 +77,7 @@
 #include "sysemu.h"
 #include "qemu-timer.h"
 #include "qemu-char.h"
-#include "block.h"
+#include "blockdev.h"
 #include "audio/audio.h"
 #include "migration.h"
 #include "qemu_socket.h"
sysemu.h +0 -49

55 lines not on this page · raw message

vl.c +1 -482

501 lines not on this page · raw message

Signature · 1 line
1.6.6.1