Patchwork [11/31] block/raw: Fix to forward method bdrv_media_changed()

login
register
mail settings
Submitter Kevin Wolf
Date Sept. 6, 2011, 3:39 p.m.
Message ID <1315323586-23840-12-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/113592/
State New
Headers show

Comments

Kevin Wolf - Sept. 6, 2011, 3:39 p.m.
From: Markus Armbruster <armbru@redhat.com>

Block driver "raw" forwards most methods to the underlying block
driver.  However, it doesn't implement method bdrv_media_changed().
Makes bdrv_media_changed() always return -ENOTSUP.

I believe -fda /dev/fd0 gives you raw over host_floppy, and disk
change detection (fdc register 7 bit 7) is broken.  Testing my theory
requires a computer museum, though.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/raw.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
Blue Swirl - Sept. 7, 2011, 7:25 p.m.
On Tue, Sep 6, 2011 at 3:39 PM, Kevin Wolf <kwolf@redhat.com> wrote:
> From: Markus Armbruster <armbru@redhat.com>
>
> Block driver "raw" forwards most methods to the underlying block
> driver.  However, it doesn't implement method bdrv_media_changed().
> Makes bdrv_media_changed() always return -ENOTSUP.
>
> I believe -fda /dev/fd0 gives you raw over host_floppy, and disk
> change detection (fdc register 7 bit 7) is broken.  Testing my theory
> requires a computer museum, though.

Or software to emulate ancient computers? Maybe such software could be
already available to you? ;-)

>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  block/raw.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/block/raw.c b/block/raw.c
> index 555db4f..f197479 100644
> --- a/block/raw.c
> +++ b/block/raw.c
> @@ -75,6 +75,11 @@ static int raw_is_inserted(BlockDriverState *bs)
>     return bdrv_is_inserted(bs->file);
>  }
>
> +static int raw_media_changed(BlockDriverState *bs)
> +{
> +    return bdrv_media_changed(bs->file);
> +}
> +
>  static void raw_eject(BlockDriverState *bs, int eject_flag)
>  {
>     bdrv_eject(bs->file, eject_flag);
> @@ -137,8 +142,10 @@ static BlockDriver bdrv_raw = {
>     .bdrv_discard       = raw_discard,
>
>     .bdrv_is_inserted   = raw_is_inserted,
> +    .bdrv_media_changed = raw_media_changed,
>     .bdrv_eject         = raw_eject,
>     .bdrv_set_locked    = raw_set_locked,
> +
>     .bdrv_ioctl         = raw_ioctl,
>     .bdrv_aio_ioctl     = raw_aio_ioctl,
>
> --
> 1.7.6
>
>
>
Kevin Wolf - Sept. 8, 2011, 7:40 a.m.
Am 07.09.2011 21:25, schrieb Blue Swirl:
> On Tue, Sep 6, 2011 at 3:39 PM, Kevin Wolf <kwolf@redhat.com> wrote:
>> From: Markus Armbruster <armbru@redhat.com>
>>
>> Block driver "raw" forwards most methods to the underlying block
>> driver.  However, it doesn't implement method bdrv_media_changed().
>> Makes bdrv_media_changed() always return -ENOTSUP.
>>
>> I believe -fda /dev/fd0 gives you raw over host_floppy, and disk
>> change detection (fdc register 7 bit 7) is broken.  Testing my theory
>> requires a computer museum, though.
> 
> Or software to emulate ancient computers? Maybe such software could be
> already available to you? ;-)

In general, such software is buggy. ;-)

Kevin

Patch

diff --git a/block/raw.c b/block/raw.c
index 555db4f..f197479 100644
--- a/block/raw.c
+++ b/block/raw.c
@@ -75,6 +75,11 @@  static int raw_is_inserted(BlockDriverState *bs)
     return bdrv_is_inserted(bs->file);
 }
 
+static int raw_media_changed(BlockDriverState *bs)
+{
+    return bdrv_media_changed(bs->file);
+}
+
 static void raw_eject(BlockDriverState *bs, int eject_flag)
 {
     bdrv_eject(bs->file, eject_flag);
@@ -137,8 +142,10 @@  static BlockDriver bdrv_raw = {
     .bdrv_discard       = raw_discard,
 
     .bdrv_is_inserted   = raw_is_inserted,
+    .bdrv_media_changed = raw_media_changed,
     .bdrv_eject         = raw_eject,
     .bdrv_set_locked    = raw_set_locked,
+
     .bdrv_ioctl         = raw_ioctl,
     .bdrv_aio_ioctl     = raw_aio_ioctl,