From 459ea39686101291836a041b1d817352c1fdec4d Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Mon, 5 Mar 2018 10:20:02 +0100 Subject: [PATCH] Make print_uint64 from btrfs.c globally available And rename it to print_uint64_array_member to make the name sensible without additional context. * defs.h (print_uint64_array_member): New function prototype. * btrfs.c (print_uint64): Move... * util.c (print_uint64_array_member): ...here, drop "static" qualifier. --- btrfs.c | 10 +--------- defs.h | 2 ++ util.c | 9 +++++++++ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/btrfs.c b/btrfs.c index ff10d69a..6f47a34a 100644 --- a/btrfs.c +++ b/btrfs.c @@ -366,14 +366,6 @@ btrfs_print_ino_path_container(struct tcb *tcp, btrfs_print_data_container_footer(); } -static bool -print_uint64(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data) -{ - tprintf("%" PRIu64, *(uint64_t *) elem_buf); - - return true; -} - static void btrfs_print_qgroup_inherit(struct tcb *const tcp, const kernel_ulong_t qgi_addr) { @@ -400,7 +392,7 @@ btrfs_print_qgroup_inherit(struct tcb *const tcp, const kernel_ulong_t qgi_addr) uint64_t record; print_array(tcp, qgi_addr + offsetof(typeof(inherit), qgroups), inherit.num_qgroups, &record, sizeof(record), - umoven_or_printaddr, print_uint64, 0); + umoven_or_printaddr, print_uint64_array_member, 0); } tprints("}"); } diff --git a/defs.h b/defs.h index 4cb68dbd..28285c93 100644 --- a/defs.h +++ b/defs.h @@ -493,6 +493,8 @@ umovestr(struct tcb *, kernel_ulong_t addr, unsigned int len, char *laddr); extern int upeek(struct tcb *tcp, unsigned long, kernel_ulong_t *); extern int upoke(struct tcb *tcp, unsigned long, kernel_ulong_t); +extern bool print_uint64_array_member(struct tcb *tcp, void *elem_buf, + size_t elem_size, void *data); extern bool print_array(struct tcb *, kernel_ulong_t start_addr, diff --git a/util.c b/util.c index edec6c7a..468904d7 100644 --- a/util.c +++ b/util.c @@ -1008,6 +1008,15 @@ umoven_or_printaddr64_ignore_syserror(struct tcb *const tcp, return 0; } +bool +print_uint64_array_member(struct tcb *tcp, void *elem_buf, size_t elem_size, + void *data) +{ + tprintf("%" PRIu64, *(uint64_t *) elem_buf); + + return true; +} + /* * Iteratively fetch and print up to nmemb elements of elem_size size * from the array that starts at tracee's address start_addr. -- 2.40.0