From f1cb01d6b654d6dd0e2db9b1c313d2e8f0bf667c Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Tue, 20 Dec 2011 17:08:49 +0800 Subject: [PATCH] kvm tools: cleanup kvm_ipc__handle() Make it be a static function. Expland to kvm_ipc_msg to its arguments. Signed-off-by: Lai Jiangshan Signed-off-by: Pekka Enberg --- tools/kvm/include/kvm/kvm-ipc.h | 1 - tools/kvm/kvm-ipc.c | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/kvm/include/kvm/kvm-ipc.h b/tools/kvm/include/kvm/kvm-ipc.h index 731767fbff68..c55628564767 100644 --- a/tools/kvm/include/kvm/kvm-ipc.h +++ b/tools/kvm/include/kvm/kvm-ipc.h @@ -20,7 +20,6 @@ enum { }; int kvm_ipc__register_handler(u32 type, void (*cb)(int fd, u32 type, u32 len, u8 *msg)); -int kvm_ipc__handle(int fd, struct kvm_ipc_msg *msg); int kvm_ipc__start(int sock); int kvm_ipc__stop(void); diff --git a/tools/kvm/kvm-ipc.c b/tools/kvm/kvm-ipc.c index 68c2565c65ae..be534f818dac 100644 --- a/tools/kvm/kvm-ipc.c +++ b/tools/kvm/kvm-ipc.c @@ -28,23 +28,23 @@ int kvm_ipc__register_handler(u32 type, void (*cb)(int fd, u32 type, u32 len, u8 return 0; } -int kvm_ipc__handle(int fd, struct kvm_ipc_msg *msg) +static int kvm_ipc__handle(int fd, u32 type, u32 len, u8 *data) { void (*cb)(int fd, u32 type, u32 len, u8 *msg); - if (msg->type >= KVM_IPC_MAX_MSGS) + if (type >= KVM_IPC_MAX_MSGS) return -ENOSPC; down_read(&msgs_rwlock); - cb = msgs[msg->type]; + cb = msgs[type]; up_read(&msgs_rwlock); if (cb == NULL) { - pr_warning("No device handles type %u\n", msg->type); + pr_warning("No device handles type %u\n", type); return -ENODEV; } - cb(fd, msg->type, msg->len, msg->data); + cb(fd, type, len, data); return 0; } @@ -95,7 +95,7 @@ static void kvm_ipc__new_data(int fd) if (n != msg->len) goto done; - kvm_ipc__handle(fd, msg); + kvm_ipc__handle(fd, msg->type, msg->len, msg->data); done: free(msg); -- 2.39.5