Whamcloud - gitweb
LU-6245 libcfs: remove types.h from userland code 79/16879/9
authorJames Simmons <uja.ornl@yahoo.com>
Fri, 19 Feb 2016 15:10:51 +0000 (10:10 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 14 Mar 2016 02:38:59 +0000 (02:38 +0000)
With the cleanup of lustre_idl.h much of the lustre
specific types from the libcfs types.h header has
been removed. This cleanup removes the remaining
user land references allowing use to make libcfs
types.h a kernel specific header.

Change-Id: I888ace937993bab9f63be00fd3ef5e8f3a0a1803
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: http://review.whamcloud.com/16879
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
34 files changed:
libcfs/include/libcfs/libcfs.h
libcfs/include/libcfs/libcfs_debug.h
libcfs/include/libcfs/types.h
lnet/include/lnet/types.h
lnet/utils/lnetctl.c
lnet/utils/lst.c
lnet/utils/portals.c
lustre/include/lustre/lustre_idl.h
lustre/include/lustre_disk.h
lustre/include/lustre_ioctl.h
lustre/tests/it_test.c
lustre/tests/mpi/lp_utils.c
lustre/tests/mpi/mdsrate.c
lustre/tests/mpi/parallel_grouplock.c
lustre/tests/multiop.c
lustre/tests/statone.c
lustre/tests/test_brw.c
lustre/utils/gss/l_idmap.c
lustre/utils/gss/lsupport.c
lustre/utils/l_getidentity.c
lustre/utils/lctl.c
lustre/utils/lfs.c
lustre/utils/lhsmtool_posix.c
lustre/utils/liblustreapi.c
lustre/utils/llog_reader.c
lustre/utils/lr_reader.c
lustre/utils/lustre_cfg.c
lustre/utils/lustre_rsync.c
lustre/utils/mount_utils.c
lustre/utils/mount_utils.h
lustre/utils/mount_utils_ldiskfs.c
lustre/utils/obd.c
lustre/utils/req-layout.c
lustre/utils/wiretest.c

index 8a04dd3..a604e01 100644 (file)
 #ifndef __LIBCFS_LIBCFS_H__
 #define __LIBCFS_LIBCFS_H__
 
 #ifndef __LIBCFS_LIBCFS_H__
 #define __LIBCFS_LIBCFS_H__
 
-#include <libcfs/types.h>
 #include <libcfs/list.h>
 
 #ifndef __KERNEL__
 # include <libcfs/user-time.h>
 # else /* __KERNEL__ */
 # include <libcfs/linux/libcfs.h>
 #include <libcfs/list.h>
 
 #ifndef __KERNEL__
 # include <libcfs/user-time.h>
 # else /* __KERNEL__ */
 # include <libcfs/linux/libcfs.h>
+# include <libcfs/types.h>
 # include "curproc.h"
 
 #define LIBCFS_VERSION "0.5.0"
 # include "curproc.h"
 
 #define LIBCFS_VERSION "0.5.0"
index fc89ce8..73b8c00 100644 (file)
@@ -370,12 +370,14 @@ extern int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
                               va_list args, const char *format2, ...)
         __attribute__ ((format (printf, 4, 5)));
 
                               va_list args, const char *format2, ...)
         __attribute__ ((format (printf, 4, 5)));
 
+#ifdef __KERNEL__
 /* other external symbols that tracefile provides: */
 extern int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob,
                                   const char __user *usr_buffer,
                                   int usr_buffer_nob);
 extern int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,
                                    const char *knl_buffer, char *append);
 /* other external symbols that tracefile provides: */
 extern int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob,
                                   const char __user *usr_buffer,
                                   int usr_buffer_nob);
 extern int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,
                                    const char *knl_buffer, char *append);
+#endif /* __KERNEL__ */
 
 #define LIBCFS_DEBUG_FILE_PATH_DEFAULT "/tmp/lustre-log"
 
 
 #define LIBCFS_DEBUG_FILE_PATH_DEFAULT "/tmp/lustre-log"
 
index 7e3fe2f..171e380 100644 (file)
 #include <linux/types.h>
 
 #ifndef __KERNEL__
 #include <linux/types.h>
 
 #ifndef __KERNEL__
-# include <limits.h> /* LONG_MAX */
-# include <stdbool.h> /* bool */
-# include <stddef.h> /* size_t */
-#endif /* !__KERNEL__ */
+# error This include is only for kernel use.
+#endif
 
 #if defined(_ASM_GENERIC_INT_L64_H)
 # define LPF64 "l"
 
 #if defined(_ASM_GENERIC_INT_L64_H)
 # define LPF64 "l"
 #define LPLX "%#lx"
 #define LPPID "%d"
 
 #define LPLX "%#lx"
 #define LPPID "%d"
 
-#ifndef BITS_PER_LONG
-# if LONG_MAX == 9223372036854775807
-#  define BITS_PER_LONG 64
-# elif LONG_MAX == 2147483647
-#  define BITS_PER_LONG 32
-# else /* LONG_MAX == 2147483647 */
-#  error "cannot define BITS_PER_LONG"
-# endif /* LONG_MAX != 2147483647 */
-#endif /* !BITS_PER_LONG */
-
 #if BITS_PER_LONG == 64
 # define LI_POISON ((int)0x5a5a5a5a5a5a5a5a)
 # define LL_POISON ((long)0x5a5a5a5a5a5a5a5a)
 #if BITS_PER_LONG == 64
 # define LI_POISON ((int)0x5a5a5a5a5a5a5a5a)
 # define LL_POISON ((long)0x5a5a5a5a5a5a5a5a)
@@ -80,9 +68,4 @@
 typedef unsigned long ulong_ptr_t;
 typedef long long_ptr_t;
 
 typedef unsigned long ulong_ptr_t;
 typedef long long_ptr_t;
 
-#ifndef __KERNEL__
-/* Sparse annotation. */
-#define __user
-#endif
-
 #endif /* _LIBCFS_TYPES_H */
 #endif /* _LIBCFS_TYPES_H */
index 119da94..ebc997c 100644 (file)
@@ -40,8 +40,7 @@
 /** \addtogroup lnet
  * @{ */
 
 /** \addtogroup lnet
  * @{ */
 
-#include <libcfs/types.h>
-
+#include <linux/types.h>
 /** \addtogroup lnet_addr
  * @{ */
 
 /** \addtogroup lnet_addr
  * @{ */
 
index 831543d..2a8db75 100644 (file)
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <libcfs/util/ioctl.h>
 #include <libcfs/util/parser.h>
 #include <lnet/lnetctl.h>
 #include "cyaml/cyaml.h"
 #include <libcfs/util/parser.h>
 #include <lnet/lnetctl.h>
 #include "cyaml/cyaml.h"
index 07c5fcb..a02b805 100644 (file)
@@ -39,6 +39,7 @@
  */
 #include <errno.h>
 #include <getopt.h>
  */
 #include <errno.h>
 #include <getopt.h>
+#include <inttypes.h>
 #include <pwd.h>
 #include <unistd.h>
 #include <stdarg.h>
 #include <pwd.h>
 #include <unistd.h>
 #include <stdarg.h>
@@ -661,8 +662,8 @@ jt_lst_show_session(int argc, char **argv)
                 return -1;
         }
 
                 return -1;
         }
 
-       fprintf(stdout, "%s ID: "LPU64"@%s, KEY: %d FEATURES: %x NODES: %d\n",
-               name, sid.ses_stamp, libcfs_nid2str(sid.ses_nid),
+       fprintf(stdout, "%s ID: %ju@%s, KEY: %d FEATURES: %x NODES: %d\n",
+               name, (uintmax_t)sid.ses_stamp, libcfs_nid2str(sid.ses_nid),
                key, feats, ndinfo.nle_nnode);
 
         return 0;
                key, feats, ndinfo.nle_nnode);
 
         return 0;
index ab3f9f7..6918c37 100644 (file)
@@ -21,6 +21,7 @@
  */
 #include <errno.h>
 #include <getopt.h>
  */
 #include <errno.h>
 #include <getopt.h>
+#include <inttypes.h>
 #include <limits.h>
 #ifdef HAVE_NETDB_H
 # include <netdb.h>
 #include <limits.h>
 #ifdef HAVE_NETDB_H
 # include <netdb.h>
@@ -635,17 +636,15 @@ jt_ptl_print_peers (int argc, char **argv)
                        else
                                state = data.ioc_flags & 0xffff ? "C" : "U";
 
                        else
                                state = data.ioc_flags & 0xffff ? "C" : "U";
 
-                       printf ("%-20s (%d) %s [%d] "LPU64" "
-                               "sq %d/%d tx %d/%d/%d\n",
-                               libcfs_nid2str(data.ioc_nid), /* peer nid */
-                               data.ioc_net, /* gemini device id */
-                               state, /* peer is Connecting, Up, or Down */
-                               data.ioc_count,   /* peer refcount */
-                               data.ioc_u64[0], /* peerstamp */
-                               data.ioc_u32[2], data.ioc_u32[3], /* tx and rx seq */
-                               /* fmaq, nfma, nrdma */
-                               data.ioc_u32[0], data.ioc_u32[1], data.ioc_u32[4]
-                               );
+                       printf("%-20s (%d) %s [%d] %ju sq %d/%d tx %d/%d/%d\n",
+                              libcfs_nid2str(data.ioc_nid), /* peer nid */
+                              data.ioc_net, /* gemini device id */
+                              state, /* peer is Connecting, Up, or Down */
+                              data.ioc_count,   /* peer refcount */
+                              (uintmax_t)data.ioc_u64[0], /* peerstamp */
+                              data.ioc_u32[2], data.ioc_u32[3], /* tx and rx seq */
+                              /* fmaq, nfma, nrdma */
+                              data.ioc_u32[0], data.ioc_u32[1], data.ioc_u32[4]);
                 } else {
                         printf ("%-20s [%d]\n",
                                 libcfs_nid2str(data.ioc_nid), data.ioc_count);
                 } else {
                         printf ("%-20s [%d]\n",
                                 libcfs_nid2str(data.ioc_nid), data.ioc_count);
@@ -1620,29 +1619,35 @@ fault_simul_rule_list(__u32 opc, char *name, int argc, char **argv)
                libcfs_ioctl_unpack(&data, ioc_buf);
 
                if (opc == LNET_CTL_DROP_LIST) {
                libcfs_ioctl_unpack(&data, ioc_buf);
 
                if (opc == LNET_CTL_DROP_LIST) {
-                       printf("%s->%s (1/%d | %d) ptl "LPX64", msg %x, "
-                              LPU64"/"LPU64", PUT "LPU64", ACK "LPU64", GET "
-                              LPU64", REP "LPU64"\n",
+                       printf("%s->%s (1/%d | %d) ptl %#jx, msg %x, "
+                              "%ju/%ju, PUT %ju, ACK %ju, GET "
+                              "%ju, REP %ju\n",
                               libcfs_nid2str(attr.fa_src),
                               libcfs_nid2str(attr.fa_dst),
                               attr.u.drop.da_rate, attr.u.drop.da_interval,
                               libcfs_nid2str(attr.fa_src),
                               libcfs_nid2str(attr.fa_dst),
                               attr.u.drop.da_rate, attr.u.drop.da_interval,
-                              attr.fa_ptl_mask, attr.fa_msg_mask,
-                              stat.u.drop.ds_dropped, stat.fs_count,
-                              stat.fs_put, stat.fs_ack,
-                              stat.fs_get, stat.fs_reply);
+                              (uintmax_t)attr.fa_ptl_mask, attr.fa_msg_mask,
+                              (uintmax_t)stat.u.drop.ds_dropped,
+                              (uintmax_t)stat.fs_count,
+                              (uintmax_t)stat.fs_put,
+                              (uintmax_t)stat.fs_ack,
+                              (uintmax_t)stat.fs_get,
+                              (uintmax_t)stat.fs_reply);
 
                } else if (opc == LNET_CTL_DELAY_LIST) {
 
                } else if (opc == LNET_CTL_DELAY_LIST) {
-                       printf("%s->%s (1/%d | %d, latency %d) ptl "LPX64
-                              ", msg %x, "LPU64"/"LPU64", PUT "LPU64
-                              ", ACK "LPU64", GET "LPU64", REP "LPU64"\n",
+                       printf("%s->%s (1/%d | %d, latency %d) ptl %#jx"
+                              ", msg %x, %ju/%ju, PUT %ju"
+                              ", ACK %ju, GET %ju, REP %ju\n",
                               libcfs_nid2str(attr.fa_src),
                               libcfs_nid2str(attr.fa_dst),
                               attr.u.delay.la_rate, attr.u.delay.la_interval,
                               attr.u.delay.la_latency,
                               libcfs_nid2str(attr.fa_src),
                               libcfs_nid2str(attr.fa_dst),
                               attr.u.delay.la_rate, attr.u.delay.la_interval,
                               attr.u.delay.la_latency,
-                              attr.fa_ptl_mask, attr.fa_msg_mask,
-                              stat.u.delay.ls_delayed, stat.fs_count,
-                              stat.fs_put, stat.fs_ack, stat.fs_get,
-                              stat.fs_reply);
+                              (uintmax_t)attr.fa_ptl_mask, attr.fa_msg_mask,
+                              (uintmax_t)stat.u.delay.ls_delayed,
+                              (uintmax_t)stat.fs_count,
+                              (uintmax_t)stat.fs_put,
+                              (uintmax_t)stat.fs_ack,
+                              (uintmax_t)stat.fs_get,
+                              (uintmax_t)stat.fs_reply);
                }
        }
        printf("found total %d\n", pos);
                }
        }
        printf("found total %d\n", pos);
index 3f65812..3cf729f 100644 (file)
@@ -73,6 +73,7 @@
 #ifndef _LUSTRE_IDL_H_
 #define _LUSTRE_IDL_H_
 
 #ifndef _LUSTRE_IDL_H_
 #define _LUSTRE_IDL_H_
 
+#include <linux/types.h>
 #include <libcfs/libcfs.h>
 #include <lnet/types.h>
 #include <lustre/lustre_user.h> /* Defn's shared with user-space. */
 #include <libcfs/libcfs.h>
 #include <lnet/types.h>
 #include <lustre/lustre_user.h> /* Defn's shared with user-space. */
index 2130784..653349d 100644 (file)
@@ -48,6 +48,7 @@
  * @{
  */
 
  * @{
  */
 
+#include <linux/types.h>
 #include <libcfs/libcfs.h>
 #include <lnet/types.h>
 
 #include <libcfs/libcfs.h>
 #include <lnet/types.h>
 
index dece264..2d51337 100644 (file)
@@ -28,7 +28,9 @@
 #ifndef LUSTRE_IOCTL_H_
 #define LUSTRE_IOCTL_H_
 
 #ifndef LUSTRE_IOCTL_H_
 #define LUSTRE_IOCTL_H_
 
+#include <linux/types.h>
 #include <libcfs/libcfs.h>
 #include <libcfs/libcfs.h>
+#include <libcfs/util/ioctl.h>
 #include <lustre/lustre_idl.h>
 
 #ifdef __KERNEL__
 #include <lustre/lustre_idl.h>
 
 #ifdef __KERNEL__
index 4d3617c..2777143 100644 (file)
  *
  * Author: jay <jxiong@clusterfs.com>
  */
  *
  * Author: jay <jxiong@clusterfs.com>
  */
-
+#include <inttypes.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <sys/time.h>
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <sys/time.h>
 
+#include <linux/types.h>
+
 #define EXPORT_SYMBOL(s)
 
 #include <../ldlm/interval_tree.c>
 #define EXPORT_SYMBOL(s)
 
 #include <../ldlm/interval_tree.c>
@@ -55,9 +58,6 @@
         abort();                                        \
 } while(0)
 
         abort();                                        \
 } while(0)
 
-#define __F(ext)         (ext)->start, (ext)->end
-#define __S              "["LPX64":"LPX64"]"
-
 #define ALIGN_SIZE       4096
 #define ALIGN_MASK       (~(ALIGN_SIZE - 1))
 
 #define ALIGN_SIZE       4096
 #define ALIGN_MASK       (~(ALIGN_SIZE - 1))
 
@@ -84,14 +84,16 @@ static enum interval_iter cb(struct interval_node *n, void *args)
         static int count = 1;
 
         if (node->hit == 1) {
         static int count = 1;
 
         if (node->hit == 1) {
-                error("A duplicate node "__S" access found\n",
-                       __F(&n->in_extent));
+               error("A duplicate node [%#jx:%#jx] access found\n",
+                     (uintmax_t)n->in_extent.start,
+                     (uintmax_t)n->in_extent.end);
                 return INTERVAL_ITER_CONT;
         }
 
         if (node->valid == 0) {
                 return INTERVAL_ITER_CONT;
         }
 
         if (node->valid == 0) {
-                error("A deleted node "__S" being accessed\n",
-                       __F(&n->in_extent));
+               error("A deleted node [%#jx:%#jx] being accessed\n",
+                     (uintmax_t)n->in_extent.start,
+                     (uintmax_t)n->in_extent.end);
                 return INTERVAL_ITER_STOP;
         }
 
                 return INTERVAL_ITER_STOP;
         }
 
@@ -99,7 +101,8 @@ static enum interval_iter cb(struct interval_node *n, void *args)
                 dprintf("\n");
                 count = 1;
         }
                 dprintf("\n");
                 count = 1;
         }
-        dprintf(""__S" ", __F(&n->in_extent));
+       dprintf("[%#jx:%#jx] ", (uintmax_t)n->in_extent.start,
+               (uintmax_t)n->in_extent.end);
         fflush(stdout);
 
         node->hit = 1;
         fflush(stdout);
 
         node->hit = 1;
@@ -120,8 +123,8 @@ static int it_test_search(struct interval_node *root)
                 if (ext.end > max_count)
                         ext.end = max_count;
 
                 if (ext.end > max_count)
                         ext.end = max_count;
 
-                dprintf("\n\nSearching the node overlapped "__S" ..\n",
-                        __F(&ext));
+               dprintf("\n\nSearching the node overlapped [%#jx:%#jx] ..\n",
+                       (uintmax_t)ext.start, (uintmax_t)ext.end);
 
                 interval_search(root, &ext, cb, NULL);
 
 
                 interval_search(root, &ext, cb, NULL);
 
@@ -135,16 +138,18 @@ static int it_test_search(struct interval_node *root)
 
                         if (extent_overlapped(&ext, &n->node.in_extent) &&
                             n->hit == 0)
 
                         if (extent_overlapped(&ext, &n->node.in_extent) &&
                             n->hit == 0)
-                                error("node "__S" overlaps" __S","
+                               error("node [%#jx:%#jx] overlaps [%#jx:%#jx],"
                                       "but never to be hit.\n",
                                       "but never to be hit.\n",
-                                      __F(&n->node.in_extent),
-                                      __F(&ext));
+                                     (uintmax_t)n->node.in_extent.start,
+                                     (uintmax_t)n->node.in_extent.end,
+                                     (uintmax_t)ext.start, (uintmax_t)ext.end);
 
                         if (!extent_overlapped(&ext, &n->node.in_extent) &&
                             n->hit)
 
                         if (!extent_overlapped(&ext, &n->node.in_extent) &&
                             n->hit)
-                                error("node "__S" overlaps" __S", but hit.\n",
-                                      __F(&n->node.in_extent),
-                                      __F(&ext));
+                               error("node [%#jx:%#jx] overlaps [%#jx:%#jx], but hit.\n",
+                                     (uintmax_t)n->node.in_extent.start,
+                                     (uintmax_t)n->node.in_extent.end,
+                                     (uintmax_t)ext.start, (uintmax_t)ext.end);
                 }
                 if (err) error("search error\n");
                 dprintf("ok.\n");
                 }
                 if (err) error("search error\n");
                 dprintf("ok.\n");
