Remove struct stop_cmd and use kvm_ipc__send().
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
static void handle_stop(int fd, u32 type, u32 len, u8 *msg)
{
+ if (WARN_ON(type != KVM_IPC_STOP || len))
+ return;
+
kvm_cpu__reboot();
}
#include <string.h>
#include <signal.h>
-struct stop_cmd {
- u32 type;
- u32 len;
-};
-
static bool all;
static const char *instance_name;
static int do_stop(const char *name, int sock)
{
- struct stop_cmd cmd = {KVM_IPC_STOP, 0};
- int r;
-
- r = write(sock, &cmd, sizeof(cmd));
- if (r < 0)
- return r;
-
- return 0;
+ return kvm_ipc__send(sock, KVM_IPC_STOP);
}
int kvm_cmd_stop(int argc, const char **argv, const char *prefix)