loader: add rom transaction API
Image file loaders may add a series of roms. If an error occurs partway through loading there is no easy way to drop previously added roms. This patch adds a transaction mechanism that works like this: rom_transaction_begin(); ...call rom_add_*()... rom_transaction_end(ok); If ok is false then roms added in this transaction are dropped. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-id: 20180814162739.11814-5-stefanha@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
e7f5993354
commit
e2336043cc
2 changed files with 51 additions and 0 deletions
|
|
@ -225,6 +225,25 @@ int rom_check_and_register_reset(void);
|
|||
void rom_set_fw(FWCfgState *f);
|
||||
void rom_set_order_override(int order);
|
||||
void rom_reset_order_override(void);
|
||||
|
||||
/**
|
||||
* rom_transaction_begin:
|
||||
*
|
||||
* Call this before of a series of rom_add_*() calls. Call
|
||||
* rom_transaction_end() afterwards to commit or abort. These functions are
|
||||
* useful for undoing a series of rom_add_*() calls if image file loading fails
|
||||
* partway through.
|
||||
*/
|
||||
void rom_transaction_begin(void);
|
||||
|
||||
/**
|
||||
* rom_transaction_end:
|
||||
* @commit: true to commit added roms, false to drop added roms
|
||||
*
|
||||
* Call this after a series of rom_add_*() calls. See rom_transaction_begin().
|
||||
*/
|
||||
void rom_transaction_end(bool commit);
|
||||
|
||||
int rom_copy(uint8_t *dest, hwaddr addr, size_t size);
|
||||
void *rom_ptr(hwaddr addr, size_t size);
|
||||
void hmp_info_roms(Monitor *mon, const QDict *qdict);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue