59 lines
1.8 KiB
Diff
59 lines
1.8 KiB
Diff
|
|
From 5969f357385914e29a847c030d195cb8476f38c4 Mon Sep 17 00:00:00 2001
|
||
|
|
From: qihao <qihao_yewu@cmss.chinamobile.com>
|
||
|
|
Date: Thu, 3 Aug 2023 19:19:26 +0800
|
||
|
|
Subject: [PATCH] block/nfs: Fix 32-bit Windows build
|
||
|
|
|
||
|
|
cheery-pick from 588fec8a4c3fe9e0d1cb3f7ea6fdd46221e42814
|
||
|
|
|
||
|
|
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 <bin.meng@windriver.com>
|
||
|
|
Message-Id: <20220908132817.1831008-6-bmeng.cn@gmail.com>
|
||
|
|
Reviewed-by: Stefan Weil <sw@weilnetz.de>
|
||
|
|
Signed-off-by: Stefan Weil <sw@weilnetz.de>
|
||
|
|
Signed-off-by: qihao_yewu <qihao_yewu@cmss.chinamobile.com>
|
||
|
|
---
|
||
|
|
block/nfs.c | 8 ++++++++
|
||
|
|
1 file changed, 8 insertions(+)
|
||
|
|
|
||
|
|
diff --git a/block/nfs.c b/block/nfs.c
|
||
|
|
index 577aea1d22..56b25829cf 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(&client->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)) {
|
||
|
|
--
|
||
|
|
2.41.0.windows.1
|
||
|
|
|