qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v6 09/12] VMDK: open/read/write for monolithicFl


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v6 09/12] VMDK: open/read/write for monolithicFlat image
Date: Fri, 1 Jul 2011 06:23:19 +0100

On Fri, Jul 1, 2011 at 5:55 AM, Fam Zheng <address@hidden> wrote:
> +        /* save to extents array */
> +        if (!strcmp(type, "FLAT")) {
> +            /* FLAT extent */
> +            char extent_path[PATH_MAX];
> +            BlockDriverState *extent_file;
> +            BlockDriver *drv;
> +            VmdkExtent *extent;
> +
> +            extent_file = bdrv_new("");
> +            drv = bdrv_find_format("file");
> +            if (!drv) {
> +                bdrv_delete(extent_file);
> +                return -EINVAL;
> +            }
> +            path_combine(extent_path, sizeof(extent_path),
> +                    desc_file_path, fname);
> +            ret = bdrv_open(extent_file, extent_path,
> +                    bs->open_flags | BDRV_O_RDWR | BDRV_O_NO_BACKING, drv);

Why are you forcing BDRV_O_RDWR and BDRV_O_NO_BACKING?  It should be
possible to open a vmdk file readonly.

By the way, you can shortcut the bdrv_find_format()/bdrv_open() using
bdrv_open_file().  That will simplify things a little.
BDRV_O_NO_BACKING is not needed with the "file" driver (which doesn't
support backing files).

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]