PERFORCE change 142604 for review
Vincenzo Iozzo
snagg at FreeBSD.org
Fri May 30 21:47:20 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=142604
Change 142604 by snagg at snagg_macosx on 2008/05/30 21:46:23
bug fix in the find function
Affected files ...
.. //depot/projects/soc2008/snagg-audit/sys/compat/ndis/subr_ntoskrnl.c#2 integrate
.. //depot/projects/soc2008/snagg-audit/sys/dev/bce/if_bce.c#3 integrate
.. //depot/projects/soc2008/snagg-audit/sys/dev/ie/if_ie.c#3 integrate
.. //depot/projects/soc2008/snagg-audit/sys/dev/if_ndis/if_ndis.c#5 integrate
.. //depot/projects/soc2008/snagg-audit/sys/dev/uart/uart_dev_ns8250.c#2 integrate
.. //depot/projects/soc2008/snagg-audit/sys/kern/kern_umtx.c#3 integrate
.. //depot/projects/soc2008/snagg-audit/sys/modules/ath_rate_onoe/Makefile#2 integrate
.. //depot/projects/soc2008/snagg-audit/sys/net/radix_mpath.c#4 integrate
.. //depot/projects/soc2008/snagg-audit/sys/net/radix_mpath.h#3 integrate
.. //depot/projects/soc2008/snagg-audit/sys/nlm/nlm_prot_impl.c#2 integrate
.. //depot/projects/soc2008/snagg-audit/sys/security/audit/audit_pipe.c#21 edit
Differences ...
==== //depot/projects/soc2008/snagg-audit/sys/compat/ndis/subr_ntoskrnl.c#2 (text+ko) ====
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ntoskrnl.c,v 1.94 2007/12/25 17:51:56 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ntoskrnl.c,v 1.95 2008/05/30 06:31:55 weongyo Exp $");
#include <sys/ctype.h>
#include <sys/unistd.h>
@@ -1591,8 +1591,9 @@
}
if (satisfied == TRUE)
- cv_broadcastpri(&we->we_cv, w->wb_oldpri -
- (increment * 4));
+ cv_broadcastpri(&we->we_cv,
+ (w->wb_oldpri - (increment * 4)) > PRI_MIN_KERN ?
+ w->wb_oldpri - (increment * 4) : PRI_MIN_KERN);
e = e->nle_flink;
}
@@ -3384,8 +3385,9 @@
}
} else {
w->wb_awakened |= TRUE;
- cv_broadcastpri(&we->we_cv, w->wb_oldpri -
- (increment * 4));
+ cv_broadcastpri(&we->we_cv,
+ (w->wb_oldpri - (increment * 4)) > PRI_MIN_KERN ?
+ w->wb_oldpri - (increment * 4) : PRI_MIN_KERN);
}
}
==== //depot/projects/soc2008/snagg-audit/sys/dev/bce/if_bce.c#3 (text) ====
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.39 2008/05/08 15:05:38 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.40 2008/05/30 18:26:37 jhb Exp $");
/*
* The following controllers are supported by this driver:
@@ -779,7 +779,7 @@
#ifdef BCE_USE_SPLIT_HEADER
sc->rx_bd_mbuf_alloc_size = MHLEN;
#else
- sc->rx_bd_mbuf_alloc_size = MCLBYTES;;
+ sc->rx_bd_mbuf_alloc_size = MCLBYTES;
#endif
sc->pg_bd_mbuf_alloc_size = MCLBYTES;
==== //depot/projects/soc2008/snagg-audit/sys/dev/ie/if_ie.c#3 (text+ko) ====
@@ -51,7 +51,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ie/if_ie.c,v 1.107 2008/05/29 17:32:55 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ie/if_ie.c,v 1.108 2008/05/30 16:22:30 jhb Exp $");
/*
* Intel 82586 Ethernet chip
@@ -365,7 +365,7 @@
#ifdef DEBUG
in_ierint++;
if (ie_debug & IED_RINT)
- if_printf(ifp, "rint\n");
+ if_printf(sc->ifp, "rint\n");
#endif
ierint(sc);
#ifdef DEBUG
@@ -376,7 +376,7 @@
#ifdef DEBUG
in_ietint++;
if (ie_debug & IED_TINT)
- if_printf(ifp, "tint\n");
+ if_printf(sc->ifp, "tint\n");
#endif
ietint(sc);
#ifdef DEBUG
@@ -386,13 +386,13 @@
if (status & IE_ST_RNR) {
#ifdef DEBUG
if (ie_debug & IED_RNR)
- if_printf(ifp, "rnr\n");
+ if_printf(sc->ifp, "rnr\n");
#endif
iernr(sc);
}
#ifdef DEBUG
if ((status & IE_ST_ALLDONE) && (ie_debug & IED_CNA))
- if_printf(ifp, "cna\n");
+ if_printf(sc->ifp, "cna\n");
#endif
if ((status = sc->scb->ie_status) & IE_ST_WHENCE)
==== //depot/projects/soc2008/snagg-audit/sys/dev/if_ndis/if_ndis.c#5 (text+ko) ====
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis.c,v 1.139 2008/05/12 00:15:28 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis.c,v 1.140 2008/05/30 07:17:51 weongyo Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -996,15 +996,18 @@
sc = device_get_softc(dev);
NDIS_LOCK(sc);
ifp = sc->ifp;
- ifp->if_flags &= ~IFF_UP;
+ if (ifp != NULL)
+ ifp->if_flags &= ~IFF_UP;
if (device_is_attached(dev)) {
NDIS_UNLOCK(sc);
ndis_stop(sc);
- if (sc->ndis_80211)
- ieee80211_ifdetach(ifp->if_l2com);
- else
- ether_ifdetach(ifp);
+ if (ifp != NULL) {
+ if (sc->ndis_80211)
+ ieee80211_ifdetach(ifp->if_l2com);
+ else
+ ether_ifdetach(ifp);
+ }
} else
NDIS_UNLOCK(sc);
==== //depot/projects/soc2008/snagg-audit/sys/dev/uart/uart_dev_ns8250.c#2 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/uart/uart_dev_ns8250.c,v 1.28 2008/03/12 19:09:20 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/uart/uart_dev_ns8250.c,v 1.29 2008/05/30 01:57:13 benno Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -258,7 +258,12 @@
ns8250_param(bas, baudrate, databits, stopbits, parity);
/* Disable all interrupt sources. */
- ier = uart_getreg(bas, REG_IER) & 0xf0;
+ /*
+ * We use 0xe0 instead of 0xf0 as the mask because the XScale PXA
+ * UARTs split the receive time-out interrupt bit out separately as
+ * 0x10. This gets handled by ier_mask and ier_rxbits below.
+ */
+ ier = uart_getreg(bas, REG_IER) & 0xe0;
uart_setreg(bas, REG_IER, ier);
uart_barrier(bas);
@@ -332,6 +337,9 @@
uint8_t fcr;
uint8_t ier;
uint8_t mcr;
+
+ uint8_t ier_mask;
+ uint8_t ier_rxbits;
};
static int ns8250_bus_attach(struct uart_softc *);
@@ -400,6 +408,19 @@
ns8250->fcr |= FCR_RX_MEDH;
} else
ns8250->fcr |= FCR_RX_MEDH;
+
+ /* Get IER mask */
+ ivar = 0xf0;
+ resource_int_value("uart", device_get_unit(sc->sc_dev), "ier_mask",
+ &ivar);
+ ns8250->ier_mask = (uint8_t)(ivar & 0xff);
+
+ /* Get IER RX interrupt bits */
+ ivar = IER_EMSC | IER_ERLS | IER_ERXRDY;
+ resource_int_value("uart", device_get_unit(sc->sc_dev), "ier_rxbits",
+ &ivar);
+ ns8250->ier_rxbits = (uint8_t)(ivar & 0xff);
+
uart_setreg(bas, REG_FCR, ns8250->fcr);
uart_barrier(bas);
ns8250_bus_flush(sc, UART_FLUSH_RECEIVER|UART_FLUSH_TRANSMITTER);
@@ -411,21 +432,24 @@
ns8250_bus_getsig(sc);
ns8250_clrint(bas);
- ns8250->ier = uart_getreg(bas, REG_IER) & 0xf0;
- ns8250->ier |= IER_EMSC | IER_ERLS | IER_ERXRDY;
+ ns8250->ier = uart_getreg(bas, REG_IER) & ns8250->ier_mask;
+ ns8250->ier |= ns8250->ier_rxbits;
uart_setreg(bas, REG_IER, ns8250->ier);
uart_barrier(bas);
+
return (0);
}
static int
ns8250_bus_detach(struct uart_softc *sc)
{
+ struct ns8250_softc *ns8250;
struct uart_bas *bas;
u_char ier;
+ ns8250 = (struct ns8250_softc *)sc;
bas = &sc->sc_bas;
- ier = uart_getreg(bas, REG_IER) & 0xf0;
+ ier = uart_getreg(bas, REG_IER) & ns8250->ier_mask;
uart_setreg(bas, REG_IER, ier);
uart_barrier(bas);
ns8250_clrint(bas);
@@ -597,10 +621,12 @@
static int
ns8250_bus_probe(struct uart_softc *sc)
{
+ struct ns8250_softc *ns8250;
struct uart_bas *bas;
int count, delay, error, limit;
uint8_t lsr, mcr, ier;
+ ns8250 = (struct ns8250_softc *)sc;
bas = &sc->sc_bas;
error = ns8250_probe(bas);
@@ -683,7 +709,7 @@
--limit)
DELAY(delay);
if (limit == 0) {
- ier = uart_getreg(bas, REG_IER) & 0xf0;
+ ier = uart_getreg(bas, REG_IER) & ns8250->ier_mask;
uart_setreg(bas, REG_IER, ier);
uart_setreg(bas, REG_MCR, mcr);
uart_setreg(bas, REG_FCR, 0);
==== //depot/projects/soc2008/snagg-audit/sys/kern/kern_umtx.c#3 (text+ko) ====
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_umtx.c,v 1.69 2008/04/29 03:48:48 davidxu Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_umtx.c,v 1.70 2008/05/30 02:18:54 davidxu Exp $");
#include "opt_compat.h"
#include <sys/param.h>
@@ -58,12 +58,12 @@
#include <compat/freebsd32/freebsd32_proto.h>
#endif
-#define TYPE_SIMPLE_LOCK 0
-#define TYPE_SIMPLE_WAIT 1
-#define TYPE_NORMAL_UMUTEX 2
-#define TYPE_PI_UMUTEX 3
-#define TYPE_PP_UMUTEX 4
-#define TYPE_CV 5
+#define TYPE_SIMPLE_WAIT 0
+#define TYPE_CV 1
+#define TYPE_SIMPLE_LOCK 2
+#define TYPE_NORMAL_UMUTEX 3
+#define TYPE_PI_UMUTEX 4
+#define TYPE_PP_UMUTEX 5
#define TYPE_RWLOCK 6
/* Key to represent a unique userland synchronous object */
@@ -191,7 +191,7 @@
#define BUSY_SPINS 200
static uma_zone_t umtx_pi_zone;
-static struct umtxq_chain umtxq_chains[UMTX_CHAINS];
+static struct umtxq_chain umtxq_chains[2][UMTX_CHAINS];
static MALLOC_DEFINE(M_UMTX, "umtx", "UMTX queue memory");
static int umtx_pi_allocated;
@@ -232,18 +232,20 @@
static void
umtxq_sysinit(void *arg __unused)
{
- int i;
+ int i, j;
umtx_pi_zone = uma_zcreate("umtx pi", sizeof(struct umtx_pi),
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
- for (i = 0; i < UMTX_CHAINS; ++i) {
- mtx_init(&umtxq_chains[i].uc_lock, "umtxql", NULL,
- MTX_DEF | MTX_DUPOK);
- TAILQ_INIT(&umtxq_chains[i].uc_queue[0]);
- TAILQ_INIT(&umtxq_chains[i].uc_queue[1]);
- TAILQ_INIT(&umtxq_chains[i].uc_pi_list);
- umtxq_chains[i].uc_busy = 0;
- umtxq_chains[i].uc_waiters = 0;
+ for (i = 0; i < 2; ++i) {
+ for (j = 0; j < UMTX_CHAINS; ++j) {
+ mtx_init(&umtxq_chains[i][j].uc_lock, "umtxql", NULL,
+ MTX_DEF | MTX_DUPOK);
+ TAILQ_INIT(&umtxq_chains[i][j].uc_queue[0]);
+ TAILQ_INIT(&umtxq_chains[i][j].uc_queue[1]);
+ TAILQ_INIT(&umtxq_chains[i][j].uc_pi_list);
+ umtxq_chains[i][j].uc_busy = 0;
+ umtxq_chains[i][j].uc_waiters = 0;
+ }
}
mtx_init(&umtx_lock, "umtx lock", NULL, MTX_SPIN);
EVENTHANDLER_REGISTER(process_exec, umtx_exec_hook, NULL,
@@ -285,7 +287,9 @@
static inline struct umtxq_chain *
umtxq_getchain(struct umtx_key *key)
{
- return (&umtxq_chains[key->hash]);
+ if (key->type <= TYPE_CV)
+ return (&umtxq_chains[1][key->hash]);
+ return (&umtxq_chains[0][key->hash]);
}
/*
==== //depot/projects/soc2008/snagg-audit/sys/modules/ath_rate_onoe/Makefile#2 (text+ko) ====
@@ -33,7 +33,7 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGES.
#
-# $FreeBSD: src/sys/modules/ath_rate_onoe/Makefile,v 1.5 2008/04/20 20:35:40 sam Exp $
+# $FreeBSD: src/sys/modules/ath_rate_onoe/Makefile,v 1.6 2008/05/30 03:36:52 sam Exp $
#
.PATH: ${.CURDIR}/../../dev/ath/ath_rate/onoe
@@ -56,10 +56,10 @@
ATH_MODULE_ARCH=${MACHINE_ARCH}
.endif
-.if !defined(KERNBUILDDIR)
opt_ah.h: ${HAL}/public/${ATH_MODULE_ARCH}-elf.opt_ah.h
cp ${HAL}/public/${ATH_MODULE_ARCH}-elf.opt_ah.h ${.TARGET}
+.if !defined(KERNBUILDDIR)
opt_wlan.h:
echo "#define IEEE80211_DEBUG 1" > opt_wlan.h
# echo > opt_wlan.h
==== //depot/projects/soc2008/snagg-audit/sys/net/radix_mpath.c#4 (text+ko) ====
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net/radix_mpath.c,v 1.5 2008/05/09 23:02:56 julian Exp $");
+__FBSDID("$FreeBSD: src/sys/net/radix_mpath.c,v 1.6 2008/05/30 09:34:35 qingli Exp $");
#include "opt_inet6.h"
@@ -76,10 +76,10 @@
return NULL;
}
-int
+u_int32_t
rn_mpath_count(struct radix_node *rn)
{
- int i;
+ u_int32_t i;
i = 1;
while ((rn = rn_mpath_next(rn)) != NULL)
@@ -255,10 +255,10 @@
}
void
-rtalloc_mpath_fib(struct route *ro, int hash, u_int fibnum)
+rtalloc_mpath_fib(struct route *ro, u_int32_t hash, u_int fibnum)
{
struct radix_node *rn0, *rn;
- int n;
+ u_int32_t n;
/*
* XXX we don't attempt to lookup cached route again; what should
==== //depot/projects/soc2008/snagg-audit/sys/net/radix_mpath.h#3 (text+ko) ====
@@ -32,7 +32,7 @@
* BE LIABLE FOR ANY INFRINGEMENT OF ANY OTHERS' INTELLECTUAL
* PROPERTIES.
*/
-/* $FreeBSD: src/sys/net/radix_mpath.h,v 1.2 2008/05/09 23:02:56 julian Exp $ */
+/* $FreeBSD: src/sys/net/radix_mpath.h,v 1.3 2008/05/30 09:34:35 qingli Exp $ */
#ifndef _NET_RADIX_MPATH_H_
#define _NET_RADIX_MPATH_H_
@@ -46,11 +46,11 @@
struct sockaddr;
int rn_mpath_capable(struct radix_node_head *);
struct radix_node *rn_mpath_next(struct radix_node *);
-int rn_mpath_count(struct radix_node *);
+u_int32_t rn_mpath_count(struct radix_node *);
struct rtentry *rt_mpath_matchgate(struct rtentry *, struct sockaddr *);
int rt_mpath_conflict(struct radix_node_head *, struct rtentry *,
struct sockaddr *);
-void rtalloc_mpath_fib(struct route *, int, u_int);
+void rtalloc_mpath_fib(struct route *, u_int32_t, u_int);
#define rtalloc_mpath(_route, _hash) rtalloc_mpath_fib((_route), (_hash), 0)
struct radix_node *rn_mpath_lookup(void *, void *,
struct radix_node_head *);
==== //depot/projects/soc2008/snagg-audit/sys/nlm/nlm_prot_impl.c#2 (text+ko) ====
@@ -28,7 +28,7 @@
#include "opt_inet6.h"
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/nlm/nlm_prot_impl.c,v 1.6 2008/04/16 09:09:50 dfr Exp $");
+__FBSDID("$FreeBSD: src/sys/nlm/nlm_prot_impl.c,v 1.7 2008/05/30 09:34:08 dfr Exp $");
#include <sys/param.h>
#include <sys/fcntl.h>
@@ -178,6 +178,7 @@
int nh_state; /* (s) last seen NSM state of host */
enum nlm_host_state nh_monstate; /* (s) local NSM monitoring state */
time_t nh_idle_timeout; /* (s) Time at which host is idle */
+ time_t nh_rpc_create_time; /* (s) Time we create RPC client */
struct sysctl_ctx_list nh_sysctl; /* (c) vfs.nlm.sysid nodes */
struct nlm_async_lock_list nh_pending; /* (l) pending async locks */
struct nlm_async_lock_list nh_finished; /* (l) finished async locks */
@@ -953,6 +954,21 @@
{
struct timeval zero;
+ /*
+ * We can't hold onto RPC handles for too long - the async
+ * call/reply protocol used by some NLM clients makes it hard
+ * to tell when they change port numbers (e.g. after a
+ * reboot). Note that if a client reboots while it isn't
+ * holding any locks, it won't bother to notify us. We
+ * expire the RPC handles after two minutes.
+ */
+ if (host->nh_rpc && time_uptime > host->nh_rpc_create_time + 2*60) {
+ CLIENT *client;
+ client = host->nh_rpc;
+ host->nh_rpc = NULL;
+ CLNT_DESTROY(client);
+ }
+
if (host->nh_rpc)
return (host->nh_rpc);
@@ -968,12 +984,7 @@
zero.tv_usec = 0;
CLNT_CONTROL(host->nh_rpc, CLSET_TIMEOUT, &zero);
- /*
- * Monitor the host - if it reboots, the address of
- * its NSM might change so we must discard our RPC
- * handle.
- */
- nlm_host_monitor(host, 0);
+ host->nh_rpc_create_time = time_uptime;
}
return (host->nh_rpc);
==== //depot/projects/soc2008/snagg-audit/sys/security/audit/audit_pipe.c#21 (text) ====
@@ -264,7 +264,7 @@
if(app->app_pid == app_pid) {
/* Just skip if we are interested only in the pid. */
- if(app_event != -1) {
+ if(app_event != -1 && app->app_event_len > 0) {
event = bsearch(&ev_a, (app->app_auevents), app->app_event_len,
sizeof(struct audit_pipe_preselect_event),
audit_pipe_compare_preselect_event);
More information about the p4-projects
mailing list