[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/14] x86: use typedef for SetupData struct
From: |
Paolo Bonzini |
Subject: |
[PULL 02/14] x86: use typedef for SetupData struct |
Date: |
Thu, 29 Sep 2022 18:30:02 +0200 |
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
The preferred style is SetupData as a typedef, not setup_data as a plain
struct.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Message-Id: <20220921093134.2936487-2-Jason@zx2c4.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/i386/x86.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index 96d205927e..1ee0b1b413 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -653,12 +653,12 @@ DeviceState *ioapic_init_secondary(GSIState *gsi_state)
return dev;
}
-struct setup_data {
+typedef struct SetupData {
uint64_t next;
uint32_t type;
uint32_t len;
uint8_t data[];
-} __attribute__((packed));
+} __attribute__((packed)) SetupData;
/*
@@ -799,7 +799,7 @@ void x86_load_linux(X86MachineState *x86ms,
FILE *f;
char *vmode;
MachineState *machine = MACHINE(x86ms);
- struct setup_data *setup_data;
+ SetupData *setup_data;
const char *kernel_filename = machine->kernel_filename;
const char *initrd_filename = machine->initrd_filename;
const char *dtb_filename = machine->dtb;
@@ -1082,11 +1082,11 @@ void x86_load_linux(X86MachineState *x86ms,
}
setup_data_offset = QEMU_ALIGN_UP(kernel_size, 16);
- kernel_size = setup_data_offset + sizeof(struct setup_data) + dtb_size;
+ kernel_size = setup_data_offset + sizeof(SetupData) + dtb_size;
kernel = g_realloc(kernel, kernel_size);
- setup_data = (struct setup_data *)(kernel + setup_data_offset);
+ setup_data = (SetupData *)(kernel + setup_data_offset);
setup_data->next = cpu_to_le64(first_setup_data);
first_setup_data = prot_addr + setup_data_offset;
setup_data->type = cpu_to_le32(SETUP_DTB);
@@ -1097,9 +1097,9 @@ void x86_load_linux(X86MachineState *x86ms,
if (!legacy_no_rng_seed) {
setup_data_offset = QEMU_ALIGN_UP(kernel_size, 16);
- kernel_size = setup_data_offset + sizeof(struct setup_data) +
RNG_SEED_LENGTH;
+ kernel_size = setup_data_offset + sizeof(SetupData) + RNG_SEED_LENGTH;
kernel = g_realloc(kernel, kernel_size);
- setup_data = (struct setup_data *)(kernel + setup_data_offset);
+ setup_data = (SetupData *)(kernel + setup_data_offset);
setup_data->next = cpu_to_le64(first_setup_data);
first_setup_data = prot_addr + setup_data_offset;
setup_data->type = cpu_to_le32(SETUP_RNG_SEED);
--
2.37.3
- [PULL 00/14] x86 + misc changes for 2022-09-29, Paolo Bonzini, 2022/09/29
- [PULL 01/14] x86: return modified setup_data only if read as memory, not as file, Paolo Bonzini, 2022/09/29
- [PULL 06/14] configure: do not invoke as/ld directly for pc-bios/optionrom, Paolo Bonzini, 2022/09/29
- [PULL 07/14] watchdog: remove -watchdog option, Paolo Bonzini, 2022/09/29
- [PULL 05/14] qboot: rebuild based on latest commit, Paolo Bonzini, 2022/09/29
- [PULL 02/14] x86: use typedef for SetupData struct,
Paolo Bonzini <=
- [PULL 03/14] x86: reinitialize RNG seed on system reboot, Paolo Bonzini, 2022/09/29
- [PULL 08/14] ui: fix path to dbus-display1.h, Paolo Bonzini, 2022/09/29
- [PULL 04/14] x86: re-enable rng seeding via SetupData, Paolo Bonzini, 2022/09/29
- [PULL 09/14] meson: require 0.61.3, Paolo Bonzini, 2022/09/29
- [PULL 10/14] meson: multiple names can be passed to dependency(), Paolo Bonzini, 2022/09/29
- [PULL 11/14] configure, meson: move C++ compiler detection to meson.build, Paolo Bonzini, 2022/09/29
- [PULL 12/14] configure, meson: move linker flag detection to meson, Paolo Bonzini, 2022/09/29
- [PULL 13/14] target/i386/kvm: fix kvmclock_current_nsec: Assertion `time.tsc_timestamp <= migration_tsc' failed, Paolo Bonzini, 2022/09/29
- [PULL 14/14] x86: re-initialize RNG seed when selecting kernel, Paolo Bonzini, 2022/09/29
- Re: [PULL 00/14] x86 + misc changes for 2022-09-29, Stefan Hajnoczi, 2022/09/29