diff mbox

[1/4] monitor: Convert bdrv_find to blk_by_name

Message ID 1425296209-1476-2-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng March 2, 2015, 11:36 a.m. UTC
Signed-off-by: Fam Zheng <famz@redhat.com>
---
 monitor.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Max Reitz March 2, 2015, 3:30 p.m. UTC | #1
On 2015-03-02 at 06:36, Fam Zheng wrote:
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>   monitor.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index 41900da..6ad777d 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -72,6 +72,7 @@
>   #include "block/qapi.h"
>   #include "qapi/qmp-event.h"
>   #include "qapi-event.h"
> +#include "sysemu/block-backend.h"
>   
>   /* for hmp_info_irq/pic */
>   #if defined(TARGET_SPARC)
> @@ -5413,15 +5414,15 @@ int monitor_read_block_device_key(Monitor *mon, const char *device,
>                                     BlockCompletionFunc *completion_cb,
>                                     void *opaque)
>   {
> -    BlockDriverState *bs;
> +    BlockBackend *blk;
>   
> -    bs = bdrv_find(device);
> -    if (!bs) {
> +    blk = blk_by_name(device);
> +    if (!blk) {
>           monitor_printf(mon, "Device not found %s\n", device);
>           return -1;
>       }
>   
> -    return monitor_read_bdrv_key_start(mon, bs, completion_cb, opaque);
> +    return monitor_read_bdrv_key_start(mon, blk_bs(blk), completion_cb, opaque);
>   }
>   
>   QemuOptsList qemu_mon_opts = {

Reviewed-by: Max Reitz <mreitz@redhat.com>
diff mbox

Patch

diff --git a/monitor.c b/monitor.c
index 41900da..6ad777d 100644
--- a/monitor.c
+++ b/monitor.c
@@ -72,6 +72,7 @@ 
 #include "block/qapi.h"
 #include "qapi/qmp-event.h"
 #include "qapi-event.h"
+#include "sysemu/block-backend.h"
 
 /* for hmp_info_irq/pic */
 #if defined(TARGET_SPARC)
@@ -5413,15 +5414,15 @@  int monitor_read_block_device_key(Monitor *mon, const char *device,
                                   BlockCompletionFunc *completion_cb,
                                   void *opaque)
 {
-    BlockDriverState *bs;
+    BlockBackend *blk;
 
-    bs = bdrv_find(device);
-    if (!bs) {
+    blk = blk_by_name(device);
+    if (!blk) {
         monitor_printf(mon, "Device not found %s\n", device);
         return -1;
     }
 
-    return monitor_read_bdrv_key_start(mon, bs, completion_cb, opaque);
+    return monitor_read_bdrv_key_start(mon, blk_bs(blk), completion_cb, opaque);
 }
 
 QemuOptsList qemu_mon_opts = {