Patchwork [3/4] block/raw: add .bdrv_get_info

login
register
mail settings
Submitter Peter Lieven
Date July 15, 2013, 10:49 a.m.
Message ID <1373885375-13601-4-git-send-email-pl@kamp.de>
Download mbox | patch
Permalink /patch/258993/
State New
Headers show

Comments

Peter Lieven - July 15, 2013, 10:49 a.m.
Signed-off-by: Peter Lieven <pl@kamp.de>
---
 block/raw.c |    6 ++++++
 1 file changed, 6 insertions(+)
Stefan Hajnoczi - July 19, 2013, 5:12 a.m.
On Mon, Jul 15, 2013 at 12:49:34PM +0200, Peter Lieven wrote:
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
>  block/raw.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/block/raw.c b/block/raw.c
> index 8c81de9..f1682d4 100644
> --- a/block/raw.c
> +++ b/block/raw.c
> @@ -121,6 +121,11 @@ static int raw_has_zero_init(BlockDriverState *bs)
>      return bdrv_has_zero_init(bs->file);
>  }
>  
> +static int raw_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
> +{
> +    return bdrv_get_info(bs->file, bdi);
> +}
> +
>  static BlockDriver bdrv_raw = {
>      .format_name        = "raw",
>  
> @@ -140,6 +145,7 @@ static BlockDriver bdrv_raw = {
>  
>      .bdrv_probe         = raw_probe,
>      .bdrv_getlength     = raw_getlength,
> +    .bdrv_get_info      = raw_get_info,

I checked BlockDriverInfo to make sure the fields still make sense for
the raw BlockDriverState.  The vm_state_offset field is questionable,
since the raw BDS doesn't know about vmstate and you certainly cannot
write to it.  If protocols start supporting vmstate we might have to
rework that anyway, so I'm happy with this patch.

Stefan

Patch

diff --git a/block/raw.c b/block/raw.c
index 8c81de9..f1682d4 100644
--- a/block/raw.c
+++ b/block/raw.c
@@ -121,6 +121,11 @@  static int raw_has_zero_init(BlockDriverState *bs)
     return bdrv_has_zero_init(bs->file);
 }
 
+static int raw_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
+{
+    return bdrv_get_info(bs->file, bdi);
+}
+
 static BlockDriver bdrv_raw = {
     .format_name        = "raw",
 
@@ -140,6 +145,7 @@  static BlockDriver bdrv_raw = {
 
     .bdrv_probe         = raw_probe,
     .bdrv_getlength     = raw_getlength,
+    .bdrv_get_info      = raw_get_info,
     .bdrv_truncate      = raw_truncate,
 
     .bdrv_is_inserted   = raw_is_inserted,