mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 15:12:36 +02:00
flashrom.c: Move write_buf_to_include_args() to cli_classic.c
The write_buf_to_include_args() helper is only ever used by the cli frontend therefore make it static local to the user. BUG=b:242246291 TEST=builds Change-Id: Ia16bf4b8e46a011aa45f98089d43904b077833a0 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66648 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Evan Benn <evanbenn@google.com> Reviewed-by: Sam McNally <sammc@google.com> Reviewed-by: Thomas Heijligen <src@posteo.de>
This commit is contained in:
parent
b2b154802b
commit
16744f9e96
@ -392,6 +392,33 @@ static int read_buf_from_include_args(const struct flashrom_layout *const layout
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes content from buffer to one or more files.
|
||||
*
|
||||
* Writes content from supplied buffer to files. If a filename is specified for
|
||||
* individual regions using the partial read syntax ('-i <region>[:<filename>]')
|
||||
* then this will write files using data from the corresponding region in the
|
||||
* supplied buffer.
|
||||
*
|
||||
* @param layout The layout to be used.
|
||||
* @param buf Chip-sized buffer to read data from
|
||||
* @return 0 on success
|
||||
*/
|
||||
static int write_buf_to_include_args(const struct flashrom_layout *const layout, unsigned char *buf)
|
||||
{
|
||||
const struct romentry *entry = NULL;
|
||||
|
||||
while ((entry = layout_next_included(layout, entry))) {
|
||||
if (!entry->file)
|
||||
continue;
|
||||
if (write_buf_to_file(buf + entry->start,
|
||||
entry->end - entry->start + 1, entry->file))
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_read(struct flashctx *const flash, const char *const filename)
|
||||
{
|
||||
int ret;
|
||||
|
27
flashrom.c
27
flashrom.c
@ -870,33 +870,6 @@ notfound:
|
||||
return chip - flashchips;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes content from buffer to one or more files.
|
||||
*
|
||||
* Writes content from supplied buffer to files. If a filename is specified for
|
||||
* individual regions using the partial read syntax ('-i <region>[:<filename>]')
|
||||
* then this will write files using data from the corresponding region in the
|
||||
* supplied buffer.
|
||||
*
|
||||
* @param layout The layout to be used.
|
||||
* @param buf Chip-sized buffer to read data from
|
||||
* @return 0 on success
|
||||
*/
|
||||
int write_buf_to_include_args(const struct flashrom_layout *const layout, unsigned char *buf)
|
||||
{
|
||||
const struct romentry *entry = NULL;
|
||||
|
||||
while ((entry = layout_next_included(layout, entry))) {
|
||||
if (!entry->file)
|
||||
continue;
|
||||
if (write_buf_to_file(buf + entry->start,
|
||||
entry->end - entry->start + 1, entry->file))
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads the included layout regions into a buffer.
|
||||
*
|
||||
|
@ -424,7 +424,6 @@ void list_programmers_linebreak(int startcol, int cols, int paren);
|
||||
int selfcheck(void);
|
||||
int read_buf_from_file(unsigned char *buf, unsigned long size, const char *filename);
|
||||
int write_buf_to_file(const unsigned char *buf, unsigned long size, const char *filename);
|
||||
int write_buf_to_include_args(const struct flashrom_layout *const layout, unsigned char *buf);
|
||||
int prepare_flash_access(struct flashctx *, bool read_it, bool write_it, bool erase_it, bool verify_it);
|
||||
void finalize_flash_access(struct flashctx *);
|
||||
int register_chip_restore(chip_restore_fn_cb_t func, struct flashctx *flash, uint8_t status);
|
||||
|
Loading…
x
Reference in New Issue
Block a user