From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, kraxel@redhat.com, hch@lst.de
Subject: [Qemu-devel] [PATCH 8/8] block: Remove type hint
Date: Tue, 6 Jul 2010 14:37:49 +0200 [thread overview]
Message-ID: <1278419869-26126-9-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1278419869-26126-1-git-send-email-armbru@redhat.com>
No users left.
bdrv_set_type_hint() can make the media removable by side effect.
Make that explicit.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
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:
--
1.6.6.1
next prev parent reply other threads:[~2010-07-06 12:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-06 12:37 [Qemu-devel] [PATCH 0/8] Split ide-drive and scsi-disk qdevs, and more Markus Armbruster
2010-07-06 12:37 ` [Qemu-devel] [PATCH 1/8] virtio-pci: Check for virtio_blk_init() failure Markus Armbruster
2010-07-07 1:32 ` [Qemu-devel] " Christoph Hellwig
2010-07-06 12:37 ` [Qemu-devel] [PATCH 2/8] virtio-blk: Fix virtio-blk-s390 to require drive Markus Armbruster
2010-07-07 1:32 ` [Qemu-devel] " Christoph Hellwig
2010-07-06 12:37 ` [Qemu-devel] [PATCH 3/8] ide scsi virtio-blk: Reject empty drives unless media is removable Markus Armbruster
2010-07-07 1:33 ` [Qemu-devel] " Christoph Hellwig
2010-07-06 12:37 ` [Qemu-devel] [PATCH 4/8] block QMP: Drop query-block member "type" (type= in info block) Markus Armbruster
2010-07-06 16:39 ` [Qemu-devel] " Kevin Wolf
2010-07-06 16:45 ` Daniel P. Berrange
2010-07-07 1:33 ` Christoph Hellwig
2010-07-06 12:37 ` [Qemu-devel] [PATCH 5/8] ide: Split qdev "ide-drive" into "ide-hd" and "ide-cd" Markus Armbruster
2010-07-07 1:35 ` [Qemu-devel] " Christoph Hellwig
2010-07-07 10:19 ` Kevin Wolf
2010-07-06 12:37 ` [Qemu-devel] [PATCH 6/8] scsi: Split qdev "scsi-disk" into "scsi-hd" and "scsi-cd" Markus Armbruster
2010-07-07 1:37 ` [Qemu-devel] " Christoph Hellwig
2010-07-07 7:38 ` Kevin Wolf
2010-07-07 9:33 ` Markus Armbruster
2010-07-06 12:37 ` [Qemu-devel] [PATCH 7/8] blockdev: Store -drive option media in DriveInfo Markus Armbruster
2010-07-07 1:38 ` [Qemu-devel] " Christoph Hellwig
2010-07-06 12:37 ` Markus Armbruster [this message]
2010-07-12 9:52 ` [Qemu-devel] Re: [PATCH 0/8] Split ide-drive and scsi-disk qdevs, and more 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=1278419869-26126-9-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=hch@lst.de \
--cc=kraxel@redhat.com \
--cc=kwolf@redhat.com \
--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).