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

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

 



Commit-ID:  6119b86dc490c2eeda516fc5cba710ad6561abcd
Gitweb:     http://git.kernel.org/tip/6119b86dc490c2eeda516fc5cba710ad6561abcd
Author:     Asias He <asias.hejun@xxxxxxxxx>
AuthorDate: Thu, 22 Dec 2011 10:10:47 +0800
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Thu, 22 Dec 2011 16:06:52 +0200

kvm tools: Use kvm_ipc__send to send IPC msg

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

Signed-off-by: Asias He <asias.hejun@xxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 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;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux