From 66229c7a54a98ecc0afd9c075d28edd89b94019f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 13 Jun 2011 22:11:51 -0700 Subject: [PATCH] qa: direct_io: fix warnings Signed-off-by: Sage Weil --- qa/workunits/direct_io/Makefile.am | 2 ++ qa/workunits/direct_io/test_short_dio_read.c | 4 ++-- qa/workunits/direct_io/test_sync_io.c | 21 ++++++++++++-------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/qa/workunits/direct_io/Makefile.am b/qa/workunits/direct_io/Makefile.am index 56e7a3d7d20bf..d41c4be6442b0 100644 --- a/qa/workunits/direct_io/Makefile.am +++ b/qa/workunits/direct_io/Makefile.am @@ -3,6 +3,8 @@ AUTOMAKE_OPTIONS = gnu SUBDIRS = bin_PROGRAMS = +AM_CFLAGS = -Wall + direct_io_test_SOURCES = direct_io_test.c test_sync_io_SOURCES = test_sync_io.c test_short_dio_read_SOURCES = test_short_dio_read.c diff --git a/qa/workunits/direct_io/test_short_dio_read.c b/qa/workunits/direct_io/test_short_dio_read.c index 0f6a8257986f0..f9cce468ec5ac 100644 --- a/qa/workunits/direct_io/test_short_dio_read.c +++ b/qa/workunits/direct_io/test_short_dio_read.c @@ -8,7 +8,7 @@ int main(int argc, char **argv) { char buf[409600]; - int fd = open("shortfile", O_WRONLY|O_CREAT); + int fd = open("shortfile", O_WRONLY|O_CREAT, 0644); ssize_t r; printf("writing first 3 bytes of 10k file\n"); @@ -22,7 +22,7 @@ int main(int argc, char **argv) r = read(fd, buf, sizeof(buf)); close(fd); - printf("got %d\n", r); + printf("got %d\n", (int)r); if (r != 10000) return 1; return 0; diff --git a/qa/workunits/direct_io/test_sync_io.c b/qa/workunits/direct_io/test_sync_io.c index a5b8c6a251a35..c9042011a85a6 100644 --- a/qa/workunits/direct_io/test_sync_io.c +++ b/qa/workunits/direct_io/test_sync_io.c @@ -9,6 +9,8 @@ #include #include #include +#include +#include //#include "../client/ioctl.h" @@ -39,7 +41,8 @@ int verify_pattern(char *buf, size_t len, uint64_t off) uint64_t expected = i + off; uint64_t actual = *(uint64_t*)(buf + i); if (expected != actual) { - printf("error: offset %llu had %llu\n", expected, actual); + printf("error: offset %llu had %llu\n", (unsigned long long)expected, + (unsigned long long)actual); exit(1); return -1; } @@ -59,7 +62,8 @@ void generate_pattern(void *buf, size_t len, uint64_t offset) int read_direct(int buf_align, uint64_t offset, int len) { - printf("read_direct buf_align %d offset %llu len %d\n", buf_align, offset, len); + printf("read_direct buf_align %d offset %llu len %d\n", buf_align, + (unsigned long long)offset, len); int fd = open("foo", O_RDONLY|O_DIRECT); void *rawbuf; posix_memalign(&rawbuf, 4096, len + buf_align); @@ -74,7 +78,8 @@ int read_direct(int buf_align, uint64_t offset, int len) int read_sync(int buf_align, uint64_t offset, int len) { - printf("read_sync buf_align %d offset %llu len %d\n", buf_align, offset, len); + printf("read_sync buf_align %d offset %llu len %d\n", buf_align, + (unsigned long long)offset, len); int fd = open("foo", O_RDONLY); ioctl(fd, CEPH_IOC_SYNCIO); void *rawbuf; @@ -90,7 +95,8 @@ int read_sync(int buf_align, uint64_t offset, int len) int write_direct(int buf_align, uint64_t offset, int len) { - printf("write_direct buf_align %d offset %llu len %d\n", buf_align, offset, len); + printf("write_direct buf_align %d offset %llu len %d\n", buf_align, + (unsigned long long)offset, len); int fd = open("foo", O_WRONLY|O_DIRECT|O_CREAT, 0644); void *rawbuf; posix_memalign(&rawbuf, 4096, len + buf_align); @@ -117,8 +123,9 @@ int write_direct(int buf_align, uint64_t offset, int len) int write_sync(int buf_align, uint64_t offset, int len) { - printf("write_sync buf_align %d offset %llu len %d\n", buf_align, offset, len); - int fd = open("foo", O_WRONLY|O_CREAT); + printf("write_sync buf_align %d offset %llu len %d\n", buf_align, + (unsigned long long)offset, len); + int fd = open("foo", O_WRONLY|O_CREAT, 0644); ioctl(fd, CEPH_IOC_SYNCIO); void *rawbuf; posix_memalign(&rawbuf, 4096, len + buf_align); @@ -145,8 +152,6 @@ int write_sync(int buf_align, uint64_t offset, int len) int main(int argc, char **argv) { - char *buf; - int fd; uint64_t i, j, k; int read = 1; int write = 1; -- 2.39.5