Re: [PATCH 3/3] util: Fix fallocate stubs for mingw build

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

 



On 12/16/2014 12:13 PM, Martin Kletzander wrote:
> When any of the functions modified in commit 214c687b took false branch,
> the function itself used none of its parameters resulting in "unused
> parameter" error.  Rewriting these functions to the stubs we use
> elsewhere should fix the problem.
> 
> Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
> ---
>  src/util/virfile.c | 38 +++++++++++++++++++++++++++++++-------
>  1 file changed, 31 insertions(+), 7 deletions(-)
> 
> diff --git a/src/util/virfile.c b/src/util/virfile.c
> index 4483cce..2076860 100644
> --- a/src/util/virfile.c
> +++ b/src/util/virfile.c
> @@ -1037,36 +1037,52 @@ safewrite(int fd, const void *buf, size_t count)
>      return nwritten;
>  }
> 
> +#ifdef HAVE_POSIX_FALLOCATE
>  static int
>  safezero_posix_fallocate(int fd, off_t offset, off_t len)
>  {
> -#ifdef HAVE_POSIX_FALLOCATE
>      int ret = posix_fallocate(fd, offset, len);
>      if (ret == 0)
>          return 0;
>      errno = ret;
> -#endif
>      return -1;
>  }
> +#else /* !HAVE_POSIX_FALLOCATE */
> +static int
> +safezero_posix_fallocate(int fd ATTRIBUTE_UNUSED,
> +                         off_t offset ATTRIBUTE_UNUSED,
> +                         off_t len ATTRIBUTE_UNUSED)
> +{
> +    return -1;

Odd that we don't set errno on the fallback, but it's pre-existing, so
not a problem in your patch.


> +safezero_mmap(int fd ATTRIBUTE_UNUSED,
> +              off_t offset ATTRIBUTE_UNUSED,
> +              off_t lenATTRIBUTE_UNUSED)

Missing a space; you'd still get a warning that 'lenATTRIBUTE_UNUSED' is
not marked unused :)

ACK with the space added.


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]