From mboxrd@z Thu Jan 1 00:00:00 1970 From: Asias He Subject: [PATCH 6/6] kvm tools: Use kvm_ipc__send to send IPC msg Date: Thu, 22 Dec 2011 10:10:47 +0800 Message-ID: <1324519847-19897-6-git-send-email-asias.hejun@gmail.com> References: <1324519847-19897-1-git-send-email-asias.hejun@gmail.com> Cc: Sasha Levin , Cyrill Gorcunov , Ingo Molnar , kvm@vger.kernel.org, Asias He To: Pekka Enberg Return-path: Received: from mail-iy0-f174.google.com ([209.85.210.174]:62527 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753218Ab1LVCMn (ORCPT ); Wed, 21 Dec 2011 21:12:43 -0500 Received: by mail-iy0-f174.google.com with SMTP id h11so12745040iae.19 for ; Wed, 21 Dec 2011 18:12:43 -0800 (PST) In-Reply-To: <1324519847-19897-1-git-send-email-asias.hejun@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: No need to send IPC msg using bare write() any more. Signed-off-by: Asias He --- 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 #include -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