@@ -166,11 +171,12 @@ static int it_test_iterate(struct interval_node *root)
         for (i = 0; i < it_count; i++) {
                 if (it_array[i].valid == 0)
                         continue;
         for (i = 0; i < it_count; i++) {
                 if (it_array[i].valid == 0)
                         continue;
-                if (it_array[i].hit == 0)
-                        error("Node "__S" is not accessed\n",
-                              __F(&it_array[i].node.in_extent));
-        }
-
+               if (it_array[i].hit == 0) {
+                       error("Node [%#jx:%#jx] is not accessed\n",
+                             (uintmax_t)it_array[i].node.in_extent.start,
+                             (uintmax_t)it_array[i].node.in_extent.end);
+               }
+       }
         return 0;
 }
 
         return 0;
 }
 
@@ -204,11 +210,14 @@ static int it_test_find(struct interval_node *root)
                         continue;
 
                 ext = &it_array[idx].node.in_extent;
                         continue;
 
                 ext = &it_array[idx].node.in_extent;
-                dprintf("Try to find "__S"\n", __F(ext));
-                if (!interval_find(root, ext))
-                        error("interval_find, try to find "__S"\n", __F(ext));
-        }
-        return 0;
+               dprintf("Try to find [%#jx:%#jx]\n", (uintmax_t)ext->start,
+                       (uintmax_t)ext->end);
+               if (!interval_find(root, ext)) {
+                       error("interval_find, try to find [%#jx:%#jx]\n",
+                             (uintmax_t)ext->start, (uintmax_t)ext->end);
+               }
+       }
+       return 0;
 }
 
 /* sanity test is tightly coupled with implementation, so when you changed
 }
 
 /* sanity test is tightly coupled with implementation, so when you changed
@@ -228,7 +237,7 @@ static enum interval_iter sanity_cb(struct interval_node *node, void *args)
 
                 if (tmp->in_max_high > max_high) {
                         dprintf("max high sanity check, max_high is %llu,"
 
                 if (tmp->in_max_high > max_high) {
                         dprintf("max high sanity check, max_high is %llu,"
-                                "child max_high: %llu"__S"\n",
+                               "child max_high: %llu[%#jx:%#jx]\n",
                                 max_high, tmp->in_max_high,
                                 __F(&tmp->in_extent));
                         goto err;
                                 max_high, tmp->in_max_high,
                                 __F(&tmp->in_extent));
                         goto err;
@@ -246,13 +255,13 @@ static enum interval_iter sanity_cb(struct interval_node *node, void *args)
                 int count;
 err:
                 count = 1;
                 int count;
 err:
                 count = 1;
-                dprintf("node"__S":%llu Child list:\n",
+               dprintf("node[%#jx:%#jx]:%llu Child list:\n",
                         node->in_extent.start,
                         node->in_extent.end,
                         node->in_max_high);
 
                 interval_for_each(tmp, node) {
                         node->in_extent.start,
                         node->in_extent.end,
                         node->in_max_high);
 
                 interval_for_each(tmp, node) {
-                        dprintf(""__S":%llu ",
+                       dprintf("[%#jx:%#jx]:%llu ",
                                 __F(&tmp->in_extent),
                                 tmp->in_max_high);
                         if (count++ == 8) {
                                 __F(&tmp->in_extent),
                                 tmp->in_max_high);
                         if (count++ == 8) {
@@ -311,15 +320,20 @@ static int it_test_search_hole(struct interval_node *root)
         ext2 = ext;
 
         interval_expand(root, &ext, NULL);
         ext2 = ext;
 
         interval_expand(root, &ext, NULL);
-        dprintf("Extending "__S" to .."__S"\n", __F(&ext2), __F(&ext));
+       dprintf("Extending [%#jx:%#jx] to ..[%#jx:%#jx]\n",
+               (uintmax_t)ext2.start, (uintmax_t)ext2.end,
+               (uintmax_t)ext.start, (uintmax_t)ext.end);
         for (i = 0; i < it_count; i++) {
                 n = &it_array[i];
                 if (n->valid == 0)
                         continue;
 
                 if (extent_overlapped(&ext, &n->node.in_extent)) {
         for (i = 0; i < it_count; i++) {
                 n = &it_array[i];
                 if (n->valid == 0)
                         continue;
 
                 if (extent_overlapped(&ext, &n->node.in_extent)) {
-                        error("Extending "__S" to .."__S" overlaps node"__S"\n",
-                                __F(&ext2), __F(&ext), __F(&n->node.in_extent));
+                       error("Extending [%#jx:%#jx] to ..[%#jx:%#jx] overlaps node[%#jx:%#jx]\n",
+                             (uintmax_t)ext2.start, (uintmax_t)ext2.end,
+                             (uintmax_t)ext.start, (uintmax_t)ext.end,
+                             (uintmax_t)n->node.in_extent.start,
+                             (uintmax_t)n->node.in_extent.end);
                 }
 
                 if (n->node.in_extent.end < ext2.start)
                 }
 
                 if (n->node.in_extent.end < ext2.start)
@@ -332,8 +346,9 @@ static int it_test_search_hole(struct interval_node *root)
         /* only expanding high right now */
         if (ext2.start != ext.start || high != ext.end) {
                 ext2.start = low, ext2.end = high;
         /* only expanding high right now */
         if (ext2.start != ext.start || high != ext.end) {
                 ext2.start = low, ext2.end = high;
-                error("Real extending result:"__S", expected:"__S"\n",
-                       __F(&ext), __F(&ext2));
+               error("Real extending result:[%#jx:%#jx], expected:[%#jx:%#jx]\n",
+                     (uintmax_t)ext.start, (uintmax_t)ext.end,
+                     (uintmax_t)ext2.start, (uintmax_t)ext2.end);
         }
 
         return 0;
         }
 
         return 0;
@@ -374,7 +389,8 @@ static int it_test_performance(struct interval_node *root, unsigned long len)
                 ext.end = max_count;
         }
 
                 ext.end = max_count;
         }
 
-        dprintf("Extent search"__S"\n", __F(&ext));
+       dprintf("Extent search[%#jx:%#jx]\n", (uintmax_t)ext.start,
+               (uintmax_t)ext.end);
 
         /* list */
         contended_count = 0;
 
         /* list */
         contended_count = 0;
@@ -420,8 +436,9 @@ static struct interval_node *it_test_helper(struct interval_node *root)
                 if (n->valid) {
                         if (!interval_find(root, &n->node.in_extent))
                                 error("Cannot find an existent node\n");
                 if (n->valid) {
                         if (!interval_find(root, &n->node.in_extent))
                                 error("Cannot find an existent node\n");
-                        dprintf("Erasing a node "__S"\n",
-                                __F(&n->node.in_extent));
+                       dprintf("Erasing a node [%#jx:%#jx]\n",
+                               (uintmax_t)n->node.in_extent.start,
+                               (uintmax_t)n->node.in_extent.end);
                         interval_erase(&n->node, &root);
                         n->valid = 0;
                        list_del_init(&n->list);
                         interval_erase(&n->node, &root);
                         n->valid = 0;
                        list_del_init(&n->list);
@@ -434,8 +451,9 @@ static struct interval_node *it_test_helper(struct interval_node *root)
                         interval_set(&n->node, low, high);
                         while (interval_insert(&n->node, &root))
                                 interval_set(&n->node, low, ++high);
                         interval_set(&n->node, low, high);
                         while (interval_insert(&n->node, &root))
                                 interval_set(&n->node, low, ++high);
-                        dprintf("Adding a node "__S"\n",
-                                __F(&n->node.in_extent));
+                       dprintf("Adding a node [%#jx:%#jx]\n",
+                               (uintmax_t)n->node.in_extent.start,
+                               (uintmax_t)n->node.in_extent.end);
                         n->valid = 1;
                        list_add(&n->list, &header);
                 }
                         n->valid = 1;
                        list_add(&n->list, &header);
                 }
index 62fe40d..b2010b2 100644 (file)
@@ -35,7 +35,7 @@
  *
  * Author: You Feng <youfeng@clusterfs.com>
  */
  *
  * Author: You Feng <youfeng@clusterfs.com>
  */
-
+#include <limits.h>
 #include <mpi.h>
 #include <stdio.h>
 #include <string.h>
 #include <mpi.h>
 #include <stdio.h>
 #include <string.h>
@@ -48,7 +48,6 @@
 #include <sys/ioctl.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <sys/ioctl.h>
 #include <fcntl.h>
 #include <errno.h>
-#include <libcfs/libcfs.h>
 #include "lustre/lustre_user.h"
 #include "lp_utils.h"
 
 #include "lustre/lustre_user.h"
 #include "lp_utils.h"
 
index 509873e..48efb1d 100644 (file)
@@ -234,7 +234,6 @@ sigalrm_handler(int signum)
 #define HAVE_MDC_LOOKUP
 #elif defined(USE_MDC_LOOKUP)
 #include <config.h>
 #define HAVE_MDC_LOOKUP
 #elif defined(USE_MDC_LOOKUP)
 #include <config.h>
-#include <libcfs/libcfs.h>
 #include <lustre_ioctl.h>
 
 int llapi_file_lookup(int dirfd, const char *name)
 #include <lustre_ioctl.h>
 
 int llapi_file_lookup(int dirfd, const char *name)
index 8cfc35c..a92919d 100644 (file)
@@ -36,6 +36,7 @@
  * Author: You Feng <youfeng@clusterfs.com>
  */
 
  * Author: You Feng <youfeng@clusterfs.com>
  */
 
+#include <limits.h>
 #include <mpi.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <mpi.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -48,7 +49,6 @@
 #include <unistd.h>
 #include <time.h>
 #include <errno.h>
 #include <unistd.h>
 #include <time.h>
 #include <errno.h>
-#include <libcfs/libcfs.h>
 #include <lustre/lustre_user.h>
 #include "lp_utils.h"
 
 #include <lustre/lustre_user.h>
 #include "lp_utils.h"
 
index fb6ff6b..40a8cb4 100644 (file)
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE /* pull in O_DIRECTORY in bits/fcntl.h */
 #endif
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE /* pull in O_DIRECTORY in bits/fcntl.h */
 #endif
-#include <stdio.h>
+#include <errno.h>
 #include <fcntl.h>
 #include <fcntl.h>
