From: Kevin Wolf <kwolf@redhat.com>
To: anthony@codemonkey.ws
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 32/41] hw/block-common: Move BlockConf & friends from block.h
Date: Tue, 17 Jul 2012 18:00:29 +0200 [thread overview]
Message-ID: <1342540838-9027-33-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1342540838-9027-1-git-send-email-kwolf@redhat.com>
From: Markus Armbruster <armbru@redhat.com>
This stuff doesn't belong to block layer, and was put there only
because a better home didn't exist then. Now it does.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block.h | 45 ---------------------------------------------
hw/block-common.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
hw/ide/internal.h | 1 +
hw/scsi.h | 1 +
hw/usb.h | 1 -
hw/virtio-blk.h | 2 +-
hw/virtio.h | 1 -
7 files changed, 48 insertions(+), 48 deletions(-)
diff --git a/block.h b/block.h
index 29c5eab..c89590d 100644
--- a/block.h
+++ b/block.h
@@ -403,49 +403,4 @@ typedef enum {
#define BLKDBG_EVENT(bs, evt) bdrv_debug_event(bs, evt)
void bdrv_debug_event(BlockDriverState *bs, BlkDebugEvent event);
-
-/* Convenience for block device models */
-
-typedef struct BlockConf {
- BlockDriverState *bs;
- uint16_t physical_block_size;
- uint16_t logical_block_size;
- uint16_t min_io_size;
- uint32_t opt_io_size;
- int32_t bootindex;
- uint32_t discard_granularity;
- /* geometry, not all devices use this */
- uint32_t cyls, heads, secs;
-} BlockConf;
-
-static inline unsigned int get_physical_block_exp(BlockConf *conf)
-{
- unsigned int exp = 0, size;
-
- for (size = conf->physical_block_size;
- size > conf->logical_block_size;
- size >>= 1) {
- exp++;
- }
-
- return exp;
-}
-
-#define DEFINE_BLOCK_PROPERTIES(_state, _conf) \
- DEFINE_PROP_DRIVE("drive", _state, _conf.bs), \
- DEFINE_PROP_BLOCKSIZE("logical_block_size", _state, \
- _conf.logical_block_size, 512), \
- DEFINE_PROP_BLOCKSIZE("physical_block_size", _state, \
- _conf.physical_block_size, 512), \
- DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0), \
- DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0), \
- DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1), \
- DEFINE_PROP_UINT32("discard_granularity", _state, \
- _conf.discard_granularity, 0)
-
-#define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf) \
- DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0), \
- DEFINE_PROP_UINT32("heads", _state, _conf.heads, 0), \
- DEFINE_PROP_UINT32("secs", _state, _conf.secs, 0)
-
#endif
diff --git a/hw/block-common.h b/hw/block-common.h
index 31e12ba..f0d509b 100644
--- a/hw/block-common.h
+++ b/hw/block-common.h
@@ -13,6 +13,51 @@
#include "qemu-common.h"
+/* Configuration */
+
+typedef struct BlockConf {
+ BlockDriverState *bs;
+ uint16_t physical_block_size;
+ uint16_t logical_block_size;
+ uint16_t min_io_size;
+ uint32_t opt_io_size;
+ int32_t bootindex;
+ uint32_t discard_granularity;
+ /* geometry, not all devices use this */
+ uint32_t cyls, heads, secs;
+} BlockConf;
+
+static inline unsigned int get_physical_block_exp(BlockConf *conf)
+{
+ unsigned int exp = 0, size;
+
+ for (size = conf->physical_block_size;
+ size > conf->logical_block_size;
+ size >>= 1) {
+ exp++;
+ }
+
+ return exp;
+}
+
+#define DEFINE_BLOCK_PROPERTIES(_state, _conf) \
+ DEFINE_PROP_DRIVE("drive", _state, _conf.bs), \
+ DEFINE_PROP_BLOCKSIZE("logical_block_size", _state, \
+ _conf.logical_block_size, 512), \
+ DEFINE_PROP_BLOCKSIZE("physical_block_size", _state, \
+ _conf.physical_block_size, 512), \
+ DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0), \
+ DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0), \
+ DEFINE_PROP_INT32("bootindex", _state, _conf.bootindex, -1), \
+ DEFINE_PROP_UINT32("discard_granularity", _state, \
+ _conf.discard_granularity, 0)
+
+#define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf) \
+ DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0), \
+ DEFINE_PROP_UINT32("heads", _state, _conf.heads, 0), \
+ DEFINE_PROP_UINT32("secs", _state, _conf.secs, 0)
+
+
/* Hard disk geometry */
#define BIOS_ATA_TRANSLATION_AUTO 0
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index c3ecafc..7170bd9 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -11,6 +11,7 @@
#include "iorange.h"
#include "dma.h"
#include "sysemu.h"
+#include "hw/block-common.h"
#include "hw/scsi-defs.h"
/* debug IDE devices */
diff --git a/hw/scsi.h b/hw/scsi.h
index 76f06d4..d90e970 100644
--- a/hw/scsi.h
+++ b/hw/scsi.h
@@ -3,6 +3,7 @@
#include "qdev.h"
#include "block.h"
+#include "hw/block-common.h"
#include "sysemu.h"
#define MAX_SCSI_DEVS 255
diff --git a/hw/usb.h b/hw/usb.h
index 7ed8fb8..432ccae 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -25,7 +25,6 @@
* THE SOFTWARE.
*/
-#include "block.h"
#include "qdev.h"
#include "qemu-queue.h"
diff --git a/hw/virtio-blk.h b/hw/virtio-blk.h
index d785001..79ebccc 100644
--- a/hw/virtio-blk.h
+++ b/hw/virtio-blk.h
@@ -15,7 +15,7 @@
#define _QEMU_VIRTIO_BLK_H
#include "virtio.h"
-#include "block.h"
+#include "hw/block-common.h"
/* from Linux's linux/virtio_blk.h */
diff --git a/hw/virtio.h b/hw/virtio.h
index 85aabe5..42a7762 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -18,7 +18,6 @@
#include "net.h"
#include "qdev.h"
#include "sysemu.h"
-#include "block.h"
#include "event_notifier.h"
#ifdef CONFIG_LINUX
#include "9p.h"
--
1.7.6.5
next prev parent reply other threads:[~2012-07-17 16:01 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-17 15:59 [Qemu-devel] [PULL 00/41] Block patches Kevin Wolf
2012-07-17 15:59 ` [Qemu-devel] [PATCH 01/41] sheepdog: always use coroutine-based network functions Kevin Wolf
2012-07-17 15:59 ` [Qemu-devel] [PATCH 02/41] sheepdog: do not blindly memset all read buffers Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 03/41] fdc: Move floppy geometry guessing back from block.c Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 04/41] vvfat: Fix partition table Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 05/41] vvfat: Do not clobber the user's geometry Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 06/41] qtest: Add hard disk geometry test Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 07/41] hd-geometry: Move disk geometry guessing back from block.c Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 08/41] hd-geometry: Add tracepoints Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 09/41] hd-geometry: Unnest conditional in hd_geometry_guess() Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 10/41] hd-geometry: Factor out guess_chs_for_size() Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 11/41] hd-geometry: Clean up gratuitous goto in hd_geometry_guess() Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 12/41] hd-geometry: Clean up confusing use of prior translation hint Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 13/41] hd-geometry: Cut out block layer translation middleman Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 14/41] ide pc: Cut out the block layer geometry middleman Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 15/41] blockdev: Save geometry in DriveInfo Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 16/41] qdev: Introduce block geometry properties Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 17/41] hd-geometry: Switch to uint32_t to match BlockConf Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 18/41] scsi-hd: qdev properties for disk geometry Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 19/41] virtio-blk: " Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 20/41] ide: " Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 21/41] qtest: Cover " Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 22/41] qdev: Collect private helpers in one place Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 23/41] qdev: New property type chs-translation Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 24/41] ide: qdev property for BIOS CHS translation Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 25/41] qtest: Cover " Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 26/41] block: Geometry and translation hints are now useless, purge them Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 27/41] ide pc: Put hard disk info into CMOS only for hard disks Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 28/41] qtest: Test we don't put hard disk info into CMOS for a CD-ROM Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 29/41] hd-geometry: Compute BIOS CHS translation in one place Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 30/41] blockdev: Drop redundant CHS validation for if=ide Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 31/41] Relax IDE CHS limits from 16383, 16, 63 to 65535, 16, 255 Kevin Wolf
2012-07-17 16:00 ` Kevin Wolf [this message]
2012-07-17 16:00 ` [Qemu-devel] [PATCH 33/41] hw/block-common: Factor out fall back to legacy -drive serial= Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 34/41] blockdev: Don't limit DriveInfo serial to 20 characters Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 35/41] hw/block-common: Factor out fall back to legacy -drive cyls= Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 36/41] qemu-io: Fix memory leaks Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 37/41] coroutine-ucontext: Help valgrind understand coroutines Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 38/41] qemu-iotests: Valgrind support Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 39/41] fdc: fix relative seek Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 40/41] fdc-test: introduce test_relative_seek Kevin Wolf
2012-07-17 16:00 ` [Qemu-devel] [PATCH 41/41] fdc-test: Clean up a bit Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1342540838-9027-33-git-send-email-kwolf@redhat.com \
--to=kwolf@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).