Commit 8c43a6f0 authored by Andreas Färber's avatar Andreas Färber Committed by Anthony Liguori
Browse files

Make all static TypeInfos const



Since 39bffca2 (qdev: register all
types natively through QEMU Object Model), TypeInfo as used in
the common, non-iterative pattern is no longer amended with information
and should therefore be const.

Fix the documented QOM examples:

 sed -i 's/static TypeInfo/static const TypeInfo/g' include/qom/object.h

Since frequently the wrong examples are being copied by contributors of
new devices, fix all types in the tree:

 sed -i 's/^static TypeInfo/static const TypeInfo/g' */*.c
 sed -i 's/^static TypeInfo/static const TypeInfo/g' */*/*.c

This also avoids to piggy-back these changes onto real functional
changes or other refactorings.

Signed-off-by: default avatarAndreas Färber <afaerber@suse.de>
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent a6308bc2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -207,7 +207,7 @@ static void rng_egd_class_init(ObjectClass *klass, void *data)
    rbc->opened = rng_egd_opened;
}

static TypeInfo rng_egd_info = {
static const TypeInfo rng_egd_info = {
    .name = TYPE_RNG_EGD,
    .parent = TYPE_RNG_BACKEND,
    .instance_size = sizeof(RngEgd),
+1 −1
Original line number Diff line number Diff line
@@ -144,7 +144,7 @@ static void rng_random_class_init(ObjectClass *klass, void *data)
    rbc->opened = rng_random_opened;
}

static TypeInfo rng_random_info = {
static const TypeInfo rng_random_info = {
    .name = TYPE_RNG_RANDOM,
    .parent = TYPE_RNG_BACKEND,
    .instance_size = sizeof(RndRandom),
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ static void rng_backend_init(Object *obj)
                             NULL);
}

static TypeInfo rng_backend_info = {
static const TypeInfo rng_backend_info = {
    .name = TYPE_RNG_BACKEND,
    .parent = TYPE_OBJECT,
    .instance_size = sizeof(RngBackend),
+1 −1
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ static void virtio_9p_class_init(ObjectClass *klass, void *data)
    dc->reset = virtio_pci_reset;
}

static TypeInfo virtio_9p_info = {
static const TypeInfo virtio_9p_info = {
    .name          = "virtio-9p-pci",
    .parent        = TYPE_PCI_DEVICE,
    .instance_size = sizeof(VirtIOPCIProxy),
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ static void a15mp_priv_class_init(ObjectClass *klass, void *data)
    /* We currently have no savable state */
}

static TypeInfo a15mp_priv_info = {
static const TypeInfo a15mp_priv_info = {
    .name  = "a15mpcore_priv",
    .parent = TYPE_SYS_BUS_DEVICE,
    .instance_size  = sizeof(A15MPPrivState),
Loading