e2fsprogs: code shrink
function old new delta print_e2flags_long - 109 +109 list_attributes 248 232 -16 print_e2flags 169 47 -122 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/2 up/down: 109/-138) Total: -29 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
9468ea06d2
commit
87c40cf4de
@ -98,36 +98,41 @@ static const char e2attr_flags_lname[] ALIGN1 =
|
|||||||
"Verity" "\0"
|
"Verity" "\0"
|
||||||
/* Another trailing NUL is added by compiler */;
|
/* Another trailing NUL is added by compiler */;
|
||||||
|
|
||||||
void print_e2flags(FILE *f, unsigned flags, unsigned options)
|
void print_e2flags_long(unsigned flags)
|
||||||
{
|
{
|
||||||
const uint32_t *fv;
|
const uint32_t *fv;
|
||||||
const char *fn;
|
const char *fn;
|
||||||
|
int first = 1;
|
||||||
|
|
||||||
fv = e2attr_flags_value;
|
fv = e2attr_flags_value;
|
||||||
if (options & PFOPT_LONG) {
|
|
||||||
int first = 1;
|
|
||||||
fn = e2attr_flags_lname;
|
fn = e2attr_flags_lname;
|
||||||
do {
|
do {
|
||||||
if (flags & *fv) {
|
if (flags & *fv) {
|
||||||
if (!first)
|
if (!first)
|
||||||
fputs(", ", f);
|
fputs(", ", stdout);
|
||||||
fputs(fn, f);
|
fputs(fn, stdout);
|
||||||
first = 0;
|
first = 0;
|
||||||
}
|
}
|
||||||
fv++;
|
fv++;
|
||||||
fn += strlen(fn) + 1;
|
fn += strlen(fn) + 1;
|
||||||
} while (*fn);
|
} while (*fn);
|
||||||
if (first)
|
if (first)
|
||||||
fputs("---", f);
|
fputs("---", stdout);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
void print_e2flags(unsigned flags)
|
||||||
|
{
|
||||||
|
const uint32_t *fv;
|
||||||
|
const char *fn;
|
||||||
|
|
||||||
|
fv = e2attr_flags_value;
|
||||||
fn = e2attr_flags_sname;
|
fn = e2attr_flags_sname;
|
||||||
do {
|
do {
|
||||||
char c = '-';
|
char c = '-';
|
||||||
if (flags & *fv)
|
if (flags & *fv)
|
||||||
c = *fn;
|
c = *fn;
|
||||||
fputc(c, f);
|
putchar(c);
|
||||||
fv++;
|
fv++;
|
||||||
fn++;
|
fn++;
|
||||||
} while (*fn);
|
} while (*fn);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,9 @@ int iterate_on_dir(const char *dir_name,
|
|||||||
int FAST_FUNC (*func)(const char *, struct dirent *, void *),
|
int FAST_FUNC (*func)(const char *, struct dirent *, void *),
|
||||||
void *private);
|
void *private);
|
||||||
|
|
||||||
/* Must be 1 for compatibility with 'int long_format'. */
|
|
||||||
#define PFOPT_LONG 1
|
|
||||||
/* Print file attributes on an ext2 file system */
|
/* Print file attributes on an ext2 file system */
|
||||||
void print_e2flags(FILE *f, unsigned flags, unsigned options);
|
void print_e2flags_long(unsigned flags);
|
||||||
|
void print_e2flags(unsigned flags);
|
||||||
|
|
||||||
extern const uint32_t e2attr_flags_value[];
|
extern const uint32_t e2attr_flags_value[];
|
||||||
extern const char e2attr_flags_sname[];
|
extern const char e2attr_flags_sname[];
|
||||||
|
@ -83,10 +83,10 @@ static void list_attributes(const char *name)
|
|||||||
|
|
||||||
if (option_mask32 & OPT_PF_LONG) {
|
if (option_mask32 & OPT_PF_LONG) {
|
||||||
printf("%-28s ", name);
|
printf("%-28s ", name);
|
||||||
print_e2flags(stdout, fsflags, PFOPT_LONG);
|
print_e2flags_long(fsflags);
|
||||||
bb_putchar('\n');
|
bb_putchar('\n');
|
||||||
} else {
|
} else {
|
||||||
print_e2flags(stdout, fsflags, 0);
|
print_e2flags(fsflags);
|
||||||
printf(" %s\n", name);
|
printf(" %s\n", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user