#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/types.h>
# include "curproc.h"
#define LIBCFS_VERSION "0.5.0"
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);
+#endif /* __KERNEL__ */
#define LIBCFS_DEBUG_FILE_PATH_DEFAULT "/tmp/lustre-log"
#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"
#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)
typedef unsigned long ulong_ptr_t;
typedef long long_ptr_t;
-#ifndef __KERNEL__
-/* Sparse annotation. */
-#define __user
-#endif
-
#endif /* _LIBCFS_TYPES_H */
/** \addtogroup lnet
* @{ */
-#include <libcfs/types.h>
-
+#include <linux/types.h>
/** \addtogroup lnet_addr
* @{ */
#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 <errno.h>
#include <getopt.h>
+#include <inttypes.h>
#include <pwd.h>
#include <unistd.h>
#include <stdarg.h>
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;
*/
#include <errno.h>
#include <getopt.h>
+#include <inttypes.h>
#include <limits.h>
#ifdef HAVE_NETDB_H
# include <netdb.h>
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);
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,
- 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) {
- 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,
- 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);
#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 <linux/types.h>
#include <libcfs/libcfs.h>
#include <lnet/types.h>
#ifndef LUSTRE_IOCTL_H_
#define LUSTRE_IOCTL_H_
+#include <linux/types.h>
#include <libcfs/libcfs.h>
+#include <libcfs/util/ioctl.h>
#include <lustre/lustre_idl.h>
#ifdef __KERNEL__
*
* 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 <linux/types.h>
+
#define EXPORT_SYMBOL(s)
#include <../ldlm/interval_tree.c>
abort(); \
} while(0)
-#define __F(ext) (ext)->start, (ext)->end
-#define __S "["LPX64":"LPX64"]"
-
#define ALIGN_SIZE 4096
#define ALIGN_MASK (~(ALIGN_SIZE - 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) {
- 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;
}
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;
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);
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",
- __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)
- 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");
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;
}
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
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;
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) {
- dprintf(""__S":%llu ",
+ dprintf("[%#jx:%#jx]:%llu ",
__F(&tmp->in_extent),
tmp->in_max_high);
if (count++ == 8) {
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)) {
- 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)
/* 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;
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;
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_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);
}
*
* Author: You Feng <youfeng@clusterfs.com>
*/
-
+#include <limits.h>
#include <mpi.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <errno.h>
-#include <libcfs/libcfs.h>
#include "lustre/lustre_user.h"
#include "lp_utils.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)
* Author: You Feng <youfeng@clusterfs.com>
*/
+#include <limits.h>
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <errno.h>
-#include <libcfs/libcfs.h>
#include <lustre/lustre_user.h>
#include "lp_utils.h"
#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 <limits.h>
+#include <stdio.h>
#include <string.h>
-#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
" %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) {
*/
#include <errno.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _GNU_SOURCE
#endif
+#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <linux/types.h>
-#include <libcfs/types.h>
#include <libcfs/byteorder.h>
#define READ 1
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)) {
- 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)) {
- 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)) {
- 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)) {
- 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;
}
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;
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",
#include <sys/types.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
/* For basename() */
#include <sys/ipc.h>
#include <sys/sem.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <pwd.h>
* Lustre is a trademark of Sun Microsystems, Inc.
*/
+#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
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");
}
*/
#include <errno.h>
+#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.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",
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");
}
}
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) ?
- 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) ?
- LPU64 : "["LPU64"]", dqb->dqb_ihardlimit);
+ "%ju" : "[%ju]", (uintmax_t)dqb->dqb_ihardlimit);
if (type != QC_OSTIDX)
printf(" %7s%c %6s %7s %7s",
&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)
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)),
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;
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;
}
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;
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;
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;
}
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);
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
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),
- 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)
path[sizeof(path) - 1] = '\0';
}
- printf("max_sequence: "LPX64"\n", seq);
+ printf("max_sequence: %#jx\n", (uintmax_t)seq);
return 0;
}
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);
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:
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) {
*/
#include <errno.h>
+#include <limits.h>
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
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
}
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),
- "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",
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++)
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 ");
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),
- 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,
- 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)));
}
#define _GNU_SOURCE
#endif
#include <errno.h>
+#include <limits.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
+#include <limits.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
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)
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;
}
*/
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;
}
#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>
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! */
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));
}
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include "obdctl.h"
#include <libcfs/util/ioctl.h>
{
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);
}
&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 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;
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))
- printf("%s: #%d is object id "LPX64"\n",
+ printf("%s: #%d is object id %#jx\n",
jt_cmdname(argv[0]), i,
- ostid_id(&data.ioc_obdo1.o_oi));
+ (uintmax_t) ostid_id(&data.ioc_obdo1.o_oi));
}
return rc;
}
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++) {
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))
- printf("%s: set attr #"LPD64"\n",
- jt_cmdname(argv[0]), i);
+ printf("%s: set attr #%jd\n",
+ jt_cmdname(argv[0]), (uintmax_t)i);
}
}
--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 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;
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))
- 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;
/* 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));
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;
}
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++) {
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))
- printf("%s: got attr #"LPD64"\n",
- jt_cmdname(argv[0]), i);
+ printf("%s: got attr #%jd\n",
+ jt_cmdname(argv[0]), (uintmax_t)i);
}
}
--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;
}
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++) {
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,
- 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 ();
}
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");
}
obd_ioctl_unpack(&data, buf, sizeof rawbuf);
- printf(LPX64"\n", version);
+ printf("%#jx\n", (uintmax_t)version);
return 0;
}
*/
#include <errno.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
*/
#include <errno.h>
+#include <limits.h>
#include <stdio.h>
#include <string.h>