+#include <limits.h>
+#include <stdio.h>
 #include <string.h>
 #include <string.h>
-#include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
@@ -649,7 +650,7 @@ int main(int argc, char **argv)
                                        " %d\n", rc);
                                exit(-rc);
                        }
                                        " %d\n", rc);
                                exit(-rc);
                        }
-                       printf("dataversion is "LPU64"\n", dv);
+                       printf("dataversion is %ju\n", (uintmax_t)dv);
                        break;
                 case 'y':
                         if (fsync(fd) == -1) {
                        break;
                 case 'y':
                         if (fsync(fd) == -1) {
index 4a1c695..1bf553b 100644 (file)
@@ -35,6 +35,7 @@
  */
 
 #include <errno.h>
  */
 
 #include <errno.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index d0773e9..9d7dacb 100644 (file)
@@ -39,6 +39,7 @@
 #define _GNU_SOURCE
 #endif
 
 #define _GNU_SOURCE
 #endif
 
+#include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
@@ -50,7 +51,6 @@
 #include <sys/stat.h>
 #include <linux/types.h>
 
 #include <sys/stat.h>
 #include <linux/types.h>
 
-#include <libcfs/types.h>
 #include <libcfs/byteorder.h>
 
 #define READ  1
 #include <libcfs/byteorder.h>
 
 #define READ  1
@@ -71,33 +71,33 @@ int block_debug_setup(void *addr, int len, __u64 off, __u64 id)
         return 0;
 }
 
         return 0;
 }
 
-int block_debug_check(char *who, void *addr, int size, __u64 off, __u64 id)
+int block_debug_check(char *who, void *addr, int size, uint64_t off, uint64_t id)
 {
 {
-        __u64 ne_off;
+       uint64_t ne_off;
         int err = 0;
 
         ne_off = le64_to_cpu(off);
         id = le64_to_cpu(id);
         if (memcmp(addr, (char *)&ne_off, LPDS)) {
         int err = 0;
 
         ne_off = le64_to_cpu(off);
         id = le64_to_cpu(id);
         if (memcmp(addr, (char *)&ne_off, LPDS)) {
-               fprintf(stderr, "%s: for offset "LPU64" off: "LPX64" != "LPX64"\n",
-                       who, off, *(__u64 *)addr, ne_off);
+               fprintf(stderr, "%s: for offset %"PRIu64" off: %"PRIx64" != %"PRIx64"\n",
+                       who, off, *(uint64_t *)addr, ne_off);
                 err = -EINVAL;
         }
         if (memcmp(addr + LPDS, (char *)&id, LPDS)) {
                 err = -EINVAL;
         }
         if (memcmp(addr + LPDS, (char *)&id, LPDS)) {
-               fprintf(stderr, "%s: for offset "LPU64" id: "LPX64" != "LPX64"\n",
-                       who, off, *(__u64 *)(addr + LPDS), id);
+               fprintf(stderr, "%s: for offset %"PRIu64" id: %"PRIx64" != %"PRIx64"\n",
+                       who, off, *(uint64_t *)(addr + LPDS), id);
                 err = -EINVAL;
         }
 
         addr += size - LPDS - LPDS;
         if (memcmp(addr, (char *)&ne_off, LPDS)) {
                 err = -EINVAL;
         }
 
         addr += size - LPDS - LPDS;
         if (memcmp(addr, (char *)&ne_off, LPDS)) {
-               fprintf(stderr, "%s: for offset "LPU64" end off: "LPX64" != "LPX64"\n",
-                       who, off, *(__u64 *)addr, ne_off);
+               fprintf(stderr, "%s: for offset %"PRIu64" end off: %"PRIx64" != %"PRIx64"\n",
+                       who, off, *(uint64_t *)addr, ne_off);
                 err = -EINVAL;
         }
         if (memcmp(addr + LPDS, (char *)&id, LPDS)) {
                 err = -EINVAL;
         }
         if (memcmp(addr + LPDS, (char *)&id, LPDS)) {
-               fprintf(stderr, "%s: for offset "LPU64" end id: "LPX64" != "LPX64"\n",
-                       who, off, *(__u64 *)(addr + LPDS), id);
+               fprintf(stderr, "%s: for offset %"PRIu64" end id: %"PRIx64" != %"PRIx64"\n",
+                       who, off, *(uint64_t *)(addr + LPDS), id);
                 err = -EINVAL;
         }
 
                 err = -EINVAL;
         }
 
@@ -119,7 +119,7 @@ int main(int argc, char **argv)
         char *buf;
         long long count, last, offset;
         long pg_vec, len;
         char *buf;
         long long count, last, offset;
         long pg_vec, len;
-        __u64 objid;
+       uint64_t objid;
         struct stat st;
         int flags = 0;
         int cmd = 0;
         struct stat st;
         int flags = 0;
         int cmd = 0;
@@ -188,7 +188,7 @@ int main(int argc, char **argv)
                 objid = 3;
         }
 
                 objid = 3;
         }
 
-        printf("%s: %s on %s(objid "LPX64") for %llux%ld pages \n",
+       printf("%s: %s on %s(objid %"PRIx64") for %llux%ld pages \n",
                argv[0],
 #ifdef O_DIRECT
                flags & O_DIRECT ? "directio" : "i/o",
                argv[0],
 #ifdef O_DIRECT
                flags & O_DIRECT ? "directio" : "i/o",
index cde42b4..1b2e17c 100644 (file)
@@ -1,4 +1,5 @@
 #include <sys/types.h>
 #include <sys/types.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <stdio.h>
 /* For basename() */
 #include <stdlib.h>
 #include <stdio.h>
 /* For basename() */
index b8c7e8e..8c0b971 100644 (file)
@@ -47,6 +47,7 @@
 #include <sys/ipc.h>
 #include <sys/sem.h>
 
 #include <sys/ipc.h>
 #include <sys/sem.h>
 
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <pwd.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <pwd.h>
index 10842a2..c03c8f7 100644 (file)
@@ -34,6 +34,7 @@
  * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
  * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
+#include <stdbool.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
 #include <stdio.h>
@@ -412,7 +413,8 @@ static void show_result(struct identity_downcall_data *data)
 
                 pdd = &data->idd_perms[i];
 
 
                 pdd = &data->idd_perms[i];
 
-                printf("  "LPX64"\t0x%x\n", pdd->pdd_nid, pdd->pdd_perm);
+               printf("  %#jx\t0x%x\n", (uintmax_t)pdd->pdd_nid,
+                      pdd->pdd_perm);
         }
         printf("\n");
 }
         }
         printf("\n");
 }
index 9f0c2d6..fe9d273 100644 (file)
@@ -41,6 +41,7 @@
  */
 
 #include <errno.h>
  */
 
 #include <errno.h>
