Change sc_wrports from an int to a bool and "test truth" instead of

comparing with 0.

Add 'volatile' to several other state variables that need it.
This commit is contained in:
dyoung 2010-05-26 23:46:44 +00:00
parent 5f75591d60
commit a5a3d4c202
2 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_agr.c,v 1.27 2010/04/05 07:22:24 joerg Exp $ */
/* $NetBSD: if_agr.c,v 1.28 2010/05/26 23:46:44 dyoung Exp $ */
/*-
* Copyright (c)2005 YAMAMOTO Takashi,
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.27 2010/04/05 07:22:24 joerg Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.28 2010/05/26 23:46:44 dyoung Exp $");
#include "opt_inet.h"
@ -1003,7 +1003,7 @@ static bool
agr_ports_enter(struct agr_softc *sc)
{
mutex_enter(&sc->sc_entry_mtx);
while (sc->sc_wrports != 0)
while (sc->sc_wrports)
cv_wait(&sc->sc_ports_cv, &sc->sc_entry_mtx);
sc->sc_rdports++;
mutex_exit(&sc->sc_entry_mtx);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_agrvar_impl.h,v 1.9 2010/02/08 17:59:06 dyoung Exp $ */
/* $NetBSD: if_agrvar_impl.h,v 1.10 2010/05/26 23:46:44 dyoung Exp $ */
/*-
* Copyright (c)2005 YAMAMOTO Takashi,
@ -107,11 +107,11 @@ struct agr_softc {
kmutex_t sc_lock;
kcondvar_t sc_ports_cv;
kcondvar_t sc_insc_cv;
int sc_noentry;
int sc_insc;
int sc_wrports;
int sc_rdports;
int sc_paused;
volatile int sc_noentry;
volatile int sc_insc;
volatile bool sc_wrports;
volatile int sc_rdports;
volatile int sc_paused;
struct callout sc_callout;
int sc_nports;
TAILQ_HEAD(, agr_port) sc_ports;