From patchwork Wed Jul 11 13:08:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 170462 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 837AD2C0210 for ; Wed, 11 Jul 2012 23:09:19 +1000 (EST) Received: from localhost ([::1]:34748 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SowfN-00063r-7M for incoming@patchwork.ozlabs.org; Wed, 11 Jul 2012 09:09:17 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57702) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sowf2-0005nY-U6 for qemu-devel@nongnu.org; Wed, 11 Jul 2012 09:09:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sower-0002Bs-Kg for qemu-devel@nongnu.org; Wed, 11 Jul 2012 09:08:56 -0400 Received: from oxygen.pond.sub.org ([78.46.104.156]:42133) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sower-0002BN-AY for qemu-devel@nongnu.org; Wed, 11 Jul 2012 09:08:45 -0400 Received: from blackfin.pond.sub.org (p57B0F3EA.dip.t-dialin.net [87.176.243.234]) by oxygen.pond.sub.org (Postfix) with ESMTPA id C0D4D9FE4F for ; Wed, 11 Jul 2012 15:08:40 +0200 (CEST) Received: by blackfin.pond.sub.org (Postfix, from userid 500) id 24A626009B; Wed, 11 Jul 2012 15:08:40 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Wed, 11 Jul 2012 15:08:36 +0200 Message-Id: <1342012119-27088-2-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.7.6.5 In-Reply-To: <1342012119-27088-1-git-send-email-armbru@redhat.com> References: <1342012119-27088-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 78.46.104.156 Cc: kwolf@redhat.com Subject: [Qemu-devel] [PATCH 1/4] hw/block-common: Move BlockConf & friends from block.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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"