+#include <limits.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
index 9059890..1dcfc44 100644 (file)
@@ -2947,7 +2947,7 @@ static void print_quota_title(char *name, struct if_quotactl *qctl,
 static void kbytes2str(__u64 num, char *buf, int buflen, bool h)
 {
        if (!h) {
 static void kbytes2str(__u64 num, char *buf, int buflen, bool h)
 {
        if (!h) {
-               snprintf(buf, buflen, LPU64, num);
+               snprintf(buf, buflen, "%ju", (uintmax_t)num);
        } else {
                if (num >> 40)
                        snprintf(buf, buflen, "%5.4gP",
        } else {
                if (num >> 40)
                        snprintf(buf, buflen, "%5.4gP",
@@ -2962,7 +2962,7 @@ static void kbytes2str(__u64 num, char *buf, int buflen, bool h)
                        snprintf(buf, buflen, "%5.4gM",
                                 (double)num / (1 << 10));
                else
                        snprintf(buf, buflen, "%5.4gM",
                                 (double)num / (1 << 10));
                else
-                       snprintf(buf, buflen, LPU64"%s", num, "k");
+                       snprintf(buf, buflen, "%ju%s", (uintmax_t)num, "k");
        }
 }
 
        }
 }
 
@@ -3039,16 +3039,17 @@ static void print_quota(char *mnt, struct if_quotactl *qctl, int type,
                        diff2str(dqb->dqb_itime, timebuf, now);
 
                sprintf(numbuf[0], (dqb->dqb_valid & QIF_INODES) ?
                        diff2str(dqb->dqb_itime, timebuf, now);
 
                sprintf(numbuf[0], (dqb->dqb_valid & QIF_INODES) ?
-                       LPU64 : "["LPU64"]", dqb->dqb_curinodes);
+                       "%ju" : "[%ju]", (uintmax_t)dqb->dqb_curinodes);
 
                if (type == QC_GENERAL)
                        sprintf(numbuf[1], (dqb->dqb_valid & QIF_ILIMITS) ?
 
                if (type == QC_GENERAL)
                        sprintf(numbuf[1], (dqb->dqb_valid & QIF_ILIMITS) ?
-                               LPU64 : "["LPU64"]", dqb->dqb_isoftlimit);
+                               "%ju" : "[%ju]",
+                               (uintmax_t)dqb->dqb_isoftlimit);
                else
                        sprintf(numbuf[1], "%s", "-");
 
                sprintf(numbuf[2], (dqb->dqb_valid & QIF_ILIMITS) ?
                else
                        sprintf(numbuf[1], "%s", "-");
 
                sprintf(numbuf[2], (dqb->dqb_valid & QIF_ILIMITS) ?
-                       LPU64 : "["LPU64"]", dqb->dqb_ihardlimit);
+                       "%ju" : "[%ju]", (uintmax_t)dqb->dqb_ihardlimit);
 
                if (type != QC_OSTIDX)
                        printf(" %7s%c %6s %7s %7s",
 
                if (type != QC_OSTIDX)
                        printf(" %7s%c %6s %7s %7s",
@@ -3260,8 +3261,9 @@ ug_output:
                                      &total_balloc);
                kbytes2str(total_balloc, strbuf, sizeof(strbuf),
                           human_readable);
                                      &total_balloc);
                kbytes2str(total_balloc, strbuf, sizeof(strbuf),
                           human_readable);
-               printf("Total allocated inode limit: "LPU64", total "
-                      "allocated block limit: %s\n", total_ialloc, strbuf);
+               printf("Total allocated inode limit: %ju, total "
+                      "allocated block limit: %s\n", (uintmax_t)total_ialloc,
+                      strbuf);
        }
 
         if (rc1 || rc2 || rc3 || inacc)
        }
 
         if (rc1 || rc2 || rc3 || inacc)
@@ -3441,8 +3443,8 @@ static int lfs_changelog(int argc, char **argv)
 
                secs = rec->cr_time >> 30;
                gmtime_r(&secs, &ts);
 
                secs = rec->cr_time >> 30;
                gmtime_r(&secs, &ts);
-               printf(LPU64" %02d%-5s %02d:%02d:%02d.%06d %04d.%02d.%02d "
-                      "0x%x t="DFID, rec->cr_index, rec->cr_type,
+               printf("%ju %02d%-5s %02d:%02d:%02d.%06d %04d.%02d.%02d "
+                      "0x%x t="DFID, (uintmax_t) rec->cr_index, rec->cr_type,
                       changelog_type2str(rec->cr_type),
                       ts.tm_hour, ts.tm_min, ts.tm_sec,
                       (int)(rec->cr_time & ((1<<30) - 1)),
                       changelog_type2str(rec->cr_type),
                       ts.tm_hour, ts.tm_min, ts.tm_sec,
                       (int)(rec->cr_time & ((1<<30) - 1)),
@@ -3706,7 +3708,7 @@ static int lfs_data_version(int argc, char **argv)
        if (rc < 0)
                err(errno, "cannot get version for %s", path);
        else
        if (rc < 0)
                err(errno, "cannot get version for %s", path);
        else
-               printf(LPU64 "\n", data_version);
+               printf("%ju" "\n", (uintmax_t)data_version);
 
        close(fd);
        return rc;
 
        close(fd);
        return rc;
index 40cbf3c..fdf63c8 100644 (file)
@@ -547,8 +547,9 @@ static int ct_copy_data(struct hsm_copyaction_private *hcp, const char *src,
 
        if (hai->hai_extent.offset > (__u64)src_st.st_size) {
                rc = -EINVAL;
 
        if (hai->hai_extent.offset > (__u64)src_st.st_size) {
                rc = -EINVAL;
-               CT_ERROR(rc, "Trying to start reading past end ("LPU64" > "
-                        "%jd) of '%s' source file", hai->hai_extent.offset,
+               CT_ERROR(rc, "Trying to start reading past end (%ju > "
+                        "%jd) of '%s' source file",
+                        (uintmax_t)hai->hai_extent.offset,
                         (intmax_t)src_st.st_size, src);
                return rc;
        }
                         (intmax_t)src_st.st_size, src);
                return rc;
        }
@@ -590,8 +591,8 @@ static int ct_copy_data(struct hsm_copyaction_private *hcp, const char *src,
                goto out;
        }
 
                goto out;
        }
 
-       CT_TRACE("start copy of "LPU64" bytes from '%s' to '%s'",
-                length, src, dst);
+       CT_TRACE("start copy of %ju bytes from '%s' to '%s'",
+                (uintmax_t)length, src, dst);
 
        while (write_total < length) {
                ssize_t rsize;
 
        while (write_total < length) {
                ssize_t rsize;
@@ -664,7 +665,7 @@ static int ct_copy_data(struct hsm_copyaction_private *hcp, const char *src,
                now = time(NULL);
                if (now >= last_report_time + opt.o_report_int) {
                        last_report_time = now;
                now = time(NULL);
                if (now >= last_report_time + opt.o_report_int) {
                        last_report_time = now;
-                       CT_TRACE("%%"LPU64" ", 100 * write_total / length);
+                       CT_TRACE("%%%ju ", (uintmax_t)(100 * write_total / length));
                        /* only give the length of the write since the last
                         * progress report */
                        he.length = offset - he.offset;
                        /* only give the length of the write since the last
                         * progress report */
                        he.length = offset - he.offset;
@@ -705,8 +706,8 @@ out:
        if (buf != NULL)
                free(buf);
 
        if (buf != NULL)
                free(buf);
 
-       CT_TRACE("copied "LPU64" bytes in %f seconds",
-                length, ct_now() - start_ct_now);
+       CT_TRACE("copied %ju bytes in %f seconds",
+                (uintmax_t)length, ct_now() - start_ct_now);
 
        return rc;
 }
 
        return rc;
 }
@@ -840,8 +841,8 @@ static int ct_fini(struct hsm_copyaction_private **phcp,
        int                              rc;
 
        CT_TRACE("Action completed, notifying coordinator "
        int                              rc;
 
        CT_TRACE("Action completed, notifying coordinator "
-                "cookie="LPX64", FID="DFID", hp_flags=%d err=%d",
-                hai->hai_cookie, PFID(&hai->hai_fid),
+                "cookie=%#jx, FID="DFID", hp_flags=%d err=%d",
+                (uintmax_t)hai->hai_cookie, PFID(&hai->hai_fid),
                 hp_flags, -ct_rc);
 
        ct_path_lustre(lstr, sizeof(lstr), opt.o_mnt, &hai->hai_fid);
                 hp_flags, -ct_rc);
 
        ct_path_lustre(lstr, sizeof(lstr), opt.o_mnt, &hai->hai_fid);
@@ -859,8 +860,8 @@ static int ct_fini(struct hsm_copyaction_private **phcp,
        rc = llapi_hsm_action_end(phcp, &hai->hai_extent, hp_flags, abs(ct_rc));
        if (rc == -ECANCELED)
                CT_ERROR(rc, "completed action on '%s' has been canceled: "
        rc = llapi_hsm_action_end(phcp, &hai->hai_extent, hp_flags, abs(ct_rc));
        if (rc == -ECANCELED)
                CT_ERROR(rc, "completed action on '%s' has been canceled: "
-                        "cookie="LPX64", FID="DFID, lstr, hai->hai_cookie,
-                        PFID(&hai->hai_fid));
+                        "cookie=%#jx, FID="DFID, lstr,
+                        (uintmax_t)hai->hai_cookie, PFID(&hai->hai_fid));
        else if (rc < 0)
                CT_ERROR(rc, "llapi_hsm_action_end() on '%s' failed", lstr);
        else
        else if (rc < 0)
                CT_ERROR(rc, "llapi_hsm_action_end() on '%s' failed", lstr);
        else
@@ -1281,9 +1282,9 @@ static int ct_process_item(struct hsm_action_item *hai, const long hal_flags)
                int             linkno = 0;
 
                sprintf(fid, DFID, PFID(&hai->hai_fid));
                int             linkno = 0;
 
                sprintf(fid, DFID, PFID(&hai->hai_fid));
-               CT_TRACE("'%s' action %s reclen %d, cookie="LPX64,
+               CT_TRACE("'%s' action %s reclen %d, cookie=%#jx",
                         fid, hsm_copytool_action2name(hai->hai_action),
                         fid, hsm_copytool_action2name(hai->hai_action),
-                        hai->hai_len, hai->hai_cookie);
+                        hai->hai_len, (uintmax_t)hai->hai_cookie);
                rc = llapi_fid2path(opt.o_mnt, fid, path,
                                    sizeof(path), &recno, &linkno);
                if (rc < 0)
                rc = llapi_fid2path(opt.o_mnt, fid, path,
                                    sizeof(path), &recno, &linkno);
                if (rc < 0)
@@ -1766,7 +1767,7 @@ static int ct_max_sequence(void)
                path[sizeof(path) - 1] = '\0';
        }
 
                path[sizeof(path) - 1] = '\0';
        }
 
-       printf("max_sequence: "LPX64"\n", seq);
+       printf("max_sequence: %#jx\n", (uintmax_t)seq);
 
        return 0;
 }
 
        return 0;
 }
index dd236a8..15ad55b 100644 (file)
@@ -613,8 +613,8 @@ retry_open:
                        errmsg = strerror(errno);
 
                llapi_err_noerrno(LLAPI_MSG_ERROR,
                        errmsg = strerror(errno);
 
                llapi_err_noerrno(LLAPI_MSG_ERROR,
-                                 "error on ioctl "LPX64" for '%s' (%d): %s",
-                                 (__u64)LL_IOC_LOV_SETSTRIPE, name, fd,
+                                 "error on ioctl %#jx for '%s' (%d): %s",
+                                 (uintmax_t)LL_IOC_LOV_SETSTRIPE, name, fd,
                                  errmsg);
 
                close(fd);
                                  errmsg);
 
                close(fd);
@@ -829,8 +829,8 @@ int llapi_direntry_remove(char *dname)
        if (ioctl(fd, LL_IOC_REMOVE_ENTRY, filename)) {
                char *errmsg = strerror(errno);
                llapi_err_noerrno(LLAPI_MSG_ERROR,
        if (ioctl(fd, LL_IOC_REMOVE_ENTRY, filename)) {
                char *errmsg = strerror(errno);
                llapi_err_noerrno(LLAPI_MSG_ERROR,
-                                 "error on ioctl "LPX64" for '%s' (%d): %s",
-                                 (__u64)LL_IOC_LMV_SETSTRIPE, filename,
+                                 "error on ioctl %#jx for '%s' (%d): %s",
+                                 (uintmax_t)LL_IOC_LMV_SETSTRIPE, filename,
                                  fd, errmsg);
        }
 out:
                                  fd, errmsg);
        }
 out:
@@ -2111,10 +2111,10 @@ static void lov_dump_user_lmm_header(struct lov_user_md *lum, char *path,
        if ((verbose & VERBOSE_DETAIL) && !is_dir) {
                llapi_printf(LLAPI_MSG_NORMAL, "lmm_magic:          0x%08X\n",
                             lum->lmm_magic);
        if ((verbose & VERBOSE_DETAIL) && !is_dir) {
                llapi_printf(LLAPI_MSG_NORMAL, "lmm_magic:          0x%08X\n",
                             lum->lmm_magic);
-               llapi_printf(LLAPI_MSG_NORMAL, "lmm_seq:            "LPX64"\n",
-                            lmm_oi_seq(&lum->lmm_oi));
-               llapi_printf(LLAPI_MSG_NORMAL, "lmm_object_id:      "LPX64"\n",
-                            lmm_oi_id(&lum->lmm_oi));
+               llapi_printf(LLAPI_MSG_NORMAL, "lmm_seq:            %#jx\n",
+                            (uintmax_t)lmm_oi_seq(&lum->lmm_oi));
+               llapi_printf(LLAPI_MSG_NORMAL, "lmm_object_id:      %#jx\n",
+                            (uintmax_t)lmm_oi_id(&lum->lmm_oi));
        }
 
         if (verbose & VERBOSE_COUNT) {
        }
 
         if (verbose & VERBOSE_COUNT) {
index 9dc3ef8..1c862d7 100644 (file)
@@ -41,6 +41,8 @@
  */
 
 #include <errno.h>
  */
 
 #include <errno.h>
+#include <limits.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
@@ -67,8 +69,8 @@ static inline int ext2_test_bit(int nr, const void *addr)
        return (tmp[nr >> 3] >> (nr & 7)) & 1;
 #else
        const unsigned long *tmp = addr;
        return (tmp[nr >> 3] >> (nr & 7)) & 1;
 #else
        const unsigned long *tmp = addr;
-       return ((1UL << (nr & (BITS_PER_LONG - 1))) &
-               ((tmp)[nr / BITS_PER_LONG])) != 0;
+       return ((1UL << (nr & (__WORDSIZE - 1))) &
+               ((tmp)[nr / __WORDSIZE])) != 0;
 #endif
 }
 
 #endif
 }
 
@@ -145,12 +147,13 @@ static void print_log_path(struct llog_logid_rec *lid, int is_ext)
 
        if (is_ext)
                snprintf(object_path, sizeof(object_path),
 
        if (is_ext)
                snprintf(object_path, sizeof(object_path),
-                        "O/"LPU64"/d%u/%u", fid_from_logid.f_seq,
-                        fid_from_logid.f_oid % 32, fid_from_logid.f_oid);
+                        "O/%ju/d%u/%u", (uintmax_t)fid_from_logid.f_seq,
+                        fid_from_logid.f_oid % 32,
+                        fid_from_logid.f_oid);
        else
                snprintf(object_path, sizeof(object_path),
        else
                snprintf(object_path, sizeof(object_path),
-                        "oi."LPU64"/"DFID_NOBRACE,
-                        fid_from_logid.f_seq & (OSD_OI_FID_NR - 1) ,
+                        "oi.%ju/"DFID_NOBRACE,
+                        (uintmax_t)(fid_from_logid.f_seq & (OSD_OI_FID_NR - 1)),
                         PFID(&fid_from_logid));
 
        printf("ogen=%X id="DOSTID" path=%s\n",
                         PFID(&fid_from_logid));
 
        printf("ogen=%X id="DOSTID" path=%s\n",
@@ -366,8 +369,8 @@ static void print_1_cfg(struct lustre_cfg *lcfg)
         int i;
 
         if (lcfg->lcfg_nid)
         int i;
 
         if (lcfg->lcfg_nid)
-                printf("nid=%s("LPX64")  ", libcfs_nid2str(lcfg->lcfg_nid),
-                       lcfg->lcfg_nid);
+               printf("nid=%s(%#jx)  ", libcfs_nid2str(lcfg->lcfg_nid),
+                      (uintmax_t)lcfg->lcfg_nid);
         if (lcfg->lcfg_nal)
                 printf("nal=%d ", lcfg->lcfg_nal);
         for (i = 0; i <  lcfg->lcfg_bufcount; i++)
         if (lcfg->lcfg_nal)
                 printf("nal=%d ", lcfg->lcfg_nal);
         for (i = 0; i <  lcfg->lcfg_bufcount; i++)
@@ -389,8 +392,9 @@ static void print_setup_cfg(struct lustre_cfg *lcfg)
                 desc = (struct lov_desc*)(lustre_cfg_string(lcfg, 1));
                 printf("\t\tuuid=%s  ", (char*)desc->ld_uuid.uuid);
                 printf("stripe:cnt=%u ", desc->ld_default_stripe_count);
                 desc = (struct lov_desc*)(lustre_cfg_string(lcfg, 1));
                 printf("\t\tuuid=%s  ", (char*)desc->ld_uuid.uuid);
                 printf("stripe:cnt=%u ", desc->ld_default_stripe_count);
-                printf("size="LPU64" ", desc->ld_default_stripe_size);
-                printf("offset="LPU64" ", desc->ld_default_stripe_offset);
+               printf("size=%ju ", (uintmax_t)desc->ld_default_stripe_size);
+               printf("offset=%ju ",
+                      (uintmax_t)desc->ld_default_stripe_offset);
                 printf("pattern=%#x", desc->ld_pattern);
         } else {
                 printf("setup     ");
                 printf("pattern=%#x", desc->ld_pattern);
         } else {
                 printf("setup     ");
@@ -595,23 +599,25 @@ static void print_hsm_action(struct llog_agent_req_rec *larr)
 
        sz = larr->arr_hai.hai_len - sizeof(larr->arr_hai);
        printf("lrh=[type=%X len=%d idx=%d] fid="DFID
 
        sz = larr->arr_hai.hai_len - sizeof(larr->arr_hai);
        printf("lrh=[type=%X len=%d idx=%d] fid="DFID
-              " compound/cookie="LPX64"/"LPX64
-              " status=%s action=%s archive#=%d flags="LPX64
-              " create="LPU64" change="LPU64
-              " extent="LPX64"-"LPX64" gid="LPX64" datalen=%d"
+              " compound/cookie=%#jx/%#jx"
+              " status=%s action=%s archive#=%d flags=%#jx"
+              " create=%ju change=%ju"
+              " extent=%#jx-%#jx gid=%#jx datalen=%d"
               " data=[%s]\n",
               larr->arr_hdr.lrh_type,
               larr->arr_hdr.lrh_len, larr->arr_hdr.lrh_index,
               PFID(&larr->arr_hai.hai_fid),
               " data=[%s]\n",
               larr->arr_hdr.lrh_type,
               larr->arr_hdr.lrh_len, larr->arr_hdr.lrh_index,
               PFID(&larr->arr_hai.hai_fid),
-              larr->arr_compound_id, larr->arr_hai.hai_cookie,
+              (uintmax_t)larr->arr_compound_id,
+              (uintmax_t)larr->arr_hai.hai_cookie,
               agent_req_status2name(larr->arr_status),
               hsm_copytool_action2name(larr->arr_hai.hai_action),
               larr->arr_archive_id,
               agent_req_status2name(larr->arr_status),
               hsm_copytool_action2name(larr->arr_hai.hai_action),
               larr->arr_archive_id,
-              larr->arr_flags,
-              larr->arr_req_create, larr->arr_req_change,
-              larr->arr_hai.hai_extent.offset,
-              larr->arr_hai.hai_extent.length,
-              larr->arr_hai.hai_gid, sz,
+              (uintmax_t)larr->arr_flags,
+              (uintmax_t)larr->arr_req_create,
+              (uintmax_t)larr->arr_req_change,
+              (uintmax_t)larr->arr_hai.hai_extent.offset,
+              (uintmax_t)larr->arr_hai.hai_extent.length,
+              (uintmax_t)larr->arr_hai.hai_gid, sz,
               hai_dump_data_field(&larr->arr_hai, buf, sizeof(buf)));
 }
 
               hai_dump_data_field(&larr->arr_hai, buf, sizeof(buf)));
 }
 
index 3e2495b..4d07027 100644 (file)
@@ -47,6 +47,8 @@
 #define _GNU_SOURCE
 #endif
 #include <errno.h>
 #define _GNU_SOURCE
 #endif
 #include <errno.h>
+#include <limits.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <unistd.h>
index 04a072c..7e5f0c0 100644 (file)
@@ -43,6 +43,8 @@
 
 #include <errno.h>
 #include <fcntl.h>
 
 #include <errno.h>
 #include <fcntl.h>
+#include <limits.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ioctl.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/ioctl.h>
index e0f7599..b12a2d9 100644 (file)
@@ -1445,7 +1445,8 @@ void lr_print_status(struct lr_info *info)
         if (statuslog != NULL)
                 printf("Statuslog: %s\n", statuslog);
         printf("Changelog registration: %s\n", status->ls_registration);
         if (statuslog != NULL)
                 printf("Statuslog: %s\n", statuslog);
         printf("Changelog registration: %s\n", status->ls_registration);
-        printf("Starting changelog record: "LPD64"\n", status->ls_last_recno);
+       printf("Starting changelog record: %jd\n",
+              (uintmax_t)status->ls_last_recno);
         if (noxattr)
                 printf("Replicate xattrs: no\n");
         if (noclear)
         if (noxattr)
                 printf("Replicate xattrs: no\n");
         if (noclear)
index 2289b72..2eb9daa 100644 (file)
@@ -781,7 +781,7 @@ __u64 get_device_size(char* device)
                return 0;
        }
 
                return 0;
        }
 
-       vprint("device size = "LPU64"MB\n", size >> 20);
+       vprint("device size = %juMB\n", (uintmax_t)(size >> 20));
        /* return value in KB */
        return size >> 10;
 }
        /* return value in KB */
        return size >> 10;
 }
@@ -798,8 +798,9 @@ int file_create(char *path, __u64 size)
         */
        size_max = (off_t)1 << (_FILE_OFFSET_BITS - 1 - 10);
        if (size >= size_max) {
         */
        size_max = (off_t)1 << (_FILE_OFFSET_BITS - 1 - 10);
        if (size >= size_max) {
-               fprintf(stderr, "%s: "LPU64" KB: Backing store size must be "
-                       "smaller than "LPU64" KB\n", progname, size, size_max);
+               fprintf(stderr, "%s: %ju KB: Backing store size must be "
+                       "smaller than %ju KB\n", progname, (uintmax_t) size,
+                       (uintmax_t)size_max);
                return EFBIG;
        }
 
                return EFBIG;
        }
 
index cac592c..48afe0b 100644 (file)
@@ -51,6 +51,8 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <limits.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
index 0aa9b4f..2937a1b 100644 (file)
@@ -921,8 +921,8 @@ int ldiskfs_make_lustre(struct mkfs_opts *mop)
 
        vprint("formatting backing filesystem %s on %s\n",
               MT_STR(&mop->mo_ldd), dev);
 
        vprint("formatting backing filesystem %s on %s\n",
               MT_STR(&mop->mo_ldd), dev);
-       vprint("\ttarget name  %s\n", mop->mo_ldd.ldd_svname);
-       vprint("\t4k blocks     "LPU64"\n", block_count);
+       vprint("\ttarget name   %s\n", mop->mo_ldd.ldd_svname);
+       vprint("\t4k blocks     %ju\n", (uintmax_t)block_count);
        vprint("\toptions       %s\n", mop->mo_mkfsopts);
 
        /* mkfs_cmd's trailing space is important! */
        vprint("\toptions       %s\n", mop->mo_mkfsopts);
 
        /* mkfs_cmd's trailing space is important! */
@@ -930,7 +930,8 @@ int ldiskfs_make_lustre(struct mkfs_opts *mop)
        strscat(mkfs_cmd, " ", sizeof(mkfs_cmd));
        strscat(mkfs_cmd, dev, sizeof(mkfs_cmd));
        if (block_count != 0) {
        strscat(mkfs_cmd, " ", sizeof(mkfs_cmd));
        strscat(mkfs_cmd, dev, sizeof(mkfs_cmd));
        if (block_count != 0) {
-               sprintf(buf, " "LPU64, block_count);
+               snprintf(buf, sizeof(buf), " %ju",
+                        (uintmax_t)block_count);
                strscat(mkfs_cmd, buf, sizeof(mkfs_cmd));
        }
 
                strscat(mkfs_cmd, buf, sizeof(mkfs_cmd));
        }
 
index 96b2e86..393c61a 100644 (file)
@@ -61,6 +61,7 @@
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
+#include <limits.h>
 
 #include "obdctl.h"
 #include <libcfs/util/ioctl.h>
 
 #include "obdctl.h"
 #include <libcfs/util/ioctl.h>
@@ -204,15 +205,17 @@ char *obdo_print(struct obdo *obd)
 {
        char buf[1024];
 
 {
        char buf[1024];
 
-       sprintf(buf, "id: "LPX64"\ngrp: "LPX64"\natime: "LPU64"\nmtime: "LPU64
-               "\nctime: "LPU64"\nsize: "LPU64"\nblocks: "LPU64
-               "\nblksize: %u\nmode: %o\nuid: %d\ngid: %d\nflags: %x\n"
-               "misc: %x\nnlink: %d,\nvalid "LPX64"\n",
-               ostid_id(&obd->o_oi), ostid_seq(&obd->o_oi), obd->o_atime,
-               obd->o_mtime, obd->o_ctime,
-               obd->o_size, obd->o_blocks, obd->o_blksize, obd->o_mode,
-               obd->o_uid, obd->o_gid, obd->o_flags, obd->o_misc,
-               obd->o_nlink, obd->o_valid);
+       snprintf(buf, sizeof(buf), "id: %#jx\ngrp: %#jx\natime: %ju\n"
+                "mtime: %ju\nctime: %ju\nsize: %ju\nblocks: %ju"
+                "\nblksize: %u\nmode: %o\nuid: %d\ngid: %d\nflags: %x\n"
+                "misc: %x\nnlink: %d,\nvalid %#jx\n",
+                (uintmax_t)ostid_id(&obd->o_oi),
+                (uintmax_t)ostid_seq(&obd->o_oi),
+                (uintmax_t)obd->o_atime, (uintmax_t)obd->o_mtime,
+                (uintmax_t)obd->o_ctime, (uintmax_t)obd->o_size,
+                (uintmax_t)obd->o_blocks, obd->o_blksize, obd->o_mode,
+                obd->o_uid, obd->o_gid, obd->o_flags, obd->o_misc,
+                obd->o_nlink, (uintmax_t)obd->o_valid);
        return strdup(buf);
 }
 
        return strdup(buf);
 }
 
@@ -489,8 +492,8 @@ static void shmem_total(int total_threads)
                         &shared_data->body.start_time);
         shmem_unlock();
 
                         &shared_data->body.start_time);
         shmem_unlock();
 
