mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 18:44:58 -06:00
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:
parent
e20a4425ca
commit
51680269fe
3 changed files with 14 additions and 10 deletions
|
@ -1027,22 +1027,23 @@ void *fw_cfg_modify_file(FWCfgState *s, const char *filename,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
FWCfgDataGeneratorClass *klass;
|
||||
GByteArray *array;
|
||||
Object *obj;
|
||||
gsize size;
|
||||
|
||||
obj = object_resolve_path_component(object_get_objects_root(), gen_id);
|
||||
obj = object_resolve_path_component(parent, part);
|
||||
if (!obj) {
|
||||
error_setg(errp, "Cannot find object ID '%s'", gen_id);
|
||||
error_setg(errp, "Cannot find object ID '%s'", part);
|
||||
return false;
|
||||
}
|
||||
if (!object_dynamic_cast(obj, TYPE_FW_CFG_DATA_GENERATOR_INTERFACE)) {
|
||||
error_setg(errp, "Object ID '%s' is not a '%s' subclass",
|
||||
gen_id, TYPE_FW_CFG_DATA_GENERATOR_INTERFACE);
|
||||
part, TYPE_FW_CFG_DATA_GENERATOR_INTERFACE);
|
||||
return false;
|
||||
}
|
||||
klass = FW_CFG_DATA_GENERATOR_GET_CLASS(obj);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue