Whamcloud - gitweb
Branch HEAD
authorscjody <scjody>
Thu, 5 Apr 2007 01:47:51 +0000 (01:47 +0000)
committerscjody <scjody>
Thu, 5 Apr 2007 01:47:51 +0000 (01:47 +0000)
Clean up compiler warnings in liblustre builds.

Original patch by nic@cray.com.

b=11175
i=green
i=adilger

16 files changed:
build/Rules.in
build/autoconf/lustre-build.m4
lustre/include/linux/lustre_user.h
lustre/include/lustre_lib.h
lustre/liblustre/llite_lib.c
lustre/liblustre/lutil.c
lustre/liblustre/tests/Makefile.am
lustre/liblustre/tests/sanity.c
lustre/llite/llite_lib.c
lustre/obdclass/class_obd.c
lustre/tests/test_brw.c
lustre/utils/obd.c
lustre/utils/obdbarrier.c
lustre/utils/obdio.c
lustre/utils/obdiolib.c
lustre/utils/obdiolib.h

index f03bb80..815b3da 100644 (file)
@@ -60,7 +60,7 @@ else
 include @LINUX_CONFIG@
 
 EXTRA_CFLAGS := $(EXTRA_PRE_CFLAGS)
-EXTRA_CFLAGS += @EXTRA_KCFLAGS@ @UML_CFLAGS@
+EXTRA_CFLAGS += @EXTRA_KCFLAGS@ @UML_CFLAGS@ @CFLAGS@
 EXTRA_CFLAGS += $(EXTRA_POST_CFLAGS)
 
 obj-m := $(patsubst %,%.o,$(MODULES))
index cbc76bb..42b20b9 100644 (file)
@@ -452,6 +452,7 @@ AM_CONDITIONAL(DOC, test x$ENABLE_DOC = x1)
 AM_CONDITIONAL(INIT_SCRIPTS, test x$ENABLE_INIT_SCRIPTS = "x1")
 AM_CONDITIONAL(LINUX, test x$lb_target_os = "xlinux")
 AM_CONDITIONAL(DARWIN, test x$lb_target_os = "xdarwin")
+AM_CONDITIONAL(CRAY_XT3, test x$enable_cray_xt3 = "xyes")
 
 # this lets lustre cancel libsysio, per-branch or if liblustre is
 # disabled
index a549214..4778993 100644 (file)
@@ -57,26 +57,35 @@ typedef struct stat64   lstat_t;
 #endif
 
 #ifndef LPU64
+/* this is a bit chunky */
+#if defined(__KERNEL__)
+ #define _LWORDSIZE BITS_PER_LONG
+#else
+ #define _LWORDSIZE __WORDSIZE
+#endif
 /* x86_64 defines __u64 as "long" in userspace, but "long long" in the kernel */
-#if defined(__x86_64__) && defined(__KERNEL__)
+#if (defined(__x86_64__) && (defined(__KERNEL__) || defined(CRAY_XT3)))
 # define LPU64 "%Lu"
 # define LPD64 "%Ld"
 # define LPX64 "%#Lx"
 # define LPSZ  "%lu"
 # define LPSSZ "%ld"
-#elif (BITS_PER_LONG == 32 || __WORDSIZE == 32)
+#elif (_LWORDSIZE == 32)
 # define LPU64 "%Lu"
 # define LPD64 "%Ld"
 # define LPX64 "%#Lx"
 # define LPSZ  "%u"
 # define LPSSZ "%d"
-#elif (BITS_PER_LONG == 64 || __WORDSIZE == 64)
+#elif (_LWORDSIZE == 64)
 # define LPU64 "%lu"
 # define LPD64 "%ld"
 # define LPX64 "%#lx"
 # define LPSZ  "%lu"
 # define LPSSZ "%ld"
 #endif
+
+#undef _LWORDSIZE
+
 #endif /* !LPU64 */
 
 #endif /* _LUSTRE_USER_H */
