layout: Get rid of struct typedef and use upstream name
Start to converge our local implementation with upstreams that
was worked on around the `commit 3a9939b952e` as a point of reference.
BUG=chromium:478356
BRANCH=none
TEST=still builds
Change-Id: Id42e697e16d9d4ded82eeb2777c84719d2d9a636
Signed-off-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/flashrom/+/1672913
Reviewed-by: Sam McNally <sammc@chromium.org>
diff --git a/cli_classic.c b/cli_classic.c
index 8073470..8143a4c 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -952,7 +952,7 @@
if (set_wp_region && wp_region) {
int n;
- romlayout_t entry;
+ struct romentry entry;
n = find_romentry(wp_region);
if (n < 0) {
diff --git a/fdtmap.c b/fdtmap.c
index 2a04622..d3ea05a 100644
--- a/fdtmap.c
+++ b/fdtmap.c
@@ -126,7 +126,7 @@
return 0;
}
-static int scan_flashmap(const void *blob, romlayout_t *rom_entries,
+static int scan_flashmap(const void *blob, struct romentry *rom_entries,
int max_entries)
{
int romimages;
@@ -142,7 +142,7 @@
for (depth = romimages = 0; offset > 0 && depth >= 0; offset = node) {
struct fmap_entry entry;
const char *name;
- romlayout_t *rl;
+ struct romentry *rl;
char *s;
int ret;
@@ -203,7 +203,7 @@
return romimages;
}
-int fdtmap_add_entries_from_buf(const void *blob, romlayout_t *rom_entries,
+int fdtmap_add_entries_from_buf(const void *blob, struct romentry *rom_entries,
int max_entries)
{
int count;
diff --git a/fdtmap.h b/fdtmap.h
index f0d3015..9b603cc 100644
--- a/fdtmap.h
+++ b/fdtmap.h
@@ -38,7 +38,7 @@
#define FDTMAP_SIGNATURE "__FDTM__"
-struct romlayout;
+struct romentry;
/* The header at the start of an fdtmap */
struct fdtmap_hdr {
@@ -57,7 +57,7 @@
* @return Number of entries added, or -1 on error
*/
int fdtmap_add_entries_from_buf(const void *blob,
- struct romlayout *rom_entries, int max_entries);
+ struct romentry *rom_entries, int max_entries);
/*
* fdtmap_find - find FDTMAP at offset in an image and copy it to buffer
diff --git a/layout.c b/layout.c
index a9aae88..2e02bdc 100644
--- a/layout.c
+++ b/layout.c
@@ -48,7 +48,7 @@
*/
static char *include_args[MAX_ROMLAYOUT];
static int num_include_args = 0; /* the number of valid entries. */
-static romlayout_t rom_entries[MAX_ROMLAYOUT];
+static struct romentry rom_entries[MAX_ROMLAYOUT];
#if CONFIG_INTERNAL == 1 /* FIXME: Move the whole block to cbtable.c? */
@@ -503,7 +503,7 @@
}
-int fill_romentry(romlayout_t *entry, int n)
+int fill_romentry(struct romentry *entry, int n)
{
if (!entry)
return 1;
@@ -565,12 +565,12 @@
return 0;
}
-static romlayout_t *get_next_included_romentry(unsigned int start)
+static struct romentry *get_next_included_romentry(unsigned int start)
{
int i;
unsigned int best_start = UINT_MAX;
- romlayout_t *best_entry = NULL;
- romlayout_t *cur;
+ struct romentry *best_entry = NULL;
+ struct romentry *cur;
/* First come, first serve for overlapping regions. */
for (i = 0; i < romimages; i++) {
@@ -631,7 +631,7 @@
return overlap_detected;
}
-static int read_content_from_file(romlayout_t *entry, uint8_t *newcontents) {
+static int read_content_from_file(struct romentry *entry, uint8_t *newcontents) {
char *file;
FILE *fp;
int len;
@@ -676,7 +676,7 @@
uint8_t *newcontents, int erase_mode)
{
unsigned int start = 0;
- romlayout_t *entry;
+ struct romentry *entry;
unsigned int size = flash->chip->total_size * 1024;
/* If no regions were specified for inclusion, assume
@@ -736,7 +736,7 @@
return 0;
}
-static int write_content_to_file(romlayout_t *entry, uint8_t *buf) {
+static int write_content_to_file(struct romentry *entry, uint8_t *buf) {
char *file;
FILE *fp;
int len = entry->end - entry->start + 1;
@@ -931,7 +931,7 @@
msg_gdbg("Extracting %d images\n", romimages);
for (i = 0; !ret && i < romimages; i++) {
- romlayout_t *region = &rom_entries[i];
+ struct romentry *region = &rom_entries[i];
char fname[256];
char *from, *to;
unsigned long region_size;
diff --git a/layout.h b/layout.h
index b655602..469ac1a 100644
--- a/layout.h
+++ b/layout.h
@@ -17,13 +17,13 @@
#ifndef FLASHMAP_LIB_LAYOUT_H__
#define FLASHMAP_LIB_LAYOUT_H__
-typedef struct romlayout {
+struct romentry {
unsigned int start;
unsigned int end;
unsigned int included;
char name[256];
char file[256]; /* file[0]=='\0' means not specified. */
-} romlayout_t;
+};
/**
* Extract regions to current directory
@@ -36,7 +36,7 @@
int specified_partition();
int read_romlayout(char *name);
int find_romentry(char *name);
-int fill_romentry(romlayout_t *entry, int n);
+int fill_romentry(struct romentry *entry, int n);
int get_fmap_entries(const char *filename, struct flashctx *flash);
int get_num_include_args(void);
int register_include_arg(char *name);