-        printf("Total: total "LPU64" threads %d sec %f %f/second\n",
-               total, total_threads, secs, total / secs);
+       printf("Total: total %ju threads %d sec %f %f/second\n",
+              (uintmax_t)total, total_threads, secs, total / secs);
 
         return;
 }
 
         return;
 }
@@ -1488,7 +1491,7 @@ int jt_obd_create(int argc, char **argv)
                         return CMD_HELP;
         }
 
                         return CMD_HELP;
         }
 
-        printf("%s: "LPD64" objects\n", jt_cmdname(argv[0]), count);
+       printf("%s: %jd objects\n", jt_cmdname(argv[0]), (uintmax_t)count);
         gettimeofday(&next_time, NULL);
         next_time.tv_sec -= verbose;
 
         gettimeofday(&next_time, NULL);
         next_time.tv_sec -= verbose;
 
@@ -1518,16 +1521,17 @@ int jt_obd_create(int argc, char **argv)
                         break;
                 }
                 if (!(data.ioc_obdo1.o_valid & OBD_MD_FLID)) {
                         break;
                 }
                 if (!(data.ioc_obdo1.o_valid & OBD_MD_FLID)) {
-                        fprintf(stderr,"error: %s: oid not valid #%d:"LPX64"\n",
-                                jt_cmdname(argv[0]), i, data.ioc_obdo1.o_valid);
+                       fprintf(stderr, "error: %s: oid not valid #%d:%#jx\n",
+                               jt_cmdname(argv[0]), i,
+                               (uintmax_t)data.ioc_obdo1.o_valid);
                         rc = EINVAL;
                         break;
                 }
 
                if (be_verbose(verbose, &next_time, i, &next_count, count))
                         rc = EINVAL;
                         break;
                 }
 
                if (be_verbose(verbose, &next_time, i, &next_count, count))
