]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: cleanup kvm_ipc__handle()
authorLai Jiangshan <laijs@cn.fujitsu.com>
Tue, 20 Dec 2011 09:08:49 +0000 (17:08 +0800)
committerPekka Enberg <penberg@kernel.org>
Wed, 21 Dec 2011 20:28:08 +0000 (22:28 +0200)
Make it be a static function.
Expland to kvm_ipc_msg to its arguments.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/include/kvm/kvm-ipc.h
tools/kvm/kvm-ipc.c

index 731767fbff68aad16e68d443df3c969ae377d3a1..c5562856476711d944c98eac0ac304ab61607cd5 100644 (file)
@@ -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);
 
index 68c2565c65ae77648a67ae079fbbbc28ef9fb89d..be534f818dac658b6ba513b371a784bc144ff77b 100644 (file)
@@ -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);