hw/nvram/fw_cfg: Pass QOM parent to fw_cfg_add_file_from_generator()

Currently fw_cfg_add_file_from_generator() is restricted
to command line created objects which reside in the
'/objects' QOM container. In order to extend to other
types of containers, pass the QOM parent by argument.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20241206181352.6836-3-philmd@linaro.org>
This commit is contained in:
Philippe Mathieu-Daudé 2024-12-06 17:04:09 +01:00
parent e20a4425ca
commit 51680269fe
3 changed files with 14 additions and 10 deletions

View file

@ -294,11 +294,12 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *filename, void *data,
* fw_cfg_add_file_from_generator:
* @s: fw_cfg device being modified
* @filename: name of new fw_cfg file item
* @gen_id: name of object implementing FW_CFG_DATA_GENERATOR interface
* @part: name of object implementing FW_CFG_DATA_GENERATOR interface
* @parent: the object in which to resolve the @part
* @errp: pointer to a NULL initialized error object
*
* Add a new NAMED fw_cfg item with the content generated from the
* @gen_id object. The data generated by the @gen_id object is copied
* @part object. The data generated by the @part object is copied
* into the data structure of the fw_cfg device.
* The next available (unused) selector key starting at FW_CFG_FILE_FIRST
* will be used; also, a new entry will be added to the file directory
@ -307,8 +308,9 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *filename, void *data,
*
* Returns: %true on success, %false on error.
*/
bool fw_cfg_add_file_from_generator(FWCfgState *s, const char *filename,
const char *gen_id, Error **errp);
bool fw_cfg_add_file_from_generator(FWCfgState *s,
Object *parent, const char *part,
const char *filename, Error **errp);
/**
* fw_cfg_add_extra_pci_roots: