]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: direct_io: fix warnings
authorSage Weil <sage.weil@dreamhost.com>
Tue, 14 Jun 2011 05:11:51 +0000 (22:11 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Tue, 14 Jun 2011 05:11:51 +0000 (22:11 -0700)
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
qa/workunits/direct_io/Makefile.am
qa/workunits/direct_io/test_short_dio_read.c
qa/workunits/direct_io/test_sync_io.c

index 56e7a3d7d20bf4a6e16e33f788604abdab7122a9..d41c4be6442b0b74d1f2efe4ee71f45390f1270d 100644 (file)
@@ -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
index 0f6a8257986f027fcd3ee5867638a7a620772214..f9cce468ec5accfa5dde050074f892bd50ae6580 100644 (file)
@@ -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;
index a5b8c6a251a356bcc49f579dbe58f613e659d970..c9042011a85a6d691e2cc5fa7d777e2bb30f70a8 100644 (file)
@@ -9,6 +9,8 @@
 #include <inttypes.h>
 #include <linux/types.h>
 #include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
 
 //#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;