svn commit: r356826 - in head/sys: kern net sys
Gleb Smirnoff
glebius at FreeBSD.org
Fri Jan 17 06:10:25 UTC 2020
Author: glebius
Date: Fri Jan 17 06:10:24 2020
New Revision: 356826
URL: https://svnweb.freebsd.org/changeset/base/356826
Log:
Change argument order of epoch_call() to more natural, first function,
then its argument.
Reviewed by: imp, cem, jhb
Modified:
head/sys/kern/subr_epoch.c
head/sys/net/pfil.c
head/sys/sys/epoch.h
Modified: head/sys/kern/subr_epoch.c
==============================================================================
--- head/sys/kern/subr_epoch.c Fri Jan 17 04:13:16 2020 (r356825)
+++ head/sys/kern/subr_epoch.c Fri Jan 17 06:10:24 2020 (r356826)
@@ -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 */
Modified: head/sys/net/pfil.c
==============================================================================
--- head/sys/net/pfil.c Fri Jan 17 04:13:16 2020 (r356825)
+++ head/sys/net/pfil.c Fri Jan 17 06:10:24 2020 (r356826)
@@ -313,9 +313,9 @@ pfil_unlink(struct pfil_link_args *pa, pfil_head_t hea
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 @@ retry:
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? */
Modified: head/sys/sys/epoch.h
==============================================================================
--- head/sys/sys/epoch.h Fri Jan 17 04:13:16 2020 (r356825)
+++ head/sys/sys/epoch.h Fri Jan 17 06:10:24 2020 (r356826)
@@ -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 */
More information about the svn-src-head
mailing list