Change argument order of epoch_call() to more natural, first function,

then its argument.

Reviewed by:	imp, cem, jhb
This commit is contained in:
Gleb Smirnoff 2020-01-17 06:10:24 +00:00
parent 5844774900
commit 66c6c556b6
3 changed files with 11 additions and 10 deletions

View File

@ -664,7 +664,7 @@ epoch_wait(epoch_t epoch)
}
void
epoch_call(epoch_t epoch, epoch_context_t ctx, void (*callback) (epoch_context_t))
epoch_call(epoch_t epoch, epoch_callback_t callback, epoch_context_t ctx)
{
epoch_record_t er;
ck_epoch_entry_t *cb;
@ -819,7 +819,7 @@ epoch_drain_callbacks(epoch_t epoch)
CPU_FOREACH(cpu) {
er = zpcpu_get_cpu(epoch->e_pcpu_record, cpu);
sched_bind(td, cpu);
epoch_call(epoch, &er->er_drain_ctx, &epoch_drain_cb);
epoch_call(epoch, &epoch_drain_cb, &er->er_drain_ctx);
}
/* restore CPU binding, if any */

View File

@ -313,9 +313,9 @@ pfil_unlink(struct pfil_link_args *pa, pfil_head_t head, pfil_hook_t hook)
PFIL_UNLOCK();
if (in != NULL)
epoch_call(PFIL_EPOCH, &in->link_epoch_ctx, pfil_link_free);
epoch_call(PFIL_EPOCH, pfil_link_free, &in->link_epoch_ctx);
if (out != NULL)
epoch_call(PFIL_EPOCH, &out->link_epoch_ctx, pfil_link_free);
epoch_call(PFIL_EPOCH, pfil_link_free, &out->link_epoch_ctx);
if (in == NULL && out == NULL)
return (ENOENT);
@ -443,15 +443,15 @@ pfil_remove_hook(pfil_hook_t hook)
if (in != NULL) {
head->head_nhooksin--;
hook->hook_links--;
epoch_call(PFIL_EPOCH, &in->link_epoch_ctx,
pfil_link_free);
epoch_call(PFIL_EPOCH, pfil_link_free,
&in->link_epoch_ctx);
}
out = pfil_link_remove(&head->head_out, hook);
if (out != NULL) {
head->head_nhooksout--;
hook->hook_links--;
epoch_call(PFIL_EPOCH, &out->link_epoch_ctx,
pfil_link_free);
epoch_call(PFIL_EPOCH, pfil_link_free,
&out->link_epoch_ctx);
}
if (in != NULL || out != NULL)
/* What if some stupid admin put same filter twice? */

View File

@ -35,6 +35,7 @@ struct epoch_context {
} __aligned(sizeof(void *));
typedef struct epoch_context *epoch_context_t;
typedef void epoch_callback_t(epoch_context_t);
#ifdef _KERNEL
#include <sys/lock.h>
@ -68,7 +69,7 @@ void epoch_free(epoch_t epoch);
void epoch_wait(epoch_t epoch);
void epoch_wait_preempt(epoch_t epoch);
void epoch_drain_callbacks(epoch_t epoch);
void epoch_call(epoch_t epoch, epoch_context_t ctx, void (*callback) (epoch_context_t));
void epoch_call(epoch_t epoch, epoch_callback_t cb, epoch_context_t ctx);
int in_epoch(epoch_t epoch);
int in_epoch_verbose(epoch_t epoch, int dump_onfail);
DPCPU_DECLARE(int, epoch_cb_count);
@ -101,7 +102,7 @@ extern epoch_t net_epoch_preempt;
#define NET_EPOCH_ENTER(et) epoch_enter_preempt(net_epoch_preempt, &(et))
#define NET_EPOCH_EXIT(et) epoch_exit_preempt(net_epoch_preempt, &(et))
#define NET_EPOCH_WAIT() epoch_wait_preempt(net_epoch_preempt)
#define NET_EPOCH_CALL(f, c) epoch_call(net_epoch_preempt, (c), (f))
#define NET_EPOCH_CALL(f, c) epoch_call(net_epoch_preempt, (f), (c))
#define NET_EPOCH_ASSERT() MPASS(in_epoch(net_epoch_preempt))
#endif /* _KERNEL */