[PATCH 6/6] kvm tools: Use kvm_ipc__send to send IPC msg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No need to send IPC msg using bare write() any more.

Signed-off-by: Asias He <asias.hejun@xxxxxxxxx>
---
 tools/kvm/builtin-list.c |   20 ++++----------------
 1 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/tools/kvm/builtin-list.c b/tools/kvm/builtin-list.c
index e74b636..eb0ac6c 100644
--- a/tools/kvm/builtin-list.c
+++ b/tools/kvm/builtin-list.c
@@ -11,16 +11,6 @@
 #include <signal.h>
 #include <fcntl.h>
 
-struct pid_cmd {
-	u32 type;
-	u32 len;
-};
-
-struct vmstate_cmd {
-	u32 type;
-	u32 len;
-};
-
 static bool run;
 static bool rootfs;
 
@@ -47,11 +37,10 @@ void kvm_list_help(void)
 
 static pid_t get_pid(int sock)
 {
-	struct pid_cmd cmd = {KVM_IPC_PID, 0};
-	int r;
 	pid_t pid;
+	int r;
 
-	r = write(sock, &cmd, sizeof(cmd));
+	r = kvm_ipc__send(sock, KVM_IPC_PID);
 	if (r < 0)
 		return r;
 
@@ -64,11 +53,10 @@ static pid_t get_pid(int sock)
 
 static int get_vmstate(int sock)
 {
-	struct vmstate_cmd cmd = {KVM_IPC_VMSTATE, 0};
-	int r;
 	int vmstate;
+	int r;
 
-	r = write(sock, &cmd, sizeof(cmd));
+	r = kvm_ipc__send(sock, KVM_IPC_VMSTATE);
 	if (r < 0)
 		return r;
 
-- 
1.7.7.3

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux