Skip to content

Commit

Permalink
external/pflash: Use ffs_entry_user_to_string() to standardise flag s…
Browse files Browse the repository at this point in the history
…trings

Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
cyrilbur-ibm authored and stewartsmith committed Apr 9, 2018
1 parent 60b8ea4 commit 2b9ae3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
16 changes: 5 additions & 11 deletions external/pflash/pflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions external/pflash/test/results/01-info.out
Original file line number Diff line number Diff line change
Expand Up @@ -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-]

0 comments on commit 2b9ae3a

Please sign in to comment.