util.c: introduce printaddr64
Sometimes, 64-bit value is expected to be interpreted as an address (in BTRFS ioctl interface, for example). * defs.h (printaddr64): New declaration. * util.c (printaddr64): Rename from printaddr, change argument type to uint64_t. (printaddr): Turn into a thin wrapper around printaddr64. (printnum_addr_int, printnum_addr_int64): Use printaddr64 instead of printaddr. printnum_addr_int64 is not used outside the cases where kernel_long is less or equal than 64 bit currently, so this change should be safe.
This commit is contained in:
parent
beafdd36e1
commit
84c03b20b4
1
defs.h
1
defs.h
@ -556,6 +556,7 @@ extern int getllval(struct tcb *, unsigned long long *, int);
|
||||
extern int printllval(struct tcb *, const char *, int)
|
||||
ATTRIBUTE_FORMAT((printf, 2, 0));
|
||||
|
||||
extern void printaddr64(uint64_t addr);
|
||||
extern void printaddr(kernel_ulong_t addr);
|
||||
extern int printxvals(const uint64_t, const char *, const struct xlat *, ...)
|
||||
ATTRIBUTE_SENTINEL;
|
||||
|
12
util.c
12
util.c
@ -228,12 +228,18 @@ printllval(struct tcb *tcp, const char *format, int arg_no)
|
||||
}
|
||||
|
||||
void
|
||||
printaddr(const kernel_ulong_t addr)
|
||||
printaddr64(const uint64_t addr)
|
||||
{
|
||||
if (!addr)
|
||||
tprints("NULL");
|
||||
else
|
||||
tprintf("%#" PRI_klx, addr);
|
||||
tprintf("%#" PRIx64, addr);
|
||||
}
|
||||
|
||||
void
|
||||
printaddr(const kernel_ulong_t addr)
|
||||
{
|
||||
printaddr64(addr);
|
||||
}
|
||||
|
||||
#define DEF_PRINTNUM(name, type) \
|
||||
@ -258,7 +264,7 @@ printnum_addr_ ## name(struct tcb *tcp, const kernel_ulong_t addr) \
|
||||
if (umove_or_printaddr(tcp, addr, &num)) \
|
||||
return false; \
|
||||
tprints("["); \
|
||||
printaddr(num); \
|
||||
printaddr64(num); \
|
||||
tprints("]"); \
|
||||
return true; \
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user