Remove addflags

It has only single user and implementation of xlat styles for it would
lead to lots of code duplication.

* defs.h (addflags): Remove declaration.
* mem.c (print_mmap_flags): Convert addflags call into printflags64 with
non-zeroeness flags check.
* xlat.c (addflags): Remove.
This commit is contained in:
Eugene Syromyatnikov 2018-03-10 05:38:10 +01:00 committed by Dmitry V. Levin
parent 53b0d9c438
commit 3744bc73f7
3 changed files with 4 additions and 20 deletions

1
defs.h
View File

@ -582,7 +582,6 @@ extern int printargs(struct tcb *);
extern int printargs_u(struct tcb *);
extern int printargs_d(struct tcb *);
extern void addflags(const struct xlat *, uint64_t);
extern int printflags_ex(uint64_t, const char *, const struct xlat *, ...)
ATTRIBUTE_SENTINEL;
extern const char *sprintflags(const char *, const struct xlat *, uint64_t);

5
mem.c
View File

@ -73,7 +73,10 @@ print_mmap_flags(kernel_ulong_t flags)
const unsigned int hugetlb_value = flags & mask;
flags &= ~mask;
addflags(mmap_flags, flags);
if (flags) {
tprints("|");
printflags64(mmap_flags, flags, NULL);
}
if (hugetlb_value)
tprintf("|%u<<MAP_HUGE_SHIFT",

18
xlat.c
View File

@ -139,24 +139,6 @@ printxval_searchn(const struct xlat *xlat, size_t xlat_size, uint64_t val,
return 0;
}
/*
* Interpret `xlat' as an array of flags
* print the entries whose bits are on in `flags'
*/
void
addflags(const struct xlat *xlat, uint64_t flags)
{
for (; xlat->str; xlat++) {
if (xlat->val && (flags & xlat->val) == xlat->val) {
tprintf("|%s", xlat->str);
flags &= ~xlat->val;
}
}
if (flags) {
tprintf("|%#" PRIx64, flags);
}
}
/*
* Interpret `xlat' as an array of flags.
* Print to static string the entries whose bits are on in `flags'