|
@@ -369,24 +369,6 @@ host_memory_backend_can_be_deleted(UserCreatable *uc)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-static char *get_id(Object *o, Error **errp)
|
|
|
|
-{
|
|
|
|
- HostMemoryBackend *backend = MEMORY_BACKEND(o);
|
|
|
|
-
|
|
|
|
- return g_strdup(backend->id);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static void set_id(Object *o, const char *str, Error **errp)
|
|
|
|
-{
|
|
|
|
- HostMemoryBackend *backend = MEMORY_BACKEND(o);
|
|
|
|
-
|
|
|
|
- if (backend->id) {
|
|
|
|
- error_setg(errp, "cannot change property value");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- backend->id = g_strdup(str);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static bool host_memory_backend_get_share(Object *o, Error **errp)
|
|
static bool host_memory_backend_get_share(Object *o, Error **errp)
|
|
{
|
|
{
|
|
HostMemoryBackend *backend = MEMORY_BACKEND(o);
|
|
HostMemoryBackend *backend = MEMORY_BACKEND(o);
|
|
@@ -434,18 +416,11 @@ host_memory_backend_class_init(ObjectClass *oc, void *data)
|
|
&HostMemPolicy_lookup,
|
|
&HostMemPolicy_lookup,
|
|
host_memory_backend_get_policy,
|
|
host_memory_backend_get_policy,
|
|
host_memory_backend_set_policy, &error_abort);
|
|
host_memory_backend_set_policy, &error_abort);
|
|
- object_class_property_add_str(oc, "id", get_id, set_id, &error_abort);
|
|
|
|
object_class_property_add_bool(oc, "share",
|
|
object_class_property_add_bool(oc, "share",
|
|
host_memory_backend_get_share, host_memory_backend_set_share,
|
|
host_memory_backend_get_share, host_memory_backend_set_share,
|
|
&error_abort);
|
|
&error_abort);
|
|
}
|
|
}
|
|
|
|
|
|
-static void host_memory_backend_finalize(Object *o)
|
|
|
|
-{
|
|
|
|
- HostMemoryBackend *backend = MEMORY_BACKEND(o);
|
|
|
|
- g_free(backend->id);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static const TypeInfo host_memory_backend_info = {
|
|
static const TypeInfo host_memory_backend_info = {
|
|
.name = TYPE_MEMORY_BACKEND,
|
|
.name = TYPE_MEMORY_BACKEND,
|
|
.parent = TYPE_OBJECT,
|
|
.parent = TYPE_OBJECT,
|
|
@@ -454,7 +429,6 @@ static const TypeInfo host_memory_backend_info = {
|
|
.class_init = host_memory_backend_class_init,
|
|
.class_init = host_memory_backend_class_init,
|
|
.instance_size = sizeof(HostMemoryBackend),
|
|
.instance_size = sizeof(HostMemoryBackend),
|
|
.instance_init = host_memory_backend_init,
|
|
.instance_init = host_memory_backend_init,
|
|
- .instance_finalize = host_memory_backend_finalize,
|
|
|
|
.interfaces = (InterfaceInfo[]) {
|
|
.interfaces = (InterfaceInfo[]) {
|
|
{ TYPE_USER_CREATABLE },
|
|
{ TYPE_USER_CREATABLE },
|
|
{ }
|
|
{ }
|