From 2b9ae3ab9e53f0e23c4092addbc1421afb63bff7 Mon Sep 17 00:00:00 2001 From: Cyril Bur Date: Thu, 15 Mar 2018 16:58:15 +1100 Subject: external/pflash: Use ffs_entry_user_to_string() to standardise flag strings Signed-off-by: Cyril Bur Signed-off-by: Stewart Smith --- external/pflash/pflash.c | 16 +++++----------- external/pflash/test/results/01-info.out | 14 +++++++------- 2 files changed, 12 insertions(+), 18 deletions(-) (limited to 'external') diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c index 3ac9484..3bc8475 100644 --- a/external/pflash/pflash.c +++ b/external/pflash/pflash.c @@ -101,8 +101,8 @@ static uint32_t print_ffs_info(struct ffs_handle *ffsh, uint32_t toc) for (i = 0;; i++) { uint32_t start, size, act, end; + struct ffs_entry_user user; char *name = NULL, *flags; - int l; rc = ffs_part_info(ffsh, i, &name, &start, &size, &act, NULL); if (rc == FFS_ERR_PART_NOT_FOUND) @@ -115,19 +115,13 @@ static uint32_t print_ffs_info(struct ffs_handle *ffsh, uint32_t toc) goto out; } - l = asprintf(&flags, "[%c%c%c%c%c%c%c]", - has_ecc(ent) ? 'E' : '-', - has_flag(ent, FFS_MISCFLAGS_PRESERVED) ? 'P' : '-', - has_flag(ent, FFS_MISCFLAGS_READONLY) ? 'R' : '-', - has_flag(ent, FFS_MISCFLAGS_BACKUP) ? 'B' : '-', - has_flag(ent, FFS_MISCFLAGS_REPROVISION) ? 'F' : '-', - has_flag(ent, FFS_MISCFLAGS_VOLATILE) ? 'V' : '-', - has_flag(ent, FFS_MISCFLAGS_CLEARECC) ? 'C' : '-'); - if (l < 0) + user = ffs_entry_user_get(ent); + flags = ffs_entry_user_to_string(&user); + if (!flags) goto out; end = start + size; - printf("ID=%02d %15s 0x%08x..0x%08x (actual=0x%08x) %s\n", + printf("ID=%02d %15s 0x%08x..0x%08x (actual=0x%08x) [%s]\n", i, name, start, end, act, flags); if (strcmp(name, "OTHER_SIDE") == 0) diff --git a/external/pflash/test/results/01-info.out b/external/pflash/test/results/01-info.out index 7377c71..6dfa921 100644 --- a/external/pflash/test/results/01-info.out +++ b/external/pflash/test/results/01-info.out @@ -6,10 +6,10 @@ Erase granule = 0KB F:REPROVISION, V:VOLATILE, C:CLEARECC TOC@0x00000000 Partitions: ----------- -ID=00 part 0x00000000..0x00001000 (actual=0x00001000) [-------] -ID=01 ONE 0x00003000..0x00004000 (actual=0x00001000) [E----V-] -ID=02 TWO 0x00004000..0x00005000 (actual=0x00001000) [E---F--] -ID=03 THREE 0x00005000..0x00006000 (actual=0x00001000) [E---F--] -ID=04 FOUR 0x00006000..0x00007000 (actual=0x00001000) [E---F--] -ID=05 FIVE 0x00007000..0x00008000 (actual=0x00001000) [-------] -ID=06 SIX 0x00008000..0x00009000 (actual=0x00001000) [------C] +ID=00 part 0x00000000..0x00001000 (actual=0x00001000) [----------] +ID=01 ONE 0x00003000..0x00004000 (actual=0x00001000) [E--------V] +ID=02 TWO 0x00004000..0x00005000 (actual=0x00001000) [E-----F---] +ID=03 THREE 0x00005000..0x00006000 (actual=0x00001000) [E-----F---] +ID=04 FOUR 0x00006000..0x00007000 (actual=0x00001000) [E-----F---] +ID=05 FIVE 0x00007000..0x00008000 (actual=0x00001000) [-L--------] +ID=06 SIX 0x00008000..0x00009000 (actual=0x00001000) [--------C-] -- cgit v1.1