static void rxi_Resend(struct rxevent *event, void *arg0, void *arg1,
int istack);
static void rxi_SendDelayedAck(struct rxevent *event, void *call,
- void *dummy);
+ void *dummy, int dummy2);
+static void rxi_SendDelayedCallAbort(struct rxevent *event, void *arg1,
+ void *dummy, int dummy2);
+static void rxi_SendDelayedConnAbort(struct rxevent *event, void *arg1,
+ void *unused, int unused2);
+static void rxi_ReapConnections(struct rxevent *unused, void *unused1,
+ void *unused2, int unused3);
#ifdef RX_ENABLE_LOCKS
static void rxi_SetAcksInTransmitQueue(struct rx_call *call);
MUTEX_ENTER(&rx_refcnt_mutex);
CALL_HOLD(call, RX_CALL_REFCOUNT_RESEND);
MUTEX_EXIT(&rx_refcnt_mutex);
- call->resendEvent = rxevent_PostNow2(&retryTime, &now, rxi_Resend,
- call, 0, istack);
+ call->resendEvent = rxevent_Post(&retryTime, &now, rxi_Resend,
+ call, NULL, istack);
}
/*!
CALL_HOLD(call, RX_CALL_REFCOUNT_DELAY);
MUTEX_EXIT(&rx_refcnt_mutex);
- call->delayedAckEvent = rxevent_PostNow(&when, &now,
- rxi_SendDelayedAck,
- call, 0);
+ call->delayedAckEvent = rxevent_Post(&when, &now,
+ rxi_SendDelayedAck,
+ call, NULL, 0);
}
}
}
/* Turn on reaping of idle server connections */
- rxi_ReapConnections(NULL, NULL, NULL);
+ rxi_ReapConnections(NULL, NULL, NULL, 0);
USERPRI;
rxevent_Cancel(call->delayedAckEvent, call,
RX_CALL_REFCOUNT_DELAY);
call->delayedAckEvent = NULL;
- rxi_SendDelayedAck(NULL, call, NULL);
+ rxi_SendDelayedAck(NULL, call, NULL, 0);
}
/* We need to release the call lock since it's lower than the
}
static void
-rxi_CheckReachEvent(struct rxevent *event, void *arg1, void *arg2)
+rxi_CheckReachEvent(struct rxevent *event, void *arg1, void *arg2, int dummy)
{
struct rx_connection *conn = arg1;
struct rx_call *acall = arg2;
MUTEX_ENTER(&rx_refcnt_mutex);
conn->refCount++;
MUTEX_EXIT(&rx_refcnt_mutex);
- conn->checkReachEvent =
- rxevent_PostNow(&when, &now, rxi_CheckReachEvent, conn,
- NULL);
+ conn->checkReachEvent = rxevent_Post(&when, &now,
+ rxi_CheckReachEvent, conn,
+ NULL, 0);
}
MUTEX_EXIT(&conn->conn_data_lock);
}
conn->flags |= RX_CONN_ATTACHWAIT;
MUTEX_EXIT(&conn->conn_data_lock);
if (!conn->checkReachEvent)
- rxi_CheckReachEvent(NULL, conn, call);
+ rxi_CheckReachEvent(NULL, conn, call, 0);
return 1;
}
}
void
-rxi_SendDelayedAck(struct rxevent *event, void *arg1, void *unused)
+rxi_SendDelayedAck(struct rxevent *event, void *arg1, void *unused1,
+ int unused2)
{
struct rx_call *call = arg1;
#ifdef RX_ENABLE_LOCKS
CALL_HOLD(call, RX_CALL_REFCOUNT_ABORT);
MUTEX_EXIT(&rx_refcnt_mutex);
call->delayedAbortEvent =
- rxevent_PostNow(&when, &now, rxi_SendDelayedCallAbort, call, 0);
+ rxevent_Post(&when, &now, rxi_SendDelayedCallAbort, call, 0, 0);
}
return packet;
}
when = now;
clock_Addmsec(&when, rxi_connAbortDelay);
conn->delayedAbortEvent =
- rxevent_PostNow(&when, &now, rxi_SendDelayedConnAbort, conn, 0);
+ rxevent_Post(&when, &now, rxi_SendDelayedConnAbort, conn, NULL, 0);
}
return packet;
}
}
void
-rxi_NatKeepAliveEvent(struct rxevent *event, void *arg1, void *dummy)
+rxi_NatKeepAliveEvent(struct rxevent *event, void *arg1,
+ void *dummy, int dummy2)
{
struct rx_connection *conn = arg1;
struct rx_header theader;
conn->refCount++; /* hold a reference for this */
MUTEX_EXIT(&rx_refcnt_mutex);
conn->natKeepAliveEvent =
- rxevent_PostNow(&when, &now, rxi_NatKeepAliveEvent, conn, 0);
+ rxevent_Post(&when, &now, rxi_NatKeepAliveEvent, conn, NULL, 0);
}
}
* keep-alive packet (if we're actually trying to keep the call alive)
*/
void
-rxi_KeepAliveEvent(struct rxevent *event, void *arg1, void *dummy)
+rxi_KeepAliveEvent(struct rxevent *event, void *arg1, void *dummy,
+ int dummy2)
{
struct rx_call *call = arg1;
struct rx_connection *conn;
/* Does what's on the nameplate. */
void
-rxi_GrowMTUEvent(struct rxevent *event, void *arg1, void *dummy)
+rxi_GrowMTUEvent(struct rxevent *event, void *arg1, void *dummy, int dummy2)
{
struct rx_call *call = arg1;
struct rx_connection *conn;
CALL_HOLD(call, RX_CALL_REFCOUNT_ALIVE);
MUTEX_EXIT(&rx_refcnt_mutex);
call->keepAliveEvent =
- rxevent_PostNow(&when, &now, rxi_KeepAliveEvent, call, 0);
+ rxevent_Post(&when, &now, rxi_KeepAliveEvent, call, NULL, 0);
}
}
CALL_HOLD(call, RX_CALL_REFCOUNT_ALIVE);
MUTEX_EXIT(&rx_refcnt_mutex);
call->growMTUEvent =
- rxevent_PostNow(&when, &now, rxi_GrowMTUEvent, call, 0);
+ rxevent_Post(&when, &now, rxi_GrowMTUEvent, call, NULL, 0);
}
}
/* This routine is called to send connection abort messages
* that have been delayed to throttle looping clients. */
void
-rxi_SendDelayedConnAbort(struct rxevent *event,
- void *arg1, void *unused)
+rxi_SendDelayedConnAbort(struct rxevent *event, void *arg1, void *unused,
+ int unused2)
{
struct rx_connection *conn = arg1;
/* This routine is called to send call abort messages
* that have been delayed to throttle looping clients. */
-void
-rxi_SendDelayedCallAbort(struct rxevent *event,
- void *arg1, void *dummy)
+static void
+rxi_SendDelayedCallAbort(struct rxevent *event, void *arg1, void *dummy,
+ int dummy2)
{
struct rx_call *call = arg1;
when = now;
when.sec += RX_CHALLENGE_TIMEOUT;
conn->challengeEvent =
- rxevent_PostNow2(&when, &now, rxi_ChallengeEvent, conn, 0,
+ rxevent_Post(&when, &now, rxi_ChallengeEvent, conn, 0,
(tries - 1));
}
}
/* Find all server connections that have not been active for a long time, and
* toss them */
void
-rxi_ReapConnections(struct rxevent *unused, void *unused1, void *unused2)
+rxi_ReapConnections(struct rxevent *unused, void *unused1, void *unused2,
+ int unused3)
{
struct clock now, when;
clock_GetTime(&now);
when = now;
when.sec += RX_REAP_TIME; /* Check every RX_REAP_TIME seconds */
- rxevent_Post(&when, rxi_ReapConnections, 0, 0);
+ rxevent_Post(&when, &now, rxi_ReapConnections, 0, NULL, 0);
}
* "when" argument specifies when "func" should be called, in clock (clock.h)
* units. */
-static struct rxevent *
-_rxevent_Post(struct clock *when, struct clock *now,
+struct rxevent *
+rxevent_Post(struct clock *when, struct clock *now,
void (*func) (struct rxevent *, void *, void *, int),
- void *arg, void *arg1, int arg2, int newargs)
+ void *arg, void *arg1, int arg2)
{
struct rxevent *ev, *evqe, *evqpr;
struct rxepoch *ep, *epqe, *epqpr;
/* Record user defined event state */
ev->eventTime = *when;
- if (newargs) {
- ev->func.newfunc = func;
- } else {
- ev->func.oldfunc = (void (*)(struct rxevent *, void *, void*))func;
- }
+ ev->func = func;
ev->arg = arg;
ev->arg1 = arg1;
ev->arg2 = arg2;
- ev->newargs = newargs;
rxevent_nPosted += 1; /* Rather than ++, to shut high-C up
* regarding never-set variables
*/
return ev;
}
-struct rxevent *
-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,
- (void (*)(struct rxevent *, void *, void *, int))func,
- arg, arg1, 0, 0);
-}
-
-struct rxevent *
-rxevent_Post2(struct clock *when,
- void (*func) (struct rxevent *, void *, void *, int),
- void *arg, void *arg1, int arg2)
-{
- struct clock now;
- clock_Zero(&now);
- return _rxevent_Post(when, &now, func, arg, arg1, arg2, 1);
-}
-
-struct rxevent *
-rxevent_PostNow(struct clock *when, struct clock *now,
- void (*func) (struct rxevent *, void *, void *),
- void *arg, void *arg1)
-{
- 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) (struct rxevent *, void *, void *, int),
- void *arg, void *arg1, int arg2)
-{
- return _rxevent_Post(when, now, func, arg, arg1, arg2, 1);
-}
-
/* Cancel an event by moving it from the event queue to the free list.
* Warning, the event must be on the event queue! If not, this should core
* dump (reference through 0). This routine should be called using the macro
fprintf(rx_Log_event, "%d.%d: rxevent_Cancel_1(%d.%d, %"
AFS_PTR_FMT ", %p" AFS_PTR_FMT ")\n",
(int)now.sec, (int)now.usec, (int)ev->eventTime.sec,
- (int)ev->eventTime.usec, ev->func.newfunc,
+ (int)ev->eventTime.usec, ev->func,
ev->arg);
}
#endif
queue_Remove(ev);
rxevent_nPosted--;
MUTEX_EXIT(&rxevent_lock);
- if (ev->newargs) {
- ev->func.newfunc(ev, ev->arg, ev->arg1, ev->arg2);
- } else {
- ev->func.oldfunc(ev, ev->arg, ev->arg1);
- }
+ ev->func(ev, ev->arg, ev->arg1, ev->arg2);
MUTEX_ENTER(&rxevent_lock);
queue_Append(&rxevent_free, ev);
rxevent_nFree++;
#else /* RX_ENABLE_LOCKS */
extern int rxi_CheckCall(struct rx_call *call);
#endif /* RX_ENABLE_LOCKS */
-extern void rxi_KeepAliveEvent(struct rxevent *event,
- void *call /* struct rx_call *call */,
- void *dummy);
-extern void rxi_GrowMTUEvent(struct rxevent *event,
- void *call /* struct rx_call *call */,
- void *dummy);
extern void rxi_ScheduleKeepAliveEvent(struct rx_call *call);
extern void rxi_ScheduleNatKeepAliveEvent(struct rx_connection *conn);
extern void rxi_ScheduleGrowMTUEvent(struct rx_call *call, int secs);
extern void rxi_NatKeepAliveOn(struct rx_connection *conn);
extern void rxi_GrowMTUOn(struct rx_call *call);
extern void rx_SetConnSecondsUntilNatPing(struct rx_connection *conn, afs_int32 seconds);
-extern void rxi_SendDelayedConnAbort(struct rxevent *event,
- void *conn, /* struct rx_connection *conn */
- void *dummy);
-extern void rxi_SendDelayedCallAbort(struct rxevent *event,
- void *call, /* struct rx_call *call */
- void *dummy);
extern void rxi_ChallengeEvent(struct rxevent *event,
void *conn, /* struct rx_connection *conn */
void *arg1, int atries);
extern void rxi_ChallengeOn(struct rx_connection *conn);
-extern void rxi_ReapConnections(struct rxevent *unused, void *unused1,
- void *unused2);
extern int rxs_Release(struct rx_securityClass *aobj);
#ifndef KERNEL
extern void rx_PrintTheseStats(FILE * file, struct rx_statistics *s, int size,
/* rx_event.c */
extern int rxevent_nFree;
extern int rxevent_nPosted;
-#if 0
-extern struct rxevent *rxevent_Post(struct clock *when,
- void (*func) (struct rxevent * event,
- struct rx_connection * conn,
- struct rx_call * acall),
- void *arg, void *arg1);
-/* this func seems to be called with tons of different style routines, need to look
-at another time. */
-#else
-extern struct rxevent *rxevent_Post(struct clock *when,
- void (*func) (struct rxevent *, void *, void *),
- void *arg, void *arg1);
-extern struct rxevent *rxevent_Post2(struct clock *when,
- void (*func) (struct rxevent *, void *, void *, int),
- void *arg, void *arg1, int arg2);
-extern struct rxevent *rxevent_PostNow(struct clock *when, struct clock *now,
- void (*func) (struct rxevent *, void *, void *), void *arg, void *arg1);
-extern struct rxevent *rxevent_PostNow2(struct clock *when, struct clock *now,
- void (*func) (struct rxevent *, void *, void *, int), void *arg,
- void *arg1, int arg2);
-#endif
+extern struct rxevent *rxevent_Post(struct clock *when, struct clock *now,
+ void (*func) (struct rxevent *, void *,
+ void *, int),
+ void *arg, void *arg1, int arg2);
extern void shutdown_rxevent(void);
extern struct rxepoch *rxepoch_Allocate(struct clock *when);
extern void rxevent_Init(int nEvents, void (*scheduler) (void));