[tip:tools/kvm] kvm tools: cleanup kvm_ipc__handle()

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

 



Commit-ID:  f1cb01d6b654d6dd0e2db9b1c313d2e8f0bf667c
Gitweb:     http://git.kernel.org/tip/f1cb01d6b654d6dd0e2db9b1c313d2e8f0bf667c
Author:     Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
AuthorDate: Tue, 20 Dec 2011 17:08:49 +0800
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Wed, 21 Dec 2011 22:28:08 +0200

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 <laijs@xxxxxxxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 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 731767f..c556285 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 68c2565..be534f8 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);
--
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