From patchwork Tue Jul 6 12:37:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 58014 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 157A3B6EEF for ; Tue, 6 Jul 2010 22:45:55 +1000 (EST) Received: from localhost ([127.0.0.1]:52572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OW7X6-00028v-AX for incoming@patchwork.ozlabs.org; Tue, 06 Jul 2010 08:45:52 -0400 Received: from [140.186.70.92] (port=46834 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OW7PO-0005yF-KV for qemu-devel@nongnu.org; Tue, 06 Jul 2010 08:37:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OW7PM-00080d-PQ for qemu-devel@nongnu.org; Tue, 06 Jul 2010 08:37:54 -0400 Received: from oxygen.pond.sub.org ([213.239.205.148]:60890) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OW7PM-00080T-HO for qemu-devel@nongnu.org; Tue, 06 Jul 2010 08:37:52 -0400 Received: from blackfin.pond.sub.org (pD9E3954B.dip.t-dialin.net [217.227.149.75]) by oxygen.pond.sub.org (Postfix) with ESMTPA id 77EA92DD3C5; Tue, 6 Jul 2010 14:37:50 +0200 (CEST) Received: by blackfin.pond.sub.org (Postfix, from userid 500) id 8998B423; Tue, 6 Jul 2010 14:37:49 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 6 Jul 2010 14:37:49 +0200 Message-Id: <1278419869-26126-9-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1278419869-26126-1-git-send-email-armbru@redhat.com> References: <1278419869-26126-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: kwolf@redhat.com, kraxel@redhat.com, hch@lst.de Subject: [Qemu-devel] [PATCH 8/8] block: Remove type hint X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org No users left. bdrv_set_type_hint() can make the media removable by side effect. Make that explicit. Signed-off-by: Markus Armbruster --- block.c | 12 ------------ block.h | 5 ----- block_int.h | 1 - blockdev.c | 4 ++-- 4 files changed, 2 insertions(+), 20 deletions(-) diff --git a/block.c b/block.c index 6d419b9..5d3c676 100644 --- a/block.c +++ b/block.c @@ -1260,13 +1260,6 @@ void bdrv_set_geometry_hint(BlockDriverState *bs, bs->secs = secs; } -void bdrv_set_type_hint(BlockDriverState *bs, int type) -{ - bs->type = type; - bs->removable = ((type == BDRV_TYPE_CDROM || - type == BDRV_TYPE_FLOPPY)); -} - void bdrv_set_translation_hint(BlockDriverState *bs, int translation) { bs->translation = translation; @@ -1280,11 +1273,6 @@ void bdrv_get_geometry_hint(BlockDriverState *bs, *psecs = bs->secs; } -int bdrv_get_type_hint(BlockDriverState *bs) -{ - return bs->type; -} - int bdrv_get_translation_hint(BlockDriverState *bs) { return bs->translation; diff --git a/block.h b/block.h index c2a7e4c..4471b96 100644 --- a/block.h +++ b/block.h @@ -150,9 +150,6 @@ int bdrv_has_zero_init(BlockDriverState *bs); int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum); -#define BDRV_TYPE_HD 0 -#define BDRV_TYPE_CDROM 1 -#define BDRV_TYPE_FLOPPY 2 #define BIOS_ATA_TRANSLATION_AUTO 0 #define BIOS_ATA_TRANSLATION_NONE 1 #define BIOS_ATA_TRANSLATION_LBA 2 @@ -161,11 +158,9 @@ int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, void bdrv_set_geometry_hint(BlockDriverState *bs, int cyls, int heads, int secs); -void bdrv_set_type_hint(BlockDriverState *bs, int type); void bdrv_set_translation_hint(BlockDriverState *bs, int translation); void bdrv_get_geometry_hint(BlockDriverState *bs, int *pcyls, int *pheads, int *psecs); -int bdrv_get_type_hint(BlockDriverState *bs); int bdrv_get_translation_hint(BlockDriverState *bs); void bdrv_set_on_error(BlockDriverState *bs, BlockErrorAction on_read_error, BlockErrorAction on_write_error); diff --git a/block_int.h b/block_int.h index 877e1e5..df06409 100644 --- a/block_int.h +++ b/block_int.h @@ -186,7 +186,6 @@ struct BlockDriverState { /* NOTE: the following infos are only hints for real hardware drivers. They are not used by the block driver */ int cyls, heads, secs, translation; - int type; BlockErrorAction on_read_error, on_write_error; char device_name[32]; unsigned long *dirty_bitmap; diff --git a/blockdev.c b/blockdev.c index 02b4c22..506a68c 100644 --- a/blockdev.c +++ b/blockdev.c @@ -436,7 +436,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, int *fatal_error) } break; case MEDIA_CDROM: - bdrv_set_type_hint(dinfo->bdrv, BDRV_TYPE_CDROM); + bdrv_set_removable(dinfo->bdrv, 1); dinfo->media_cd = 1; break; } @@ -445,7 +445,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi, int *fatal_error) /* FIXME: This isn't really a floppy, but it's a reasonable approximation. */ case IF_FLOPPY: - bdrv_set_type_hint(dinfo->bdrv, BDRV_TYPE_FLOPPY); + bdrv_set_removable(dinfo->bdrv, 1); break; case IF_PFLASH: case IF_MTD: