mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
cbfstool: use struct cbfs_file * instead of void *
My concern was that compilers may something stupid under the assumption of a fixed struct size, but filename is already variable, so things are okay. Change-Id: I5348faf68f0a7993294e9de4c0b6c737278b28af Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-on: http://review.coreboot.org/11331 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
dc9dbc0059
commit
a60e7b6da5
2 changed files with 5 additions and 5 deletions
|
@ -457,7 +457,7 @@ static int cbfs_add_entry_at(struct cbfs_image *image,
|
||||||
struct cbfs_file *entry,
|
struct cbfs_file *entry,
|
||||||
const void *data,
|
const void *data,
|
||||||
uint32_t content_offset,
|
uint32_t content_offset,
|
||||||
const void *header_data,
|
const struct cbfs_file *header,
|
||||||
uint32_t header_size)
|
uint32_t header_size)
|
||||||
{
|
{
|
||||||
struct cbfs_file *next = cbfs_find_next_entry(image, entry);
|
struct cbfs_file *next = cbfs_find_next_entry(image, entry);
|
||||||
|
@ -487,7 +487,7 @@ static int cbfs_add_entry_at(struct cbfs_image *image,
|
||||||
}
|
}
|
||||||
|
|
||||||
len = content_offset - addr - header_size;
|
len = content_offset - addr - header_size;
|
||||||
memcpy(entry, header_data, header_size);
|
memcpy(entry, header, header_size);
|
||||||
if (len != 0) {
|
if (len != 0) {
|
||||||
/* the header moved backwards a bit to accomodate cbfs_file
|
/* the header moved backwards a bit to accomodate cbfs_file
|
||||||
* alignment requirements, so patch up ->offset to still point
|
* alignment requirements, so patch up ->offset to still point
|
||||||
|
@ -533,14 +533,14 @@ static int cbfs_add_entry_at(struct cbfs_image *image,
|
||||||
|
|
||||||
int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
|
int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
|
||||||
uint32_t content_offset,
|
uint32_t content_offset,
|
||||||
void *header, uint32_t header_size)
|
struct cbfs_file *header, uint32_t header_size)
|
||||||
{
|
{
|
||||||
assert(image);
|
assert(image);
|
||||||
assert(buffer);
|
assert(buffer);
|
||||||
assert(buffer->data);
|
assert(buffer->data);
|
||||||
assert(!IS_TOP_ALIGNED_ADDRESS(content_offset));
|
assert(!IS_TOP_ALIGNED_ADDRESS(content_offset));
|
||||||
|
|
||||||
const char *name = ((struct cbfs_file *)header)->filename;
|
const char *name = header->filename;
|
||||||
|
|
||||||
uint32_t entry_type;
|
uint32_t entry_type;
|
||||||
uint32_t addr, addr_next;
|
uint32_t addr, addr_next;
|
||||||
|
|
|
@ -94,7 +94,7 @@ int cbfs_export_entry(struct cbfs_image *image, const char *entry_name,
|
||||||
* Returns 0 on success, otherwise non-zero. */
|
* Returns 0 on success, otherwise non-zero. */
|
||||||
int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
|
int cbfs_add_entry(struct cbfs_image *image, struct buffer *buffer,
|
||||||
uint32_t content_offset,
|
uint32_t content_offset,
|
||||||
void *header, uint32_t header_size);
|
struct cbfs_file *header, uint32_t header_size);
|
||||||
|
|
||||||
/* Removes an entry from CBFS image. Returns 0 on success, otherwise non-zero. */
|
/* Removes an entry from CBFS image. Returns 0 on success, otherwise non-zero. */
|
||||||
int cbfs_remove_entry(struct cbfs_image *image, const char *name);
|
int cbfs_remove_entry(struct cbfs_image *image, const char *name);
|
||||||
|
|
Loading…
Add table
Reference in a new issue