Fix compile warnings on Windows
authorJens Axboe <axboe@kernel.dk>
Thu, 24 Jan 2013 00:21:41 +0000 (17:21 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 24 Jan 2013 00:21:41 +0000 (17:21 -0700)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/net.c
os/os-windows.h
os/os.h
os/windows/posix.h [new file with mode: 0644]
server.c

index eb05bcccc5cb9e1d8db8236a1a1fc0f78d8db48f..de7cdb541824bc35d8eb3cb97121f24bcce5bde3 100644 (file)
@@ -541,7 +541,7 @@ static void fio_netio_udp_close(struct thread_data *td, struct fio_file *f)
        msg.magic = htonl(FIO_LINK_OPEN_CLOSE_MAGIC);
        msg.cmd = htonl(FIO_LINK_CLOSE);
 
        msg.magic = htonl(FIO_LINK_OPEN_CLOSE_MAGIC);
        msg.cmd = htonl(FIO_LINK_CLOSE);
 
-       ret = sendto(f->fd, &msg, sizeof(msg), MSG_WAITALL, to,
+       ret = sendto(f->fd, (void *) &msg, sizeof(msg), MSG_WAITALL, to,
                        sizeof(nd->addr));
        if (ret < 0)
                td_verror(td, errno, "sendto udp link close");
                        sizeof(nd->addr));
        if (ret < 0)
                td_verror(td, errno, "sendto udp link close");
@@ -569,7 +569,7 @@ static int fio_netio_udp_recv_open(struct thread_data *td, struct fio_file *f)
        socklen_t len = sizeof(nd->addr);
        int ret;
 
        socklen_t len = sizeof(nd->addr);
        int ret;
 
-       ret = recvfrom(f->fd, &msg, sizeof(msg), MSG_WAITALL, to, &len);
+       ret = recvfrom(f->fd, (void *) &msg, sizeof(msg), MSG_WAITALL, to, &len);
        if (ret < 0) {
                td_verror(td, errno, "sendto udp link open");
                return ret;
        if (ret < 0) {
                td_verror(td, errno, "sendto udp link open");
                return ret;
@@ -595,7 +595,7 @@ static int fio_netio_udp_send_open(struct thread_data *td, struct fio_file *f)
        msg.magic = htonl(FIO_LINK_OPEN_CLOSE_MAGIC);
        msg.cmd = htonl(FIO_LINK_OPEN);
 
        msg.magic = htonl(FIO_LINK_OPEN_CLOSE_MAGIC);
        msg.cmd = htonl(FIO_LINK_OPEN);
 
-       ret = sendto(f->fd, &msg, sizeof(msg), MSG_WAITALL, to,
+       ret = sendto(f->fd, (void *) &msg, sizeof(msg), MSG_WAITALL, to,
                        sizeof(nd->addr));
        if (ret < 0) {
                td_verror(td, errno, "sendto udp link open");
                        sizeof(nd->addr));
        if (ret < 0) {
                td_verror(td, errno, "sendto udp link open");
@@ -743,7 +743,7 @@ static int fio_netio_setup_listen_inet(struct thread_data *td, short port)
        }
 
        opt = 1;
        }
 
        opt = 1;
-       if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
+       if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*)&opt, sizeof(opt)) < 0) {
                td_verror(td, errno, "setsockopt");
                return 1;
        }
                td_verror(td, errno, "setsockopt");
                return 1;
        }
index 18de83987d635281329cfffe98816616e26a737d..f68f654c8c832ba8be0aea618d3b622c7377cc48 100644 (file)
@@ -15,6 +15,8 @@
 #include "../file.h"
 #include "../log.h"
 
 #include "../file.h"
 #include "../log.h"
 
+#include "windows/posix.h"
+
 #define FIO_HAVE_ODIRECT
 #define FIO_HAVE_CPU_AFFINITY
 #define FIO_HAVE_CHARDEV_SIZE
 #define FIO_HAVE_ODIRECT
 #define FIO_HAVE_CPU_AFFINITY
 #define FIO_HAVE_CHARDEV_SIZE
@@ -36,9 +38,6 @@
 #define fio_swap32(x)  _byteswap_ulong(x)
 #define fio_swap64(x)  _byteswap_uint64(x)
 
 #define fio_swap32(x)  _byteswap_ulong(x)
 #define fio_swap64(x)  _byteswap_uint64(x)
 
-typedef off_t off64_t;
-typedef int clockid_t;
-
 typedef DWORD_PTR os_cpu_mask_t;
 
 #define CLOCK_REALTIME 1
 typedef DWORD_PTR os_cpu_mask_t;
 
 #define CLOCK_REALTIME 1
diff --git a/os/os.h b/os/os.h
index fb544a173e4a2c03e56bc893b18f37d38205715b..f33a7cdf5d631c5e0fd4f0be548dafa9a08477ce 100644 (file)
--- a/os/os.h
+++ b/os/os.h
@@ -137,7 +137,7 @@ typedef unsigned int socklen_t;
 #endif
 
 #ifndef FIO_OS_HAS_CTIME_R
 #endif
 
 #ifndef FIO_OS_HAS_CTIME_R
-#define os_ctime_r(x, y, z)     ctime_r((x), (y))
+#define os_ctime_r(x, y, z)     (void) ctime_r((x), (y))
 #endif
 
 #ifdef FIO_USE_GENERIC_SWAP
 #endif
 
 #ifdef FIO_USE_GENERIC_SWAP
diff --git a/os/windows/posix.h b/os/windows/posix.h
new file mode 100644 (file)
index 0000000..cb89cf6
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef FIO_WINDOWS_POSIX_H
+#define FIO_WINDOWS_POSIX_H
+
+typedef off_t off64_t;
+typedef int clockid_t;
+
+extern int clock_gettime(clockid_t clock_id, struct timespec *tp);
+extern int inet_aton(const char *, struct in_addr *);
+
+#endif
index bb03c779fb11598bede46ec90c8e2c56f8ec2de8..3607ee81f5b21d2a9ca3b99f5bdd0e1849d247c7 100644 (file)
--- a/server.c
+++ b/server.c
@@ -829,7 +829,7 @@ static int fio_init_server_ip(void)
        }
 
        opt = 1;
        }
 
        opt = 1;
-       if (setsockopt(sk, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
+       if (setsockopt(sk, SOL_SOCKET, SO_REUSEADDR, (void *)&opt, sizeof(opt)) < 0) {
                log_err("fio: setsockopt: %s\n", strerror(errno));
                close(sk);
                return -1;
                log_err("fio: setsockopt: %s\n", strerror(errno));
                close(sk);
                return -1;