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

[Xen-changelog] [xen-unstable] [MINI-OS] Clean up event channel types in mini-os.



# HG changeset patch
# User sos22@xxxxxxxxxxxxxxxxxxxx
# Node ID 98a802d258482b4d8e462493eb981741c82a713c
# Parent  a10d02d20b31ac0d7c7330169443fb60b38fb276
[MINI-OS] Clean up event channel types in mini-os.

Signed-off-by: John D. Ramsdell <ramsdell@xxxxxxxxx>
Signed-off-by: Steven Smith <sos22@xxxxxxxxx>
---
 extras/mini-os/console/xencons_ring.c |    2 +-
 extras/mini-os/events.c               |   23 ++++++++++-------------
 extras/mini-os/include/events.h       |   20 ++++++++++----------
 extras/mini-os/time.c                 |    2 +-
 extras/mini-os/xenbus/xenbus.c        |    3 ++-
 5 files changed, 24 insertions(+), 26 deletions(-)

diff -r a10d02d20b31 -r 98a802d25848 extras/mini-os/console/xencons_ring.c
--- a/extras/mini-os/console/xencons_ring.c     Fri Jul 28 14:00:37 2006 +0100
+++ b/extras/mini-os/console/xencons_ring.c     Fri Jul 28 14:02:49 2006 +0100
@@ -53,7 +53,7 @@ int xencons_ring_send(const char *data, 
 
 
 
-static void handle_input(int port, struct pt_regs *regs, void *ign)
+static void handle_input(evtchn_port_t port, struct pt_regs *regs, void *ign)
 {
        struct xencons_interface *intf = xencons_interface();
        XENCONS_RING_IDX cons, prod;
diff -r a10d02d20b31 -r 98a802d25848 extras/mini-os/events.c
--- a/extras/mini-os/events.c   Fri Jul 28 14:00:37 2006 +0100
+++ b/extras/mini-os/events.c   Fri Jul 28 14:02:49 2006 +0100
@@ -26,20 +26,20 @@
 
 /* this represents a event handler. Chaining or sharing is not allowed */
 typedef struct _ev_action_t {
-       void (*handler)(int, struct pt_regs *, void *);
+       evtchn_handler_t handler;
        void *data;
     u32 count;
 } ev_action_t;
 
 
 static ev_action_t ev_actions[NR_EVS];
-void default_handler(int port, struct pt_regs *regs, void *data);
+void default_handler(evtchn_port_t port, struct pt_regs *regs, void *data);
 
 
 /*
  * Demux events to different handlers.
  */
-int do_event(u32 port, struct pt_regs *regs)
+int do_event(evtchn_port_t port, struct pt_regs *regs)
 {
     ev_action_t  *action;
     if (port >= NR_EVS) {
@@ -60,8 +60,8 @@ int do_event(u32 port, struct pt_regs *r
 
 }
 
-int bind_evtchn( u32 port, void (*handler)(int, struct pt_regs *, void *),
-                                void *data )
+evtchn_port_t bind_evtchn(evtchn_port_t port, evtchn_handler_t handler,
+                                                 void *data)
 {
        if(ev_actions[port].handler != default_handler)
         printk("WARN: Handler for port %d already registered, replacing\n",
@@ -77,7 +77,7 @@ int bind_evtchn( u32 port, void (*handle
        return port;
 }
 
-void unbind_evtchn( u32 port )
+void unbind_evtchn(evtchn_port_t port )
 {
        if (ev_actions[port].handler == default_handler)
                printk("WARN: No handler for port %d when unbinding\n", port);
@@ -86,8 +86,7 @@ void unbind_evtchn( u32 port )
        ev_actions[port].data = NULL;
 }
 
-int bind_virq( u32 virq, void (*handler)(int, struct pt_regs *, void *data),
-                          void *data)
+int bind_virq(uint32_t virq, evtchn_handler_t handler, void *data)
 {
        evtchn_op_t op;
 
@@ -137,7 +136,7 @@ void init_events(void)
     }
 }
 
-void default_handler(int port, struct pt_regs *regs, void *ignore)
+void default_handler(evtchn_port_t port, struct pt_regs *regs, void *ignore)
 {
     printk("[Port %d] - event received\n", port);
 }
@@ -145,11 +144,9 @@ void default_handler(int port, struct pt
 /* Unfortunate confusion of terminology: the port is unbound as far
    as Xen is concerned, but we automatically bind a handler to it
    from inside mini-os. */
-int evtchn_alloc_unbound(void (*handler)(int, struct pt_regs *regs,
-                                                                               
 void *data),
-                                                void *data)
+evtchn_port_t evtchn_alloc_unbound(evtchn_handler_t handler, void *data)
 {
-       u32 port;
+       evtchn_port_t port;
        evtchn_op_t op;
        int err;
 
diff -r a10d02d20b31 -r 98a802d25848 extras/mini-os/include/events.h
--- a/extras/mini-os/include/events.h   Fri Jul 28 14:00:37 2006 +0100
+++ b/extras/mini-os/include/events.h   Fri Jul 28 14:02:49 2006 +0100
@@ -22,19 +22,19 @@
 #include<traps.h>
 #include <xen/event_channel.h>
 
+typedef void (*evtchn_handler_t)(evtchn_port_t, struct pt_regs *, void *);
+
 /* prototypes */
-int do_event(u32 port, struct pt_regs *regs);
-int bind_virq( u32 virq, void (*handler)(int, struct pt_regs *, void *data),
-                          void *data);
-int bind_evtchn( u32 virq, void (*handler)(int, struct pt_regs *, void *data),
-                                void *data );
-void unbind_evtchn( u32 port );
+int do_event(evtchn_port_t port, struct pt_regs *regs);
+int bind_virq(uint32_t virq, evtchn_handler_t handler, void *data);
+evtchn_port_t bind_evtchn(evtchn_port_t port, evtchn_handler_t handler,
+                                                 void *data);
+void unbind_evtchn(evtchn_port_t port);
 void init_events(void);
-int evtchn_alloc_unbound(void (*handler)(int, struct pt_regs *regs,
-                                                                               
 void *data),
-                                                void *data);
+evtchn_port_t evtchn_alloc_unbound(evtchn_handler_t handler,
+                                                                  void *data);
 
-static inline int notify_remote_via_evtchn(int port)
+static inline int notify_remote_via_evtchn(evtchn_port_t port)
 {
     evtchn_op_t op;
     op.cmd = EVTCHNOP_send;
diff -r a10d02d20b31 -r 98a802d25848 extras/mini-os/time.c
--- a/extras/mini-os/time.c     Fri Jul 28 14:00:37 2006 +0100
+++ b/extras/mini-os/time.c     Fri Jul 28 14:02:49 2006 +0100
@@ -215,7 +215,7 @@ void block_domain(u32 millisecs)
 /*
  * Just a dummy 
  */
-static void timer_handler(int ev, struct pt_regs *regs, void *ign)
+static void timer_handler(evtchn_port_t ev, struct pt_regs *regs, void *ign)
 {
     static int i;
 
diff -r a10d02d20b31 -r 98a802d25848 extras/mini-os/xenbus/xenbus.c
--- a/extras/mini-os/xenbus/xenbus.c    Fri Jul 28 14:00:37 2006 +0100
+++ b/extras/mini-os/xenbus/xenbus.c    Fri Jul 28 14:02:49 2006 +0100
@@ -112,7 +112,8 @@ static void xenbus_thread_func(void *ign
     }
 }
 
-static void xenbus_evtchn_handler(int port, struct pt_regs *regs, void *ign)
+static void xenbus_evtchn_handler(evtchn_port_t port, struct pt_regs *regs,
+                                 void *ign)
 {
     wake_up(&xb_waitq);
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.