aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2020-05-05 17:29:15 +0200
committerMarkus Armbruster <armbru@redhat.com>2020-05-15 07:06:49 +0200
commit7eecec7d1224890b0d04479dd4736e1eefaa72dc (patch)
tree58da9dda7cf32c9297f6d710d6dac2f0bf493448 /backends
parent702518877220187a858da1a6ba08d53995dc6e2f (diff)
qom: Drop object_property_set_description() parameter @errp
object_property_set_description() and object_class_property_set_description() fail only when property @name is not found. There are 85 calls of object_property_set_description() and object_class_property_set_description(). None of them can fail: * 84 immediately follow the creation of the property. * The one in spapr_rng_instance_init() refers to a property created in spapr_rng_class_init(), from spapr_rng_properties[]. Every one of them still gets to decide what to pass for @errp. 51 calls pass &error_abort, 32 calls pass NULL, one receives the error and propagates it to &error_abort, and one propagates it to &error_fatal. I'm actually surprised none of them violates the Error API. What are we gaining by letting callers handle the "property not found" error? Use when the property is not known to exist is simpler: you don't have to guard the call with a check. We haven't found such a use in 5+ years. Until we do, let's make life a bit simpler and drop the @errp parameter. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200505152926.18877-8-armbru@redhat.com> [One semantic rebase conflict resolved]
Diffstat (limited to 'backends')
-rw-r--r--backends/hostmem-memfd.c9
-rw-r--r--backends/hostmem.c16
2 files changed, 11 insertions, 14 deletions
diff --git a/backends/hostmem-memfd.c b/backends/hostmem-memfd.c
index 74ba9879c4..5991f31459 100644
--- a/backends/hostmem-memfd.c
+++ b/backends/hostmem-memfd.c
@@ -144,23 +144,20 @@ memfd_backend_class_init(ObjectClass *oc, void *data)
memfd_backend_set_hugetlb,
&error_abort);
object_class_property_set_description(oc, "hugetlb",
- "Use huge pages",
- &error_abort);
+ "Use huge pages");
object_class_property_add(oc, "hugetlbsize", "int",
memfd_backend_get_hugetlbsize,
memfd_backend_set_hugetlbsize,
NULL, NULL, &error_abort);
object_class_property_set_description(oc, "hugetlbsize",
- "Huge pages size (ex: 2M, 1G)",
- &error_abort);
+ "Huge pages size (ex: 2M, 1G)");
}
object_class_property_add_bool(oc, "seal",
memfd_backend_get_seal,
memfd_backend_set_seal,
&error_abort);
object_class_property_set_description(oc, "seal",
- "Seal growing & shrinking",
- &error_abort);
+ "Seal growing & shrinking");
}
static const TypeInfo memfd_backend_info = {
diff --git a/backends/hostmem.c b/backends/hostmem.c
index 327f9eebc3..946d176435 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -465,46 +465,46 @@ host_memory_backend_class_init(ObjectClass *oc, void *data)
host_memory_backend_get_merge,
host_memory_backend_set_merge, &error_abort);
object_class_property_set_description(oc, "merge",
- "Mark memory as mergeable", &error_abort);
+ "Mark memory as mergeable");
object_class_property_add_bool(oc, "dump",
host_memory_backend_get_dump,
host_memory_backend_set_dump, &error_abort);
object_class_property_set_description(oc, "dump",
- "Set to 'off' to exclude from core dump", &error_abort);
+ "Set to 'off' to exclude from core dump");
object_class_property_add_bool(oc, "prealloc",
host_memory_backend_get_prealloc,
host_memory_backend_set_prealloc, &error_abort);
object_class_property_set_description(oc, "prealloc",
- "Preallocate memory", &error_abort);
+ "Preallocate memory");
object_class_property_add(oc, "prealloc-threads", "int",
host_memory_backend_get_prealloc_threads,
host_memory_backend_set_prealloc_threads,
NULL, NULL, &error_abort);
object_class_property_set_description(oc, "prealloc-threads",
- "Number of CPU threads to use for prealloc", &error_abort);
+ "Number of CPU threads to use for prealloc");
object_class_property_add(oc, "size", "int",
host_memory_backend_get_size,
host_memory_backend_set_size,
NULL, NULL, &error_abort);
object_class_property_set_description(oc, "size",
- "Size of the memory region (ex: 500M)", &error_abort);
+ "Size of the memory region (ex: 500M)");
object_class_property_add(oc, "host-nodes", "int",
host_memory_backend_get_host_nodes,
host_memory_backend_set_host_nodes,
NULL, NULL, &error_abort);
object_class_property_set_description(oc, "host-nodes",
- "Binds memory to the list of NUMA host nodes", &error_abort);
+ "Binds memory to the list of NUMA host nodes");
object_class_property_add_enum(oc, "policy", "HostMemPolicy",
&HostMemPolicy_lookup,
host_memory_backend_get_policy,
host_memory_backend_set_policy, &error_abort);
object_class_property_set_description(oc, "policy",
- "Set the NUMA policy", &error_abort);
+ "Set the NUMA policy");
object_class_property_add_bool(oc, "share",
host_memory_backend_get_share, host_memory_backend_set_share,
&error_abort);
object_class_property_set_description(oc, "share",
- "Mark the memory as private to QEMU or shared", &error_abort);
+ "Mark the memory as private to QEMU or shared");
object_class_property_add_bool(oc, "x-use-canonical-path-for-ramblock-id",
host_memory_backend_get_use_canonical_path,
host_memory_backend_set_use_canonical_path, &error_abort);