Fix Windows build warnings.
authorBruce Cran <bruce@cran.org.uk>
Tue, 23 Apr 2013 14:27:23 +0000 (15:27 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 23 Apr 2013 14:41:57 +0000 (08:41 -0600)
winsock2.h needs to be included before windows.h.
Separate declarations and code.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/windowsaio.c
os/os-windows.h
os/windows/posix.c

index f32c3563dcc50417930829c253a558159ff174e7..ee89fa128108e5346f031a750de82ee7a4eb7410 100644 (file)
@@ -9,7 +9,6 @@
 #include <unistd.h>
 #include <signal.h>
 #include <errno.h>
-#include <windows.h>
 
 #include "../fio.h"
 
index 09f9c5438d2ff1580d16ab2b5586da488866b648..4f4e2bb38e74994e4c42a8c5e3c38885174b8a7a 100644 (file)
@@ -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;
index 6a7841d5513d743b3451ec14dd94daf11f27b679..794a707f15f8effde6daf5e068ac0a510fd24268 100755 (executable)
@@ -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