diff mbox

[v2,2/3] block: use defaults of bdrv_* callbacks in raw

Message ID 20170629184320.7151-3-el13635@mail.ntua.gr (mailing list archive)
State New, archived
Headers show

Commit Message

Manos Pitsidianakis June 29, 2017, 6:43 p.m. UTC
Now that passing the call to bs->file is the default for some bdrv_*
callbacks, remove the duplicate implementations in block/raw-format.c

Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr>
---
 block/raw-format.c | 32 +-------------------------------
 1 file changed, 1 insertion(+), 31 deletions(-)

Comments

Eric Blake July 3, 2017, 4:05 p.m. UTC | #1
On 06/29/2017 01:43 PM, Manos Pitsidianakis wrote:
> Now that passing the call to bs->file is the default for some bdrv_*
> callbacks, remove the duplicate implementations in block/raw-format.c
> 
> Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr>
> ---
>  block/raw-format.c | 32 +-------------------------------
>  1 file changed, 1 insertion(+), 31 deletions(-)
> 

> @@ -479,16 +454,11 @@ BlockDriver bdrv_raw = {
>      .bdrv_truncate        = &raw_truncate,
>      .bdrv_getlength       = &raw_getlength,
>      .has_variable_length  = true,
> -    .bdrv_get_info        = &raw_get_info,
>      .bdrv_refresh_limits  = &raw_refresh_limits,
>      .bdrv_probe_blocksizes = &raw_probe_blocksizes,
>      .bdrv_probe_geometry  = &raw_probe_geometry,
> -    .bdrv_media_changed   = &raw_media_changed,
> -    .bdrv_eject           = &raw_eject,
> -    .bdrv_lock_medium     = &raw_lock_medium,
>      .bdrv_co_ioctl        = &raw_co_ioctl,
> -    .create_opts          = &raw_create_opts,
> -    .bdrv_has_zero_init   = &raw_has_zero_init
> +    .create_opts          = &raw_create_opts

Please use a trailing comma here. It causes less churn in future patches
if you don't have to have a -/+ line pair just re-adding the comma.
(Yes, we didn't have a trailing comma, but we should have had one; your
patch is now the chance to make it so).

With that fixed, you can add:
Reviewed-by: Eric Blake <eblake@redhat.com>
Stefan Hajnoczi July 6, 2017, 9:40 a.m. UTC | #2
On Thu, Jun 29, 2017 at 09:43:19PM +0300, Manos Pitsidianakis wrote:
> Now that passing the call to bs->file is the default for some bdrv_*
> callbacks, remove the duplicate implementations in block/raw-format.c
> 
> Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr>
> ---
>  block/raw-format.c | 32 +-------------------------------
>  1 file changed, 1 insertion(+), 31 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
diff mbox

Patch

diff --git a/block/raw-format.c b/block/raw-format.c
index 1ea8c2d7..ff9b4359 100644
--- a/block/raw-format.c
+++ b/block/raw-format.c
@@ -312,11 +312,6 @@  static int64_t raw_getlength(BlockDriverState *bs)
     return s->size;
 }
 
-static int raw_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
-{
-    return bdrv_get_info(bs->file->bs, bdi);
-}
-
 static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
 {
     if (bs->probed) {
@@ -346,21 +341,6 @@  static int raw_truncate(BlockDriverState *bs, int64_t offset, Error **errp)
     return bdrv_truncate(bs->file, offset, errp);
 }
 
-static int raw_media_changed(BlockDriverState *bs)
-{
-    return bdrv_media_changed(bs->file->bs);
-}
-
-static void raw_eject(BlockDriverState *bs, bool eject_flag)
-{
-    bdrv_eject(bs->file->bs, eject_flag);
-}
-
-static void raw_lock_medium(BlockDriverState *bs, bool locked)
-{
-    bdrv_lock_medium(bs->file->bs, locked);
-}
-
 static int raw_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
 {
     BDRVRawState *s = bs->opaque;
@@ -370,11 +350,6 @@  static int raw_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
     return bdrv_co_ioctl(bs->file->bs, req, buf);
 }
 
-static int raw_has_zero_init(BlockDriverState *bs)
-{
-    return bdrv_has_zero_init(bs->file->bs);
-}
-
 static int raw_create(const char *filename, QemuOpts *opts, Error **errp)
 {
     return bdrv_create_file(filename, opts, errp);
@@ -479,16 +454,11 @@  BlockDriver bdrv_raw = {
     .bdrv_truncate        = &raw_truncate,
     .bdrv_getlength       = &raw_getlength,
     .has_variable_length  = true,
-    .bdrv_get_info        = &raw_get_info,
     .bdrv_refresh_limits  = &raw_refresh_limits,
     .bdrv_probe_blocksizes = &raw_probe_blocksizes,
     .bdrv_probe_geometry  = &raw_probe_geometry,
-    .bdrv_media_changed   = &raw_media_changed,
-    .bdrv_eject           = &raw_eject,
-    .bdrv_lock_medium     = &raw_lock_medium,
     .bdrv_co_ioctl        = &raw_co_ioctl,
-    .create_opts          = &raw_create_opts,
-    .bdrv_has_zero_init   = &raw_has_zero_init
+    .create_opts          = &raw_create_opts
 };
 
 static void bdrv_raw_init(void)