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: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [RFC PATCH v3 3/6] block/raw-posix: implement bdrv_preallocate
Date: Fri, 20 Dec 2013 11:14:05 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

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.



reply via email to

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