aboutsummaryrefslogtreecommitdiff
path: root/include/hw/nvram
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-09-11 18:59:23 +0200
committerMichael S. Tsirkin <mst@redhat.com>2017-10-15 05:54:40 +0300
commit5f9252f7cc12c5cec1b3c6695aca02eb52ea7acc (patch)
tree386c56dedd94b4121f9864095d6964c160b30770 /include/hw/nvram
parent06592d7e28794dcd93dbd5186910ba8c987453ba (diff)
fw_cfg: add write callback
Reintroduce the write callback that was removed when write support was removed in commit 023e3148567ac898c7258138f8e86c3c2bb40d07. Contrary to the previous callback implementation, the write_cb callback is called whenever a write happened, so handlers must be ready to handle partial write as necessary. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include/hw/nvram')
-rw-r--r--include/hw/nvram/fw_cfg.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
index f50d068563..7ccbae5fba 100644
--- a/include/hw/nvram/fw_cfg.h
+++ b/include/hw/nvram/fw_cfg.h
@@ -45,6 +45,7 @@ typedef struct FWCfgDmaAccess {
} QEMU_PACKED FWCfgDmaAccess;
typedef void (*FWCfgCallback)(void *opaque);
+typedef void (*FWCfgWriteCallback)(void *opaque, off_t start, size_t len);
struct FWCfgState {
/*< private >*/
@@ -183,6 +184,7 @@ void fw_cfg_add_file(FWCfgState *s, const char *filename, void *data,
* @s: fw_cfg device being modified
* @filename: name of new fw_cfg file item
* @select_cb: callback function when selecting
+ * @write_cb: callback function after a write
* @callback_opaque: argument to be passed into callback function
* @data: pointer to start of item data
* @len: size of item data
@@ -202,6 +204,7 @@ void fw_cfg_add_file(FWCfgState *s, const char *filename, void *data,
*/
void fw_cfg_add_file_callback(FWCfgState *s, const char *filename,
FWCfgCallback select_cb,
+ FWCfgWriteCallback write_cb,
void *callback_opaque,
void *data, size_t len, bool read_only);