Patchwork [03/17] block: pass protocol flags up to the format

login
register
mail settings
Submitter Paolo Bonzini
Date Dec. 13, 2011, 12:37 p.m.
Message ID <1323779840-4235-4-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/131077/
State New
Headers show

Comments

Paolo Bonzini - Dec. 13, 2011, 12:37 p.m.
In the next patches, the protocols will modify bs->open_flags to signify
that they cannot support the exact requested feature set.  Pass the
modified flags to the format.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Zhiyong Wu - Dec. 15, 2011, 4:10 a.m.
On Tue, Dec 13, 2011 at 8:37 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> In the next patches, the protocols will modify bs->open_flags to signify
> that they cannot support the exact requested feature set.  Pass the
> modified flags to the format.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  block.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/block.c b/block.c
> index fa11e3a..6734e66 100644
> --- a/block.c
> +++ b/block.c
> @@ -612,8 +612,9 @@ static int bdrv_open_common(BlockDriverState *bs, const char *filename,
>         ret = drv->bdrv_file_open(bs, filename, open_flags);
>     } else {
>         ret = bdrv_file_open(&bs->file, filename, open_flags);
> +        bs->open_flags = bs->file->open_flags;
>         if (ret >= 0) {
> -            ret = drv->bdrv_open(bs, open_flags);
> +            ret = drv->bdrv_open(bs, bs->file->open_flags);
s/bs->file->open_flags/bs->open_flags/, it is more reasonable to use
bs->open_flags here.

>         }
>     }
>
> --
> 1.7.7.1
>
>
>

Patch

diff --git a/block.c b/block.c
index fa11e3a..6734e66 100644
--- a/block.c
+++ b/block.c
@@ -612,8 +612,9 @@  static int bdrv_open_common(BlockDriverState *bs, const char *filename,
         ret = drv->bdrv_file_open(bs, filename, open_flags);
     } else {
         ret = bdrv_file_open(&bs->file, filename, open_flags);
+        bs->open_flags = bs->file->open_flags;
         if (ret >= 0) {
-            ret = drv->bdrv_open(bs, open_flags);
+            ret = drv->bdrv_open(bs, bs->file->open_flags);
         }
     }