From: Jack Lange Date: Wed, 8 Jun 2011 20:29:55 +0000 (-0500) Subject: ported inspector to the extension framework X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=84ff69d67d79aa9641135b2d120fe800c91797b4;hp=fcb418e3ef916356ef80c1f1436adfa1e6878d4f;p=palacios.git ported inspector to the extension framework --- diff --git a/linux_module/palacios-dev.c b/linux_module/palacios-dev.c index 1f73de1..3899a2c 100644 --- a/linux_module/palacios-dev.c +++ b/linux_module/palacios-dev.c @@ -28,9 +28,6 @@ #include "linux-exts.h" -#ifdef V3_CONFIG_EXT_INSPECTOR -#include "palacios-inspector.h" -#endif #ifdef V3_CONFIG_KEYED_STREAMS #include "palacios-keyed-stream.h" @@ -268,9 +265,6 @@ static int __init v3_init(void) { palacios_init_graphics_console(); #endif -#ifdef V3_CONFIG_EXT_INSPECTOR - palacios_init_inspector(); -#endif #ifdef V3_CONFIG_SOCKET palacios_socket_init(); @@ -331,9 +325,6 @@ static void __exit v3_exit(void) { deinit_lnx_extensions(); -#ifdef V3_CONFIG_EXT_INSPECTOR - palacios_deinit_inspector(); -#endif diff --git a/linux_module/palacios-inspector.c b/linux_module/palacios-inspector.c index a3b5ac9..340821b 100644 --- a/linux_module/palacios-inspector.c +++ b/linux_module/palacios-inspector.c @@ -11,27 +11,12 @@ #include #include "palacios.h" +#include "palacios-vm.h" +#include "linux-exts.h" struct dentry * v3_dir = NULL; -int palacios_init_inspector( void ) { - - v3_dir = debugfs_create_dir("v3vee", NULL); - - if (IS_ERR(v3_dir)) { - printk("Error creating v3vee debugfs directory\n"); - return -1; - } - - return 0; -} - - -int palacios_deinit_inspector( void ) { - debugfs_remove(v3_dir); - return 0; -} @@ -66,7 +51,8 @@ static int dfs_register_tree(struct dentry * dir, v3_inspect_node_t * root) { } -int inspect_vm(struct v3_guest * guest) { +static int inspect_vm(struct v3_guest * guest, unsigned int cmd, unsigned long arg, + void * priv_data) { v3_inspect_node_t * root = v3_get_inspection_root(guest->v3_ctx); struct dentry * guest_dir = NULL; @@ -86,3 +72,47 @@ int inspect_vm(struct v3_guest * guest) { dfs_register_tree(guest_dir, root); return 0; } + + + +static int init_inspector( void ) { + + v3_dir = debugfs_create_dir("v3vee", NULL); + + if (IS_ERR(v3_dir)) { + printk("Error creating v3vee debugfs directory\n"); + return -1; + } + + return 0; +} + + +static int deinit_inspector( void ) { + debugfs_remove(v3_dir); + return 0; +} + + +static int guest_init(struct v3_guest * guest, void ** vm_data) { + + add_guest_ctrl(guest, V3_VM_INSPECT, inspect_vm, NULL); + return 0; +} + +static int guest_deinit(struct v3_guest * guest, void * vm_data) { + + return 0; +} + + +struct linux_ext inspector_ext = { + .name = "INSPECTOR", + .init = init_inspector, + .deinit = deinit_inspector, + .guest_init = guest_init, + .guest_deinit = guest_deinit +}; + + +register_extension(&inspector_ext); diff --git a/linux_module/palacios-inspector.h b/linux_module/palacios-inspector.h deleted file mode 100644 index ad966df..0000000 --- a/linux_module/palacios-inspector.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * DebugFS interface - * (c) Jack Lange, 2011 - */ - -#include "palacios.h" - -int palacios_init_inspector( void ); -int palacios_deinit_inspector( void ); - - - -int inspect_vm(struct v3_guest * guest); - diff --git a/linux_module/palacios-stream.h b/linux_module/palacios-stream.h deleted file mode 100644 index d3b73e1..0000000 --- a/linux_module/palacios-stream.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Palacios Stream interface - * (c) Lei Xia, 2010 - */ - -#ifndef __PALACIOS_STREAM_H__ -#define __PALACIOS_STREAM_H__ - -#include -#include -#include "palacios.h" -#include "palacios-ringbuffer.h" - -#define _V3VEE_ -//#include -#undef _V3VEE_ - -#define STREAM_BUF_SIZE 1024 -#define STREAM_NAME_LEN 128 - -struct stream_buffer { - char name[STREAM_NAME_LEN]; - struct ringbuf * buf; - - wait_queue_head_t intr_queue; - spinlock_t lock; - - struct v3_guest * guest; - struct list_head stream_node; -}; - - -void palacios_init_stream(void); -void palacios_deinit_stream(void); - -int stream_dequeue(struct stream_buffer * stream, char * buf, int len); -int stream_datalen(struct stream_buffer * stream); - -struct stream_buffer * find_stream_by_name(struct v3_guest * guest, const char * name); - -int open_stream(const char * name); -#endif - diff --git a/linux_module/palacios-vm.c b/linux_module/palacios-vm.c index b50714e..2d12374 100644 --- a/linux_module/palacios-vm.c +++ b/linux_module/palacios-vm.c @@ -113,9 +113,6 @@ static struct vm_ctrl * get_ctrl(struct v3_guest * guest, unsigned int cmd) { -#ifdef V3_CONFIG_EXT_INSPECTOR -#include "palacios-inspector.h" -#endif #ifdef V3_CONFIG_GRAPHICS_CONSOLE #include "palacios-graphics-console.h" @@ -255,9 +252,6 @@ int start_palacios_vm(void * arg) { // init linux extensions -#ifdef V3_CONFIG_EXT_INSPECTOR - inspect_vm(guest); -#endif printk("Creating VM device: Major %d, Minor %d\n", MAJOR(guest->vm_dev), MINOR(guest->vm_dev)); diff --git a/linux_module/palacios.h b/linux_module/palacios.h index bd01430..7122a01 100644 --- a/linux_module/palacios.h +++ b/linux_module/palacios.h @@ -26,6 +26,8 @@ #define V3_VM_STREAM_CONNECT 21 #define V3_VM_STOP 22 +#define V3_VM_INSPECT 30 + #define V3_VM_FB_INPUT (256+1) #define V3_VM_FB_QUERY (256+2)