rx-prototypes-20080924
[openafs.git] / src / rx / rx_event.c
index 67f115a..bcdba29 100644 (file)
@@ -214,7 +214,8 @@ rxepoch_Allocate(struct clock *when)
  * units. */
 
 static struct rxevent *
-_rxevent_Post(struct clock *when, struct clock *now, void (*func) (), 
+_rxevent_Post(struct clock *when, struct clock *now, 
+             void (*func) (struct rxevent *, void *, void *, int), 
              void *arg, void *arg1, int arg2, int newargs)
 {
     register struct rxevent *ev, *evqe, *evqpr;
@@ -301,7 +302,11 @@ _rxevent_Post(struct clock *when, struct clock *now, void (*func) (),
 
     /* Record user defined event state */
     ev->eventTime = *when;
-    ev->func = func;
+    if (newargs) {
+       ev->func.newfunc = func;
+    } else {
+       ev->func.oldfunc = (void (*)(struct rxevent *, void *, void*))func;
+    }
     ev->arg = arg;
     ev->arg1 = arg1;
     ev->arg2 = arg2;
@@ -336,16 +341,21 @@ _rxevent_Post(struct clock *when, struct clock *now, void (*func) (),
 }
 
 struct rxevent *
-rxevent_Post(struct clock *when, void (*func) (), void *arg, void *arg1)
+rxevent_Post(struct clock *when, 
+            void (*func) (struct rxevent *, void *, void *), 
+            void *arg, void *arg1)
 {
     struct clock now;
     clock_Zero(&now);
-    return _rxevent_Post(when, &now, func, arg, arg1, 0, 0);
+    return _rxevent_Post(when, &now, 
+                        (void (*)(struct rxevent *, void *, void *, int))func,
+                        arg, arg1, 0, 0);
 }
 
 struct rxevent *
-rxevent_Post2(struct clock *when, void (*func) (), void *arg, void *arg1,
-             int arg2)
+rxevent_Post2(struct clock *when, 
+             void (*func) (struct rxevent *, void *, void *, int), 
+             void *arg, void *arg1, int arg2)
 {
     struct clock now;
     clock_Zero(&now);
@@ -353,14 +363,18 @@ rxevent_Post2(struct clock *when, void (*func) (), void *arg, void *arg1,
 }
 
 struct rxevent *
-rxevent_PostNow(struct clock *when, struct clock *now, void (*func) (), 
+rxevent_PostNow(struct clock *when, struct clock *now, 
+               void (*func) (struct rxevent *, void *, void *), 
                void *arg, void *arg1)
 {
-    return _rxevent_Post(when, now, func, arg, arg1, 0, 0);
+    return _rxevent_Post(when, now, 
+                        (void (*)(struct rxevent *, void *, void *, int))func,
+                        arg, arg1, 0, 0);
 }
 
 struct rxevent *
-rxevent_PostNow2(struct clock *when, struct clock *now, void (*func) (), 
+rxevent_PostNow2(struct clock *when, struct clock *now, 
+                 void (*func) (struct rxevent *, void *, void *, int), 
                 void *arg, void *arg1, int arg2)
 {
     return _rxevent_Post(when, now, func, arg, arg1, arg2, 1);
@@ -388,7 +402,7 @@ rxevent_Cancel_1(register struct rxevent *ev, register struct rx_call *call,
        clock_GetTime(&now);
        fprintf(rx_Log_event, "%d.%d: rxevent_Cancel_1(%d.%d, %lp, %lp)\n",
                (int)now.sec, (int)now.usec, (int)ev->eventTime.sec,
-               (int)ev->eventTime.usec, ev->func,
+               (int)ev->eventTime.usec, ev->func.newfunc,
                ev->arg);
     }
 #endif
@@ -477,9 +491,9 @@ rxevent_RaiseEvents(struct clock *next)
            rxevent_nPosted--;
            MUTEX_EXIT(&rxevent_lock);
            if (ev->newargs) {
-               ev->func(ev, ev->arg, ev->arg1, ev->arg2);
+               ev->func.newfunc(ev, ev->arg, ev->arg1, ev->arg2);
            } else {
-               ev->func(ev, ev->arg, ev->arg1);
+               ev->func.oldfunc(ev, ev->arg, ev->arg1);
            }
            MUTEX_ENTER(&rxevent_lock);
            queue_Append(&rxevent_free, ev);