diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2019-03-06 15:35:37 +1100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2019-03-12 14:33:05 +1100 |
commit | ce2918cbc31e190e7d644c684dcc2bbcb6b9a9df (patch) | |
tree | df386cb966b057efa2e125a19dc5d5d65b4545bf /hw/char | |
parent | dd977e4f45cba191fd65c84204cbceffc3bab48a (diff) | |
download | qemu-ce2918cbc31e190e7d644c684dcc2bbcb6b9a9df.zip qemu-ce2918cbc31e190e7d644c684dcc2bbcb6b9a9df.tar.gz qemu-ce2918cbc31e190e7d644c684dcc2bbcb6b9a9df.tar.bz2 |
spapr: Use CamelCase properly
The qemu coding standard is to use CamelCase for type and structure names,
and the pseries code follows that... sort of. There are quite a lot of
places where we bend the rules in order to preserve the capitalization of
internal acronyms like "PHB", "TCE", "DIMM" and most commonly "sPAPR".
That was a bad idea - it frequently leads to names ending up with hard to
read clusters of capital letters, and means they don't catch the eye as
type identifiers, which is kind of the point of the CamelCase convention in
the first place.
In short, keeping type identifiers look like CamelCase is more important
than preserving standard capitalization of internal "words". So, this
patch renames a heap of spapr internal type names to a more standard
CamelCase.
In addition to case changes, we also make some other identifier renames:
VIOsPAPR* -> SpaprVio*
The reverse word ordering was only ever used to mitigate the capital
cluster, so revert to the natural ordering.
VIOsPAPRVTYDevice -> SpaprVioVty
VIOsPAPRVLANDevice -> SpaprVioVlan
Brevity, since the "Device" didn't add useful information
sPAPRDRConnector -> SpaprDrc
sPAPRDRConnectorClass -> SpaprDrcClass
Brevity, and makes it clearer this is the same thing as a "DRC"
mentioned in many other places in the code
This is 100% a mechanical search-and-replace patch. It will, however,
conflict with essentially any and all outstanding patches touching the
spapr code.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/char')
-rw-r--r-- | hw/char/spapr_vty.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c index 6748334..617303d 100644 --- a/hw/char/spapr_vty.c +++ b/hw/char/spapr_vty.c @@ -10,27 +10,27 @@ #define VTERM_BUFSIZE 16 -typedef struct VIOsPAPRVTYDevice { - VIOsPAPRDevice sdev; +typedef struct SpaprVioVty { + SpaprVioDevice sdev; CharBackend chardev; uint32_t in, out; uint8_t buf[VTERM_BUFSIZE]; -} VIOsPAPRVTYDevice; +} SpaprVioVty; #define TYPE_VIO_SPAPR_VTY_DEVICE "spapr-vty" #define VIO_SPAPR_VTY_DEVICE(obj) \ - OBJECT_CHECK(VIOsPAPRVTYDevice, (obj), TYPE_VIO_SPAPR_VTY_DEVICE) + OBJECT_CHECK(SpaprVioVty, (obj), TYPE_VIO_SPAPR_VTY_DEVICE) static int vty_can_receive(void *opaque) { - VIOsPAPRVTYDevice *dev = VIO_SPAPR_VTY_DEVICE(opaque); + SpaprVioVty *dev = VIO_SPAPR_VTY_DEVICE(opaque); return VTERM_BUFSIZE - (dev->in - dev->out); } static void vty_receive(void *opaque, const uint8_t *buf, int size) { - VIOsPAPRVTYDevice *dev = VIO_SPAPR_VTY_DEVICE(opaque); + SpaprVioVty *dev = VIO_SPAPR_VTY_DEVICE(opaque); int i; if ((dev->in == dev->out) && size) { @@ -51,9 +51,9 @@ static void vty_receive(void *opaque, const uint8_t *buf, int size) } } -static int vty_getchars(VIOsPAPRDevice *sdev, uint8_t *buf, int max) +static int vty_getchars(SpaprVioDevice *sdev, uint8_t *buf, int max) { - VIOsPAPRVTYDevice *dev = VIO_SPAPR_VTY_DEVICE(sdev); + SpaprVioVty *dev = VIO_SPAPR_VTY_DEVICE(sdev); int n = 0; while ((n < max) && (dev->out != dev->in)) { @@ -83,18 +83,18 @@ static int vty_getchars(VIOsPAPRDevice *sdev, uint8_t *buf, int max) return n; } -void vty_putchars(VIOsPAPRDevice *sdev, uint8_t *buf, int len) +void vty_putchars(SpaprVioDevice *sdev, uint8_t *buf, int len) { - VIOsPAPRVTYDevice *dev = VIO_SPAPR_VTY_DEVICE(sdev); + SpaprVioVty *dev = VIO_SPAPR_VTY_DEVICE(sdev); /* XXX this blocks entire thread. Rewrite to use * qemu_chr_fe_write and background I/O callbacks */ qemu_chr_fe_write_all(&dev->chardev, buf, len); } -static void spapr_vty_realize(VIOsPAPRDevice *sdev, Error **errp) +static void spapr_vty_realize(SpaprVioDevice *sdev, Error **errp) { - VIOsPAPRVTYDevice *dev = VIO_SPAPR_VTY_DEVICE(sdev); + SpaprVioVty *dev = VIO_SPAPR_VTY_DEVICE(sdev); if (!qemu_chr_fe_backend_connected(&dev->chardev)) { error_setg(errp, "chardev property not set"); @@ -106,14 +106,14 @@ static void spapr_vty_realize(VIOsPAPRDevice *sdev, Error **errp) } /* Forward declaration */ -static target_ulong h_put_term_char(PowerPCCPU *cpu, sPAPRMachineState *spapr, +static target_ulong h_put_term_char(PowerPCCPU *cpu, SpaprMachineState *spapr, target_ulong opcode, target_ulong *args) { target_ulong reg = args[0]; target_ulong len = args[1]; target_ulong char0_7 = args[2]; target_ulong char8_15 = args[3]; - VIOsPAPRDevice *sdev; + SpaprVioDevice *sdev; uint8_t buf[16]; sdev = vty_lookup(spapr, reg); @@ -133,14 +133,14 @@ static target_ulong h_put_term_char(PowerPCCPU *cpu, sPAPRMachineState *spapr, return H_SUCCESS; } -static target_ulong h_get_term_char(PowerPCCPU *cpu, sPAPRMachineState *spapr, +static target_ulong h_get_term_char(PowerPCCPU *cpu, SpaprMachineState *spapr, target_ulong opcode, target_ulong *args) { target_ulong reg = args[0]; target_ulong *len = args + 0; target_ulong *char0_7 = args + 1; target_ulong *char8_15 = args + 2; - VIOsPAPRDevice *sdev; + SpaprVioDevice *sdev; uint8_t buf[16]; sdev = vty_lookup(spapr, reg); @@ -159,7 +159,7 @@ static target_ulong h_get_term_char(PowerPCCPU *cpu, sPAPRMachineState *spapr, return H_SUCCESS; } -void spapr_vty_create(VIOsPAPRBus *bus, Chardev *chardev) +void spapr_vty_create(SpaprVioBus *bus, Chardev *chardev) { DeviceState *dev; @@ -169,8 +169,8 @@ void spapr_vty_create(VIOsPAPRBus *bus, Chardev *chardev) } static Property spapr_vty_properties[] = { - DEFINE_SPAPR_PROPERTIES(VIOsPAPRVTYDevice, sdev), - DEFINE_PROP_CHR("chardev", VIOsPAPRVTYDevice, chardev), + DEFINE_SPAPR_PROPERTIES(SpaprVioVty, sdev), + DEFINE_PROP_CHR("chardev", SpaprVioVty, chardev), DEFINE_PROP_END_OF_LIST(), }; @@ -179,11 +179,11 @@ static const VMStateDescription vmstate_spapr_vty = { .version_id = 1, .minimum_version_id = 1, .fields = (VMStateField[]) { - VMSTATE_SPAPR_VIO(sdev, VIOsPAPRVTYDevice), + VMSTATE_SPAPR_VIO(sdev, SpaprVioVty), - VMSTATE_UINT32(in, VIOsPAPRVTYDevice), - VMSTATE_UINT32(out, VIOsPAPRVTYDevice), - VMSTATE_BUFFER(buf, VIOsPAPRVTYDevice), + VMSTATE_UINT32(in, SpaprVioVty), + VMSTATE_UINT32(out, SpaprVioVty), + VMSTATE_BUFFER(buf, SpaprVioVty), VMSTATE_END_OF_LIST() }, }; @@ -191,7 +191,7 @@ static const VMStateDescription vmstate_spapr_vty = { static void spapr_vty_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - VIOsPAPRDeviceClass *k = VIO_SPAPR_DEVICE_CLASS(klass); + SpaprVioDeviceClass *k = VIO_SPAPR_DEVICE_CLASS(klass); k->realize = spapr_vty_realize; k->dt_name = "vty"; @@ -205,13 +205,13 @@ static void spapr_vty_class_init(ObjectClass *klass, void *data) static const TypeInfo spapr_vty_info = { .name = TYPE_VIO_SPAPR_VTY_DEVICE, .parent = TYPE_VIO_SPAPR_DEVICE, - .instance_size = sizeof(VIOsPAPRVTYDevice), + .instance_size = sizeof(SpaprVioVty), .class_init = spapr_vty_class_init, }; -VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus) +SpaprVioDevice *spapr_vty_get_default(SpaprVioBus *bus) { - VIOsPAPRDevice *sdev, *selected; + SpaprVioDevice *sdev, *selected; BusChild *kid; /* @@ -246,9 +246,9 @@ VIOsPAPRDevice *spapr_vty_get_default(VIOsPAPRBus *bus) return selected; } -VIOsPAPRDevice *vty_lookup(sPAPRMachineState *spapr, target_ulong reg) +SpaprVioDevice *vty_lookup(SpaprMachineState *spapr, target_ulong reg) { - VIOsPAPRDevice *sdev; + SpaprVioDevice *sdev; sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); if (!sdev && reg == 0) { |