mirror of
https://github.com/clearlinux/kvmtool.git
synced 2026-06-16 02:15:47 +00:00
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:
committed by
Will Deacon
parent
d642f038d7
commit
e333e41af5
@@ -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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user