aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/vmport.c
diff options
context:
space:
mode:
authorLiran Alon <liran.alon@oracle.com>2020-03-12 18:54:23 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2020-06-10 12:09:46 -0400
commitdcd938f032d3cca5d33d9faaca591b498d40debe (patch)
tree9928b579c0ffc663743d2f06042700cd59685d87 /hw/i386/vmport.c
parentd8f23d619c495bc64977c00e92f3af4ff2c54046 (diff)
hw/i386/vmport: Define enum for all commands
No functional change. Defining an enum for all VMPort commands have the following advantages: * It gets rid of the error-prone requirement to update VMPORT_ENTRIES when new VMPort commands are added to QEMU. * It makes it clear to know by looking at one place at the source, what are all the VMPort commands supported by QEMU. Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com> Signed-off-by: Liran Alon <liran.alon@oracle.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200312165431.82118-9-liran.alon@oracle.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/i386/vmport.c')
-rw-r--r--hw/i386/vmport.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c
index e6d169566d..359cdef1e0 100644
--- a/hw/i386/vmport.c
+++ b/hw/i386/vmport.c
@@ -37,10 +37,6 @@
#include "cpu.h"
#include "trace.h"
-#define VMPORT_CMD_GETVERSION 0x0a
-#define VMPORT_CMD_GETRAMSIZE 0x14
-
-#define VMPORT_ENTRIES 0x2c
#define VMPORT_MAGIC 0x564D5868
/* Compatibility flags for migration */
@@ -71,12 +67,9 @@ typedef struct VMPortState {
static VMPortState *port_state;
-void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque)
+void vmport_register(VMPortCommand command, VMPortReadFunc *func, void *opaque)
{
- if (command >= VMPORT_ENTRIES) {
- return;
- }
-
+ assert(command < VMPORT_ENTRIES);
trace_vmport_register(command, func, opaque);
port_state->func[command] = func;
port_state->opaque[command] = opaque;