PERFORCE change 49924 for review
Peter Wemm
peter at FreeBSD.org
Mon Mar 29 15:31:06 PST 2004
http://perforce.freebsd.org/chv.cgi?CH=49924
Change 49924 by peter at peter_daintree on 2004/03/29 15:31:03
IFC @49922
Affected files ...
.. //depot/projects/hammer/etc/rc.d/ntpdate#7 integrate
.. //depot/projects/hammer/lib/libc/locale/Makefile.inc#18 integrate
.. //depot/projects/hammer/libexec/rtld-elf/rtld.c#19 integrate
.. //depot/projects/hammer/share/man/man9/copy.9#3 integrate
.. //depot/projects/hammer/sys/amd64/amd64/vm_machdep.c#35 integrate
.. //depot/projects/hammer/sys/conf/NOTES#38 integrate
.. //depot/projects/hammer/sys/contrib/dev/oltr/if_oltr.c#8 integrate
.. //depot/projects/hammer/sys/fs/umapfs/umap_vnops.c#5 integrate
.. //depot/projects/hammer/sys/i386/i386/vm_machdep.c#26 integrate
.. //depot/projects/hammer/sys/kern/kern_sig.c#36 integrate
.. //depot/projects/hammer/sys/kern/vfs_default.c#18 integrate
.. //depot/projects/hammer/sys/kern/vfs_subr.c#35 integrate
.. //depot/projects/hammer/sys/libkern/index.c#3 integrate
.. //depot/projects/hammer/sys/libkern/rindex.c#3 integrate
.. //depot/projects/hammer/sys/modules/Makefile#40 integrate
.. //depot/projects/hammer/sys/net/if_tun.c#15 integrate
.. //depot/projects/hammer/sys/powerpc/powerpc/vm_machdep.c#14 integrate
.. //depot/projects/hammer/sys/sys/vnode.h#22 integrate
Differences ...
==== //depot/projects/hammer/etc/rc.d/ntpdate#7 (text+ko) ====
@@ -1,7 +1,7 @@
#!/bin/sh
#
# $NetBSD: ntpdate,v 1.8 2002/03/22 04:16:39 lukem Exp $
-# $FreeBSD: src/etc/rc.d/ntpdate,v 1.8 2004/03/22 16:35:35 des Exp $
+# $FreeBSD: src/etc/rc.d/ntpdate,v 1.9 2004/03/29 20:00:54 des Exp $
#
# PROVIDE: ntpdate
@@ -17,13 +17,13 @@
ntpdate_start()
{
- if [ -z "$ntpdate_hosts" ]; then
+ if [ -z "$ntpdate_hosts" -a -f /etc/ntp.conf ]; then
ntpdate_hosts=`awk '
/^server[ \t]*127.127/ {next}
/^(server|peer)/ {print $2}
' </etc/ntp.conf`
fi
- if [ -n "$ntpdate_hosts" ]; then
+ if [ -n "$ntpdate_hosts" -o -n "$rc_flags" ]; then
echo "Setting date via ntp."
${ntpdate_command:-ntpdate} $rc_flags $ntpdate_hosts
fi
==== //depot/projects/hammer/lib/libc/locale/Makefile.inc#18 (text+ko) ====
@@ -1,5 +1,5 @@
# from @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD: src/lib/libc/locale/Makefile.inc,v 1.53 2003/12/07 06:33:52 tjr Exp $
+# $FreeBSD: src/lib/libc/locale/Makefile.inc,v 1.54 2004/03/29 21:46:52 tjr Exp $
# locale sources
.PATH: ${.CURDIR}/${MACHINE_ARCH}/locale ${.CURDIR}/locale
@@ -39,7 +39,7 @@
MLINKS+=isdigit.3 isnumber.3
MLINKS+=iswalnum.3 iswalpha.3 iswalnum.3 iswascii.3 iswalnum.3 iswblank.3 \
iswalnum.3 iswcntrl.3 iswalnum.3 iswdigit.3 iswalnum.3 iswgraph.3 \
- iswalnum.3 iswhexnumber.3 iswalnum.3 iswhexnumber.3 \
+ iswalnum.3 iswhexnumber.3 \
iswalnum.3 iswideogram.3 iswalnum.3 iswlower.3 iswalnum.3 iswnumber.3 \
iswalnum.3 iswphonogram.3 iswalnum.3 iswprint.3 iswalnum.3 iswpunct.3 \
iswalnum.3 iswrune.3 iswalnum.3 iswspace.3 iswalnum.3 iswspecial.3 \
==== //depot/projects/hammer/libexec/rtld-elf/rtld.c#19 (text+ko) ====
@@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/libexec/rtld-elf/rtld.c,v 1.94 2004/03/21 01:21:26 peter Exp $
+ * $FreeBSD: src/libexec/rtld-elf/rtld.c,v 1.95 2004/03/29 18:37:37 dfr Exp $
*/
/*
@@ -323,6 +323,7 @@
strcmp(obj_main->interp, obj_rtld.path) != 0) {
free(obj_rtld.path);
obj_rtld.path = xstrdup(obj_main->interp);
+ __progname = obj_rtld.path;
}
digest_dynamic(obj_main, 0);
==== //depot/projects/hammer/share/man/man9/copy.9#3 (text+ko) ====
@@ -32,7 +32,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/share/man/man9/copy.9,v 1.12 2003/10/23 02:22:07 hmp Exp $
+.\" $FreeBSD: src/share/man/man9/copy.9,v 1.14 2004/03/29 19:42:21 hmp Exp $
.\"
.Dd January 7, 1996
.Dt COPY 9
@@ -72,38 +72,50 @@
.Bl -tag -width "copyoutstr()"
.It Fn copyin
Copies
-.Pa len
+.Fa len
bytes of data from the user-space address
-.Pa uaddr
+.Fa uaddr
to the kernel-space address
-.Pa kaddr .
+.Fa kaddr .
.It Fn copyout
Copies
-.Pa len
+.Fa len
bytes of data from the kernel-space address
-.Pa kaddr
+.Fa kaddr
to the user-space address
-.Pa uaddr .
+.Fa uaddr .
.It Fn copystr
Copies a NUL-terminated string, at most
-.Pa len
+.Fa len
bytes long, from kernel-space address
-.Pa kfaddr
+.Fa kfaddr
to kernel-space address
-.Pa kdaddr .
+.Fa kdaddr .
The number of bytes actually copied, including the terminating
NUL, is returned in
-.Pa *done .
+.Fa *done
+.Po
+if
+.Fa done
+is
+.No non- Ns Dv NULL
+.Pc .
.It Fn copyinstr
Copies a NUL-terminated string, at most
-.Pa len
+.Fa len
bytes long, from user-space address
-.Pa uaddr
+.Fa uaddr
to kernel-space address
-.Pa kaddr .
+.Fa kaddr .
The number of bytes actually copied, including the terminating
NUL, is returned in
-.Pa *done .
+.Fa *done
+.Po
+if
+.Fa done
+is
+.No non- Ns Dv NULL Ns
+.Pc .
.\" .It Fn copyoutstr
.\" Copies a NUL-terminated string, at most
.\" bytes long, from kernel-space address
@@ -130,7 +142,7 @@
functions return
.Er ENAMETOOLONG
if the string is longer than
-.Pa len
+.Fa len
bytes.
.Sh SEE ALSO
.Xr fetch 9 ,
==== //depot/projects/hammer/sys/amd64/amd64/vm_machdep.c#35 (text+ko) ====
@@ -41,10 +41,9 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/vm_machdep.c,v 1.230 2004/03/25 03:39:38 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/vm_machdep.c,v 1.231 2004/03/29 19:38:05 peter Exp $");
#include "opt_isa.h"
-#include "opt_kstack_pages.h"
#include "opt_cpu.h"
#include <sys/param.h>
==== //depot/projects/hammer/sys/conf/NOTES#38 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1207 2004/03/18 12:22:31 brueffer Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1208 2004/03/29 22:41:20 peter Exp $
#
# NOTES -- Lines that can be cut/pasted into kernel and hints configs.
#
@@ -701,7 +701,8 @@
options PSEUDOFS #Pseudo-filesystem framework
options SMBFS #SMB/CIFS filesystem
options UDF #Universal Disk Format
-options UMAPFS #UID map filesystem
+#umapfs is seriously (functionally) broken at this point.
+#options UMAPFS #UID map filesystem
options UNIONFS #Union filesystem
# The xFS_ROOT options REQUIRE the associated ``options xFS''
options NFS_ROOT #NFS usable as root device
==== //depot/projects/hammer/sys/contrib/dev/oltr/if_oltr.c#8 (text+ko) ====
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/contrib/dev/oltr/if_oltr.c,v 1.32 2004/03/17 17:50:23 njl Exp $
+ * $FreeBSD: src/sys/contrib/dev/oltr/if_oltr.c,v 1.33 2004/03/29 21:10:05 imp Exp $
*/
#include <sys/param.h>
@@ -50,11 +50,6 @@
#include <net/if_media.h>
#include <net/iso88025.h>
-#if (__FreeBSD_version < 400000)
-#include <bpfilter.h>
-#endif
-
-#if (NBPFILTER > 0) || (__FreeBSD_version > 400000)
#include <net/bpf.h>
#ifndef BPF_MTAP
@@ -63,7 +58,6 @@
bpf_mtap((_ifp), (_m)); \
} while (0)
#endif
-#endif
#include <vm/vm.h> /* for vtophys */
#include <vm/pmap.h> /* for vtophys */
@@ -238,8 +232,6 @@
static int oltr_ifmedia_upd __P((struct ifnet *));
static void oltr_ifmedia_sts __P((struct ifnet *, struct ifmediareq *));
-#if __FreeBSD_version > 400000
-
static int oltr_pci_probe __P((device_t));
static int oltr_pci_attach __P((device_t));
static int oltr_pci_detach __P((device_t));
@@ -488,200 +480,7 @@
return;
}
-#else
-
-static const char *oltr_pci_probe __P((pcici_t, pcidi_t));
-static void oltr_pci_attach __P((pcici_t, int));
-
-static unsigned long oltr_count = 0;
-
-static struct pci_device oltr_device = {
- "oltr",
- oltr_pci_probe,
- oltr_pci_attach,
- &oltr_count,
- NULL
-};
-
-DATA_SET(pcidevice_set, oltr_device);
-
-static const char *
-oltr_pci_probe(pcici_t config_id, pcidi_t device_id)
-{
- int i, rc;
- char PCIConfigHeader[64];
- TRlldAdapterConfig_t config;
-
- if (((device_id & 0xffff) == PCI_VENDOR_OLICOM) && (
- (((device_id >> 16) & 0xffff) == 0x0001) ||
- (((device_id >> 16) & 0xffff) == 0x0004) ||
- (((device_id >> 16) & 0xffff) == 0x0005) ||
- (((device_id >> 16) & 0xffff) == 0x0007) ||
- (((device_id >> 16) & 0xffff) == 0x0008))) {
-
- for (i = 0; i < 64; i++)
- PCIConfigHeader[i] = pci_cfgread(config_id, i, /* bytes */ 1);
-
- rc = TRlldPCIConfig(&LldDriver, &config, PCIConfigHeader);
-
- if (rc == TRLLD_PCICONFIG_FAIL) {
- printf("oltr: TRlldPciConfig failed!\n");
- return(NULL);
- }
- if (rc == TRLLD_PCICONFIG_VERSION) {
- printf("oltr: wrong LLD version.\n");
- return(NULL);
- }
- return(AdapterName[config.type]);
- }
-
- return(NULL);
-}
-
static void
-oltr_pci_attach(pcici_t config_id, int unit)
-{
- int i, s, rc = 0, scratch_size;
- int media = IFM_TOKEN|IFM_TOK_UTP16;
- u_long command;
- char PCIConfigHeader[64];
- struct oltr_softc *sc;
- struct ifnet *ifp; /* = &sc->arpcom.ac_if; */
-
- s = splimp();
-
- sc = malloc(sizeof(struct oltr_softc), M_DEVBUF, M_NOWAIT | M_ZERO);
- if (sc == NULL) {
- printf("oltr%d: no memory for softc struct!\n", unit);
- goto config_failed;
- }
- sc->unit = unit;
- sc->state = OL_UNKNOWN;
- ifp = &sc->arpcom.ac_if;
-
- for (i = 0; i < sizeof(PCIConfigHeader); i++)
- PCIConfigHeader[i] = pci_cfgread(config_id, i, 1);
-
- switch(TRlldPCIConfig(&LldDriver, &sc->config, PCIConfigHeader)) {
- case TRLLD_PCICONFIG_OK:
- break;
- case TRLLD_PCICONFIG_SET_COMMAND:
- printf("oltr%d: enabling bus master mode\n", unit);
- command = pci_conf_read(config_id, PCIR_COMMAND);
- pci_conf_write(config_id, PCIR_COMMAND, (command | PCIM_CMD_BUSMASTEREN));
- command = pci_conf_read(config_id, PCIR_COMMAND);
- if (!(command & PCIM_CMD_BUSMASTEREN)) {
- printf("oltr%d: failed to enable bus master mode\n", unit);
- goto config_failed;
- }
- break;
- case TRLLD_PCICONFIG_FAIL:
- printf("oltr%d: TRlldPciConfig failed!\n", unit);
- goto config_failed;
- break;
- case TRLLD_PCICONFIG_VERSION:
- printf("oltr%d: wrong LLD version\n", unit);
- goto config_failed;
- break;
- }
- printf("oltr%d: MAC address %6D\n", unit, sc->config.macaddress, ":");
-
- scratch_size = TRlldAdapterSize();
- if (bootverbose)
- printf("oltr%d: adapter memory block size %d bytes\n", unit, scratch_size);
- sc->TRlldAdapter = (TRlldAdapter_t)malloc(scratch_size, M_DEVBUF, M_NOWAIT);
- if (sc->TRlldAdapter == NULL) {
- printf("oltr%d: couldn't allocate scratch buffer (%d bytes)\n",unit, scratch_size);
- goto config_failed;
- }
-
- /*
- * Allocate RX/TX Pools
- */
- for (i = 0; i < RING_BUFFER_LEN; i++) {
- sc->rx_ring[i].index = i;
- sc->rx_ring[i].data = (char *)malloc(RX_BUFFER_LEN, M_DEVBUF, M_NOWAIT);
- sc->rx_ring[i].address = vtophys(sc->rx_ring[i].data);
- sc->tx_ring[i].index = i;
- sc->tx_ring[i].data = (char *)malloc(TX_BUFFER_LEN, M_DEVBUF, M_NOWAIT);
- sc->tx_ring[i].address = vtophys(sc->tx_ring[i].data);
- if ((!sc->rx_ring[i].data) || (!sc->tx_ring[i].data)) {
- printf("oltr%d: unable to allocate ring buffers\n", unit);
- while (i > 0) {
- if (sc->rx_ring[i].data)
- free(sc->rx_ring[i].data, M_DEVBUF);
- if (sc->tx_ring[i].data)
- free(sc->tx_ring[i].data, M_DEVBUF);
- i--;
- }
- goto config_failed;
- }
- }
-
- /*
- * Allocate interrupt and DMA channel
- */
- if (!pci_map_int(config_id, oltr_intr, sc, &net_imask)) {
- printf("oltr%d: couldn't setup interrupt\n", unit);
- goto config_failed;
- }
-
- /*
- * Do the ifnet initialization
- */
- ifp->if_softc = sc;
- ifp->if_unit = unit;
- ifp->if_name = "oltr";
- ifp->if_output = iso88025_output;
- ifp->if_init = oltr_init;
- ifp->if_start = oltr_start;
- ifp->if_ioctl = oltr_ioctl;
- ifp->if_flags = IFF_BROADCAST;
- bcopy(sc->config.macaddress, sc->arpcom.ac_enaddr, sizeof(sc->config.macaddress));
-
- /*
- * Do ifmedia setup.
- */
- ifmedia_init(&sc->ifmedia, 0, oltr_ifmedia_upd, oltr_ifmedia_sts);
- rc = TRlldSetSpeed(sc->TRlldAdapter, TRLLD_SPEED_16MBPS);
- switch(sc->config.type) {
- case TRLLD_ADAPTER_PCI7: /* OC-3540 */
- ifmedia_add(&sc->ifmedia, IFM_TOKEN|IFM_TOK_UTP100, 0, NULL);
- /* FALL THROUGH */
- case TRLLD_ADAPTER_PCI4: /* OC-3139 */
- case TRLLD_ADAPTER_PCI5: /* OC-3140 */
- case TRLLD_ADAPTER_PCI6: /* OC-3141 */
- ifmedia_add(&sc->ifmedia, IFM_TOKEN|IFM_AUTO, 0, NULL);
- media = IFM_TOKEN|IFM_AUTO;
- rc = TRlldSetSpeed(sc->TRlldAdapter, 0);
- /* FALL THROUGH */
- default:
- ifmedia_add(&sc->ifmedia, IFM_TOKEN|IFM_TOK_UTP4, 0, NULL);
- ifmedia_add(&sc->ifmedia, IFM_TOKEN|IFM_TOK_UTP16, 0, NULL);
- break;
- }
- sc->ifmedia.ifm_media = media;
- ifmedia_set(&sc->ifmedia, media);
-
- /*
- * Attach the interface
- */
- if_attach(ifp);
- ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
- iso88025_ifattach(ifp);
-
- splx(s);
- return;
-
-config_failed:
- (void)splx(s);
-
- return;
-}
-
-#endif
-
-static void
oltr_intr(void *xsc)
{
struct oltr_softc *sc = (struct oltr_softc *)xsc;
@@ -761,9 +560,7 @@
sc->tx_head = RING_BUFFER((sc->tx_head + sc->frame_ring[frame].FragmentCount));
sc->tx_frame++;
-#if (NBPFILTER > 0) || (__FreeBSD_version > 400000)
BPF_MTAP(ifp, m0);
-#endif
/*ifp->if_opackets++;*/
bad:
==== //depot/projects/hammer/sys/fs/umapfs/umap_vnops.c#5 (text+ko) ====
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)umap_vnops.c 8.6 (Berkeley) 5/22/95
- * $FreeBSD: src/sys/fs/umapfs/umap_vnops.c,v 1.38 2003/03/03 19:15:39 njl Exp $
+ * $FreeBSD: src/sys/fs/umapfs/umap_vnops.c,v 1.39 2004/03/29 22:41:20 peter Exp $
*/
/*
@@ -363,6 +363,15 @@
} */ *ap;
{
+ /*
+ * vop_nolock no longer exists. I could have pasted the code
+ * in so that it compiles, but that would be doing our users a
+ * great disservice. umapfs is about 5 years behind the nullfs
+ * code that it is derived from. The stub locking here guarantees
+ * a deadlock the moment a VOP_INACTIVE arrives. There is no point
+ * pasting the code that makes it compile either, because that just
+ * makes it Even More Wrong.
+ */
vop_nolock(ap);
if ((ap->a_flags & LK_TYPE_MASK) == LK_DRAIN)
return (0);
==== //depot/projects/hammer/sys/i386/i386/vm_machdep.c#26 (text+ko) ====
@@ -41,10 +41,9 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/i386/i386/vm_machdep.c,v 1.233 2004/03/22 00:28:38 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/i386/i386/vm_machdep.c,v 1.234 2004/03/29 19:38:05 peter Exp $");
#include "opt_isa.h"
-#include "opt_kstack_pages.h"
#include "opt_npx.h"
#ifdef PC98
#include "opt_pc98.h"
==== //depot/projects/hammer/sys/kern/kern_sig.c#36 (text+ko) ====
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_sig.c,v 1.273 2004/03/05 22:39:53 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_sig.c,v 1.274 2004/03/29 22:46:54 peter Exp $");
#include "opt_compat.h"
#include "opt_ktrace.h"
@@ -1875,10 +1875,8 @@
mtx_unlock_spin(&sched_lock);
goto out;
/*
- * XXXKSE What about threads that are waiting on mutexes?
- * Shouldn't they abort too?
- * No, hopefully mutexes are short lived.. They'll
- * eventually hit thread_suspend_check().
+ * Mutexes are short lived. Threads waiting on them will
+ * hit thread_suspend_check() soon.
*/
} else if (p->p_state == PRS_NORMAL) {
if ((p->p_flag & P_TRACED) || (action != SIG_DFL) ||
==== //depot/projects/hammer/sys/kern/vfs_default.c#18 (text+ko) ====
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/vfs_default.c,v 1.91 2003/11/05 04:30:07 kan Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/vfs_default.c,v 1.92 2004/03/29 22:41:20 peter Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -369,166 +369,6 @@
}
/*
- * Stubs to use when there is no locking to be done on the underlying object.
- * A minimal shared lock is necessary to ensure that the underlying object
- * is not revoked while an operation is in progress. So, an active shared
- * count is maintained in an auxillary vnode lock structure.
- */
-int
-vop_sharedlock(ap)
- struct vop_lock_args /* {
- struct vnode *a_vp;
- int a_flags;
- struct thread *a_td;
- } */ *ap;
-{
- /*
- * This code cannot be used until all the non-locking filesystems
- * (notably NFS) are converted to properly lock and release nodes.
- * Also, certain vnode operations change the locking state within
- * the operation (create, mknod, remove, link, rename, mkdir, rmdir,
- * and symlink). Ideally these operations should not change the
- * lock state, but should be changed to let the caller of the
- * function unlock them. Otherwise all intermediate vnode layers
- * (such as union, umapfs, etc) must catch these functions to do
- * the necessary locking at their layer. Note that the inactive
- * and lookup operations also change their lock state, but this
- * cannot be avoided, so these two operations will always need
- * to be handled in intermediate layers.
- */
- struct vnode *vp = ap->a_vp;
- int vnflags, flags = ap->a_flags;
-
- switch (flags & LK_TYPE_MASK) {
- case LK_DRAIN:
- vnflags = LK_DRAIN;
- break;
- case LK_EXCLUSIVE:
-#ifdef DEBUG_VFS_LOCKS
- /*
- * Normally, we use shared locks here, but that confuses
- * the locking assertions.
- */
- vnflags = LK_EXCLUSIVE;
- break;
-#endif
- case LK_SHARED:
- vnflags = LK_SHARED;
- break;
- case LK_UPGRADE:
- case LK_EXCLUPGRADE:
- case LK_DOWNGRADE:
- return (0);
- case LK_RELEASE:
- default:
- panic("vop_sharedlock: bad operation %d", flags & LK_TYPE_MASK);
- }
- vnflags |= flags & (LK_INTERLOCK | LK_EXTFLG_MASK);
-#ifndef DEBUG_LOCKS
- return (lockmgr(vp->v_vnlock, vnflags, VI_MTX(vp), ap->a_td));
-#else
- return (debuglockmgr(vp->v_vnlock, vnflags, VI_MTX(vp), ap->a_td,
- "vop_sharedlock", vp->filename, vp->line));
-#endif
-}
-
-/*
- * Stubs to use when there is no locking to be done on the underlying object.
- * A minimal shared lock is necessary to ensure that the underlying object
- * is not revoked while an operation is in progress. So, an active shared
- * count is maintained in an auxillary vnode lock structure.
- */
-int
-vop_nolock(ap)
- struct vop_lock_args /* {
- struct vnode *a_vp;
- int a_flags;
- struct thread *a_td;
- } */ *ap;
-{
-#ifdef notyet
- /*
- * This code cannot be used until all the non-locking filesystems
- * (notably NFS) are converted to properly lock and release nodes.
- * Also, certain vnode operations change the locking state within
- * the operation (create, mknod, remove, link, rename, mkdir, rmdir,
- * and symlink). Ideally these operations should not change the
- * lock state, but should be changed to let the caller of the
- * function unlock them. Otherwise all intermediate vnode layers
- * (such as union, umapfs, etc) must catch these functions to do
- * the necessary locking at their layer. Note that the inactive
- * and lookup operations also change their lock state, but this
- * cannot be avoided, so these two operations will always need
- * to be handled in intermediate layers.
- */
- struct vnode *vp = ap->a_vp;
- int vnflags, flags = ap->a_flags;
-
- switch (flags & LK_TYPE_MASK) {
- case LK_DRAIN:
- vnflags = LK_DRAIN;
- break;
- case LK_EXCLUSIVE:
- case LK_SHARED:
- vnflags = LK_SHARED;
- break;
- case LK_UPGRADE:
- case LK_EXCLUPGRADE:
- case LK_DOWNGRADE:
- return (0);
- case LK_RELEASE:
- default:
- panic("vop_nolock: bad operation %d", flags & LK_TYPE_MASK);
- }
- vnflags |= flags & (LK_INTERLOCK | LK_EXTFLG_MASK);
- return(lockmgr(vp->v_vnlock, vnflags, VI_MTX(vp), ap->a_td));
-#else /* for now */
- /*
- * Since we are not using the lock manager, we must clear
- * the interlock here.
- */
- if (ap->a_flags & LK_INTERLOCK)
- VI_UNLOCK(ap->a_vp);
- return (0);
-#endif
-}
-
-/*
- * Do the inverse of vop_nolock, handling the interlock in a compatible way.
- */
-int
-vop_nounlock(ap)
- struct vop_unlock_args /* {
- struct vnode *a_vp;
- int a_flags;
- struct thread *a_td;
- } */ *ap;
-{
-
- /*
- * Since we are not using the lock manager, we must clear
- * the interlock here.
- */
- if (ap->a_flags & LK_INTERLOCK)
- VI_UNLOCK(ap->a_vp);
- return (0);
-}
-
-/*
- * Return whether or not the node is in use.
- */
-int
-vop_noislocked(ap)
- struct vop_islocked_args /* {
- struct vnode *a_vp;
- struct thread *a_td;
- } */ *ap;
-{
-
- return (0);
-}
-
-/*
* Return our mount point, as we will take charge of the writes.
*/
int
==== //depot/projects/hammer/sys/kern/vfs_subr.c#35 (text+ko) ====
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/vfs_subr.c,v 1.487 2004/03/11 18:02:35 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/vfs_subr.c,v 1.488 2004/03/29 22:45:33 peter Exp $");
#include "opt_ddb.h"
#include "opt_mac.h"
@@ -532,7 +532,7 @@
struct mount *mp, *nmp;
int done;
struct proc *p = vnlruproc;
- struct thread *td = FIRST_THREAD_IN_PROC(p); /* XXXKSE */
+ struct thread *td = FIRST_THREAD_IN_PROC(p);
mtx_lock(&Giant);
@@ -1487,7 +1487,7 @@
struct vnode *vp;
struct mount *mp;
long starttime;
- struct thread *td = FIRST_THREAD_IN_PROC(updateproc); /* XXXKSE */
+ struct thread *td = FIRST_THREAD_IN_PROC(updateproc);
mtx_lock(&Giant);
@@ -1591,7 +1591,6 @@
* Request the syncer daemon to speed up its work.
* We never push it to speed up more than half of its
* normal turn time, otherwise it could take over the cpu.
- * XXXKSE only one update?
*/
int
speedup_syncer()
==== //depot/projects/hammer/sys/libkern/index.c#3 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/libkern/index.c,v 1.7 2003/06/11 05:23:04 obrien Exp $");
+__FBSDID("$FreeBSD: src/sys/libkern/index.c,v 1.8 2004/03/29 21:15:41 robert Exp $");
#include <sys/param.h>
#include <sys/libkern.h>
@@ -51,7 +51,7 @@
for (;; ++u.p) {
if (*u.p == ch)
return(u.p);
- if (!*u.p)
+ if (*u.p == '\0')
return(NULL);
}
/* NOTREACHED */
==== //depot/projects/hammer/sys/libkern/rindex.c#3 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/libkern/rindex.c,v 1.8 2003/06/11 05:23:04 obrien Exp $");
+__FBSDID("$FreeBSD: src/sys/libkern/rindex.c,v 1.9 2004/03/29 21:15:41 robert Exp $");
#include <sys/param.h>
#include <sys/libkern.h>
@@ -52,7 +52,7 @@
for (save = NULL;; ++u.p) {
if (*u.p == ch)
save = u.p;
- if (!*u.p)
+ if (*u.p == '\0')
return(save);
}
/* NOTREACHED */
==== //depot/projects/hammer/sys/modules/Makefile#40 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/modules/Makefile,v 1.374 2004/03/25 17:20:45 rik Exp $
+# $FreeBSD: src/sys/modules/Makefile,v 1.375 2004/03/29 22:41:21 peter Exp $
# pcic -- currently broken and being worked on out of tree.
# oldcard -- specialized use for debugging only.
@@ -222,7 +222,6 @@
uhid \
ukbd \
ulpt \
- umapfs \
umass \
umct \
umodem \
==== //depot/projects/hammer/sys/net/if_tun.c#15 (text+ko) ====
@@ -13,7 +13,7 @@
* UCL. This driver is based much more on read/write/poll mode of
* operation though.
*
- * $FreeBSD: src/sys/net/if_tun.c,v 1.138 2004/03/29 18:42:51 rwatson Exp $
+ * $FreeBSD: src/sys/net/if_tun.c,v 1.139 2004/03/29 22:16:39 rwatson Exp $
*/
#include "opt_atalk.h"
@@ -55,6 +55,11 @@
#include <sys/queue.h>
+/*
+ * tun_list is protected by global tunmtx. Other mutable fields are
+ * protected by tun->tun_mtx, or by their owning subsystem. tun_dev is
+ * static for the duration of a tunnel interface.
+ */
struct tun_softc {
TAILQ_ENTRY(tun_softc) tun_list;
dev_t tun_dev;
@@ -82,6 +87,7 @@
struct ifnet tun_if; /* the interface */
struct sigio *tun_sigio; /* information for async I/O */
struct selinfo tun_rsel; /* read select */
+ struct mtx tun_mtx; /* protect mutable softc fields */
};
#define TUNDEBUG if (tundebug) if_printf
@@ -158,6 +164,7 @@
{
dev_t dev;
+ /* Unlocked read. */
KASSERT((tp->tun_flags & TUN_OPEN) == 0,
("tununits is out of sync - unit %d", tp->tun_if.if_dunit));
@@ -165,6 +172,7 @@
bpfdetach(&tp->tun_if);
if_detach(&tp->tun_if);
destroy_dev(dev);
+ mtx_destroy(&tp->tun_mtx);
free(tp, M_TUN);
}
@@ -213,12 +221,16 @@
{
struct tun_softc *tp = ifp->if_softc;
+ mtx_lock(&tp->tun_mtx);
if (tp->tun_flags & TUN_RWAIT) {
tp->tun_flags &= ~TUN_RWAIT;
wakeup(tp);
}
- if (tp->tun_flags & TUN_ASYNC && tp->tun_sigio)
+ if (tp->tun_flags & TUN_ASYNC && tp->tun_sigio) {
+ mtx_unlock(&tp->tun_mtx);
pgsigio(&tp->tun_sigio, SIGIO, 0);
+ } else
+ mtx_unlock(&tp->tun_mtx);
selwakeuppri(&tp->tun_rsel, PZERO + 1);
}
@@ -231,6 +243,7 @@
dev->si_flags &= ~SI_CHEAPCLONE;
MALLOC(sc, struct tun_softc *, sizeof(*sc), M_TUN, M_WAITOK | M_ZERO);
+ mtx_init(&sc->tun_mtx, "tun_mtx", NULL, MTX_DEF);
sc->tun_flags = TUN_INITED;
sc->tun_dev = dev;
mtx_lock(&tunmtx);
@@ -258,17 +271,31 @@
struct ifnet *ifp;
struct tun_softc *tp;
+ /*
+ * XXXRW: Non-atomic test and set of dev->si_drv1 requires
+ * synchronization.
+ */
tp = dev->si_drv1;
if (!tp) {
tuncreate(dev);
tp = dev->si_drv1;
}
- if (tp->tun_pid != 0 && tp->tun_pid != td->td_proc->p_pid)
+ /*
+ * XXXRW: This use of tun_pid is subject to error due to the
+ * fact that a reference to the tunnel can live beyond the
+ * death of the process that created it. Can we replace this
+ * with a simple busy flag?
+ */
+ mtx_lock(&tp->tun_mtx);
+ if (tp->tun_pid != 0 && tp->tun_pid != td->td_proc->p_pid) {
+ mtx_unlock(&tp->tun_mtx);
return (EBUSY);
+ }
tp->tun_pid = td->td_proc->p_pid;
tp->tun_flags |= TUN_OPEN;
+ mtx_unlock(&tp->tun_mtx);
ifp = &tp->tun_if;
TUNDEBUG(ifp, "open\n");
@@ -289,8 +316,10 @@
tp = dev->si_drv1;
ifp = &tp->tun_if;
+ mtx_lock(&tp->tun_mtx);
tp->tun_flags &= ~TUN_OPEN;
tp->tun_pid = 0;
+ mtx_unlock(&tp->tun_mtx);
/*
* junk all pending output
@@ -310,6 +339,7 @@
/* find internet addresses and delete routes */
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
if (ifa->ifa_addr->sa_family == AF_INET)
+ /* Unlocked read. */
rtinit(ifa, (int)RTM_DELETE,
tp->tun_flags & TUN_DSTADDR ? RTF_HOST : 0);
ifp->if_flags &= ~IFF_RUNNING;
@@ -345,12 +375,14 @@
struct sockaddr_in *si;
si = (struct sockaddr_in *)ifa->ifa_addr;
+ mtx_lock(&tp->tun_mtx);
if (si->sin_addr.s_addr)
tp->tun_flags |= TUN_IASET;
si = (struct sockaddr_in *)ifa->ifa_dstaddr;
if (si && si->sin_addr.s_addr)
tp->tun_flags |= TUN_DSTADDR;
+ mtx_unlock(&tp->tun_mtx);
}
#endif
}
@@ -373,9 +405,11 @@
switch(cmd) {
case SIOCGIFSTATUS:
ifs = (struct ifstat *)data;
+ mtx_lock(&tp->tun_mtx);
if (tp->tun_pid)
sprintf(ifs->ascii + strlen(ifs->ascii),
"\tOpened by PID %d\n", tp->tun_pid);
+ mtx_unlock(&tp->tun_mtx);
break;
case SIOCSIFADDR:
error = tuninit(ifp);
@@ -411,6 +445,7 @@
struct rtentry *rt)
{
struct tun_softc *tp = ifp->if_softc;
+ u_short cached_tun_flags;
#ifdef MAC
int error;
#endif
@@ -425,7 +460,11 @@
}
#endif
- if ((tp->tun_flags & TUN_READY) != TUN_READY) {
+ /* Could be unlocked read? */
+ mtx_lock(&tp->tun_mtx);
+ cached_tun_flags = tp->tun_flags;
+ mtx_unlock(&tp->tun_mtx);
+ if ((cached_tun_flags & TUN_READY) != TUN_READY) {
TUNDEBUG (ifp, "not ready 0%o\n", tp->tun_flags);
m_freem (m0);
return (EHOSTDOWN);
@@ -450,7 +489,7 @@
}
/* prepend sockaddr? this may abort if the mbuf allocation fails */
- if (tp->tun_flags & TUN_LMODE) {
+ if (cached_tun_flags & TUN_LMODE) {
/* allocate space for sockaddr */
M_PREPEND(m0, dst->sa_len, M_DONTWAIT);
@@ -464,7 +503,7 @@
}
}
- if (tp->tun_flags & TUN_IFHEAD) {
+ if (cached_tun_flags & TUN_IFHEAD) {
/* Prepend the address family */
M_PREPEND(m0, 4, M_DONTWAIT);
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list