mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 00:35:34 +00:00
qom: Swap 'name' next to visitor in ObjectPropertyAccessor
Similar to the previous patch, it's nice to have all functions in the tree that involve a visitor and a name for conversion to or from QAPI to consistently stick the 'name' parameter next to the Visitor parameter. Done by manually changing include/qom/object.h and qom/object.c, then running this Coccinelle script and touching up the fallout (Coccinelle insisted on adding some trailing whitespace). @ rule1 @ identifier fn; typedef Object, Visitor, Error; identifier obj, v, opaque, name, errp; @@ void fn - (Object *obj, Visitor *v, void *opaque, const char *name, + (Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { ... } @@ identifier rule1.fn; expression obj, v, opaque, name, errp; @@ fn(obj, v, - opaque, name, + name, opaque, errp) Backports commit d7bce9999df85c56c8cb1fcffd944d51bff8ff48 from qemu
This commit is contained in:
parent
5dd5646a9a
commit
9ec25b4673
|
@ -29,7 +29,7 @@ void qapi_free_DummyForceArrays(DummyForceArrays *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_DummyForceArrays(v, &obj, NULL, NULL);
|
||||
visit_type_DummyForceArrays(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ void qapi_free_X86CPUFeatureWordInfo(X86CPUFeatureWordInfo *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_X86CPUFeatureWordInfo(v, &obj, NULL, NULL);
|
||||
visit_type_X86CPUFeatureWordInfo(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ void qapi_free_X86CPUFeatureWordInfoList(X86CPUFeatureWordInfoList *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_X86CPUFeatureWordInfoList(v, &obj, NULL, NULL);
|
||||
visit_type_X86CPUFeatureWordInfoList(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ void qapi_free_anyList(anyList *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_anyList(v, &obj, NULL, NULL);
|
||||
visit_type_anyList(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ void qapi_free_boolList(boolList *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_boolList(v, &obj, NULL, NULL);
|
||||
visit_type_boolList(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ void qapi_free_int16List(int16List *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_int16List(v, &obj, NULL, NULL);
|
||||
visit_type_int16List(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ void qapi_free_int32List(int32List *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_int32List(v, &obj, NULL, NULL);
|
||||
visit_type_int32List(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ void qapi_free_int64List(int64List *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_int64List(v, &obj, NULL, NULL);
|
||||
visit_type_int64List(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ void qapi_free_int8List(int8List *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_int8List(v, &obj, NULL, NULL);
|
||||
visit_type_int8List(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ void qapi_free_intList(intList *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_intList(v, &obj, NULL, NULL);
|
||||
visit_type_intList(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ void qapi_free_numberList(numberList *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_numberList(v, &obj, NULL, NULL);
|
||||
visit_type_numberList(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ void qapi_free_sizeList(sizeList *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_sizeList(v, &obj, NULL, NULL);
|
||||
visit_type_sizeList(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -243,7 +243,7 @@ void qapi_free_strList(strList *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_strList(v, &obj, NULL, NULL);
|
||||
visit_type_strList(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ void qapi_free_uint16List(uint16List *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_uint16List(v, &obj, NULL, NULL);
|
||||
visit_type_uint16List(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ void qapi_free_uint32List(uint32List *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_uint32List(v, &obj, NULL, NULL);
|
||||
visit_type_uint32List(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -288,7 +288,7 @@ void qapi_free_uint64List(uint64List *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_uint64List(v, &obj, NULL, NULL);
|
||||
visit_type_uint64List(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
||||
|
@ -303,6 +303,6 @@ void qapi_free_uint8List(uint8List *obj)
|
|||
|
||||
qdv = qapi_dealloc_visitor_new();
|
||||
v = qapi_dealloc_get_visitor(qdv);
|
||||
visit_type_uint8List(v, &obj, NULL, NULL);
|
||||
visit_type_uint8List(v, NULL, &obj, NULL);
|
||||
qapi_dealloc_visitor_cleanup(qdv);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ static void visit_type_DummyForceArrays_fields(Visitor *v, DummyForceArrays **ob
|
|||
{
|
||||
Error *err = NULL;
|
||||
|
||||
visit_type_X86CPUFeatureWordInfoList(v, &(*obj)->unused, "unused", &err);
|
||||
visit_type_X86CPUFeatureWordInfoList(v, "unused", &(*obj)->unused, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
@ -29,11 +29,11 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_DummyForceArrays(Visitor *v, DummyForceArrays **obj, const char *name, Error **errp)
|
||||
void visit_type_DummyForceArrays(Visitor *v, const char *name, DummyForceArrays **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
|
||||
visit_start_struct(v, (void **)obj, "DummyForceArrays", name, sizeof(DummyForceArrays), &err);
|
||||
visit_start_struct(v, name, (void **)obj, "DummyForceArrays", sizeof(DummyForceArrays), &err);
|
||||
|
||||
if (err) {
|
||||
goto out;
|
||||
|
@ -50,17 +50,17 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_QType(Visitor *v, QType *obj, const char *name, Error **errp)
|
||||
void visit_type_QType(Visitor *v, const char *name, QType *obj, Error **errp)
|
||||
{
|
||||
int value = *obj;
|
||||
visit_type_enum(v, &value, QType_lookup, "QType", name, errp);
|
||||
visit_type_enum(v, name, &value, QType_lookup, "QType", errp);
|
||||
*obj = value;
|
||||
}
|
||||
|
||||
void visit_type_QapiErrorClass(Visitor *v, QapiErrorClass *obj, const char *name, Error **errp)
|
||||
void visit_type_QapiErrorClass(Visitor *v, const char *name, QapiErrorClass *obj, Error **errp)
|
||||
{
|
||||
int value = *obj;
|
||||
visit_type_enum(v, &value, QapiErrorClass_lookup, "QapiErrorClass", name, errp);
|
||||
visit_type_enum(v, name, &value, QapiErrorClass_lookup, "QapiErrorClass", errp);
|
||||
*obj = value;
|
||||
}
|
||||
|
||||
|
@ -68,21 +68,21 @@ static void visit_type_X86CPUFeatureWordInfo_fields(Visitor *v, X86CPUFeatureWor
|
|||
{
|
||||
Error *err = NULL;
|
||||
|
||||
visit_type_int(v, &(*obj)->cpuid_input_eax, "cpuid-input-eax", &err);
|
||||
visit_type_int(v, "cpuid-input-eax", &(*obj)->cpuid_input_eax, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
if (visit_optional(v, &(*obj)->has_cpuid_input_ecx, "cpuid-input-ecx")) {
|
||||
visit_type_int(v, &(*obj)->cpuid_input_ecx, "cpuid-input-ecx", &err);
|
||||
if (visit_optional(v, "cpuid-input-ecx", &(*obj)->has_cpuid_input_ecx)) {
|
||||
visit_type_int(v, "cpuid-input-ecx", &(*obj)->cpuid_input_ecx, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
visit_type_X86CPURegister32(v, &(*obj)->cpuid_register, "cpuid-register", &err);
|
||||
visit_type_X86CPURegister32(v, "cpuid-register", &(*obj)->cpuid_register, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
visit_type_int(v, &(*obj)->features, "features", &err);
|
||||
visit_type_int(v, "features", &(*obj)->features, &err);
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
@ -91,11 +91,11 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_X86CPUFeatureWordInfo(Visitor *v, X86CPUFeatureWordInfo **obj, const char *name, Error **errp)
|
||||
void visit_type_X86CPUFeatureWordInfo(Visitor *v, const char *name, X86CPUFeatureWordInfo **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
|
||||
visit_start_struct(v, (void **)obj, "X86CPUFeatureWordInfo", name, sizeof(X86CPUFeatureWordInfo), &err);
|
||||
visit_start_struct(v, name, (void **)obj, "X86CPUFeatureWordInfo", sizeof(X86CPUFeatureWordInfo), &err);
|
||||
|
||||
if (err) {
|
||||
goto out;
|
||||
|
@ -112,7 +112,7 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_X86CPUFeatureWordInfoList(Visitor *v, X86CPUFeatureWordInfoList **obj, const char *name, Error **errp)
|
||||
void visit_type_X86CPUFeatureWordInfoList(Visitor *v, const char *name, X86CPUFeatureWordInfoList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GenericList *i, **prev;
|
||||
|
@ -126,7 +126,7 @@ void visit_type_X86CPUFeatureWordInfoList(Visitor *v, X86CPUFeatureWordInfoList
|
|||
!err && (i = visit_next_list(v, prev)) != NULL;
|
||||
prev = &i) {
|
||||
X86CPUFeatureWordInfoList *native_i = (X86CPUFeatureWordInfoList *)i;
|
||||
visit_type_X86CPUFeatureWordInfo(v, &native_i->value, NULL, &err);
|
||||
visit_type_X86CPUFeatureWordInfo(v, NULL, &native_i->value, &err);
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
|
@ -136,14 +136,14 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_X86CPURegister32(Visitor *v, X86CPURegister32 *obj, const char *name, Error **errp)
|
||||
void visit_type_X86CPURegister32(Visitor *v, const char *name, X86CPURegister32 *obj, Error **errp)
|
||||
{
|
||||
int value = *obj;
|
||||
visit_type_enum(v, &value, X86CPURegister32_lookup, "X86CPURegister32", name, errp);
|
||||
visit_type_enum(v, name, &value, X86CPURegister32_lookup, "X86CPURegister32", errp);
|
||||
*obj = value;
|
||||
}
|
||||
|
||||
void visit_type_anyList(Visitor *v, anyList **obj, const char *name, Error **errp)
|
||||
void visit_type_anyList(Visitor *v, const char *name, anyList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GenericList *i, **prev;
|
||||
|
@ -157,7 +157,7 @@ void visit_type_anyList(Visitor *v, anyList **obj, const char *name, Error **err
|
|||
!err && (i = visit_next_list(v, prev)) != NULL;
|
||||
prev = &i) {
|
||||
anyList *native_i = (anyList *)i;
|
||||
visit_type_any(v, &native_i->value, NULL, &err);
|
||||
visit_type_any(v, NULL, &native_i->value, &err);
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
|
@ -167,7 +167,7 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_boolList(Visitor *v, boolList **obj, const char *name, Error **errp)
|
||||
void visit_type_boolList(Visitor *v, const char *name, boolList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GenericList *i, **prev;
|
||||
|
@ -181,7 +181,7 @@ void visit_type_boolList(Visitor *v, boolList **obj, const char *name, Error **e
|
|||
!err && (i = visit_next_list(v, prev)) != NULL;
|
||||
prev = &i) {
|
||||
boolList *native_i = (boolList *)i;
|
||||
visit_type_bool(v, &native_i->value, NULL, &err);
|
||||
visit_type_bool(v, NULL, &native_i->value, &err);
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
|
@ -191,7 +191,7 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_int16List(Visitor *v, int16List **obj, const char *name, Error **errp)
|
||||
void visit_type_int16List(Visitor *v, const char *name, int16List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GenericList *i, **prev;
|
||||
|
@ -205,7 +205,7 @@ void visit_type_int16List(Visitor *v, int16List **obj, const char *name, Error *
|
|||
!err && (i = visit_next_list(v, prev)) != NULL;
|
||||
prev = &i) {
|
||||
int16List *native_i = (int16List *)i;
|
||||
visit_type_int16(v, &native_i->value, NULL, &err);
|
||||
visit_type_int16(v, NULL, &native_i->value, &err);
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
|
@ -215,7 +215,7 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_int32List(Visitor *v, int32List **obj, const char *name, Error **errp)
|
||||
void visit_type_int32List(Visitor *v, const char *name, int32List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GenericList *i, **prev;
|
||||
|
@ -229,7 +229,7 @@ void visit_type_int32List(Visitor *v, int32List **obj, const char *name, Error *
|
|||
!err && (i = visit_next_list(v, prev)) != NULL;
|
||||
prev = &i) {
|
||||
int32List *native_i = (int32List *)i;
|
||||
visit_type_int32(v, &native_i->value, NULL, &err);
|
||||
visit_type_int32(v, NULL, &native_i->value, &err);
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
|
@ -239,7 +239,7 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_int64List(Visitor *v, int64List **obj, const char *name, Error **errp)
|
||||
void visit_type_int64List(Visitor *v, const char *name, int64List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GenericList *i, **prev;
|
||||
|
@ -253,7 +253,7 @@ void visit_type_int64List(Visitor *v, int64List **obj, const char *name, Error *
|
|||
!err && (i = visit_next_list(v, prev)) != NULL;
|
||||
prev = &i) {
|
||||
int64List *native_i = (int64List *)i;
|
||||
visit_type_int64(v, &native_i->value, NULL, &err);
|
||||
visit_type_int64(v, NULL, &native_i->value, &err);
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
|
@ -263,7 +263,7 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_int8List(Visitor *v, int8List **obj, const char *name, Error **errp)
|
||||
void visit_type_int8List(Visitor *v, const char *name, int8List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GenericList *i, **prev;
|
||||
|
@ -277,7 +277,7 @@ void visit_type_int8List(Visitor *v, int8List **obj, const char *name, Error **e
|
|||
!err && (i = visit_next_list(v, prev)) != NULL;
|
||||
prev = &i) {
|
||||
int8List *native_i = (int8List *)i;
|
||||
visit_type_int8(v, &native_i->value, NULL, &err);
|
||||
visit_type_int8(v, NULL, &native_i->value, &err);
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
|
@ -287,7 +287,7 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_intList(Visitor *v, intList **obj, const char *name, Error **errp)
|
||||
void visit_type_intList(Visitor *v, const char *name, intList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GenericList *i, **prev;
|
||||
|
@ -301,7 +301,7 @@ void visit_type_intList(Visitor *v, intList **obj, const char *name, Error **err
|
|||
!err && (i = visit_next_list(v, prev)) != NULL;
|
||||
prev = &i) {
|
||||
intList *native_i = (intList *)i;
|
||||
visit_type_int(v, &native_i->value, NULL, &err);
|
||||
visit_type_int(v, NULL, &native_i->value, &err);
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
|
@ -311,7 +311,7 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_numberList(Visitor *v, numberList **obj, const char *name, Error **errp)
|
||||
void visit_type_numberList(Visitor *v, const char *name, numberList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GenericList *i, **prev;
|
||||
|
@ -325,7 +325,7 @@ void visit_type_numberList(Visitor *v, numberList **obj, const char *name, Error
|
|||
!err && (i = visit_next_list(v, prev)) != NULL;
|
||||
prev = &i) {
|
||||
numberList *native_i = (numberList *)i;
|
||||
visit_type_number(v, &native_i->value, NULL, &err);
|
||||
visit_type_number(v, NULL, &native_i->value, &err);
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
|
@ -335,7 +335,7 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_sizeList(Visitor *v, sizeList **obj, const char *name, Error **errp)
|
||||
void visit_type_sizeList(Visitor *v, const char *name, sizeList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GenericList *i, **prev;
|
||||
|
@ -349,7 +349,7 @@ void visit_type_sizeList(Visitor *v, sizeList **obj, const char *name, Error **e
|
|||
!err && (i = visit_next_list(v, prev)) != NULL;
|
||||
prev = &i) {
|
||||
sizeList *native_i = (sizeList *)i;
|
||||
visit_type_size(v, &native_i->value, NULL, &err);
|
||||
visit_type_size(v, NULL, &native_i->value, &err);
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
|
@ -359,7 +359,7 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_strList(Visitor *v, strList **obj, const char *name, Error **errp)
|
||||
void visit_type_strList(Visitor *v, const char *name, strList **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GenericList *i, **prev;
|
||||
|
@ -373,7 +373,7 @@ void visit_type_strList(Visitor *v, strList **obj, const char *name, Error **err
|
|||
!err && (i = visit_next_list(v, prev)) != NULL;
|
||||
prev = &i) {
|
||||
strList *native_i = (strList *)i;
|
||||
visit_type_str(v, &native_i->value, NULL, &err);
|
||||
visit_type_str(v, NULL, &native_i->value, &err);
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
|
@ -383,7 +383,7 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_uint16List(Visitor *v, uint16List **obj, const char *name, Error **errp)
|
||||
void visit_type_uint16List(Visitor *v, const char *name, uint16List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GenericList *i, **prev;
|
||||
|
@ -397,7 +397,7 @@ void visit_type_uint16List(Visitor *v, uint16List **obj, const char *name, Error
|
|||
!err && (i = visit_next_list(v, prev)) != NULL;
|
||||
prev = &i) {
|
||||
uint16List *native_i = (uint16List *)i;
|
||||
visit_type_uint16(v, &native_i->value, NULL, &err);
|
||||
visit_type_uint16(v, NULL, &native_i->value, &err);
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
|
@ -407,7 +407,7 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_uint32List(Visitor *v, uint32List **obj, const char *name, Error **errp)
|
||||
void visit_type_uint32List(Visitor *v, const char *name, uint32List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GenericList *i, **prev;
|
||||
|
@ -421,7 +421,7 @@ void visit_type_uint32List(Visitor *v, uint32List **obj, const char *name, Error
|
|||
!err && (i = visit_next_list(v, prev)) != NULL;
|
||||
prev = &i) {
|
||||
uint32List *native_i = (uint32List *)i;
|
||||
visit_type_uint32(v, &native_i->value, NULL, &err);
|
||||
visit_type_uint32(v, NULL, &native_i->value, &err);
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
|
@ -431,7 +431,7 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_uint64List(Visitor *v, uint64List **obj, const char *name, Error **errp)
|
||||
void visit_type_uint64List(Visitor *v, const char *name, uint64List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GenericList *i, **prev;
|
||||
|
@ -445,7 +445,7 @@ void visit_type_uint64List(Visitor *v, uint64List **obj, const char *name, Error
|
|||
!err && (i = visit_next_list(v, prev)) != NULL;
|
||||
prev = &i) {
|
||||
uint64List *native_i = (uint64List *)i;
|
||||
visit_type_uint64(v, &native_i->value, NULL, &err);
|
||||
visit_type_uint64(v, NULL, &native_i->value, &err);
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
|
@ -455,7 +455,7 @@ out:
|
|||
error_propagate(errp, err);
|
||||
}
|
||||
|
||||
void visit_type_uint8List(Visitor *v, uint8List **obj, const char *name, Error **errp)
|
||||
void visit_type_uint8List(Visitor *v, const char *name, uint8List **obj, Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
GenericList *i, **prev;
|
||||
|
@ -469,7 +469,7 @@ void visit_type_uint8List(Visitor *v, uint8List **obj, const char *name, Error *
|
|||
!err && (i = visit_next_list(v, prev)) != NULL;
|
||||
prev = &i) {
|
||||
uint8List *native_i = (uint8List *)i;
|
||||
visit_type_uint8(v, &native_i->value, NULL, &err);
|
||||
visit_type_uint8(v, NULL, &native_i->value, &err);
|
||||
}
|
||||
|
||||
error_propagate(errp, err);
|
||||
|
|
|
@ -24,28 +24,28 @@
|
|||
#ifndef QAPI_VISIT_BUILTIN
|
||||
#define QAPI_VISIT_BUILTIN
|
||||
|
||||
void visit_type_QType(Visitor *v, QType *obj, const char *name, Error **errp);
|
||||
void visit_type_anyList(Visitor *v, anyList **obj, const char *name, Error **errp);
|
||||
void visit_type_boolList(Visitor *v, boolList **obj, const char *name, Error **errp);
|
||||
void visit_type_int16List(Visitor *v, int16List **obj, const char *name, Error **errp);
|
||||
void visit_type_int32List(Visitor *v, int32List **obj, const char *name, Error **errp);
|
||||
void visit_type_int64List(Visitor *v, int64List **obj, const char *name, Error **errp);
|
||||
void visit_type_int8List(Visitor *v, int8List **obj, const char *name, Error **errp);
|
||||
void visit_type_intList(Visitor *v, intList **obj, const char *name, Error **errp);
|
||||
void visit_type_numberList(Visitor *v, numberList **obj, const char *name, Error **errp);
|
||||
void visit_type_sizeList(Visitor *v, sizeList **obj, const char *name, Error **errp);
|
||||
void visit_type_strList(Visitor *v, strList **obj, const char *name, Error **errp);
|
||||
void visit_type_uint16List(Visitor *v, uint16List **obj, const char *name, Error **errp);
|
||||
void visit_type_uint32List(Visitor *v, uint32List **obj, const char *name, Error **errp);
|
||||
void visit_type_uint64List(Visitor *v, uint64List **obj, const char *name, Error **errp);
|
||||
void visit_type_uint8List(Visitor *v, uint8List **obj, const char *name, Error **errp);
|
||||
void visit_type_QType(Visitor *v, const char *name, QType *obj, Error **errp);
|
||||
void visit_type_anyList(Visitor *v, const char *name, anyList **obj, Error **errp);
|
||||
void visit_type_boolList(Visitor *v, const char *name, boolList **obj, Error **errp);
|
||||
void visit_type_int16List(Visitor *v, const char *name, int16List **obj, Error **errp);
|
||||
void visit_type_int32List(Visitor *v, const char *name, int32List **obj, Error **errp);
|
||||
void visit_type_int64List(Visitor *v, const char *name, int64List **obj, Error **errp);
|
||||
void visit_type_int8List(Visitor *v, const char *name, int8List **obj, Error **errp);
|
||||
void visit_type_intList(Visitor *v, const char *name, intList **obj, Error **errp);
|
||||
void visit_type_numberList(Visitor *v, const char *name, numberList **obj, Error **errp);
|
||||
void visit_type_sizeList(Visitor *v, const char *name, sizeList **obj, Error **errp);
|
||||
void visit_type_strList(Visitor *v, const char *name, strList **obj, Error **errp);
|
||||
void visit_type_uint16List(Visitor *v, const char *name, uint16List **obj, Error **errp);
|
||||
void visit_type_uint32List(Visitor *v, const char *name, uint32List **obj, Error **errp);
|
||||
void visit_type_uint64List(Visitor *v, const char *name, uint64List **obj, Error **errp);
|
||||
void visit_type_uint8List(Visitor *v, const char *name, uint8List **obj, Error **errp);
|
||||
|
||||
#endif /* QAPI_VISIT_BUILTIN */
|
||||
|
||||
void visit_type_DummyForceArrays(Visitor *v, DummyForceArrays **obj, const char *name, Error **errp);
|
||||
void visit_type_QapiErrorClass(Visitor *v, QapiErrorClass *obj, const char *name, Error **errp);
|
||||
void visit_type_X86CPUFeatureWordInfo(Visitor *v, X86CPUFeatureWordInfo **obj, const char *name, Error **errp);
|
||||
void visit_type_X86CPUFeatureWordInfoList(Visitor *v, X86CPUFeatureWordInfoList **obj, const char *name, Error **errp);
|
||||
void visit_type_X86CPURegister32(Visitor *v, X86CPURegister32 *obj, const char *name, Error **errp);
|
||||
void visit_type_DummyForceArrays(Visitor *v, const char *name, DummyForceArrays **obj, Error **errp);
|
||||
void visit_type_QapiErrorClass(Visitor *v, const char *name, QapiErrorClass *obj, Error **errp);
|
||||
void visit_type_X86CPUFeatureWordInfo(Visitor *v, const char *name, X86CPUFeatureWordInfo **obj, Error **errp);
|
||||
void visit_type_X86CPUFeatureWordInfoList(Visitor *v, const char *name, X86CPUFeatureWordInfoList **obj, Error **errp);
|
||||
void visit_type_X86CPURegister32(Visitor *v, const char *name, X86CPURegister32 *obj, Error **errp);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -291,22 +291,17 @@ struct uc_struct;
|
|||
* ObjectPropertyAccessor:
|
||||
* @obj: the object that owns the property
|
||||
* @v: the visitor that contains the property data
|
||||
* @opaque: the object property opaque
|
||||
* @name: the name of the property
|
||||
* @opaque: the object property opaque
|
||||
* @errp: a pointer to an Error that is filled if getting/setting fails.
|
||||
*
|
||||
* Called when trying to get/set a property.
|
||||
*/
|
||||
typedef void (ObjectPropertyAccessor)(struct uc_struct *uc, Object *obj,
|
||||
Visitor *v,
|
||||
void *opaque,
|
||||
const char *name,
|
||||
void *opaque,
|
||||
Error **errp);
|
||||
typedef int (ObjectPropertySetAccessor)(struct uc_struct *uc, Object *obj,
|
||||
Visitor *v,
|
||||
void *opaque,
|
||||
const char *name,
|
||||
Error **errp);
|
||||
|
||||
/**
|
||||
* ObjectPropertyResolve:
|
||||
|
@ -345,7 +340,7 @@ typedef struct ObjectProperty
|
|||
gchar *type;
|
||||
gchar *description;
|
||||
ObjectPropertyAccessor *get;
|
||||
ObjectPropertySetAccessor *set;
|
||||
ObjectPropertyAccessor *set;
|
||||
ObjectPropertyResolve *resolve;
|
||||
ObjectPropertyRelease *release;
|
||||
void *opaque;
|
||||
|
@ -802,7 +797,7 @@ void object_unref(struct uc_struct *uc, Object *obj);
|
|||
ObjectProperty *object_property_add(Object *obj, const char *name,
|
||||
const char *type,
|
||||
ObjectPropertyAccessor *get,
|
||||
ObjectPropertySetAccessor *set,
|
||||
ObjectPropertyAccessor *set,
|
||||
ObjectPropertyRelease *release,
|
||||
void *opaque, Error **errp);
|
||||
|
||||
|
|
|
@ -886,8 +886,10 @@ void memory_region_init(struct uc_struct *uc, MemoryRegion *mr,
|
|||
}
|
||||
}
|
||||
|
||||
static void memory_region_get_addr(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void memory_region_get_addr(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
MemoryRegion *mr = MEMORY_REGION(uc, obj);
|
||||
uint64_t value = mr->addr;
|
||||
|
@ -895,8 +897,10 @@ static void memory_region_get_addr(struct uc_struct *uc, Object *obj, Visitor *v
|
|||
visit_type_uint64(v, name, &value, errp);
|
||||
}
|
||||
|
||||
static void memory_region_get_container(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void memory_region_get_container(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
MemoryRegion *mr = MEMORY_REGION(uc, obj);
|
||||
gchar *path = (gchar *)"";
|
||||
|
@ -918,8 +922,10 @@ static Object *memory_region_resolve_container(struct uc_struct *uc, Object *obj
|
|||
return OBJECT(mr->container);
|
||||
}
|
||||
|
||||
static void memory_region_get_priority(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void memory_region_get_priority(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
MemoryRegion *mr = MEMORY_REGION(uc, obj);
|
||||
int32_t value = mr->priority;
|
||||
|
@ -934,8 +940,10 @@ static bool memory_region_get_may_overlap(struct uc_struct *uc, Object *obj, Err
|
|||
return mr->may_overlap;
|
||||
}
|
||||
|
||||
static void memory_region_get_size(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void memory_region_get_size(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
MemoryRegion *mr = MEMORY_REGION(uc, obj);
|
||||
uint64_t value = memory_region_size(mr);
|
||||
|
|
|
@ -738,7 +738,7 @@ void object_unref(struct uc_struct *uc, Object *obj)
|
|||
ObjectProperty *
|
||||
object_property_add(Object *obj, const char *name, const char *type,
|
||||
ObjectPropertyAccessor *get,
|
||||
ObjectPropertySetAccessor *set,
|
||||
ObjectPropertyAccessor *set,
|
||||
ObjectPropertyRelease *release,
|
||||
void *opaque, Error **errp)
|
||||
{
|
||||
|
@ -857,7 +857,7 @@ void object_property_get(struct uc_struct *uc, Object *obj, Visitor *v, const ch
|
|||
if (!prop->get) {
|
||||
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||
} else {
|
||||
prop->get(uc, obj, v, prop->opaque, name, errp);
|
||||
prop->get(uc, obj, v, name, prop->opaque, errp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -872,8 +872,7 @@ void object_property_set(struct uc_struct *uc, Object *obj, Visitor *v, const ch
|
|||
if (!prop->set) {
|
||||
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||
} else {
|
||||
if (prop->set(uc, obj, v, prop->opaque, name, errp))
|
||||
error_setg(errp, QERR_UNDEFINED_ERROR);
|
||||
prop->set(uc, obj, v, name, prop->opaque, errp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1029,8 +1028,8 @@ Object *object_get_root(struct uc_struct *uc)
|
|||
return uc->root;
|
||||
}
|
||||
|
||||
static void object_get_child_property(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void object_get_child_property(struct uc_struct *uc, Object *obj, Visitor *v,
|
||||
const char *name, void *opaque, Error **errp)
|
||||
{
|
||||
Object *child = opaque;
|
||||
gchar *path;
|
||||
|
@ -1098,8 +1097,10 @@ typedef struct {
|
|||
ObjectPropertyLinkFlags flags;
|
||||
} LinkProperty;
|
||||
|
||||
static void object_get_link_property(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void object_get_link_property(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
LinkProperty *lprop = opaque;
|
||||
Object **child = lprop->child;
|
||||
|
@ -1155,8 +1156,10 @@ static Object *object_resolve_link(struct uc_struct *uc, Object *obj, const char
|
|||
return target;
|
||||
}
|
||||
|
||||
static int object_set_link_property(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void object_set_link_property(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
Error *local_err = NULL;
|
||||
LinkProperty *prop = opaque;
|
||||
|
@ -1174,20 +1177,18 @@ static int object_set_link_property(struct uc_struct *uc, Object *obj, Visitor *
|
|||
g_free(path);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
prop->check(obj, name, new_target, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
object_ref(new_target);
|
||||
*child = new_target;
|
||||
object_unref(uc, old_target);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Object *object_resolve_link_property(struct uc_struct *uc, Object *parent, void *opaque, const gchar *part)
|
||||
|
@ -1401,8 +1402,10 @@ typedef struct StringProperty
|
|||
int (*set)(struct uc_struct *uc, Object *, const char *, Error **);
|
||||
} StringProperty;
|
||||
|
||||
static void property_get_str(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void property_get_str(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
StringProperty *prop = opaque;
|
||||
char *value;
|
||||
|
@ -1418,8 +1421,10 @@ static void property_get_str(struct uc_struct *uc, Object *obj, Visitor *v, void
|
|||
g_free(value);
|
||||
}
|
||||
|
||||
static int property_set_str(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void property_set_str(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
StringProperty *prop = opaque;
|
||||
char *value;
|
||||
|
@ -1428,13 +1433,11 @@ static int property_set_str(struct uc_struct *uc, Object *obj, Visitor *v, void
|
|||
visit_type_str(v, name, &value, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
prop->set(uc, obj, value, errp);
|
||||
g_free(value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void property_release_str(struct uc_struct *uc, Object *obj, const char *name,
|
||||
|
@ -1472,8 +1475,10 @@ typedef struct BoolProperty
|
|||
int (*set)(struct uc_struct *uc, Object *, bool, Error **);
|
||||
} BoolProperty;
|
||||
|
||||
static void property_get_bool(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void property_get_bool(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
BoolProperty *prop = opaque;
|
||||
bool value;
|
||||
|
@ -1482,8 +1487,10 @@ static void property_get_bool(struct uc_struct *uc, Object *obj, Visitor *v, voi
|
|||
visit_type_bool(v, name, &value, errp);
|
||||
}
|
||||
|
||||
static int property_set_bool(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void property_set_bool(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
BoolProperty *prop = opaque;
|
||||
bool value;
|
||||
|
@ -1492,14 +1499,14 @@ static int property_set_bool(struct uc_struct *uc, Object *obj, Visitor *v, void
|
|||
visit_type_bool(v, name, &value, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
return prop->set(uc, obj, value, errp);
|
||||
prop->set(uc, obj, value, errp);
|
||||
}
|
||||
|
||||
static void property_release_bool(struct uc_struct *uc, Object *obj, const char *name,
|
||||
void *opaque)
|
||||
static void property_release_bool(struct uc_struct *uc, Object *obj,
|
||||
const char *name, void *opaque)
|
||||
{
|
||||
BoolProperty *prop = opaque;
|
||||
g_free(prop);
|
||||
|
@ -1533,7 +1540,7 @@ static char *qdev_get_type(struct uc_struct *uc, Object *obj, Error **errp)
|
|||
}
|
||||
|
||||
static void property_get_uint8_ptr(struct uc_struct *uc, Object *obj, Visitor *v,
|
||||
void *opaque, const char *name,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
uint8_t value = *(uint8_t *)opaque;
|
||||
|
@ -1541,24 +1548,24 @@ static void property_get_uint8_ptr(struct uc_struct *uc, Object *obj, Visitor *v
|
|||
}
|
||||
|
||||
static void property_get_uint16_ptr(struct uc_struct *uc, Object *obj, Visitor *v,
|
||||
void *opaque, const char *name,
|
||||
Error **errp)
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
uint16_t value = *(uint16_t *)opaque;
|
||||
visit_type_uint16(v, name, &value, errp);
|
||||
}
|
||||
|
||||
static void property_get_uint32_ptr(struct uc_struct *uc, Object *obj, Visitor *v,
|
||||
void *opaque, const char *name,
|
||||
Error **errp)
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
uint32_t value = *(uint32_t *)opaque;
|
||||
visit_type_uint32(v, name, &value, errp);
|
||||
}
|
||||
|
||||
static void property_get_uint64_ptr(struct uc_struct *uc, Object *obj, Visitor *v,
|
||||
void *opaque, const char *name,
|
||||
Error **errp)
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
uint64_t value = *(uint64_t *)opaque;
|
||||
visit_type_uint64(v, name, &value, errp);
|
||||
|
@ -1597,22 +1604,24 @@ typedef struct {
|
|||
char *target_name;
|
||||
} AliasProperty;
|
||||
|
||||
static void property_get_alias(struct uc_struct *uc, Object *obj, struct Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void property_get_alias(struct uc_struct *uc,
|
||||
Object *obj, struct Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
AliasProperty *prop = opaque;
|
||||
|
||||
object_property_get(uc, prop->target_obj, v, prop->target_name, errp);
|
||||
}
|
||||
|
||||
static int property_set_alias(struct uc_struct *uc, Object *obj, struct Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void property_set_alias(struct uc_struct *uc,
|
||||
Object *obj, struct Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
AliasProperty *prop = opaque;
|
||||
|
||||
object_property_set(uc, prop->target_obj, v, prop->target_name, errp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Object *property_resolve_alias(struct uc_struct *uc, Object *obj, void *opaque,
|
||||
|
|
|
@ -1533,8 +1533,10 @@ static void report_unavailable_features(FeatureWord w, uint32_t mask)
|
|||
}
|
||||
}
|
||||
|
||||
static void x86_cpuid_version_get_family(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void x86_cpuid_version_get_family(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(uc, obj);
|
||||
CPUX86State *env = &cpu->env;
|
||||
|
@ -1547,8 +1549,10 @@ static void x86_cpuid_version_get_family(struct uc_struct *uc, Object *obj, Visi
|
|||
visit_type_int(v, name, &value, errp);
|
||||
}
|
||||
|
||||
static int x86_cpuid_version_set_family(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void x86_cpuid_version_set_family(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(uc, obj);
|
||||
CPUX86State *env = &cpu->env;
|
||||
|
@ -1560,12 +1564,12 @@ static int x86_cpuid_version_set_family(struct uc_struct *uc, Object *obj, Visit
|
|||
visit_type_int(v, name, &value, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
if (value < min || value > max) {
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
|
||||
name ? name : "null", value, min, max);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
env->cpuid_version &= ~0xff00f00;
|
||||
|
@ -1574,12 +1578,12 @@ static int x86_cpuid_version_set_family(struct uc_struct *uc, Object *obj, Visit
|
|||
} else {
|
||||
env->cpuid_version |= value << 8;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void x86_cpuid_version_get_model(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void x86_cpuid_version_get_model(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(uc, obj);
|
||||
CPUX86State *env = &cpu->env;
|
||||
|
@ -1590,8 +1594,10 @@ static void x86_cpuid_version_get_model(struct uc_struct *uc, Object *obj, Visit
|
|||
visit_type_int(v, name, &value, errp);
|
||||
}
|
||||
|
||||
static int x86_cpuid_version_set_model(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void x86_cpuid_version_set_model(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(uc, obj);
|
||||
CPUX86State *env = &cpu->env;
|
||||
|
@ -1603,22 +1609,21 @@ static int x86_cpuid_version_set_model(struct uc_struct *uc, Object *obj, Visito
|
|||
visit_type_int(v, name, &value, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
if (value < min || value > max) {
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
|
||||
name ? name : "null", value, min, max);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
env->cpuid_version &= ~0xf00f0;
|
||||
env->cpuid_version |= ((value & 0xf) << 4) | ((value >> 4) << 16);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void x86_cpuid_version_get_stepping(struct uc_struct *uc, Object *obj, Visitor *v,
|
||||
void *opaque, const char *name,
|
||||
static void x86_cpuid_version_get_stepping(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(uc, obj);
|
||||
|
@ -1629,8 +1634,9 @@ static void x86_cpuid_version_get_stepping(struct uc_struct *uc, Object *obj, Vi
|
|||
visit_type_int(v, name, &value, errp);
|
||||
}
|
||||
|
||||
static int x86_cpuid_version_set_stepping(struct uc_struct *uc, Object *obj, Visitor *v,
|
||||
void *opaque, const char *name,
|
||||
static void x86_cpuid_version_set_stepping(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(uc, obj);
|
||||
|
@ -1643,18 +1649,16 @@ static int x86_cpuid_version_set_stepping(struct uc_struct *uc, Object *obj, Vis
|
|||
visit_type_int(v, name, &value, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
if (value < min || value > max) {
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
|
||||
name ? name : "null", value, min, max);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
env->cpuid_version &= ~0xf;
|
||||
env->cpuid_version |= value & 0xf;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *x86_cpuid_get_vendor(struct uc_struct *uc, Object *obj, Error **errp)
|
||||
|
@ -1669,8 +1673,8 @@ static char *x86_cpuid_get_vendor(struct uc_struct *uc, Object *obj, Error **err
|
|||
return value;
|
||||
}
|
||||
|
||||
static int x86_cpuid_set_vendor(struct uc_struct *uc, Object *obj, const char *value,
|
||||
Error **errp)
|
||||
static int x86_cpuid_set_vendor(struct uc_struct *uc, Object *obj,
|
||||
const char *value, Error **errp)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(uc, obj);
|
||||
CPUX86State *env = &cpu->env;
|
||||
|
@ -1709,8 +1713,8 @@ static char *x86_cpuid_get_model_id(struct uc_struct *uc, Object *obj, Error **e
|
|||
return value;
|
||||
}
|
||||
|
||||
static int x86_cpuid_set_model_id(struct uc_struct *uc, Object *obj, const char *model_id,
|
||||
Error **errp)
|
||||
static int x86_cpuid_set_model_id(struct uc_struct *uc, Object *obj,
|
||||
const char *model_id, Error **errp)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(uc, obj);
|
||||
CPUX86State *env = &cpu->env;
|
||||
|
@ -1733,8 +1737,10 @@ static int x86_cpuid_set_model_id(struct uc_struct *uc, Object *obj, const char
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void x86_cpuid_get_tsc_freq(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void x86_cpuid_get_tsc_freq(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(uc, obj);
|
||||
int64_t value;
|
||||
|
@ -1743,8 +1749,10 @@ static void x86_cpuid_get_tsc_freq(struct uc_struct *uc, Object *obj, Visitor *v
|
|||
visit_type_int(v, name, &value, errp);
|
||||
}
|
||||
|
||||
static int x86_cpuid_set_tsc_freq(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void x86_cpuid_set_tsc_freq(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(uc, obj);
|
||||
const int64_t min = 0;
|
||||
|
@ -1755,21 +1763,21 @@ static int x86_cpuid_set_tsc_freq(struct uc_struct *uc, Object *obj, Visitor *v,
|
|||
visit_type_int(v, name, &value, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
if (value < min || value > max) {
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
|
||||
name ? name : "null", value, min, max);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
cpu->env.tsc_khz = (int)(value / 1000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void x86_cpuid_get_apic_id(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void x86_cpuid_get_apic_id(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(uc, obj);
|
||||
int64_t value = cpu->apic_id;
|
||||
|
@ -1777,8 +1785,10 @@ static void x86_cpuid_get_apic_id(struct uc_struct *uc, Object *obj, Visitor *v,
|
|||
visit_type_int(v, name, &value, errp);
|
||||
}
|
||||
|
||||
static int x86_cpuid_set_apic_id(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void x86_cpuid_set_apic_id(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
X86CPU *cpu = X86_CPU(uc, obj);
|
||||
DeviceState *dev = DEVICE(uc, obj);
|
||||
|
@ -1790,33 +1800,33 @@ static int x86_cpuid_set_apic_id(struct uc_struct *uc, Object *obj, Visitor *v,
|
|||
if (dev->realized) {
|
||||
error_setg(errp, "Attempt to set property '%s' on '%s' after "
|
||||
"it was realized", name, object_get_typename(obj));
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
visit_type_int(v, name, &value, &error);
|
||||
if (error) {
|
||||
error_propagate(errp, error);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
if (value < min || value > max) {
|
||||
error_setg(errp, "Property %s.%s doesn't take value %" PRId64
|
||||
" (minimum: %" PRId64 ", maximum: %" PRId64 ")" ,
|
||||
object_get_typename(obj), name, value, min, max);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if ((value != cpu->apic_id) && cpu_exists(uc, value)) {
|
||||
error_setg(errp, "CPU with APIC ID %" PRIi64 " exists", value);
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
cpu->apic_id = (uint32_t)value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Generic getter for "feature-words" and "filtered-features" properties */
|
||||
static void x86_cpu_get_feature_words(struct uc_struct *uc, Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
static void x86_cpu_get_feature_words(struct uc_struct *uc,
|
||||
Object *obj, Visitor *v,
|
||||
const char *name, void *opaque,
|
||||
Error **errp)
|
||||
{
|
||||
uint32_t *array = (uint32_t *)opaque;
|
||||
FeatureWord w;
|
||||
|
|
Loading…
Reference in a new issue