Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Use container_of rather than casts via void *.
details: https://anonhg.NetBSD.org/src/rev/1f2c2a4fdfd7
branches: trunk
changeset: 975052:1f2c2a4fdfd7
user: riastradh <riastradh%NetBSD.org@localhost>
date: Thu Aug 20 21:35:24 2020 +0000
description:
Use container_of rather than casts via void *.
diffstat:
sys/net/if_wg.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diffs (45 lines):
diff -r e1e0b9755816 -r 1f2c2a4fdfd7 sys/net/if_wg.c
--- a/sys/net/if_wg.c Thu Aug 20 21:35:13 2020 +0000
+++ b/sys/net/if_wg.c Thu Aug 20 21:35:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wg.c,v 1.15 2020/08/20 21:35:13 riastradh Exp $ */
+/* $NetBSD: if_wg.c,v 1.16 2020/08/20 21:35:24 riastradh Exp $ */
/*
* Copyright (C) Ryota Ozaki <ozaki.ryota%gmail.com@localhost>
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.15 2020/08/20 21:35:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.16 2020/08/20 21:35:24 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -3012,7 +3012,7 @@
static void
wg_peer_softint(void *arg)
{
- struct wg_peer *wgp = (struct wg_peer *)arg;
+ struct wg_peer *wgp = arg;
struct wg_session *wgs;
struct mbuf *m;
struct psref psref;
@@ -3355,7 +3355,7 @@
static int
wg_clone_destroy(struct ifnet *ifp)
{
- struct wg_softc *wg = (void *) ifp;
+ struct wg_softc *wg = container_of(ifp, struct wg_softc, wg_if);
mutex_enter(&wg_softcs.lock);
LIST_REMOVE(wg, wg_list);
@@ -3413,7 +3413,7 @@
WG_TRACE("success");
- wga = (struct wg_allowedip *)rn;
+ wga = container_of(rn, struct wg_allowedip, wga_nodes[0]);
wgp = wga->wga_peer;
wg_get_peer(wgp, psref);
Home |
Main Index |
Thread Index |
Old Index