Page MenuHomeFreeBSD

D39203.diff
No OneTemporary

D39203.diff

diff --git a/sys/net/if.c b/sys/net/if.c
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -4553,27 +4553,6 @@
_Static_assert(sizeof(struct _if_iter_ext) <= sizeof(struct if_iter),
"Public version of if_iter structure is too small");
-
-int
-if_foreach_sleep(if_foreach_match_t match_cb, void *match_arg, if_foreach_cb_t cb,
- void *cb_arg)
-{
- struct if_iter_ext_params params = {
- .match_cb = match_cb,
- .match_arg = match_arg,
- .can_sleep = true,
- };
- struct if_iter it;
- int error = 0;
-
- for (if_t ifp = if_iter_ext_start(&it, &params); ifp; ifp = if_iter_ext_next(&it)) {
- if (error == 0)
- error = cb(ifp, cb_arg);
- }
-
- return (error);
-}
-
/*
* Iterates over the list of interfaces, permitting callback function @cb to sleep.
* Stops iteration if @cb returns non-zero error code.
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -682,7 +682,6 @@
typedef int (*if_foreach_cb_t)(if_t, void *);
typedef bool (*if_foreach_match_t)(if_t, void *);
int if_foreach(if_foreach_cb_t, void *);
-int if_foreach_sleep(if_foreach_match_t, void *, if_foreach_cb_t, void *);
/* Opaque iterator structure for iterating over interfaces. */
struct if_iter {
diff --git a/sys/netlink/route/iface.c b/sys/netlink/route/iface.c
--- a/sys/netlink/route/iface.c
+++ b/sys/netlink/route/iface.c
@@ -375,15 +375,6 @@
return (true);
}
-static int
-dump_cb(struct ifnet *ifp, void *_arg)
-{
- struct netlink_walkargs *wa = (struct netlink_walkargs *)_arg;
- if (!dump_iface(wa->nw, ifp, &wa->hdr, 0))
- return (ENOMEM);
- return (0);
-}
-
/*
* {nlmsg_len=52, nlmsg_type=RTM_GETLINK, nlmsg_flags=NLM_F_REQUEST, nlmsg_seq=1662842818, nlmsg_pid=0},
* {ifi_family=AF_PACKET, ifi_type=ARPHRD_NETROM, ifi_index=0, ifi_flags=0, ifi_change=0},
@@ -449,7 +440,16 @@
*/
NL_LOG(LOG_DEBUG2, "Start dump");
- if_foreach_sleep(match_iface, &attrs, dump_cb, &wa);
+ struct if_iter_ext_params params = {
+ .match_cb = match_iface,
+ .match_arg = &attrs,
+ .can_sleep = true,
+ };
+ struct if_iter it;
+
+ for (if_t ifp = if_iter_ext_start(&it, &params); ifp; ifp = if_iter_ext_next(&it))
+ dump_iface(wa.nw, ifp, &wa.hdr, 0);
+
NL_LOG(LOG_DEBUG2, "End dump, iterated %d dumped %d", wa.count, wa.dumped);
if (!nlmsg_end_dump(wa.nw, error, &wa.hdr)) {

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 22, 6:51 AM (17 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30112088
Default Alt Text
D39203.diff (2 KB)

Event Timeline