From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefano.stabellini@eu.citrix.com,
lcapitulino@redhat.com, hare@suse.de, amit.shah@redhat.com,
pbonzini@redhat.com, hch@lst.de
Subject: [Qemu-devel] [PATCH v3 21/27] block: Move BlockConf & friends from block_int.h to block.h
Date: Tue, 6 Sep 2011 18:58:54 +0200 [thread overview]
Message-ID: <1315328340-6192-22-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1315328340-6192-1-git-send-email-armbru@redhat.com>
It's convenience stuff for block device models, so block.h isn't the
ideal home either, but better than block_int.h.
Permits moving some #include "block_int.h" from device model .h into
.c.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
block.h | 38 ++++++++++++++++++++++++++++++++++++++
block_int.h | 35 -----------------------------------
hw/ide/core.c | 1 +
hw/ide/internal.h | 1 -
hw/scsi-disk.c | 1 +
hw/scsi.h | 1 -
hw/virtio-blk.c | 1 +
hw/virtio.h | 2 +-
8 files changed, 42 insertions(+), 38 deletions(-)
diff --git a/block.h b/block.h
index 9f6d02c..6e0c468 100644
--- a/block.h
+++ b/block.h
@@ -350,5 +350,43 @@ 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;
+} 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_UINT16("logical_block_size", _state, \
+ _conf.logical_block_size, 512), \
+ DEFINE_PROP_UINT16("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)
+
#endif
diff --git a/block_int.h b/block_int.h
index f30563d..8c3b863 100644
--- a/block_int.h
+++ b/block_int.h
@@ -225,39 +225,4 @@ void qemu_aio_release(void *p);
int is_windows_drive(const char *filename);
#endif
-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;
-} 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_UINT16("logical_block_size", _state, \
- _conf.logical_block_size, 512), \
- DEFINE_PROP_UINT16("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)
-
#endif /* BLOCK_INT_H */
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 84d4c4f..2f0f6d4 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -30,6 +30,7 @@
#include "sysemu.h"
#include "dma.h"
#include "blockdev.h"
+#include "block_int.h"
#include <hw/ide/internal.h>
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index 663db39..233915c 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -7,7 +7,6 @@
* non-internal declarations are in hw/ide.h
*/
#include <hw/ide.h>
-#include "block_int.h"
#include "iorange.h"
#include "dma.h"
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index f48ca8b..d44b3b8 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -37,6 +37,7 @@ do { fprintf(stderr, "scsi-disk: " fmt , ## __VA_ARGS__); } while (0)
#include "scsi-defs.h"
#include "sysemu.h"
#include "blockdev.h"
+#include "block_int.h"
#define SCSI_DMA_BUF_SIZE 131072
#define SCSI_MAX_INQUIRY_LEN 256
diff --git a/hw/scsi.h b/hw/scsi.h
index a28cd68..e8dcabf 100644
--- a/hw/scsi.h
+++ b/hw/scsi.h
@@ -3,7 +3,6 @@
#include "qdev.h"
#include "block.h"
-#include "block_int.h"
#define MAX_SCSI_DEVS 255
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index c464bbd..4876555 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -15,6 +15,7 @@
#include "qemu-error.h"
#include "trace.h"
#include "blockdev.h"
+#include "block_int.h"
#include "virtio-blk.h"
#ifdef __linux__
# include <scsi/sg.h>
diff --git a/hw/virtio.h b/hw/virtio.h
index c129264..4d20d9b 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -18,7 +18,7 @@
#include "net.h"
#include "qdev.h"
#include "sysemu.h"
-#include "block_int.h"
+#include "block.h"
#include "event_notifier.h"
#ifdef CONFIG_LINUX
#include "9p.h"
--
1.7.6
next prev parent reply other threads:[~2011-09-06 16:59 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-06 16:58 [Qemu-devel] [PATCH v3 00/27] Block layer cleanup & fixes Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 01/27] ide: Fix ATA command READ to set ATAPI signature for CD-ROM Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 02/27] ide: Use a table to declare which drive kinds accept each command Markus Armbruster
2011-09-07 15:40 ` Kevin Wolf
2011-09-08 7:05 ` Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 03/27] ide: Reject ATA commands specific to drive kinds Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 04/27] ide/atapi: Clean up misleading name in cmd_start_stop_unit() Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 05/27] ide/atapi: Track tray open/close state Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 06/27] scsi-disk: Factor out scsi_disk_emulate_start_stop() Markus Armbruster
2011-09-07 7:04 ` Paolo Bonzini
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 07/27] scsi-disk: Track tray open/close state Markus Armbruster
2011-09-07 7:05 ` Paolo Bonzini
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 08/27] block: Revert entanglement of bdrv_is_inserted() with tray status Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 09/27] block: Drop tray status tracking, no longer used Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 10/27] ide/atapi: Track tray locked state Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 11/27] scsi-disk: " Markus Armbruster
2011-09-07 7:05 ` Paolo Bonzini
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 12/27] block: Leave enforcing tray lock to device models Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 13/27] block: Drop medium lock tracking, ask device models instead Markus Armbruster
2011-09-07 7:06 ` Paolo Bonzini
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 14/27] block: Rename bdrv_set_locked() to bdrv_lock_medium() Markus Armbruster
2011-09-07 15:53 ` Kevin Wolf
2011-09-08 7:06 ` Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 15/27] ide/atapi: Don't fail eject when tray is already open Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 16/27] scsi-disk: Fix START_STOP to fail when it can't eject Markus Armbruster
2011-09-07 7:08 ` Paolo Bonzini
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 17/27] ide/atapi: Preserve tray state on migration Markus Armbruster
2011-09-07 7:14 ` Paolo Bonzini
2011-09-07 7:35 ` Kevin Wolf
2011-09-07 8:00 ` Paolo Bonzini
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 18/27] block: Clean up remaining users of "removable" Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 19/27] block: Drop BlockDriverState member removable Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 20/27] block: Show whether the virtual tray is open in info block Markus Armbruster
2011-09-06 16:58 ` Markus Armbruster [this message]
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 22/27] hw: Trim superfluous #include "block_int.h" Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 23/27] block: New bdrv_set_buffer_alignment() Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 24/27] block: Reset buffer alignment on detach Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 25/27] nbd: Clean up use of block_int.h Markus Armbruster
2011-09-06 16:58 ` [Qemu-devel] [PATCH v3 26/27] block: New change_media_cb() parameter load Markus Armbruster
2011-09-06 16:59 ` [Qemu-devel] [PATCH v3 27/27] ide/atapi scsi-disk: Make monitor eject -f, then change work Markus Armbruster
2011-09-07 7:09 ` Paolo Bonzini
2011-09-08 11:40 ` [Qemu-devel] [PATCH v3 00/27] Block layer cleanup & fixes 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=1315328340-6192-22-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=amit.shah@redhat.com \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefano.stabellini@eu.citrix.com \
/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).