index 4f4aa86..451d16c 100644 (file)
@@ -120,47 +120,47 @@ int l_has_lock(struct lustre_lock *);
 #define OBD_IOCTL_VERSION 0x00010004
 
 struct obd_ioctl_data {
-        uint32_t ioc_len;
-        uint32_t ioc_version;
+        __u32 ioc_len;
+        __u32 ioc_version;
 
-        uint64_t ioc_cookie;
-        uint32_t ioc_conn1;
-        uint32_t ioc_conn2;
+        __u64 ioc_cookie;
+        __u32 ioc_conn1;
+        __u32 ioc_conn2;
 
         struct obdo ioc_obdo1;
         struct obdo ioc_obdo2;
 
         obd_size         ioc_count;
         obd_off          ioc_offset;
-        uint32_t         ioc_dev;
-        uint32_t         ioc_command;
+        __u32            ioc_dev;
+        __u32            ioc_command;
 
-        uint64_t ioc_nid;
-        uint32_t ioc_nal;
-        uint32_t ioc_type;
+        __u64 ioc_nid;
+        __u32 ioc_nal;
+        __u32 ioc_type;
 
         /* buffers the kernel will treat as user pointers */
-        uint32_t ioc_plen1;
+        __u32    ioc_plen1;
         char    *ioc_pbuf1;
-        uint32_t ioc_plen2;
+        __u32    ioc_plen2;
         char    *ioc_pbuf2;
 
         /* inline buffers for various arguments */
-        uint32_t ioc_inllen1;
+        __u32    ioc_inllen1;
         char    *ioc_inlbuf1;
-        uint32_t ioc_inllen2;
+        __u32    ioc_inllen2;
         char    *ioc_inlbuf2;
-        uint32_t ioc_inllen3;
+        __u32    ioc_inllen3;
         char    *ioc_inlbuf3;
-        uint32_t ioc_inllen4;
+        __u32    ioc_inllen4;
         char    *ioc_inlbuf4;
 
         char    ioc_bulk[0];
 };
 
 struct obd_ioctl_hdr {
-        uint32_t ioc_len;
-        uint32_t ioc_version;
+        __u32    ioc_len;
+        __u32    ioc_version;
 };
 
 static inline int obd_ioctl_packlen(struct obd_ioctl_data *data)
index 8adbb45..6f0c570 100644 (file)
@@ -307,9 +307,7 @@ char *lustre_path = NULL;
 void __liblustre_setup_(void)
 {
         char *target = NULL;
-        char *root_driver = "native";
         char *lustre_driver = "lustre";
-        char *root_path = "/";
         unsigned mntflgs = 0;
         int err;
 
@@ -336,7 +334,7 @@ void __liblustre_setup_(void)
         }
         _sysio_native_init();
 
