Re: [PATCH 5/7] block/nfs: Fix 32-bit Windows build

2022-10-29 Thread Stefan Weil via

Am 08.09.22 um 15:28 schrieb Bin Meng:

From: Bin Meng 

libnfs.h declares nfs_fstat() as the following for win32:

   int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh,
 struct __stat64 *st);

The 'st' parameter should be of type 'struct __stat64'. The
codes happen to build successfully for 64-bit Windows, but it
does not build for 32-bit Windows.

Fixes: 6542aa9c75bc ("block: add native support for NFS")
Fixes: 18a8056e0bc7 ("block/nfs: cache allocated filesize for read-only files")
Signed-off-by: Bin Meng 
---

  block/nfs.c | 8 
  1 file changed, 8 insertions(+)

diff --git a/block/nfs.c b/block/nfs.c
index 444c40b458..d5d67937dd 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -418,7 +418,11 @@ static int64_t nfs_client_open(NFSClient *client, 
BlockdevOptionsNfs *opts,
 int flags, int open_flags, Error **errp)
  {
  int64_t ret = -EINVAL;
+#ifdef _WIN32
+struct __stat64 st;
+#else
  struct stat st;
+#endif
  char *file = NULL, *strp = NULL;
  
  qemu_mutex_init(>mutex);

@@ -781,7 +785,11 @@ static int nfs_reopen_prepare(BDRVReopenState *state,
BlockReopenQueue *queue, Error **errp)
  {
  NFSClient *client = state->bs->opaque;
+#ifdef _WIN32
+struct __stat64 st;
+#else
  struct stat st;
+#endif
  int ret = 0;
  
  if (state->flags & BDRV_O_RDWR && bdrv_is_read_only(state->bs)) {



Thanks!

Reviewed-by: Stefan Weil 



OpenPGP_0xE08C21D5677450AD.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH 5/7] block/nfs: Fix 32-bit Windows build

2022-10-27 Thread Bin Meng
On Thu, Oct 27, 2022 at 3:55 PM Kevin Wolf  wrote:
>
> Am 27.10.2022 um 04:45 hat Bin Meng geschrieben:
> > Hi Kevin,
> > [...]
> > Will you queue this patch via the block tree?
>
> Just to be sure, you mean only patch 5? Yes, I can do that.
>

Yes, only this one. Thank you.

Regards,
Bin



Re: [PATCH 5/7] block/nfs: Fix 32-bit Windows build

2022-10-27 Thread Kevin Wolf
Am 27.10.2022 um 04:45 hat Bin Meng geschrieben:
> Hi Kevin,
> [...]
> Will you queue this patch via the block tree?

Just to be sure, you mean only patch 5? Yes, I can do that.

Kevin




Re: [PATCH 5/7] block/nfs: Fix 32-bit Windows build

2022-10-26 Thread Bin Meng
Hi Kevin,

On Sat, Sep 24, 2022 at 9:19 AM Bin Meng  wrote:
>
> Hi,
>
> On Wed, Sep 21, 2022 at 8:10 PM Meng, Bin  wrote:
> >
> > -Original Message-
> > From: Philippe Mathieu-Daudé  On Behalf 
> > Of Philippe Mathieu-Daudé
> > Sent: Sunday, September 18, 2022 5:32 AM
> > To: Bin Meng ; qemu-devel@nongnu.org
> > Cc: Meng, Bin ; Hanna Reitz ; 
> > Kevin Wolf ; Peter Lieven ; 
> > qemu-bl...@nongnu.org
> > Subject: Re: [PATCH 5/7] block/nfs: Fix 32-bit Windows build
> >
> > [Please note: This e-mail is from an EXTERNAL e-mail address]
> >
> > On 8/9/22 15:28, Bin Meng wrote:
> > > From: Bin Meng 
> > >
> > > libnfs.h declares nfs_fstat() as the following for win32:
> > >
> > >int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh,
> > >  struct __stat64 *st);
> > >
> > > The 'st' parameter should be of type 'struct __stat64'. The codes
> > > happen to build successfully for 64-bit Windows, but it does not build
> > > for 32-bit Windows.
> > >
> > > Fixes: 6542aa9c75bc ("block: add native support for NFS")
> > > Fixes: 18a8056e0bc7 ("block/nfs: cache allocated filesize for
> > > read-only files")
> > > Signed-off-by: Bin Meng 
> > > ---
> > >
> > >   block/nfs.c | 8 
> > >   1 file changed, 8 insertions(+)
> > >
> > > diff --git a/block/nfs.c b/block/nfs.c index 444c40b458..d5d67937dd
> > > 100644
> > > --- a/block/nfs.c
> > > +++ b/block/nfs.c
> > > @@ -418,7 +418,11 @@ static int64_t nfs_client_open(NFSClient *client, 
> > > BlockdevOptionsNfs *opts,
> > >  int flags, int open_flags, Error **errp)
> > >   {
> > >   int64_t ret = -EINVAL;
> > > +#ifdef _WIN32
> > > +struct __stat64 st;
> > > +#else
> > >   struct stat st;
> > > +#endif
> > >   char *file = NULL, *strp = NULL;
> > >
> > >   qemu_mutex_init(>mutex); @@ -781,7 +785,11 @@ static int
> > > nfs_reopen_prepare(BDRVReopenState *state,
> > > BlockReopenQueue *queue, Error **errp)
> > >   {
> > >   NFSClient *client = state->bs->opaque;
> > > +#ifdef _WIN32
> > > +struct __stat64 st;
> > > +#else
> > >   struct stat st;
> > > +#endif
> > >   int ret = 0;
> > >
> > >   if (state->flags & BDRV_O_RDWR && bdrv_is_read_only(state->bs))
> > > {
> >
> > What about the field in struct NFSRPC?
> >
> > NFSRPC::struct stat is used in nfs_get_allocated_file_size_cb() and 
> > nfs_get_allocated_file_size() that are not built on win32, so there is no 
> > problem.
> >
>
> Any further comments?
>

Will you queue this patch via the block tree?

Regards,
Bin



Re: [PATCH 5/7] block/nfs: Fix 32-bit Windows build

2022-09-23 Thread Bin Meng
Hi,

On Wed, Sep 21, 2022 at 8:10 PM Meng, Bin  wrote:
>
> -Original Message-
> From: Philippe Mathieu-Daudé  On Behalf Of 
> Philippe Mathieu-Daudé
> Sent: Sunday, September 18, 2022 5:32 AM
> To: Bin Meng ; qemu-devel@nongnu.org
> Cc: Meng, Bin ; Hanna Reitz ; 
> Kevin Wolf ; Peter Lieven ; 
> qemu-bl...@nongnu.org
> Subject: Re: [PATCH 5/7] block/nfs: Fix 32-bit Windows build
>
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
> On 8/9/22 15:28, Bin Meng wrote:
> > From: Bin Meng 
> >
> > libnfs.h declares nfs_fstat() as the following for win32:
> >
> >int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh,
> >  struct __stat64 *st);
> >
> > The 'st' parameter should be of type 'struct __stat64'. The codes
> > happen to build successfully for 64-bit Windows, but it does not build
> > for 32-bit Windows.
> >
> > Fixes: 6542aa9c75bc ("block: add native support for NFS")
> > Fixes: 18a8056e0bc7 ("block/nfs: cache allocated filesize for
> > read-only files")
> > Signed-off-by: Bin Meng 
> > ---
> >
> >   block/nfs.c | 8 
> >   1 file changed, 8 insertions(+)
> >
> > diff --git a/block/nfs.c b/block/nfs.c index 444c40b458..d5d67937dd
> > 100644
> > --- a/block/nfs.c
> > +++ b/block/nfs.c
> > @@ -418,7 +418,11 @@ static int64_t nfs_client_open(NFSClient *client, 
> > BlockdevOptionsNfs *opts,
> >  int flags, int open_flags, Error **errp)
> >   {
> >   int64_t ret = -EINVAL;
> > +#ifdef _WIN32
> > +struct __stat64 st;
> > +#else
> >   struct stat st;
> > +#endif
> >   char *file = NULL, *strp = NULL;
> >
> >   qemu_mutex_init(>mutex); @@ -781,7 +785,11 @@ static int
> > nfs_reopen_prepare(BDRVReopenState *state,
> > BlockReopenQueue *queue, Error **errp)
> >   {
> >   NFSClient *client = state->bs->opaque;
> > +#ifdef _WIN32
> > +struct __stat64 st;
> > +#else
> >   struct stat st;
> > +#endif
> >   int ret = 0;
> >
> >   if (state->flags & BDRV_O_RDWR && bdrv_is_read_only(state->bs))
> > {
>
> What about the field in struct NFSRPC?
>
> NFSRPC::struct stat is used in nfs_get_allocated_file_size_cb() and 
> nfs_get_allocated_file_size() that are not built on win32, so there is no 
> problem.
>

Any further comments?

Regards,
Bin



RE: [PATCH 5/7] block/nfs: Fix 32-bit Windows build

2022-09-21 Thread Meng, Bin
-Original Message-
From: Philippe Mathieu-Daudé  On Behalf Of 
Philippe Mathieu-Daudé
Sent: Sunday, September 18, 2022 5:32 AM
To: Bin Meng ; qemu-devel@nongnu.org
Cc: Meng, Bin ; Hanna Reitz ; Kevin 
Wolf ; Peter Lieven ; qemu-bl...@nongnu.org
Subject: Re: [PATCH 5/7] block/nfs: Fix 32-bit Windows build

[Please note: This e-mail is from an EXTERNAL e-mail address]

On 8/9/22 15:28, Bin Meng wrote:
> From: Bin Meng 
>
> libnfs.h declares nfs_fstat() as the following for win32:
>
>int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh,
>  struct __stat64 *st);
>
> The 'st' parameter should be of type 'struct __stat64'. The codes 
> happen to build successfully for 64-bit Windows, but it does not build 
> for 32-bit Windows.
>
> Fixes: 6542aa9c75bc ("block: add native support for NFS")
> Fixes: 18a8056e0bc7 ("block/nfs: cache allocated filesize for 
> read-only files")
> Signed-off-by: Bin Meng 
> ---
>
>   block/nfs.c | 8 
>   1 file changed, 8 insertions(+)
>
> diff --git a/block/nfs.c b/block/nfs.c index 444c40b458..d5d67937dd 
> 100644
> --- a/block/nfs.c
> +++ b/block/nfs.c
> @@ -418,7 +418,11 @@ static int64_t nfs_client_open(NFSClient *client, 
> BlockdevOptionsNfs *opts,
>  int flags, int open_flags, Error **errp)
>   {
>   int64_t ret = -EINVAL;
> +#ifdef _WIN32
> +struct __stat64 st;
> +#else
>   struct stat st;
> +#endif
>   char *file = NULL, *strp = NULL;
>
>   qemu_mutex_init(>mutex); @@ -781,7 +785,11 @@ static int 
> nfs_reopen_prepare(BDRVReopenState *state,
> BlockReopenQueue *queue, Error **errp)
>   {
>   NFSClient *client = state->bs->opaque;
> +#ifdef _WIN32
> +struct __stat64 st;
> +#else
>   struct stat st;
> +#endif
>   int ret = 0;
>
>   if (state->flags & BDRV_O_RDWR && bdrv_is_read_only(state->bs)) 
> {

What about the field in struct NFSRPC?

NFSRPC::struct stat is used in nfs_get_allocated_file_size_cb() and 
nfs_get_allocated_file_size() that are not built on win32, so there is no 
problem.

Regards,
Bin




Re: [PATCH 5/7] block/nfs: Fix 32-bit Windows build

2022-09-17 Thread Philippe Mathieu-Daudé via

On 8/9/22 15:28, Bin Meng wrote:

From: Bin Meng 

libnfs.h declares nfs_fstat() as the following for win32:

   int nfs_fstat(struct nfs_context *nfs, struct nfsfh *nfsfh,
 struct __stat64 *st);

The 'st' parameter should be of type 'struct __stat64'. The
codes happen to build successfully for 64-bit Windows, but it
does not build for 32-bit Windows.

Fixes: 6542aa9c75bc ("block: add native support for NFS")
Fixes: 18a8056e0bc7 ("block/nfs: cache allocated filesize for read-only files")
Signed-off-by: Bin Meng 
---

  block/nfs.c | 8 
  1 file changed, 8 insertions(+)

diff --git a/block/nfs.c b/block/nfs.c
index 444c40b458..d5d67937dd 100644
--- a/block/nfs.c
+++ b/block/nfs.c
@@ -418,7 +418,11 @@ static int64_t nfs_client_open(NFSClient *client, 
BlockdevOptionsNfs *opts,
 int flags, int open_flags, Error **errp)
  {
  int64_t ret = -EINVAL;
+#ifdef _WIN32
+struct __stat64 st;
+#else
  struct stat st;
+#endif
  char *file = NULL, *strp = NULL;
  
  qemu_mutex_init(>mutex);

@@ -781,7 +785,11 @@ static int nfs_reopen_prepare(BDRVReopenState *state,
BlockReopenQueue *queue, Error **errp)
  {
  NFSClient *client = state->bs->opaque;
+#ifdef _WIN32
+struct __stat64 st;
+#else
  struct stat st;
+#endif
  int ret = 0;
  
  if (state->flags & BDRV_O_RDWR && bdrv_is_read_only(state->bs)) {


What about the field in struct NFSRPC?