diff options
author | Bruce Cran <bruce@cran.org.uk> | 2013-04-23 15:27:23 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2013-04-23 08:41:57 -0600 |
commit | 5aa23eb8d6ae67c5a5e31737164307675b36518e (patch) | |
tree | ccd62678c5fb78186297b489491b5e5a0c507ea1 | |
parent | cab2440c23426b06e7e8327c5353fbd8373dcb5a (diff) | |
download | fio-5aa23eb8d6ae67c5a5e31737164307675b36518e.tar.gz fio-5aa23eb8d6ae67c5a5e31737164307675b36518e.tar.bz2 |
Fix Windows build warnings.
winsock2.h needs to be included before windows.h.
Separate declarations and code.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | engines/windowsaio.c | 1 | ||||
-rw-r--r-- | os/os-windows.h | 7 | ||||
-rwxr-xr-x | os/windows/posix.c | 3 |
3 files changed, 6 insertions, 5 deletions
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 <unistd.h> #include <signal.h> #include <errno.h> -#include <windows.h> #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 <sys/shm.h> #include <sys/stat.h> #include <errno.h> +#include <winsock2.h> #include <windows.h> #include <psapi.h> #include <stdlib.h> @@ -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 |