/*
* Copyright (c) 2016 Jeff Mahoney <jeffm@suse.com>
+ * Copyright (c) 2016-2017 The strace developers.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
{
tprintf(", %s=%" PRIu64, name, value);
if (value == UINT64_MAX)
- tprints(" /* UINT64_MAX */");
+ tprints_comment("UINT64_MAX");
}
#define print_member_u64(obj, name) print_u64(#name, obj->name)
}
static void
-btrfs_print_balance(struct tcb *tcp, const long arg, bool out)
+btrfs_print_balance(struct tcb *const tcp, const kernel_ulong_t arg, bool out)
{
struct btrfs_ioctl_balance_args balance_args;
static void
btrfs_print_key_type(uint32_t type)
{
- const char *str = xlookup(btrfs_key_types, type);
tprintf("%u", type);
- if (str)
- tprintf(" /* %s */", str);
+ tprints_comment(xlookup(btrfs_key_types, type));
}
static void
btrfs_print_objectid(uint64_t objectid)
{
- const char *str = xlookup(btrfs_tree_objectids, objectid);
tprintf("%" PRIu64, objectid);
- if (str)
- tprintf(" /* %s */", str);
+ tprints_comment(xlookup(btrfs_tree_objectids, objectid));
}
static void
static bool
print_uint64(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
{
- tprintf("%" PRIu64, * (uint64_t *) elem_buf);
+ tprintf("%" PRIu64, *(uint64_t *) elem_buf);
return true;
}
static void
-btrfs_print_qgroup_inherit(struct tcb *tcp, const unsigned long qgi_addr)
+btrfs_print_qgroup_inherit(struct tcb *const tcp, const kernel_ulong_t qgi_addr)
{
struct btrfs_qgroup_inherit inherit;
if (value) {
tprintf(", %s=%" PRIu64, name, value);
if (value == UINT64_MAX)
- tprints(" /* UINT64_MAX */");
+ tprints_comment("UINT64_MAX");
}
}
#define print_key_value(tcp, key, name) \
print_objectid_callback(struct tcb *tcp, void *elem_buf,
size_t elem_size, void *data)
{
- btrfs_print_objectid(* (uint64_t *) elem_buf);
+ btrfs_print_objectid(*(uint64_t *) elem_buf);
return true;
}
}
MPERS_PRINTER_DECL(int, btrfs_ioctl,
- struct tcb *tcp, const unsigned int code, const long arg)
+ struct tcb *const tcp, const unsigned int code,
+ const kernel_ulong_t arg)
{
switch (code) {
/* Take no arguments; command only. */
tprintf("%" PRIu64, (uint64_t) args.len);
if (args.len == UINT64_MAX)
- tprints(" /* UINT64_MAX */");
+ tprints_comment("UINT64_MAX");
tprints(", flags=");
printflags64(btrfs_defrag_flags, args.flags,
(uint64_t) args.start.srcdevid,
(uint64_t) args.start.cont_reading_from_srcdev_mode);
- str = (const char*) args.start.srcdev_name;
+ str = (const char *) args.start.srcdev_name;
print_quoted_string(str,
sizeof(args.start.srcdev_name),
QUOTE_0_TERMINATED);
tprints(", tgtdev_name=");
- str = (const char*) args.start.tgtdev_name;
+ str = (const char *) args.start.tgtdev_name;
print_quoted_string(str,
sizeof(args.start.tgtdev_name),
QUOTE_0_TERMINATED);
printxval64(btrfs_dev_replace_results, args.result,
"BTRFS_IOCTL_DEV_REPLACE_RESULT_???");
if (args.cmd == BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS) {
- char buf[sizeof("HH:MM:SS") + 1];
- time_t time;
tprints(", ");
printxval64(btrfs_dev_replace_state,
args.status.replace_state,
"BTRFS_IOCTL_DEV_REPLACE_STATE_???");
- tprintf(", progress_1000=%" PRIu64 " /* ",
+ tprintf(", progress_1000=%" PRIu64,
(uint64_t) args.status.progress_1000);
+
if (args.status.progress_1000 <= 1000)
- tprintf("%" PRIu64 ".%.2" PRIu64 "%%",
- (uint64_t) args.status.progress_1000 / 10,
- (uint64_t) args.status.progress_1000 % 10);
- else
- tprints("???");
- tprints(" */ ,");
-
- time = args.status.time_started;
- strftime(buf, sizeof(buf), "%T",
- localtime(&time));
- tprintf("time_started=%" PRIu64" /* %s */, ",
- (uint64_t) args.status.time_started, buf);
-
- time = args.status.time_stopped;
- strftime(buf, sizeof(buf), "%T",
- localtime(&time));
- tprintf("time_stopped=%" PRIu64" /* %s */, ",
- (uint64_t) args.status.time_stopped, buf);
-
- tprintf("num_write_errors=%" PRIu64
+ tprintf_comment("%u.%u%%",
+ (unsigned) args.status.progress_1000 / 10,
+ (unsigned) args.status.progress_1000 % 10);
+
+ tprintf(", time_started=%" PRIu64,
+ (uint64_t) args.status.time_started);
+ tprints_comment(sprinttime(args.status.time_started));
+
+ tprintf(", time_stopped=%" PRIu64,
+ (uint64_t) args.status.time_stopped);
+ tprints_comment(sprinttime(args.status.time_stopped));
+
+ tprintf(", num_write_errors=%" PRIu64
", num_uncorrectable_read_errors=%" PRIu64,
(uint64_t) args.status.num_write_errors,
(uint64_t) args.status.num_uncorrectable_read_errors);
if (umove_or_printaddr(tcp, arg, &flarg))
break;
- tprints("[ /* supported */ ");
+ tprints("[");
btrfs_print_features(&flarg[0]);
+ tprints_comment("supported");
- tprints(", /* safe to set */ ");
+ tprints(", ");
btrfs_print_features(&flarg[1]);
+ tprints_comment("safe to set");
- tprints(", /* safe to clear */ ");
+ tprints(", ");
btrfs_print_features(&flarg[2]);
+ tprints_comment("safe to clear");
tprints("]");
break;
tprints("...");
break;
}
- const char *name = xlookup(btrfs_dev_stats_values, i);
- if (name)
- tprintf("/* %s */ ", name);
tprintf("%" PRI__u64, args.values[i]);
+ tprints_comment(xlookup(btrfs_dev_stats_values, i));
}
tprints("]}");
break;
args.start);
tprintf("%" PRI__u64, args.end);
if (args.end == UINT64_MAX)
- tprints(" /* UINT64_MAX */");
+ tprints_comment("UINT64_MAX");
tprints(", flags=");
printflags64(btrfs_scrub_flags, args.flags,
"BTRFS_SCRUB_???");
tprints("...");
else {
uint64_t record;
- print_array(tcp, (unsigned long) args.clone_sources,
+ print_array(tcp, ptr_to_kulong(args.clone_sources),
args.clone_sources_count,
&record, sizeof(record),
umoven_or_printaddr,
(uint64_t) args.size);
btrfs_print_qgroup_inherit(tcp,
- (unsigned long) args.qgroup_inherit);
+ ptr_to_kulong(args.qgroup_inherit));
}
tprints(", name=");
print_quoted_string(args.name, sizeof(args.name),