Introduce printflags64 function

This is necessary for the upcoming change of xlat.val type.

* defs.h (printflags): Rename to printflags64, change type of integer
argument to uint64_t.
(printflags): New static inline function.
* util.c (printflags): Rename to printflags64, change type of integer
argument to uint64_t.  Print it using PRIx64 format.
Based on patch by Jeff Mahoney <jeffm@suse.com>.
This commit is contained in:
2016-04-28 18:55:18 +00:00
parent 01c910ccc3
commit 00beed61a4
2 changed files with 10 additions and 4 deletions

8
defs.h
View File

@ -556,7 +556,7 @@ extern int printargs_u(struct tcb *);
extern int printargs_d(struct tcb *);
extern void addflags(const struct xlat *, uint64_t);
extern int printflags(const struct xlat *, int, const char *);
extern int printflags64(const struct xlat *, uint64_t, const char *);
extern const char *sprintflags64(const char *, const struct xlat *, uint64_t);
extern const char *sprintmode(int);
extern const char *sprinttime(time_t);
@ -672,6 +672,12 @@ sprintflags(const char *prefix, const struct xlat *x, unsigned int flags)
return sprintflags64(prefix, x, flags);
}
static inline int
printflags(const struct xlat *x, unsigned int flags, const char *dflt)
{
return printflags64(x, flags, dflt);
}
static inline void
printxval64(const struct xlat *x, const uint64_t val, const char *dflt)
{

6
util.c
View File

@ -356,7 +356,7 @@ sprintflags64(const char *prefix, const struct xlat *xlat, uint64_t flags)
}
int
printflags(const struct xlat *xlat, int flags, const char *dflt)
printflags64(const struct xlat *xlat, uint64_t flags, const char *dflt)
{
int n;
const char *sep;
@ -378,12 +378,12 @@ printflags(const struct xlat *xlat, int flags, const char *dflt)
if (n) {
if (flags) {
tprintf("%s%#x", sep, flags);
tprintf("%s%#" PRIx64, sep, flags);
n++;
}
} else {
if (flags) {
tprintf("%#x", flags);
tprintf("%#" PRIx64, flags);
if (dflt)
tprintf(" /* %s */", dflt);
} else {