-                       printf("%s: #%d is object id "LPX64"\n",
+                       printf("%s: #%d is object id %#jx\n",
                               jt_cmdname(argv[0]), i,
                               jt_cmdname(argv[0]), i,
-                              ostid_id(&data.ioc_obdo1.o_oi));
+                              (uintmax_t) ostid_id(&data.ioc_obdo1.o_oi));
         }
         return rc;
 }
         }
         return rc;
 }
@@ -1621,8 +1625,9 @@ int jt_obd_test_setattr(int argc, char **argv)
         next_time.tv_sec = start.tv_sec - verbose;
         next_time.tv_usec = start.tv_usec;
         if (verbose != 0)
         next_time.tv_sec = start.tv_sec - verbose;
         next_time.tv_usec = start.tv_usec;
         if (verbose != 0)
-                printf("%s: setting "LPD64" attrs (objid "LPX64"): %s",
-                       jt_cmdname(argv[0]), count, objid, ctime(&start.tv_sec));
+               printf("%s: setting %jd attrs (objid %#jx): %s",
+                      jt_cmdname(argv[0]), (uintmax_t)count,
+                      (uintmax_t)objid, ctime(&start.tv_sec));
 
        ostid_set_seq_echo(&data.ioc_obdo1.o_oi);
         for (i = 1, next_count = verbose; i <= count && shmem_running(); i++) {
 
        ostid_set_seq_echo(&data.ioc_obdo1.o_oi);
         for (i = 1, next_count = verbose; i <= count && shmem_running(); i++) {
@@ -1639,14 +1644,15 @@ int jt_obd_test_setattr(int argc, char **argv)
                 rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_SETATTR, &data);
                 shmem_bump(1);
                 if (rc < 0) {
                 rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_SETATTR, &data);
                 shmem_bump(1);
                 if (rc < 0) {
-                        fprintf(stderr, "error: %s: #"LPD64" - %d:%s\n",
-                                jt_cmdname(argv[0]), i, errno, strerror(rc = errno));
+                       fprintf(stderr, "error: %s: #%jd - %d:%s\n",
+                               jt_cmdname(argv[0]), (uintmax_t)i,
+                               errno, strerror(rc = errno));
                         break;
                 } else {
                         if (be_verbose
                             (verbose, &next_time, i, &next_count, count))
                         break;
                 } else {
                         if (be_verbose
                             (verbose, &next_time, i, &next_count, count))
-                                printf("%s: set attr #"LPD64"\n",
-                                       jt_cmdname(argv[0]), i);
+                               printf("%s: set attr #%jd\n",
+                                      jt_cmdname(argv[0]), (uintmax_t)i);
                 }
         }
 
                 }
         }
 
@@ -1660,9 +1666,9 @@ int jt_obd_test_setattr(int argc, char **argv)
 
                 --i;
                 if (verbose != 0)
 
                 --i;
                 if (verbose != 0)
-                        printf("%s: "LPD64" attrs in %.3fs (%.3f attr/s): %s",
-                               jt_cmdname(argv[0]), i, diff, i / diff,
-                               ctime(&end.tv_sec));
+                       printf("%s: %jd attrs in %.3fs (%.3f attr/s): %s",
+                              jt_cmdname(argv[0]), (uintmax_t)i, diff,
+                              i / diff, ctime(&end.tv_sec));
         }
         return rc;
 }
         }
         return rc;
 }
@@ -1705,7 +1711,7 @@ int jt_obd_destroy(int argc, char **argv)
                         return CMD_HELP;
         }
 
                         return CMD_HELP;
         }
 
-        printf("%s: "LPD64" objects\n", jt_cmdname(argv[0]), count);
+       printf("%s: %jd objects\n", jt_cmdname(argv[0]), (uintmax_t)count);
         gettimeofday(&next_time, NULL);
         next_time.tv_sec -= verbose;
 
         gettimeofday(&next_time, NULL);
         next_time.tv_sec -= verbose;
 
@@ -1726,14 +1732,15 @@ int jt_obd_destroy(int argc, char **argv)
                 obd_ioctl_unpack(&data, buf, sizeof(rawbuf));
                 shmem_bump(1);
                 if (rc < 0) {
                 obd_ioctl_unpack(&data, buf, sizeof(rawbuf));
                 shmem_bump(1);
                 if (rc < 0) {
-                        fprintf(stderr, "error: %s: objid "LPX64": %s\n",
-                                jt_cmdname(argv[0]), id, strerror(rc = errno));
+                       fprintf(stderr, "error: %s: objid %#jx: %s\n",
+                               jt_cmdname(argv[0]), (uintmax_t)id,
+                               strerror(rc = errno));
                         break;
                 }
 
                 if (be_verbose(verbose, &next_time, i, &next_count, count))
                         break;
                 }
 
                 if (be_verbose(verbose, &next_time, i, &next_count, count))
-                        printf("%s: #%d is object id "LPX64"\n",
-                               jt_cmdname(argv[0]), i, id);
+                       printf("%s: #%d is object id %#jx\n",
+                              jt_cmdname(argv[0]), i, (uintmax_t)id);
         }
 
         return rc;
         }
 
         return rc;
@@ -1761,8 +1768,8 @@ int jt_obd_getattr(int argc, char **argv)
        /* to help obd filter */
        data.ioc_obdo1.o_mode = 0100644;
        data.ioc_obdo1.o_valid = 0xffffffff;
        /* to help obd filter */
        data.ioc_obdo1.o_mode = 0100644;
        data.ioc_obdo1.o_valid = 0xffffffff;
-       printf("%s: object id "LPX64"\n", jt_cmdname(argv[0]),
-              ostid_id(&data.ioc_obdo1.o_oi));
+       printf("%s: object id %#jx\n", jt_cmdname(argv[0]),
+              (uintmax_t)ostid_id(&data.ioc_obdo1.o_oi));
 
         memset(buf, 0, sizeof(rawbuf));
         rc = obd_ioctl_pack(&data, &buf, sizeof(rawbuf));
 
         memset(buf, 0, sizeof(rawbuf));
         rc = obd_ioctl_pack(&data, &buf, sizeof(rawbuf));
@@ -1777,8 +1784,9 @@ int jt_obd_getattr(int argc, char **argv)
                 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
                         strerror(rc = errno));
         } else {
                 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
                         strerror(rc = errno));
         } else {
-               printf("%s: object id "LPU64", mode %o\n", jt_cmdname(argv[0]),
-                      ostid_id(&data.ioc_obdo1.o_oi), data.ioc_obdo1.o_mode);
+               printf("%s: object id %ju, mode %o\n", jt_cmdname(argv[0]),
+                      (uintmax_t)ostid_id(&data.ioc_obdo1.o_oi),
+                      data.ioc_obdo1.o_mode);
         }
         return rc;
 }
         }
         return rc;
 }
@@ -1830,8 +1838,9 @@ int jt_obd_test_getattr(int argc, char **argv)
         next_time.tv_sec = start.tv_sec - verbose;
         next_time.tv_usec = start.tv_usec;
         if (verbose != 0)
         next_time.tv_sec = start.tv_sec - verbose;
         next_time.tv_usec = start.tv_usec;
         if (verbose != 0)
-                printf("%s: getting "LPD64" attrs (objid "LPX64"): %s",
-                       jt_cmdname(argv[0]), count, objid, ctime(&start.tv_sec));
+               printf("%s: getting %jd attrs (objid %#jx): %s",
+                      jt_cmdname(argv[0]), (uintmax_t) count,
+                      (uintmax_t)objid, ctime(&start.tv_sec));
 
        ostid_set_seq_echo(&data.ioc_obdo1.o_oi);
         for (i = 1, next_count = verbose; i <= count && shmem_running(); i++) {
 
        ostid_set_seq_echo(&data.ioc_obdo1.o_oi);
         for (i = 1, next_count = verbose; i <= count && shmem_running(); i++) {
@@ -1848,14 +1857,15 @@ int jt_obd_test_getattr(int argc, char **argv)
                 rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_GETATTR, &data);
                 shmem_bump(1);
                 if (rc < 0) {
                 rc = l2_ioctl(OBD_DEV_ID, OBD_IOC_GETATTR, &data);
                 shmem_bump(1);
                 if (rc < 0) {
-                        fprintf(stderr, "error: %s: #"LPD64" - %d:%s\n",
-                                jt_cmdname(argv[0]), i, errno, strerror(rc = errno));
+                       fprintf(stderr, "error: %s: #%jd - %d:%s\n",
+                               jt_cmdname(argv[0]), (uintmax_t)i,
+                               errno, strerror(rc = errno));
                         break;
                 } else {
                         if (be_verbose
                             (verbose, &next_time, i, &next_count, count))
                         break;
                 } else {
                         if (be_verbose
                             (verbose, &next_time, i, &next_count, count))
-                                printf("%s: got attr #"LPD64"\n",
-                                       jt_cmdname(argv[0]), i);
+                               printf("%s: got attr #%jd\n",
+                                      jt_cmdname(argv[0]), (uintmax_t)i);
                 }
         }
 
                 }
         }
 
@@ -1869,9 +1879,9 @@ int jt_obd_test_getattr(int argc, char **argv)
 
                 --i;
                 if (verbose != 0)
 
                 --i;
                 if (verbose != 0)
-                        printf("%s: "LPD64" attrs in %.3fs (%.3f attr/s): %s",
-                               jt_cmdname(argv[0]), i, diff, i / diff,
-                               ctime(&end.tv_sec));
+                       printf("%s: %jd attrs in %.3fs (%.3f attr/s): %s",
+                              jt_cmdname(argv[0]), (uintmax_t) i, diff,
+                              i / diff, ctime(&end.tv_sec));
         }
         return rc;
 }
         }
         return rc;
 }
@@ -2054,9 +2064,10 @@ int jt_obd_test_brw(int argc, char **argv)
         next_time.tv_usec = start.tv_usec;
 
         if (verbose != 0)
         next_time.tv_usec = start.tv_usec;
 
         if (verbose != 0)
-                printf("%s: %s "LPU64"x%d pages (obj "LPX64", off "LPU64"): %s",
-                       jt_cmdname(argv[0]), write ? "writing" : "reading", count,
-                       pages, objid, data.ioc_offset, ctime(&start.tv_sec));
+               printf("%s: %s %jux%d pages (obj %#jx, off %ju): %s",
+                      jt_cmdname(argv[0]), write ? "writing" : "reading",
+                      (uintmax_t)count, pages, (uintmax_t) objid,
+                      (uintmax_t)data.ioc_offset, ctime(&start.tv_sec));
 
         cmd = write ? OBD_IOC_BRW_WRITE : OBD_IOC_BRW_READ;
         for (i = 1, next_count = verbose; i <= count && shmem_running(); i++) {
 
         cmd = write ? OBD_IOC_BRW_WRITE : OBD_IOC_BRW_READ;
         for (i = 1, next_count = verbose; i <= count && shmem_running(); i++) {
@@ -2077,9 +2088,10 @@ int jt_obd_test_brw(int argc, char **argv)
                         break;
                 } else if (be_verbose(verbose, &next_time,i, &next_count,count)) {
                        shmem_lock ();
                         break;
                 } else if (be_verbose(verbose, &next_time,i, &next_count,count)) {
                        shmem_lock ();
-                       printf("%s: %s number %d @ "LPD64":"LPU64" for %d\n",
+                       printf("%s: %s number %d @ %jd:%ju for %d\n",
                               jt_cmdname(argv[0]), write ? "write" : "read", i,
                               jt_cmdname(argv[0]), write ? "write" : "read", i,
-                              ostid_id(&data.ioc_obdo1.o_oi), data.ioc_offset,
+                              (uintmax_t)ostid_id(&data.ioc_obdo1.o_oi),
+                              (uintmax_t)data.ioc_offset,
                               (int)(pages * getpagesize()));
                        shmem_unlock ();
                 }
                               (int)(pages * getpagesize()));
                        shmem_unlock ();
                 }
@@ -2213,10 +2225,10 @@ repeat:
                 else
                         printf("default_stripe_count: %u\n",
                                desc.ld_default_stripe_count);
                 else
                         printf("default_stripe_count: %u\n",
                                desc.ld_default_stripe_count);
-                printf("default_stripe_size: "LPU64"\n",
-                       desc.ld_default_stripe_size);
-                printf("default_stripe_offset: "LPU64"\n",
-                       desc.ld_default_stripe_offset);
+               printf("default_stripe_size: %ju\n",
+                      (uintmax_t)desc.ld_default_stripe_size);
+               printf("default_stripe_offset: %ju\n",
+                      (uintmax_t)desc.ld_default_stripe_offset);
                 printf("default_stripe_pattern: %u\n", desc.ld_pattern);
                 printf("obd_count: %u\n", desc.ld_tgt_count);
                 printf("OBDS:\tobdidx\t\tobdgen\t\t obduuid\n");
                 printf("default_stripe_pattern: %u\n", desc.ld_pattern);
                 printf("obd_count: %u\n", desc.ld_tgt_count);
                 printf("OBDS:\tobdidx\t\tobdgen\t\t obduuid\n");
@@ -4250,7 +4262,7 @@ int jt_get_obj_version(int argc, char **argv)
         }
 
         obd_ioctl_unpack(&data, buf, sizeof rawbuf);
         }
 
         obd_ioctl_unpack(&data, buf, sizeof rawbuf);
-        printf(LPX64"\n", version);
+       printf("%#jx\n", (uintmax_t)version);
         return 0;
 }
 
         return 0;
 }
 
index 644e120..6668fd4 100644 (file)
@@ -41,6 +41,7 @@
  */
 
 #include <errno.h>
  */
 
 #include <errno.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 7ed3a3a..040c14b 100644 (file)
@@ -35,6 +35,7 @@
  */
 
 #include <errno.h>
  */
 
 #include <errno.h>
+#include <limits.h>
 #include <stdio.h>
 #include <string.h>
 
 #include <stdio.h>
 #include <string.h>