Monitor patches patches for 2021-11-10
-----BEGIN PGP SIGNATURE----- iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAmGLVXoSHGFybWJydUBy ZWRoYXQuY29tAAoJEDhwtADrkYZTrNoQAKelbBnhOC9+SDAm8bZJLbGtS41GvKvJ Ip3mJ6suXr822aZu+h9P3qnNb/g5oQGOL0hfFkK0nmhfmJaUZG79itMBtm8lbe33 EuLsHq3ArzmAYJx41elSQOZF9qucvAzik9aJi+HsugQmj+NyCxk4uF/EaLcHByIP yUG3PMKxtu3PXNw4CaPXn+lf13cMSrlnHCMHu8DDBkbh9LLtTeWo0Nk9CSZX6rm2 K5IY8AO7iWFFtx9vFv1EgJy68Kzj3vwfX6IcESQi5sSCA22VTvoBWhZHNURwM2Co Fv1EDaG0t/kZ3iJJrmRbjMzM0lzkz9e4N98XdQd8llAlvMjI65vDfyXHE6ZIR0wQ mYX1xNu5cdN/W8eMyfViU2wcgmOzvXStp3Zi6CYakDZS2tPVS2wpcdMF0S7t8o00 BHoUpMzsgFfEemTzy5KZIPeX5flRmlkOANp94rHz2izuX5kh5uCN1ypLlLlp0F7p 96DUOD6EsesrQvOo5rRnH2Uf3rqIX/84eShkgAeGKfDKiBL+EXI3HeTB6uMtB56w o3HGYY8WK1mPtLoMxju6X9wGFX7nerb/yLZgnLBQNa9+meZbwB60XKLVerbwi0lo ObkRJujAObR1baKOJqbUcixjUNU2yDoHKqfwyDD1V8OpTpVTnd5JUHk4QaZOwtrS xSUT/q7V6oJk =pwp8 -----END PGP SIGNATURE----- Merge tag 'pull-monitor-2021-11-10' of git://repo.or.cz/qemu/armbru into staging Monitor patches patches for 2021-11-10 # gpg: Signature made Wed 10 Nov 2021 06:15:38 AM CET # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] * tag 'pull-monitor-2021-11-10' of git://repo.or.cz/qemu/armbru: monitor: Fix find_device_state() for IDs containing slashes Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
commit
d73b6ae2c0
@ -1543,6 +1543,18 @@ Object *object_resolve_path(const char *path, bool *ambiguous);
|
||||
Object *object_resolve_path_type(const char *path, const char *typename,
|
||||
bool *ambiguous);
|
||||
|
||||
/**
|
||||
* object_resolve_path_at:
|
||||
* @parent: the object in which to resolve the path
|
||||
* @path: the path to resolve
|
||||
*
|
||||
* This is like object_resolve_path(), except paths not starting with
|
||||
* a slash are relative to @parent.
|
||||
*
|
||||
* Returns: The resolved object or NULL on path lookup failure.
|
||||
*/
|
||||
Object *object_resolve_path_at(Object *parent, const char *path);
|
||||
|
||||
/**
|
||||
* object_resolve_path_component:
|
||||
* @parent: the object in which to resolve the path
|
||||
|
11
qom/object.c
11
qom/object.c
@ -2144,6 +2144,17 @@ Object *object_resolve_path(const char *path, bool *ambiguous)
|
||||
return object_resolve_path_type(path, TYPE_OBJECT, ambiguous);
|
||||
}
|
||||
|
||||
Object *object_resolve_path_at(Object *parent, const char *path)
|
||||
{
|
||||
g_auto(GStrv) parts = g_strsplit(path, "/", 0);
|
||||
|
||||
if (*path == '/') {
|
||||
return object_resolve_abs_path(object_get_root(), parts + 1,
|
||||
TYPE_OBJECT);
|
||||
}
|
||||
return object_resolve_abs_path(parent, parts, TYPE_OBJECT);
|
||||
}
|
||||
|
||||
typedef struct StringProperty
|
||||
{
|
||||
char *(*get)(Object *, Error **);
|
||||
|
@ -871,15 +871,9 @@ void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp)
|
||||
|
||||
static DeviceState *find_device_state(const char *id, Error **errp)
|
||||
{
|
||||
Object *obj;
|
||||
Object *obj = object_resolve_path_at(qdev_get_peripheral(), id);
|
||||
DeviceState *dev;
|
||||
|
||||
if (id[0] == '/') {
|
||||
obj = object_resolve_path(id, NULL);
|
||||
} else {
|
||||
obj = object_resolve_path_component(qdev_get_peripheral(), id);
|
||||
}
|
||||
|
||||
if (!obj) {
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", id);
|
||||
|
Loading…
Reference in New Issue
Block a user