-        err = _sysio_mount_root(root_path, root_driver, mntflgs, NULL);
+        err = _sysio_mount_root("/", "native", mntflgs, NULL);
         if (err) {
                 fprintf(stderr, "sysio mount failed: %s\n", strerror(errno));
                 exit(1);
index b4689d5..db203f3 100644 (file)
@@ -104,11 +104,11 @@ static int get_ipv4_addr()
 
 void liblustre_init_random()
 {
-        int _rand_dev_fd;
         int seed[2];
         struct timeval tv;
 
 #ifdef LIBLUSTRE_USE_URANDOM
+        int _rand_dev_fd;
         _rand_dev_fd = syscall(SYS_open, "/dev/urandom", O_RDONLY);
         if (_rand_dev_fd >= 0) {
                 if (syscall(SYS_read, _rand_dev_fd,
index 9ed59aa..75943ff 100644 (file)
@@ -10,7 +10,11 @@ if LIBLUSTRE
 noinst_LIBRARIES = libtestcommon.a
 
 if LIBLUSTRE_TESTS
-noinst_PROGRAMS = sanity recovery_small replay_single replay_ost_single echo_test
+noinst_PROGRAMS = sanity echo_test
+
+if !CRAY_XT3
+noinst_PROGRAMS += recovery_small replay_single replay_ost_single
+endif # !CRAY_XT3
 
 if MPITESTS
 noinst_PROGRAMS += test_lock_cancel
index 9edfc92..16014bc 100644 (file)
 #include <dirent.h>
 #include <sys/uio.h>
 #include <sys/time.h>
+#include <time.h>
+#include <sys/ioctl.h>
 
 #include "test_common.h"
 #include <ioctl.h>
-#include <lustre/lustre_user.h>
+#include <lustre/liblustreapi.h>
 
 #ifndef PAGE_SIZE
 #define PAGE_SIZE getpagesize()
@@ -522,8 +524,7 @@ int t18(char *name)
 int t18b(char *name)
 {
         char file[MAX_PATH_LENGTH] = "";
-        char buf[128];
-        int fd, i;
+        int i;
         struct stat statbuf[3];
         ENTRY("utime should change mtime/atime/ctime");
         snprintf(file, MAX_PATH_LENGTH, "%s/test_t18b_file", lustre_path);
@@ -562,7 +563,7 @@ static int check_file_size(char *file, off_t size)
                 return(1);
         }
         if (statbuf.st_size != size) {
-                printf("size of %s: %ld != %ld\n", file, statbuf.st_size, size);
+                printf("size of %s: %ld != %lld\n", file, statbuf.st_size, size);
                 return(-1);
         }
         return 0;
@@ -685,7 +686,7 @@ int t21(char *name)
 
         fd = open(file, O_RDWR|O_CREAT, (mode_t)0666);
         if (fd < 0) {
-                printf("error open file: %m\n", file);
+                printf("error open file: %s\n", file);
                 return(-1);
         }
 
@@ -1243,7 +1244,7 @@ int t55(char *name)
                         printf("object %d:\n", index);
                         printf("\tobject_gr:    "LPX64"\n", lo->l_object_gr);
                         printf("\tobject_id:    "LPX64"\n", lo->l_object_id);
-                        printf("\tost_gen:      "LPX64"\n", lo->l_ost_gen);
+                        printf("\tost_gen:      %#x\n", lo->l_ost_gen);
                         printf("\tost_idx:      %u\n", lo->l_ost_idx);
                 }
         }
@@ -1309,7 +1310,7 @@ int t55(char *name)
                         printf("object %d:\n", index);
                         printf("\tobject_gr:    "LPX64"\n", lo->l_object_gr);
                         printf("\tobject_id:    "LPX64"\n", lo->l_object_id);
-                        printf("\tost_gen:      "LPX64"\n", lo->l_ost_gen);
+                        printf("\tost_gen:      %#x\n", lo->l_ost_gen);
                         printf("\tost_idx:      %u\n", lo->l_ost_idx);
                 }
         }
index b6ba695..a477866 100644 (file)
@@ -1917,7 +1917,7 @@ int ll_obd_statfs(struct inode *inode, void *arg)
         char *buf = NULL;
         struct obd_ioctl_data *data = NULL;
         __u32 type, index;
-        int len, rc;
+        int len = 0, rc;
 
         if (!inode || !(sbi = ll_i2sbi(inode)))
                 GOTO(out_statfs, rc = -EINVAL);
index c2af448..ccf80f3 100644 (file)
@@ -116,7 +116,7 @@ static inline void obd_conn2data(struct obd_ioctl_data *data,
         data->ioc_cookie = conn->cookie;
 }
 
-int class_resolve_dev_name(uint32_t len, const char *name)
+int class_resolve_dev_name(__u32 len, const char *name)
 {
         int rc;
         int dev;
index dd94d1b..d225b47 100644 (file)
@@ -152,7 +152,7 @@ int main(int argc, char **argv)
                 objid = 3;
         }
 
-        printf("%s: %s on %s(objid "LPX64") for "LPU64"x%ld pages \n",
+        printf("%s: %s on %s(objid "LPX64") for "LPSZ"x%ld pages \n",
                argv[0], 
 #ifdef O_DIRECT
                flags & O_DIRECT ? "directio" : "i/o",
index 2917a40..fdd18cf 100644 (file)
@@ -2062,5 +2062,6 @@ void obd_finalize(int argc, char **argv)
         sigact.sa_flags = SA_RESTART;
         sigaction(SIGINT, &sigact, NULL);
 
+        shmem_stop();
         do_disconnect(argv[0], 1);
 }
index 8774cef..f2c6eb1 100644 (file)
@@ -30,9 +30,9 @@
 #include "obdiolib.h"
 
 int
-parse_kmg (uint64_t *valp, char *str)
+parse_kmg (__u64 *valp, char *str)
 {
-        uint64_t        val;
+        __u64        val;
         char            mod[32];
 
         switch (sscanf (str, LPU64"%1[gGmMkK]", &val, mod))
@@ -100,9 +100,9 @@ exponential_modulus (int i, int base)
 int
 main (int argc, char **argv)
 {
-        uint64_t              bid = (((uint64_t)gethostid()) << 32) | getpid ();
+        __u64                 bid = (((__u64)gethostid()) << 32) | getpid ();
         int                   set_bid = 0;
-        uint64_t              oid;
+        __u64                 oid;
         int                   setup = 0;
         int                   device = -1;
         int                   npeers = 0;
@@ -111,7 +111,7 @@ main (int argc, char **argv)
         struct obdio_conn    *conn;
         struct obdio_barrier *b;
         char                 *end;
-        uint64_t              val;
+        __u64                 val;
         int                   rc;
         int                   c;
 
index 0152064..a8a6a73 100644 (file)
 
 int
 obdio_test_fixed_extent (struct obdio_conn *conn,
-                         uint32_t myhid, uint32_t mypid,
-                         int reps, int locked, uint64_t oid,
-                         uint64_t offset, uint32_t size)
+                         __u32 myhid, __u32 mypid,
+                         int reps, int locked, __u64 oid,
+                         __u64 offset, __u32 size)
 {
         struct lustre_handle lh;
         void                *space;
         void                *buffer;
-        uint32_t            *ibuf;
+        __u32               *ibuf;
         int                  i;
         int                  j;
         int                  rc = 0;
@@ -50,7 +50,7 @@ obdio_test_fixed_extent (struct obdio_conn *conn,
         }
 
         for (i = 0; i < reps; i++) {
-                ibuf = (uint32_t *) buffer;
+                ibuf = (__u32 *) buffer;
                 for (j = 0; j < size / (4 * sizeof (*ibuf)); j++) {
                         ibuf[0] = myhid;
                         ibuf[1] = mypid;
@@ -104,7 +104,7 @@ obdio_test_fixed_extent (struct obdio_conn *conn,
                         }
                 }
 
-                ibuf = (uint32_t *) buffer;
+                ibuf = (__u32 *) buffer;
                 for (j = 0; j < size / (4 * sizeof (*ibuf)); j++) {
                         if (ibuf[0] != myhid ||
                             ibuf[1] != mypid ||
@@ -129,9 +129,9 @@ obdio_test_fixed_extent (struct obdio_conn *conn,
 }
 
 int
-parse_kmg (uint64_t *valp, char *str)
+parse_kmg (__u64 *valp, char *str)
 {
-        uint64_t        val;
+        __u64           val;
         char            mod[32];
 
         switch (sscanf (str, LPU64"%1[gGmMkK]", &val, mod))
@@ -184,18 +184,18 @@ usage (char *cmdname, int help)
 int
 main (int argc, char **argv)
 {
-        uint32_t           mypid = getpid ();
-        uint32_t           myhid = gethostid ();
-        uint64_t           oid;
-        uint64_t           base_offset = 0;
-        uint32_t           size = 0;
+        __u32             mypid = getpid ();
+        __u32             myhid = gethostid ();
+        __u64             oid;
+        __u64             base_offset = 0;
+        __u32             size = 0;
         int                set_size = 0;
         int                device = -1;
         int                reps = 1;
         int                locked = 0;
         char              *end;
         struct obdio_conn *conn;
-        uint64_t           val;
+        __u64              val;
         int                v1;
         int                v2;
         int                rc;
@@ -229,7 +229,7 @@ main (int argc, char **argv)
                                          optarg);
                                 return (1);
                         }
-                        size = (uint32_t)val;
+                        size = (__u32)val;
                         set_size++;
                         break;
 
index c402104..9e046e2 100644 (file)
@@ -106,8 +106,8 @@ obdio_disconnect (struct obdio_conn *conn, int flags)
 }
 
 int
-obdio_pread (struct obdio_conn *conn, uint64_t oid,
-             void *buffer, uint32_t count, uint64_t offset)
+obdio_pread (struct obdio_conn *conn, __u64 oid,
+             void *buffer, __u32 count, __u64 offset)
 {
         obdio_iocinit (conn);
 
@@ -125,8 +125,8 @@ obdio_pread (struct obdio_conn *conn, uint64_t oid,
 }
 
 int
-obdio_pwrite (struct obdio_conn *conn, uint64_t oid,
-              void *buffer, uint32_t count, uint64_t offset)
+obdio_pwrite (struct obdio_conn *conn, __u64 oid,
+              void *buffer, __u32 count, __u64 offset)
 {
         obdio_iocinit (conn);
 
@@ -144,8 +144,8 @@ obdio_pwrite (struct obdio_conn *conn, uint64_t oid,
 }
 
 int
-obdio_enqueue (struct obdio_conn *conn, uint64_t oid,
-               int mode, uint64_t offset, uint32_t count,
+obdio_enqueue (struct obdio_conn *conn, __u64 oid,
+               int mode, __u64 offset, __u32 count,
                struct lustre_handle *lh)
 {
         int   rc;
@@ -193,7 +193,7 @@ obdio_alloc_aligned_buffer (void **spacep, int size)
 }
 
 struct obdio_barrier *
-obdio_new_barrier (uint64_t oid, uint64_t id, int npeers)
+obdio_new_barrier (__u64 oid, __u64 id, int npeers)
 {
         struct obdio_barrier *b;
 
index 97be436..e9e0642 100644 (file)
 
 struct obdio_conn {
         int                    oc_fd;
-        uint32_t               oc_device;
+        __u32                  oc_device;
         struct obd_ioctl_data  oc_data;
         char                   oc_buffer[8192];
 };
 
 struct obdio_barrier {
-        uint64_t               ob_id;
-        uint64_t               ob_oid;
-        uint64_t               ob_npeers;
-        uint64_t               ob_ordinal;
-        uint64_t               ob_count;
+        __u64                  ob_id;
+        __u64                  ob_oid;
+        __u64                  ob_npeers;
+        __u64                  ob_ordinal;
+        __u64                  ob_count;
 };
 
 extern struct obdio_conn *obdio_connect(int device);
 extern void obdio_disconnect(struct obdio_conn *conn, int flags);
-extern int obdio_open(struct obdio_conn *conn, uint64_t oid,
+extern int obdio_open(struct obdio_conn *conn, __u64 oid,
                       struct lustre_handle *fh);
-extern int obdio_close(struct obdio_conn *conn, uint64_t oid,
+extern int obdio_close(struct obdio_conn *conn, __u64 oid,
                        struct lustre_handle *fh);
-extern int obdio_pread(struct obdio_conn *conn, uint64_t oid,
-                       void *buffer, uint32_t count, uint64_t offset);
-extern int obdio_pwrite(struct obdio_conn *conn, uint64_t oid,
-                        void *buffer, uint32_t count, uint64_t offset);
-extern int obdio_enqueue(struct obdio_conn *conn, uint64_t oid,
-                         int mode, uint64_t offset, uint32_t count,
+extern int obdio_pread(struct obdio_conn *conn, __u64 oid,
+                       void *buffer, __u32 count, __u64 offset);
+extern int obdio_pwrite(struct obdio_conn *conn, __u64 oid,
+                        void *buffer, __u32 count, __u64 offset);
+extern int obdio_enqueue(struct obdio_conn *conn, __u64 oid,
+                         int mode, __u64 offset, __u32 count,
                          struct lustre_handle *lh);
 extern int obdio_cancel(struct obdio_conn *conn, struct lustre_handle *lh);
 extern void *obdio_alloc_aligned_buffer(void **spacep, int size);
-extern struct obdio_barrier *obdio_new_barrier(uint64_t oid, uint64_t id,
+extern struct obdio_barrier *obdio_new_barrier(__u64 oid, __u64 id,
                                                int npeers);
 extern int obdio_setup_barrier(struct obdio_conn *conn,struct obdio_barrier *b);
 extern int obdio_barrier(struct obdio_conn *conn, struct obdio_barrier *b);