Clean up compiler warnings in liblustre builds.
Original patch by nic@cray.com.
b=11175
i=green
i=adilger
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))
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
#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 */
#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)
void __liblustre_setup_(void)
{
char *target = NULL;
- char *root_driver = "native";
char *lustre_driver = "lustre";
- char *root_path = "/";
unsigned mntflgs = 0;
int err;
}
_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);
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,
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
#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()
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);
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;
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);
}
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);
}
}
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);
}
}
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);
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;
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",
sigact.sa_flags = SA_RESTART;
sigaction(SIGINT, &sigact, NULL);
+ shmem_stop();
do_disconnect(argv[0], 1);
}
#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))
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;
struct obdio_conn *conn;
struct obdio_barrier *b;
char *end;
- uint64_t val;
+ __u64 val;
int rc;
int c;
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;
}
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;
}
}
- ibuf = (uint32_t *) buffer;
+ ibuf = (__u32 *) buffer;
for (j = 0; j < size / (4 * sizeof (*ibuf)); j++) {
if (ibuf[0] != myhid ||
ibuf[1] != mypid ||
}
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))
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;
optarg);
return (1);
}
- size = (uint32_t)val;
+ size = (__u32)val;
set_size++;
break;
}
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);
}
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);
}
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;
}
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;
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);