qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC 2/4] raw-format: add bdrv_max_size() support


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [RFC 2/4] raw-format: add bdrv_max_size() support
Date: Fri, 10 Mar 2017 12:33:44 +0800
User-agent: Mutt/1.7.1 (2016-10-04)

On Tue, Mar 07, 2017 at 11:32:29AM +0100, Alberto Garcia wrote:
> On Fri 03 Mar 2017 02:51:48 PM CET, Stefan Hajnoczi wrote:
> 
> > +static uint64_t raw_max_size(QemuOpts *opts, BlockDriverState *in_bs,
> > +                             Error **errp)
> > +{
> > +    if (in_bs) {
> > +        int64_t size = bdrv_nb_sectors(in_bs);
> > +        if (size < 0) {
> > +            error_setg_errno(errp, -size, "Unable to get image size");
> > +            return 0;
> > +        }
> > +        return (uint64_t)size * BDRV_SECTOR_SIZE;
> > +    }
> 
> Why not use bdrv_getlength() directly? It gives you the size in bytes.

Good idea.  Will fix.

Attachment: signature.asc
Description: PGP signature


reply via email to

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