qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Yonggang Luo <luoyonggang@gmail.com>, qemu-devel@nongnu.org
Cc: QEMU Trivial <qemu-trivial@nongnu.org>,
	Kevin Wolf <kwolf@redhat.com>, Peter Lieven <pl@kamp.de>,
	qemu-block@nongnu.org
Subject: Re: [PATCH v2 1/2] block: Fixes nfs compiling error on msys2/mingw
Date: Thu, 5 Nov 2020 12:29:41 +0100	[thread overview]
Message-ID: <9582005a-1248-6a6b-060f-b0da597bc9c9@redhat.com> (raw)
In-Reply-To: <20201013001545.1958-2-luoyonggang@gmail.com>

On 13.10.20 02:15, Yonggang Luo wrote:
> These compiling errors are fixed:
> ../block/nfs.c:27:10: fatal error: poll.h: No such file or directory
>     27 | #include <poll.h>
>        |          ^~~~~~~~
> compilation terminated.
> 
> ../block/nfs.c:63:5: error: unknown type name 'blkcnt_t'
>     63 |     blkcnt_t st_blocks;
>        |     ^~~~~~~~
> ../block/nfs.c: In function 'nfs_client_open':
> ../block/nfs.c:550:27: error: 'struct _stat64' has no member named 'st_blocks'
>    550 |     client->st_blocks = st.st_blocks;
>        |                           ^
> ../block/nfs.c: In function 'nfs_get_allocated_file_size':
> ../block/nfs.c:751:41: error: 'struct _stat64' has no member named 'st_blocks'
>    751 |     return (task.ret < 0 ? task.ret : st.st_blocks * 512);
>        |                                         ^
> ../block/nfs.c: In function 'nfs_reopen_prepare':
> ../block/nfs.c:805:31: error: 'struct _stat64' has no member named 'st_blocks'
>    805 |         client->st_blocks = st.st_blocks;
>        |                               ^
> ../block/nfs.c: In function 'nfs_get_allocated_file_size':
> ../block/nfs.c:752:1: error: control reaches end of non-void function [-Werror=return-type]
>    752 | }
>        | ^
> 
> On msys2/mingw, there is no st_blocks in struct _stat64 yet, we disable the usage of it
> on msys2/mingw, and create a typedef long long blkcnt_t; for further implementation
> 
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
>   block/nfs.c | 15 +++++++++++++++
>   1 file changed, 15 insertions(+)
> 
> diff --git a/block/nfs.c b/block/nfs.c
> index f86e660374..cf8795fb49 100644
> --- a/block/nfs.c
> +++ b/block/nfs.c

[...]

> @@ -51,6 +53,10 @@
>   #define QEMU_NFS_MAX_PAGECACHE_SIZE (8388608 / NFS_BLKSIZE)
>   #define QEMU_NFS_MAX_DEBUG_LEVEL 2
>   
> +#if defined(_WIN32)
> +typedef long long blkcnt_t;

This makes me uneasy.  Is there a guarantee that this type will never be 
defined in a mingw environment (which would then result in a new compile 
error)?

Can’t we just give NFSClient.st_blocks a different type, i.e. uint64_t?

Apart from that, looks good to me.



  reply	other threads:[~2020-11-05 11:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-13  0:15 [PATCH v2 0/2] Fixes building nfs on msys2/mingw Yonggang Luo
2020-10-13  0:15 ` [PATCH v2 1/2] block: Fixes nfs compiling error " Yonggang Luo
2020-11-05 11:29   ` Max Reitz [this message]
2020-11-05 11:32     ` 罗勇刚(Yonggang Luo)
2020-11-05 11:43       ` Max Reitz
2020-11-05 11:46         ` 罗勇刚(Yonggang Luo)
2020-11-05 12:11           ` Max Reitz
2020-11-05 12:32             ` 罗勇刚(Yonggang Luo)
2020-10-13  0:15 ` [PATCH v2 2/2] block: enable libnfs on msys2/mingw in cirrus.yml Yonggang Luo
2020-11-05 11:43   ` Max Reitz
2020-11-05 12:32     ` 罗勇刚(Yonggang Luo)
2020-11-05 14:40       ` Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9582005a-1248-6a6b-060f-b0da597bc9c9@redhat.com \
    --to=mreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=luoyonggang@gmail.com \
    --cc=pl@kamp.de \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).