From: Bruce Cran Date: Tue, 23 Apr 2013 14:27:23 +0000 (+0100) Subject: Fix Windows build warnings. X-Git-Tag: fio-2.1~20 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=5aa23eb8d6ae67c5a5e31737164307675b36518e Fix Windows build warnings. winsock2.h needs to be included before windows.h. Separate declarations and code. Signed-off-by: Jens Axboe --- diff --git a/engines/windowsaio.c b/engines/windowsaio.c index f32c3563..ee89fa12 100644 --- a/engines/windowsaio.c +++ b/engines/windowsaio.c @@ -9,7 +9,6 @@ #include #include #include -#include #include "../fio.h" diff --git a/os/os-windows.h b/os/os-windows.h index 09f9c543..4f4e2bb3 100644 --- a/os/os-windows.h +++ b/os/os-windows.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -112,6 +113,9 @@ static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes) { int rc = 0; HANDLE hFile; + GET_LENGTH_INFORMATION info; + DWORD outBytes; + LARGE_INTEGER size; if (f->hFile == NULL) { hFile = CreateFile(f->file_name, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, @@ -120,9 +124,6 @@ static inline int blockdev_size(struct fio_file *f, unsigned long long *bytes) hFile = f->hFile; } - GET_LENGTH_INFORMATION info; - DWORD outBytes; - LARGE_INTEGER size; size.QuadPart = 0; if (DeviceIoControl(hFile, IOCTL_DISK_GET_LENGTH_INFO, NULL, 0, &info, sizeof(info), &outBytes, NULL)) *bytes = info.Length.QuadPart; diff --git a/os/windows/posix.c b/os/windows/posix.c index 6a7841d5..794a707f 100755 --- a/os/windows/posix.c +++ b/os/windows/posix.c @@ -421,6 +421,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp) { static LARGE_INTEGER freq = {{0,0}}; LARGE_INTEGER counts; + uint64_t t; QueryPerformanceCounter(&counts); if (freq.QuadPart == 0) @@ -429,7 +430,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp) tp->tv_sec = counts.QuadPart / freq.QuadPart; /* Get the difference between the number of ns stored * in 'tv_sec' and that stored in 'counts' */ - uint64_t t = tp->tv_sec * freq.QuadPart; + t = tp->tv_sec * freq.QuadPart; t = counts.QuadPart - t; /* 't' now contains the number of cycles since the last second. * We want the number of nanoseconds, so multiply out by 1,000,000,000