From c3c3bd2c4d8481eed56fdc9a0c01881f9c89aa51 Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Tue, 4 Oct 2011 16:24:48 +0200
Subject: [PATCH 73/76] block: Drop BlockDriverState member removable

RH-Author: Markus Armbruster <armbru@redhat.com>
Message-id: <1317745491-18401-66-git-send-email-armbru@redhat.com>
Patchwork-id: 33642
O-Subject: [PATCH RHEL-6.2 qemu-kvm 65/68] block: Drop BlockDriverState member removable
Bugzilla: 742458
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>

It's a confused mess (see previous commit).  No users remain.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 9e6a4c9177bc95aa04438458d75442e80db9ad33)

Conflicts:

	block.c
	blockdev.c

Conflict in bdrv_set_removable() caused by commit 69ce1679's conflict
resolution.  Conflicts around bdrv_set_type_hint() because we don't
have commit commit 8d278467 block: Remove type hint, it's guest
matter, doesn't belong here.  Resolution keeps the call, but drops its
side effect on removable.
---
 block.c           |    7 -------
 block.h           |    1 -
 block_int.h       |    1 -
 hw/fdc.c          |    1 -
 hw/ide/core.c     |    1 -
 hw/scsi-disk.c    |    1 -
 hw/scsi-generic.c |    1 -
 hw/virtio-blk.c   |    1 -
 8 files changed, 0 insertions(+), 14 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 block.c           |    7 -------
 block.h           |    1 -
 block_int.h       |    1 -
 hw/fdc.c          |    1 -
 hw/ide/core.c     |    1 -
 hw/scsi-disk.c    |    1 -
 hw/scsi-generic.c |    1 -
 hw/virtio-blk.c   |    1 -
 8 files changed, 0 insertions(+), 14 deletions(-)

diff --git a/block.c b/block.c
index bfe724d..dc2c4ea 100644
--- a/block.c
+++ b/block.c
@@ -1317,8 +1317,6 @@ void bdrv_set_geometry_hint(BlockDriverState *bs,
 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)
@@ -1356,11 +1354,6 @@ BlockErrorAction bdrv_get_on_error(BlockDriverState *bs, int is_read)
     return is_read ? bs->on_read_error : bs->on_write_error;
 }
 
-void bdrv_set_removable(BlockDriverState *bs, int removable)
-{
-    bs->removable = removable;
-}
-
 int bdrv_is_read_only(BlockDriverState *bs)
 {
     return bs->read_only;
diff --git a/block.h b/block.h
index a75b404..b5e73ca 100644
--- a/block.h
+++ b/block.h
@@ -206,7 +206,6 @@ int bdrv_get_translation_hint(BlockDriverState *bs);
 void bdrv_set_on_error(BlockDriverState *bs, BlockErrorAction on_read_error,
                        BlockErrorAction on_write_error);
 BlockErrorAction bdrv_get_on_error(BlockDriverState *bs, int is_read);
-void bdrv_set_removable(BlockDriverState *bs, int removable);
 int bdrv_is_read_only(BlockDriverState *bs);
 int bdrv_is_sg(BlockDriverState *bs);
 int bdrv_enable_write_cache(BlockDriverState *bs);
diff --git a/block_int.h b/block_int.h
index f477827..d91ae6b 100644
--- a/block_int.h
+++ b/block_int.h
@@ -147,7 +147,6 @@ struct BlockDriverState {
     int read_only; /* if true, the media is read only */
     int keep_read_only; /* if true, the media was requested to stay read only */
     int open_flags; /* flags used to open the file, re-used for re-open */
-    int removable; /* if true, the media can be removed */
     int encrypted; /* if true, the media is encrypted */
     int valid_key; /* if true, a valid encryption key has been set */
     int sg;        /* if true, the device is a /dev/sg* */
diff --git a/hw/fdc.c b/hw/fdc.c
index a96244e..9d0a764 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1903,7 +1903,6 @@ static void fdctrl_connect_drives(fdctrl_t *fdctrl)
         fd_revalidate(drive);
         if (drive->bs) {
             drive->media_changed = 1;
-            bdrv_set_removable(drive->bs, 1);
             bdrv_set_dev_ops(drive->bs, &fdctrl_block_ops, drive);
         }
     }
diff --git a/hw/ide/core.c b/hw/ide/core.c
index a833684..cfb17c1 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1869,7 +1869,6 @@ int ide_init_drive(IDEState *s, BlockDriverState *bs, const char *version)
         pstrcpy(s->version, sizeof(s->version), QEMU_VERSION);
     }
     ide_reset(s);
-    bdrv_set_removable(bs, s->drive_kind == IDE_CD);
     return 0;
 }
 
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index c93f1a0..8cc2b3e 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -1261,7 +1261,6 @@ static int scsi_initfn(SCSIDevice *dev, uint8_t scsi_type)
 
     s->qdev.type = scsi_type;
     qemu_add_vm_change_state_handler(scsi_dma_restart_cb, s);
-    bdrv_set_removable(s->bs, scsi_type == TYPE_ROM);
     add_boot_device_path(s->qdev.conf.bootindex, &dev->qdev, ",0");
     return 0;
 }
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 37c5982..3ae3a5f 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -494,7 +494,6 @@ static int scsi_generic_initfn(SCSIDevice *dev)
         }
     }
     DPRINTF("block size %d\n", s->qdev.blocksize);
-    bdrv_set_removable(s->bs, 0);
     return 0;
 }
 
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index 0bf7260..241f973 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -583,7 +583,6 @@ VirtIODevice *virtio_blk_init(DeviceState *dev, BlockConf *conf)
     s->qdev = dev;
     register_savevm(dev, "virtio-blk", virtio_blk_id++, 2,
                     virtio_blk_save, virtio_blk_load, s);
-    bdrv_set_removable(s->bs, 0);
     bdrv_set_dev_ops(s->bs, &virtio_block_ops, s);
     s->bs->buffer_alignment = conf->logical_block_size;
 
-- 
1.7.4.4

