Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Use atomic operations for ifa_refcnt
details: https://anonhg.NetBSD.org/src/rev/0233d32c063d
branches: trunk
changeset: 445448:0233d32c063d
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Tue Oct 30 05:29:21 2018 +0000
description:
Use atomic operations for ifa_refcnt
diffstat:
sys/net/if.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r 4191ff494c2a -r 0233d32c063d sys/net/if.c
--- a/sys/net/if.c Tue Oct 30 05:27:51 2018 +0000
+++ b/sys/net/if.c Tue Oct 30 05:29:21 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.438 2018/10/30 05:27:51 ozaki-r Exp $ */
+/* $NetBSD: if.c,v 1.439 2018/10/30 05:29:21 ozaki-r Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.438 2018/10/30 05:27:51 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.439 2018/10/30 05:29:21 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -1784,7 +1784,7 @@
ifaref(struct ifaddr *ifa)
{
- ifa->ifa_refcnt++;
+ atomic_inc_uint(&ifa->ifa_refcnt);
}
void
@@ -1793,7 +1793,7 @@
KASSERT(ifa != NULL);
KASSERT(ifa->ifa_refcnt > 0);
- if (--ifa->ifa_refcnt == 0) {
+ if (atomic_dec_uint_nv(&ifa->ifa_refcnt) == 0) {
free(ifa, M_IFADDR);
}
}
Home |
Main Index |
Thread Index |
Old Index