kvm tools: carefully send and handle stop ipc

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>
This commit is contained in:
Lai Jiangshan
2011-12-20 17:08:53 +08:00
committed by Will Deacon
parent d642f038d7
commit e333e41af5
2 changed files with 4 additions and 13 deletions
+3
View File
@@ -567,6 +567,9 @@ static void handle_sigalrm(int sig)
static void handle_stop(int fd, u32 type, u32 len, u8 *msg)
{
if (WARN_ON(type != KVM_IPC_STOP || len))
return;
kvm_cpu__reboot();
}
+1 -13
View File
@@ -9,11 +9,6 @@
#include <string.h>
#include <signal.h>
struct stop_cmd {
u32 type;
u32 len;
};
static bool all;
static const char *instance_name;
@@ -46,14 +41,7 @@ void kvm_stop_help(void)
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)