qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC PATCH v3 3/6] block/raw-posix: implement bdrv_prea


From: Hu Tao
Subject: Re: [Qemu-devel] [RFC PATCH v3 3/6] block/raw-posix: implement bdrv_preallocate
Date: Mon, 23 Dec 2013 09:45:32 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Dec 20, 2013 at 11:14:05AM +0100, Stefan Hajnoczi wrote:
> On Thu, Dec 19, 2013 at 10:27:38AM +0800, Hu Tao wrote:
> > +static int raw_preallocate2(int fd, int64_t offset, int64_t length)
> > +{
> > +    int ret = -1;
> > +
> > +    ret = fallocate(fd, 0, offset, length);
> > +
> > +    /* fallback to posix_fallocate() if fallocate() is not supported */
> > +    if (ret < 0 && (errno == ENOSYS || errno == EOPNOTSUPP)) {
> > +        ret = posix_fallocate(fd, offset, length);
> > +    }
> > +
> > +    return ret;
> 
> Return value semantics differ between the two functions:
>  * fallocate - return 0 or -1 with errno set
>  * posix_fallocate - return 0 or error number (without using errno!)
> 
> Please make it consistent.  Usually in QEMU we return 0 on success and
> -errno on failure.

Thanks for catching this!




reply via email to

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