Remove struct stat_cmd and use kvm_ipc__send().
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
#include <linux/virtio_balloon.h>
-struct stat_cmd {
- u32 type;
- u32 len;
-};
-
static bool mem;
static bool all;
static const char *instance_name;
static int do_memstat(const char *name, int sock)
{
- struct stat_cmd cmd = {KVM_IPC_STAT, 0};
struct virtio_balloon_stat stats[VIRTIO_BALLOON_S_NR];
fd_set fdset;
struct timeval t = { .tv_sec = 1 };
FD_ZERO(&fdset);
FD_SET(sock, &fdset);
- r = write(sock, &cmd, sizeof(cmd));
+ r = kvm_ipc__send(sock, KVM_IPC_STAT);
if (r < 0)
return r;
{
int r;
+ if (WARN_ON(type != KVM_IPC_STAT || len))
+ return;
+
if (virtio_bln__collect_stats() < 0)
return;