freebsd_network: Clean up struct callout.
* Remove unused flags field. * Rename internal members to have c_ at the beginning, like FreeBSD.
This commit is contained in:
@@ -52,12 +52,12 @@ callout_thread(void* /*data*/)
|
|||||||
if (c == NULL)
|
if (c == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (c->due < system_time()) {
|
if (c->c_due < system_time()) {
|
||||||
struct mtx *mutex = c->c_mtx;
|
struct mtx *mutex = c->c_mtx;
|
||||||
|
|
||||||
// execute timer
|
// execute timer
|
||||||
list_remove_item(&sTimers, c);
|
list_remove_item(&sTimers, c);
|
||||||
c->due = -1;
|
c->c_due = -1;
|
||||||
sCurrentCallout = c;
|
sCurrentCallout = c;
|
||||||
|
|
||||||
mutex_unlock(&sLock);
|
mutex_unlock(&sLock);
|
||||||
@@ -79,8 +79,8 @@ callout_thread(void* /*data*/)
|
|||||||
// restart scanning as we unlocked the list
|
// restart scanning as we unlocked the list
|
||||||
} else {
|
} else {
|
||||||
// calculate new timeout
|
// calculate new timeout
|
||||||
if (c->due < timeout)
|
if (c->c_due < timeout)
|
||||||
timeout = c->due;
|
timeout = c->c_due;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,8 +164,7 @@ callout_init(struct callout *callout, int mpsafe)
|
|||||||
void
|
void
|
||||||
callout_init_mtx(struct callout *c, struct mtx *mtx, int flags)
|
callout_init_mtx(struct callout *c, struct mtx *mtx, int flags)
|
||||||
{
|
{
|
||||||
c->due = 0;
|
c->c_due = 0;
|
||||||
c->flags = 0;
|
|
||||||
|
|
||||||
c->c_arg = NULL;
|
c->c_arg = NULL;
|
||||||
c->c_func = NULL;
|
c->c_func = NULL;
|
||||||
@@ -188,13 +187,13 @@ callout_reset(struct callout *c, int _ticks, void (*func)(void *), void *arg)
|
|||||||
|
|
||||||
if (_ticks >= 0) {
|
if (_ticks >= 0) {
|
||||||
// reschedule or add this timer
|
// reschedule or add this timer
|
||||||
if (c->due <= 0)
|
if (c->c_due <= 0)
|
||||||
list_add_item(&sTimers, c);
|
list_add_item(&sTimers, c);
|
||||||
|
|
||||||
c->due = system_time() + TICKS_2_USEC(_ticks);
|
c->c_due = system_time() + TICKS_2_USEC(_ticks);
|
||||||
|
|
||||||
// notify timer about the change if necessary
|
// notify timer about the change if necessary
|
||||||
if (sTimeout > c->due)
|
if (sTimeout > c->c_due)
|
||||||
release_sem(sWaitSem);
|
release_sem(sWaitSem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,12 +227,12 @@ _callout_stop_safe(struct callout *c, int safe)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c->due <= 0)
|
if (c->c_due <= 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// this timer is scheduled, cancel it
|
// this timer is scheduled, cancel it
|
||||||
list_remove_item(&sTimers, c);
|
list_remove_item(&sTimers, c);
|
||||||
c->due = 0;
|
c->c_due = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +240,7 @@ _callout_stop_safe(struct callout *c, int safe)
|
|||||||
int
|
int
|
||||||
callout_pending(struct callout *c)
|
callout_pending(struct callout *c)
|
||||||
{
|
{
|
||||||
return c->due > 0;
|
return c->c_due > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,8 @@
|
|||||||
|
|
||||||
|
|
||||||
struct callout {
|
struct callout {
|
||||||
struct list_link link;
|
struct list_link c_link;
|
||||||
bigtime_t due;
|
bigtime_t c_due;
|
||||||
uint32 flags;
|
|
||||||
|
|
||||||
void * c_arg;
|
void * c_arg;
|
||||||
void (*c_func)(void *);
|
void (*c_func)(void *);
|
||||||
|
|||||||
Reference in New Issue
Block a user