|
From: | Peter Lieven |
Subject: | Re: [PATCH v7 03/25] block: Fixes nfs compiling error on msys2/mingw |
Date: | Thu, 10 Sep 2020 22:16:27 +0200 |
I would simply do this: diff --git a/block/nfs.c b/block/nfs.c index 61a249a..0983143 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -24,7 +24,9 @@ #include "qemu/osdep.h" +#if !defined(_WIN32) #include <poll.h> +#endif #include "qemu/config-file.h" #include "qemu/error-report.h" #include "qapi/error.h" @@ -58,7 +60,9 @@ typedef struct NFSClient { bool has_zero_init; AioContext *aio_context; QemuMutex mutex; +#if !defined(_WIN32) blkcnt_t st_blocks; +#endif bool cache_used; NFSServer *server; char *path; @@ -545,7 +549,9 @@ static int64_t nfs_client_open(NFSClient *client, BlockdevOptionsNfs *opts, } ret = DIV_ROUND_UP(st.st_size, BDRV_SECTOR_SIZE); +#if !defined(_WIN32) client->st_blocks = st.st_blocks; +#endif client->has_zero_init = S_ISREG(st.st_mode); *strp = '/'; goto out; @@ -706,6 +712,8 @@ static int nfs_has_zero_init(BlockDriverState *bs) return client->has_zero_init; } + +#if !defined(_WIN32) /* Called (via nfs_service) with QemuMutex held. */ static void nfs_get_allocated_file_size_cb(int ret, struct nfs_context *nfs, void *data, @@ -748,6 +756,7 @@ static int64_t nfs_get_allocated_file_size(BlockDriverState *bs) return (task.ret < 0 ? task.ret : st.st_blocks * 512); } +#endif static int coroutine_fn nfs_file_co_truncate(BlockDriverState *bs, int64_t offset, bool exact, @@ -792,6 +801,7 @@ static int nfs_reopen_prepare(BDRVReopenState *state, return -EINVAL; } +#if !defined(_WIN32) /* Update cache for read-only reopens */ if (!(state->flags & BDRV_O_RDWR)) { ret = nfs_fstat(client->context, client->fh, &st); @@ -802,6 +812,7 @@ static int nfs_reopen_prepare(BDRVReopenState *state, } client->st_blocks = st.st_blocks; } +#endif return 0; } @@ -869,7 +880,9 @@ static BlockDriver bdrv_nfs = { .create_opts = &nfs_create_opts, .bdrv_has_zero_init = nfs_has_zero_init, +#if !defined(_WIN32) .bdrv_get_allocated_file_size = nfs_get_allocated_file_size, +#endif .bdrv_co_truncate = nfs_file_co_truncate, .bdrv_file_open = nfs_file_open, Best, Peter |
[Prev in Thread] | Current Thread | [Next in Thread] |