Patchwork [05/16] qemu-io: Don't use global bs in command implementations

login
register
mail settings
Submitter Kevin Wolf
Date May 28, 2013, 3:37 p.m.
Message ID <20130528153714.GF5642@dhcp-200-207.str.redhat.com>
Download mbox | patch
Permalink /patch/246908/
State New
Headers show

Comments

Kevin Wolf - May 28, 2013, 3:37 p.m.
Am 28.05.2013 um 17:27 hat Kevin Wolf geschrieben:
> Pass in the BlockDriverState to the command handlers instead of using
> the global variable. This is an important step to make the commands
> usable outside of qemu-io.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>

> @@ -1793,7 +1808,7 @@ static const cmdinfo_t abort_cmd = {
>         .oneline        = "simulate a program crash using abort(3)",
>  };
>  
> -static int close_f(int argc, char **argv)
> +static int close_f(BlockDriverState *bs, int argc, char **argv)
>  {
>      bdrv_delete(bs);
>      bs = NULL;

Here I missed the following hunk that I've applied locally now:
Eric Blake - May 28, 2013, 5:02 p.m.
On 05/28/2013 09:37 AM, Kevin Wolf wrote:
> Am 28.05.2013 um 17:27 hat Kevin Wolf geschrieben:
>> Pass in the BlockDriverState to the command handlers instead of using
>> the global variable. This is an important step to make the commands
>> usable outside of qemu-io.
>>
>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> 
>> @@ -1793,7 +1808,7 @@ static const cmdinfo_t abort_cmd = {
>>         .oneline        = "simulate a program crash using abort(3)",
>>  };
>>  
>> -static int close_f(int argc, char **argv)
>> +static int close_f(BlockDriverState *bs, int argc, char **argv)
>>  {
>>      bdrv_delete(bs);
>>      bs = NULL;
> 
> Here I missed the following hunk that I've applied locally now:
> 
> --- a/qemu-io.c
> +++ b/qemu-io.c
> @@ -1811,7 +1811,7 @@ static const cmdinfo_t abort_cmd = {
>  static int close_f(BlockDriverState *bs, int argc, char **argv)
>  {
>      bdrv_delete(bs);
> -    bs = NULL;
> +    qemuio_bs = NULL;

Reviewed-by: Eric Blake <eblake@redhat.com>

Patch

--- a/qemu-io.c
+++ b/qemu-io.c
@@ -1811,7 +1811,7 @@  static const cmdinfo_t abort_cmd = {
 static int close_f(BlockDriverState *bs, int argc, char **argv)
 {
     bdrv_delete(bs);
-    bs = NULL;
+    qemuio_bs = NULL;
     return 0;
 }