Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Feb 2010 00:30:24 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r203850 - in user/imp/tbemd: gnu/usr.bin/gdb/kgdb lib/libusb sbin/growfs sbin/restore share/man/man9 sys/boot/sparc64/loader sys/dev/acpica sys/dev/cxgb sys/dev/e1000 sys/dev/ixgbe sys/...
Message-ID:  <201002140030.o1E0UOuO006857@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Sun Feb 14 00:30:24 2010
New Revision: 203850
URL: http://svn.freebsd.org/changeset/base/203850

Log:
  merge from head.

Added:
  user/imp/tbemd/sys/sparc64/include/cmt.h
     - copied unchanged from r203844, head/sys/sparc64/include/cmt.h
  user/imp/tbemd/sys/sparc64/include/fireplane.h
     - copied unchanged from r203844, head/sys/sparc64/include/fireplane.h
  user/imp/tbemd/sys/sparc64/include/jbus.h
     - copied unchanged from r203844, head/sys/sparc64/include/jbus.h
  user/imp/tbemd/sys/sparc64/include/nexusvar.h
     - copied unchanged from r203844, head/sys/sparc64/include/nexusvar.h
  user/imp/tbemd/sys/sun4v/include/cmt.h
     - copied unchanged from r203844, head/sys/sun4v/include/cmt.h
  user/imp/tbemd/sys/sun4v/include/fireplane.h
     - copied unchanged from r203844, head/sys/sun4v/include/fireplane.h
  user/imp/tbemd/sys/sun4v/include/jbus.h
     - copied unchanged from r203844, head/sys/sun4v/include/jbus.h
Modified:
  user/imp/tbemd/gnu/usr.bin/gdb/kgdb/kthr.c
  user/imp/tbemd/lib/libusb/libusb.h
  user/imp/tbemd/lib/libusb/libusb10.c
  user/imp/tbemd/lib/libusb/libusb10_desc.c
  user/imp/tbemd/lib/libusb/libusb10_io.c
  user/imp/tbemd/lib/libusb/libusb20.c
  user/imp/tbemd/lib/libusb/libusb20.h
  user/imp/tbemd/lib/libusb/libusb20_compat01.c
  user/imp/tbemd/lib/libusb/libusb20_desc.c
  user/imp/tbemd/lib/libusb/libusb20_ugen20.c
  user/imp/tbemd/lib/libusb/usb.h
  user/imp/tbemd/sbin/growfs/growfs.c
  user/imp/tbemd/sbin/restore/tape.c
  user/imp/tbemd/share/man/man9/locking.9
  user/imp/tbemd/share/man/man9/vnode.9
  user/imp/tbemd/sys/boot/sparc64/loader/main.c
  user/imp/tbemd/sys/dev/acpica/acpi_video.c
  user/imp/tbemd/sys/dev/cxgb/cxgb_sge.c
  user/imp/tbemd/sys/dev/e1000/if_em.c
  user/imp/tbemd/sys/dev/e1000/if_igb.c
  user/imp/tbemd/sys/dev/ixgbe/ixgbe.c
  user/imp/tbemd/sys/dev/mxge/if_mxge.c
  user/imp/tbemd/sys/fs/msdosfs/bootsect.h
  user/imp/tbemd/sys/fs/msdosfs/bpb.h
  user/imp/tbemd/sys/fs/msdosfs/denode.h
  user/imp/tbemd/sys/fs/msdosfs/direntry.h
  user/imp/tbemd/sys/fs/msdosfs/msdosfs_conv.c
  user/imp/tbemd/sys/fs/msdosfs/msdosfs_denode.c
  user/imp/tbemd/sys/fs/msdosfs/msdosfs_lookup.c
  user/imp/tbemd/sys/fs/msdosfs/msdosfs_vnops.c
  user/imp/tbemd/sys/net/if_var.h
  user/imp/tbemd/sys/sparc64/include/asi.h
  user/imp/tbemd/sys/sparc64/include/ktr.h
  user/imp/tbemd/sys/sparc64/include/md_var.h
  user/imp/tbemd/sys/sparc64/include/upa.h
  user/imp/tbemd/sys/sparc64/sparc64/locore.S
  user/imp/tbemd/sys/sparc64/sparc64/machdep.c
  user/imp/tbemd/sys/sparc64/sparc64/mp_locore.S
  user/imp/tbemd/sys/sparc64/sparc64/mp_machdep.c
  user/imp/tbemd/sys/sparc64/sparc64/nexus.c
  user/imp/tbemd/sys/sparc64/sparc64/pmap.c
  user/imp/tbemd/sys/sun4v/include/asi.h
  user/imp/tbemd/sys/ufs/ffs/ffs_alloc.c
Directory Properties:
  user/imp/tbemd/   (props changed)

Modified: user/imp/tbemd/gnu/usr.bin/gdb/kgdb/kthr.c
==============================================================================
--- user/imp/tbemd/gnu/usr.bin/gdb/kgdb/kthr.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/gnu/usr.bin/gdb/kgdb/kthr.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -58,6 +58,7 @@ kgdb_lookup(const char *sym)
 {
 	struct nlist nl[2];
 
+	nl[0].n_type = N_UNDF;
 	nl[0].n_name = (char *)(uintptr_t)sym;
 	nl[1].n_name = NULL;
 	if (kvm_nlist(kvm, nl) != 0)

Modified: user/imp/tbemd/lib/libusb/libusb.h
==============================================================================
--- user/imp/tbemd/lib/libusb/libusb.h	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/lib/libusb/libusb.h	Sun Feb 14 00:30:24 2010	(r203850)
@@ -30,8 +30,6 @@
 #include <sys/time.h>
 #include <sys/types.h>
 
-
-
 #ifdef __cplusplus
 extern	"C" {
 #endif

Modified: user/imp/tbemd/lib/libusb/libusb10.c
==============================================================================
--- user/imp/tbemd/lib/libusb/libusb10.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/lib/libusb/libusb10.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -25,16 +25,17 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/queue.h>
+
 #include <assert.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
+#include <errno.h>
 #include <poll.h>
 #include <pthread.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <sys/fcntl.h>
-#include <sys/queue.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 #include "libusb20.h"
 #include "libusb20_desc.h"

Modified: user/imp/tbemd/lib/libusb/libusb10_desc.c
==============================================================================
--- user/imp/tbemd/lib/libusb/libusb10_desc.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/lib/libusb/libusb10_desc.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -24,10 +24,11 @@
  * SUCH DAMAGE.
  */
 
-#include <stdlib.h>
-#include <stdio.h>
 #include <sys/queue.h>
 
+#include <stdio.h>
+#include <stdlib.h>
+
 #include "libusb20.h"
 #include "libusb20_desc.h"
 #include "libusb20_int.h"

Modified: user/imp/tbemd/lib/libusb/libusb10_io.c
==============================================================================
--- user/imp/tbemd/lib/libusb/libusb10_io.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/lib/libusb/libusb10_io.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -24,14 +24,15 @@
  * SUCH DAMAGE.
  */
 
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
+#include <sys/queue.h>
+
+#include <errno.h>
 #include <poll.h>
 #include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <time.h>
-#include <errno.h>
-#include <sys/queue.h>
+#include <unistd.h>
 
 #include "libusb20.h"
 #include "libusb20_desc.h"

Modified: user/imp/tbemd/lib/libusb/libusb20.c
==============================================================================
--- user/imp/tbemd/lib/libusb/libusb20.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/lib/libusb/libusb20.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -24,12 +24,13 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/queue.h>
+
+#include <ctype.h>
+#include <poll.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <poll.h>
-#include <ctype.h>
-#include <sys/queue.h>
 
 #include "libusb20.h"
 #include "libusb20_desc.h"

Modified: user/imp/tbemd/lib/libusb/libusb20.h
==============================================================================
--- user/imp/tbemd/lib/libusb/libusb20.h	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/lib/libusb/libusb20.h	Sun Feb 14 00:30:24 2010	(r203850)
@@ -29,13 +29,13 @@
 #ifndef _LIBUSB20_H_
 #define	_LIBUSB20_H_
 
-#include <stdint.h>
-#include <time.h>
-#include <string.h>
-
+#include <sys/endian.h>
 #include <sys/time.h>
 #include <sys/types.h>
-#include <sys/endian.h>
+
+#include <stdint.h>
+#include <string.h>
+#include <time.h>
 
 #ifdef __cplusplus
 extern	"C" {

Modified: user/imp/tbemd/lib/libusb/libusb20_compat01.c
==============================================================================
--- user/imp/tbemd/lib/libusb/libusb20_compat01.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/lib/libusb/libusb20_compat01.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -30,9 +30,9 @@
 
 #include <sys/queue.h>
 
-#include <stdlib.h>
-#include <stdio.h>
 #include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
 
 #include "libusb20.h"
 #include "libusb20_desc.h"

Modified: user/imp/tbemd/lib/libusb/libusb20_desc.c
==============================================================================
--- user/imp/tbemd/lib/libusb/libusb20_desc.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/lib/libusb/libusb20_desc.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -24,10 +24,11 @@
  * SUCH DAMAGE.
  */
 
+#include <sys/queue.h>
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/queue.h>
 
 #include "libusb20.h"
 #include "libusb20_desc.h"

Modified: user/imp/tbemd/lib/libusb/libusb20_ugen20.c
==============================================================================
--- user/imp/tbemd/lib/libusb/libusb20_ugen20.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/lib/libusb/libusb20_ugen20.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -27,12 +27,12 @@
 #include <sys/queue.h>
 #include <sys/types.h>
 
+#include <errno.h>
+#include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <string.h>
-#include <fcntl.h>
-#include <errno.h>
+#include <unistd.h>
 
 #include "libusb20.h"
 #include "libusb20_desc.h"

Modified: user/imp/tbemd/lib/libusb/usb.h
==============================================================================
--- user/imp/tbemd/lib/libusb/usb.h	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/lib/libusb/usb.h	Sun Feb 14 00:30:24 2010	(r203850)
@@ -27,9 +27,10 @@
 #ifndef _LIBUSB20_COMPAT_01_H_
 #define	_LIBUSB20_COMPAT_01_H_
 
-#include <stdint.h>
-#include <sys/types.h>
 #include <sys/param.h>
+#include <sys/endian.h>
+
+#include <stdint.h>
 
 /* USB interface class codes */
 

Modified: user/imp/tbemd/sbin/growfs/growfs.c
==============================================================================
--- user/imp/tbemd/sbin/growfs/growfs.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sbin/growfs/growfs.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -450,13 +450,11 @@ initcg(int cylno, time_t utime, int fso,
 			acg.cg_cs.cs_nifree--;
 		}
 	/*
-	 * XXX Newfs writes out two blocks of initialized inodes
-	 *     unconditionally.  Should we check here to make sure that they
-	 *     were actually written?
+	 * For the old file system, we have to initialize all the inodes.
 	 */
 	if (sblock.fs_magic == FS_UFS1_MAGIC) {
 		bzero(iobuf, sblock.fs_bsize);
-		for (i = 2 * sblock.fs_frag; i < sblock.fs_ipg / INOPF(&sblock);
+		for (i = 0; i < sblock.fs_ipg / INOPF(&sblock);
 		     i += sblock.fs_frag) {
 			dp1 = (struct ufs1_dinode *)iobuf;
 #ifdef FSIRAND

Modified: user/imp/tbemd/sbin/restore/tape.c
==============================================================================
--- user/imp/tbemd/sbin/restore/tape.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sbin/restore/tape.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -227,7 +227,7 @@ setup(void)
 	volno = 1;
 	setdumpnum();
 	FLUSHTAPEBUF();
-	if (!pipein && !bflag)
+	if (!pipein && !pipecmdin && !bflag)
 		findtapeblksize();
 	if (gethead(&spcl) == FAIL) {
 		fprintf(stderr, "Tape is not a dump tape\n");

Modified: user/imp/tbemd/share/man/man9/locking.9
==============================================================================
--- user/imp/tbemd/share/man/man9/locking.9	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/share/man/man9/locking.9	Sun Feb 14 00:30:24 2010	(r203850)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 10, 2010
+.Dd February 13, 2010
 .Dt LOCKING 9
 .Os
 .Sh NAME
@@ -36,41 +36,9 @@ The
 kernel is written to run across multiple CPUs and as such requires
 several different synchronization primitives to allow the developers
 to safely access and manipulate the many data types required.
-.Pp
-These include:
-.Bl -enum
-.It
-Mutexes
-.It
-Spin mutexes
-.It
-Pool mutexes
-.It
-Shared/exclusive locks
-.It
-Reader/writer locks
-.It
-Read-mostly locks
-.It
-Counting semaphores
-.It
-Condition variables
-.It
-Sleep/wakeup
-.It
-Giant
-.It
-Lockmanager locks
-.El
-.Pp
-The primitives interact and have a number of rules regarding how
-they can and can not be combined.
-Many of these rules are checked using the
-.Xr witness 4
-code.
-.Pp
 .Ss Mutexes
-Mutexes are the most commonly used synchronization primitive in the kernel.
+Mutexes (also called "sleep mutexes") are the most commonly used
+synchronization primitive in the kernel.
 Thread acquires (locks) a mutex before accessing data shared with other
 threads (including interrupt threads), and releases (unlocks) it afterwards.
 If the mutex cannot be acquired, the thread requesting it will sleep.
@@ -85,12 +53,10 @@ the two is that spin mutexes never sleep
 for the thread holding the lock, which runs on another CPU, to release it.
 Differently from ordinary mutex, spin mutexes disable interrupts when acquired.
 Since disabling interrupts is expensive, they are also generally slower.
-Spin mutexes should only be used to protect data shared with primary
-(INTR_FILTER) interrupt code.
-You 
-.Em must not
-do anything that deschedules the thread while you
-are holding a spin mutex.
+Spin mutexes should be used only when neccessary, e.g. to protect data shared
+with interrupt filter code (see
+.Xr bus_setup_intr 9
+for details).
 .Ss Pool mutexes
 With most synchronisaton primitives, such as mutexes, programmer must
 provide a piece of allocated memory to hold the primitive.
@@ -284,6 +250,11 @@ See
 .Xr lock 9
 for details.
 .Sh INTERACTIONS
+The primitives interact and have a number of rules regarding how
+they can and can not be combined.
+Many of these rules are checked using the
+.Xr witness 4
+code.
 .Ss Bounded vs. unbounded sleep
 The following primitives perform bounded sleep: mutexes, pool mutexes,
 reader/writer locks and read-mostly locks.
@@ -320,21 +291,23 @@ rwlock, your sleep, will cause a panic.
 If the sleep only happens rarely it may be years before the 
 bad code path is found.
 .Pp
+It is an error to do any operation that could result in any kind of sleep when
+running inside an interrupt filter.
+.Pp
 It is an error to do any operation that could result in unbounded sleep when
 running inside an interrupt thread.
 .Ss Interaction table
-The following table shows what you can and can not do if you hold
-one of the synchronization primitives discussed here:
-(someone who knows what they are talking about should write this table)
+The following table shows what you can and can not do while holding
+one of the synchronization primitives discussed:
 .Bl -column ".Ic xxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXX" -offset indent
 .It Xo
 .Em "You have: You want:" Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
 .Xc
-.It Ic spin mtx  Ta \&ok-1 Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no-3
-.It Ic mutex     Ta \&ok Ta \&ok-1 Ta \&no Ta \&ok Ta \&ok Ta \&no-3
-.It Ic sx        Ta \&ok Ta \&ok Ta \&ok-2 Ta \&ok Ta \&ok Ta \&ok-4
-.It Ic rwlock    Ta \&ok Ta \&ok Ta \&no Ta \&ok-2 Ta \&ok Ta \&no-3
-.It Ic rmlock    Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&ok-2 Ta \&no
+.It spin mtx  Ta \&ok-1 Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no-3
+.It mutex     Ta \&ok Ta \&ok-1 Ta \&no Ta \&ok Ta \&ok Ta \&no-3
+.It sx        Ta \&ok Ta \&ok Ta \&ok-2 Ta \&ok Ta \&ok Ta \&ok-4
+.It rwlock    Ta \&ok Ta \&ok Ta \&no Ta \&ok-2 Ta \&ok Ta \&no-3
+.It rmlock    Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&ok-2 Ta \&no
 .El
 .Pp
 .Em *1
@@ -364,10 +337,12 @@ The next table shows what can be used in
 At this time this is a rather easy to remember table.
 .Bl -column ".Ic Xxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXX" -offset indent
 .It Xo
-.Em "Context:" Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
+.Em "Context:"  Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep
 .Xc
-.It interrupt:  Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no 
-.It idle:  Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no 
+.It interrupt filter:  Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no 
+.It ithread:    Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&ok Ta \&no 
+.It callout:    Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&no Ta \&no 
+.It syscall:    Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok 
 .El
 .Sh SEE ALSO
 .Xr condvar 9 ,

Modified: user/imp/tbemd/share/man/man9/vnode.9
==============================================================================
--- user/imp/tbemd/share/man/man9/vnode.9	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/share/man/man9/vnode.9	Sun Feb 14 00:30:24 2010	(r203850)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 9, 2010
+.Dd February 13, 2010
 .Os
 .Dt VNODE 9
 .Sh NAME
@@ -137,7 +137,7 @@ Advisory locking will not work on this.
 A FIFO (named pipe).
 Advisory locking will not work on this.
 .It Dv VBAD
-An old style bad sector map
+Indicates that the vnode has been reclaimed.
 .El
 .Sh IMPLEMENTATION NOTES
 VFIFO uses the "struct fileops" from

Modified: user/imp/tbemd/sys/boot/sparc64/loader/main.c
==============================================================================
--- user/imp/tbemd/sys/boot/sparc64/loader/main.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sys/boot/sparc64/loader/main.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -46,16 +46,19 @@ __FBSDID("$FreeBSD$");
  */
 
 #include <stand.h>
-#include <sys/exec.h>
 #include <sys/param.h>
-#include <sys/queue.h>
+#include <sys/exec.h>
 #include <sys/linker.h>
+#include <sys/queue.h>
 #include <sys/types.h>
 
 #include <vm/vm.h>
 #include <machine/asi.h>
+#include <machine/cmt.h>
 #include <machine/cpufunc.h>
 #include <machine/elf.h>
+#include <machine/fireplane.h>
+#include <machine/jbus.h>
 #include <machine/lsu.h>
 #include <machine/metadata.h>
 #include <machine/tte.h>
@@ -68,6 +71,12 @@ __FBSDID("$FreeBSD$");
 #include "libofw.h"
 #include "dev_net.h"
 
+#ifndef CTASSERT
+#define	CTASSERT(x)		_CTASSERT(x, __LINE__)
+#define	_CTASSERT(x, y)		__CTASSERT(x, y)
+#define	__CTASSERT(x, y)	typedef char __assert ## y[(x) ? 1 : -1]
+#endif
+
 extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[];
 
 enum {
@@ -76,6 +85,9 @@ enum {
 	LOADSZ		= 0x1000000	/* for kernel and modules */
 };
 
+/* At least Sun Fire V1280 require page sized allocations to be claimed. */
+CTASSERT(HEAPSZ % PAGE_SIZE == 0);
+
 static struct mmu_ops {
 	void (*tlb_init)(void);
 	int (*mmu_mapin)(vm_offset_t va, vm_size_t len);
@@ -84,11 +96,11 @@ static struct mmu_ops {
 typedef void kernel_entry_t(vm_offset_t mdp, u_long o1, u_long o2, u_long o3,
     void *openfirmware);
 
-static inline u_long dtlb_get_data_sun4u(int slot);
-static void dtlb_enter_sun4u(u_long vpn, u_long data);
+static inline u_long dtlb_get_data_sun4u(u_int);
+static int dtlb_enter_sun4u(u_int, u_long data, vm_offset_t);
 static vm_offset_t dtlb_va_to_pa_sun4u(vm_offset_t);
-static inline u_long itlb_get_data_sun4u(int slot);
-static void itlb_enter_sun4u(u_long vpn, u_long data);
+static inline u_long itlb_get_data_sun4u(u_int);
+static int itlb_enter_sun4u(u_int, u_long data, vm_offset_t);
 static vm_offset_t itlb_va_to_pa_sun4u(vm_offset_t);
 static void itlb_relocate_locked0_sun4u(void);
 extern vm_offset_t md_load(char *, vm_offset_t *);
@@ -104,6 +116,9 @@ static int __elfN(exec)(struct preloaded
 static int mmu_mapin_sun4u(vm_offset_t, vm_size_t);
 static int mmu_mapin_sun4v(vm_offset_t, vm_size_t);
 static vm_offset_t init_heap(void);
+static phandle_t find_bsp_sun4u(phandle_t, uint32_t);
+const char *cpu_cpuid_prop_sun4u(void);
+uint32_t cpu_get_mid_sun4u(void);
 static void tlb_init_sun4u(void);
 static void tlb_init_sun4v(void);
 
@@ -120,11 +135,11 @@ static struct mmu_ops mmu_ops_sun4v = { 
 /* sun4u */
 struct tlb_entry *dtlb_store;
 struct tlb_entry *itlb_store;
-int dtlb_slot;
-int itlb_slot;
+u_int dtlb_slot;
+u_int itlb_slot;
 int cpu_impl;
-static int dtlb_slot_max;
-static int itlb_slot_max;
+static u_int dtlb_slot_max;
+static u_int itlb_slot_max;
 
 /* sun4v */
 static struct tlb_entry *tlb_store;
@@ -398,7 +413,7 @@ __elfN(exec)(struct preloaded_file *fp)
 }
 
 static inline u_long
-dtlb_get_data_sun4u(int slot)
+dtlb_get_data_sun4u(u_int slot)
 {
 
 	/*
@@ -410,7 +425,7 @@ dtlb_get_data_sun4u(int slot)
 }
 
 static inline u_long
-itlb_get_data_sun4u(int slot)
+itlb_get_data_sun4u(u_int slot)
 {
 
 	/*
@@ -467,55 +482,24 @@ itlb_va_to_pa_sun4u(vm_offset_t va)
 	return (-1);
 }
 
-static void
-dtlb_enter_sun4u(u_long vpn, u_long data)
+static int
+dtlb_enter_sun4u(u_int index, u_long data, vm_offset_t virt)
 {
-	u_long reg;
 
-	reg = rdpr(pstate);
-	wrpr(pstate, reg & ~PSTATE_IE, 0);
-	stxa(AA_DMMU_TAR, ASI_DMMU,
-	    TLB_TAR_VA(vpn) | TLB_TAR_CTX(TLB_CTX_KERNEL));
-	stxa(0, ASI_DTLB_DATA_IN_REG, data);
-	membar(Sync);
-	wrpr(pstate, reg, 0);
+	return (OF_call_method("SUNW,dtlb-load", mmu, 3, 0, index, data,
+	    virt));
 }
 
-static void
-itlb_enter_sun4u(u_long vpn, u_long data)
+static int
+itlb_enter_sun4u(u_int index, u_long data, vm_offset_t virt)
 {
-	u_long reg;
-	int i;
-
-	reg = rdpr(pstate);
-	wrpr(pstate, reg & ~PSTATE_IE, 0);
 
-	if (cpu_impl == CPU_IMPL_ULTRASPARCIIIp) {
-		/*
-		 * Search an unused slot != 0 and explicitly enter the data
-		 * and tag there in order to avoid Cheetah+ erratum 34.
-		 */
-		for (i = 1; i < itlb_slot_max; i++) {
-			if ((itlb_get_data_sun4u(i) & TD_V) != 0)
-				continue;
-
-			stxa(AA_IMMU_TAR, ASI_IMMU,
-			    TLB_TAR_VA(vpn) | TLB_TAR_CTX(TLB_CTX_KERNEL));
-			stxa(TLB_DAR_SLOT(i), ASI_ITLB_DATA_ACCESS_REG, data);
-			flush(PROMBASE);
-			break;
-		}
-		wrpr(pstate, reg, 0);
-		if (i == itlb_slot_max)
-			panic("%s: could not find an unused slot", __func__);
-		return;
-	}
-
-	stxa(AA_IMMU_TAR, ASI_IMMU,
-	    TLB_TAR_VA(vpn) | TLB_TAR_CTX(TLB_CTX_KERNEL));
-	stxa(0, ASI_ITLB_DATA_IN_REG, data);
-	flush(PROMBASE);
-	wrpr(pstate, reg, 0);
+	if (cpu_impl == CPU_IMPL_ULTRASPARCIIIp && index == 0 &&
+	    (data & TD_L) != 0)
+		panic("%s: won't enter locked TLB entry at index 0 on USIII+",
+		    __func__);
+	return (OF_call_method("SUNW,itlb-load", mmu, 3, 0, index, data,
+	    virt));
 }
 
 static void
@@ -565,6 +549,7 @@ mmu_mapin_sun4u(vm_offset_t va, vm_size_
 {
 	vm_offset_t pa, mva;
 	u_long data;
+	u_int index;
 
 	if (va + len > curkva)
 		curkva = va + len;
@@ -602,12 +587,20 @@ mmu_mapin_sun4u(vm_offset_t va, vm_size_
 			    TD_CV | TD_P | TD_W;
 			dtlb_store[dtlb_slot].te_pa = pa;
 			dtlb_store[dtlb_slot].te_va = va;
+			index = dtlb_slot_max - dtlb_slot - 1;
+			if (dtlb_enter_sun4u(index, data, va) < 0)
+				panic("%s: can't enter dTLB slot %d data "
+				    "%#lx va %#lx", __func__, index, data,
+				    va);
+			dtlb_slot++;
 			itlb_store[itlb_slot].te_pa = pa;
 			itlb_store[itlb_slot].te_va = va;
-			dtlb_slot++;
+			index = itlb_slot_max - itlb_slot - 1;
+			if (itlb_enter_sun4u(index, data, va) < 0)
+				panic("%s: can't enter iTLB slot %d data "
+				    "%#lx va %#lxd", __func__, index, data,
+				    va);
 			itlb_slot++;
-			dtlb_enter_sun4u(va, data);
-			itlb_enter_sun4u(va, data);
 			pa = (vm_offset_t)-1;
 		}
 		len -= len > PAGE_SIZE_4M ? PAGE_SIZE_4M : len;
@@ -668,33 +661,98 @@ init_heap(void)
 	return (heapva);
 }
 
+static phandle_t
+find_bsp_sun4u(phandle_t node, uint32_t bspid)
+{
+	char type[sizeof("cpu")];
+	phandle_t child;
+	uint32_t cpuid;
+
+	for (; node > 0; node = OF_peer(node)) {
+		child = OF_child(node);
+		if (child > 0) {
+			child = find_bsp_sun4u(child, bspid);
+			if (child > 0)
+				return (child);
+		} else {
+			if (OF_getprop(node, "device_type", type,
+			    sizeof(type)) <= 0)
+				continue;
+			if (strcmp(type, "cpu") != 0)
+				continue;
+			if (OF_getprop(node, cpu_cpuid_prop_sun4u(), &cpuid,
+			    sizeof(cpuid)) <= 0)
+				continue;
+			if (cpuid == bspid)
+				return (node);
+		}
+	}
+	return (0);
+}
+
+const char *
+cpu_cpuid_prop_sun4u(void)
+{
+
+	switch (cpu_impl) {
+	case CPU_IMPL_SPARC64:
+	case CPU_IMPL_ULTRASPARCI:
+	case CPU_IMPL_ULTRASPARCII:
+	case CPU_IMPL_ULTRASPARCIIi:
+	case CPU_IMPL_ULTRASPARCIIe:
+		return ("upa-portid");
+	case CPU_IMPL_ULTRASPARCIII:
+	case CPU_IMPL_ULTRASPARCIIIp:
+	case CPU_IMPL_ULTRASPARCIIIi:
+	case CPU_IMPL_ULTRASPARCIIIip:
+		return ("portid");
+	case CPU_IMPL_ULTRASPARCIV:
+	case CPU_IMPL_ULTRASPARCIVp:
+		return ("cpuid");
+	default:
+		return ("");
+	}
+}
+
+uint32_t
+cpu_get_mid_sun4u(void)
+{
+
+	switch (cpu_impl) {
+	case CPU_IMPL_SPARC64:
+	case CPU_IMPL_ULTRASPARCI:
+	case CPU_IMPL_ULTRASPARCII:
+	case CPU_IMPL_ULTRASPARCIIi:
+	case CPU_IMPL_ULTRASPARCIIe:
+		return (UPA_CR_GET_MID(ldxa(0, ASI_UPA_CONFIG_REG)));
+	case CPU_IMPL_ULTRASPARCIII:
+	case CPU_IMPL_ULTRASPARCIIIp:
+		return (FIREPLANE_CR_GET_AID(ldxa(AA_FIREPLANE_CONFIG,
+		    ASI_FIREPLANE_CONFIG_REG)));
+	case CPU_IMPL_ULTRASPARCIIIi:
+	case CPU_IMPL_ULTRASPARCIIIip:
+		return (JBUS_CR_GET_JID(ldxa(0, ASI_JBUS_CONFIG_REG)));
+	case CPU_IMPL_ULTRASPARCIV:
+	case CPU_IMPL_ULTRASPARCIVp:
+		return (INTR_ID_GET_ID(ldxa(AA_INTR_ID, ASI_INTR_ID)));
+	default:
+		return (0);
+	}
+}
+
 static void
 tlb_init_sun4u(void)
 {
-	phandle_t child;
-	char buf[128];
-	u_int bootcpu;
-	u_int cpu;
+	phandle_t bsp;
 
 	cpu_impl = VER_IMPL(rdpr(ver));
-	bootcpu = UPA_CR_GET_MID(ldxa(0, ASI_UPA_CONFIG_REG));
-	for (child = OF_child(root); child != 0; child = OF_peer(child)) {
-		if (OF_getprop(child, "device_type", buf, sizeof(buf)) <= 0)
-			continue;
-		if (strcmp(buf, "cpu") != 0)
-			continue;
-		if (OF_getprop(child, cpu_impl < CPU_IMPL_ULTRASPARCIII ?
-		    "upa-portid" : "portid", &cpu, sizeof(cpu)) <= 0)
-			continue;
-		if (cpu == bootcpu)
-			break;
-	}
-	if (cpu != bootcpu)
+	bsp = find_bsp_sun4u(OF_child(root), cpu_get_mid_sun4u());
+	if (bsp == 0)
 		panic("%s: no node for bootcpu?!?!", __func__);
 
-	if (OF_getprop(child, "#dtlb-entries", &dtlb_slot_max,
+	if (OF_getprop(bsp, "#dtlb-entries", &dtlb_slot_max,
 	    sizeof(dtlb_slot_max)) == -1 ||
-	    OF_getprop(child, "#itlb-entries", &itlb_slot_max,
+	    OF_getprop(bsp, "#itlb-entries", &itlb_slot_max,
 	    sizeof(itlb_slot_max)) == -1)
 		panic("%s: can't get TLB slot max.", __func__);
 
@@ -749,14 +807,15 @@ main(int (*openfirm)(void *))
 	archsw.arch_autoload = sparc64_autoload;
 	archsw.arch_maphint = sparc64_maphint;
 
-	init_heap();
-	setheap((void *)heapva, (void *)(heapva + HEAPSZ));
-
 	/*
 	 * Probe for a console.
 	 */
 	cons_probe();
 
+	if (init_heap() == (vm_offset_t)-1)
+		panic("%s: can't claim heap", __func__);
+	setheap((void *)heapva, (void *)(heapva + HEAPSZ));
+
 	if ((root = OF_peer(0)) == -1)
 		panic("%s: can't get root phandle", __func__);
 	OF_getprop(root, "compatible", compatible, sizeof(compatible));

Modified: user/imp/tbemd/sys/dev/acpica/acpi_video.c
==============================================================================
--- user/imp/tbemd/sys/dev/acpica/acpi_video.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sys/dev/acpica/acpi_video.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -645,7 +645,7 @@ acpi_video_vo_notify_handler(ACPI_HANDLE
 
 	vo = context;
 	ACPI_SERIAL_BEGIN(video_output);
-	if (vo->handle == NULL) {
+	if (vo->handle != handle) {
 		ACPI_SERIAL_END(video_output);
 		return;
 	}
@@ -655,7 +655,7 @@ acpi_video_vo_notify_handler(ACPI_HANDLE
 	case VID_NOTIFY_DEC_BRN:
 		if (vo->vo_levels == NULL)
 			break;
-		level = vo_get_brightness(vo->handle);
+		level = vo_get_brightness(handle);
 		if (level < 0)
 			break;
 		new_level = level;
@@ -672,13 +672,13 @@ acpi_video_vo_notify_handler(ACPI_HANDLE
 			}
 		}
 		if (new_level != level) {
-			vo_set_brightness(vo->handle, new_level);
+			vo_set_brightness(handle, new_level);
 			vo->vo_brightness = new_level;
 		}
 		break;
 	default:
-		printf("%s: unknown notify event 0x%x\n",
-		    acpi_name(vo->handle), notify);
+		printf("unknown notify event 0x%x from %s\n",
+		    notify, acpi_name(handle));
 	}
 	ACPI_SERIAL_END(video_output);
 }

Modified: user/imp/tbemd/sys/dev/cxgb/cxgb_sge.c
==============================================================================
--- user/imp/tbemd/sys/dev/cxgb/cxgb_sge.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sys/dev/cxgb/cxgb_sge.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -228,6 +228,8 @@ static uint8_t flit_desc_map[] = {
 #define	TXQ_LOCK(qs)		mtx_lock(&(qs)->lock)	
 #define	TXQ_UNLOCK(qs)		mtx_unlock(&(qs)->lock)	
 #define	TXQ_RING_EMPTY(qs)	drbr_empty((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr)
+#define	TXQ_RING_NEEDS_ENQUEUE(qs)					\
+	drbr_needs_enqueue((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr)
 #define	TXQ_RING_FLUSH(qs)	drbr_flush((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr)
 #define	TXQ_RING_DEQUEUE_COND(qs, func, arg)				\
 	drbr_dequeue_cond((qs)->port->ifp, (qs)->txq[TXQ_ETH].txq_mr, func, arg)
@@ -1712,7 +1714,7 @@ cxgb_transmit_locked(struct ifnet *ifp, 
 	 * - there is space in hardware transmit queue 
 	 */
 	if (check_pkt_coalesce(qs) == 0 &&
-	    TXQ_RING_EMPTY(qs) && avail > 4) {
+	    !TXQ_RING_NEEDS_ENQUEUE(qs) && avail > 4) {
 		if (t3_encap(qs, &m)) {
 			if (m != NULL &&
 			    (error = drbr_enqueue(ifp, br, m)) != 0) 

Modified: user/imp/tbemd/sys/dev/e1000/if_em.c
==============================================================================
--- user/imp/tbemd/sys/dev/e1000/if_em.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sys/dev/e1000/if_em.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -955,7 +955,7 @@ em_mq_start_locked(struct ifnet *ifp, st
 	    || (!adapter->link_active)) {
 		error = drbr_enqueue(ifp, adapter->br, m);
 		return (error);
-	} else if (drbr_empty(ifp, adapter->br) &&
+	} else if (!drbr_needs_enqueue(ifp, adapter->br) &&
 	    (adapter->num_tx_desc_avail > EM_TX_OP_THRESHOLD)) {
 		if ((error = em_xmit(adapter, &m)) != 0) {
 			if (m)

Modified: user/imp/tbemd/sys/dev/e1000/if_igb.c
==============================================================================
--- user/imp/tbemd/sys/dev/e1000/if_igb.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sys/dev/e1000/if_igb.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -842,9 +842,13 @@ igb_mq_start_locked(struct ifnet *ifp, s
 	}
 
 	enq = 0;
-	if (m == NULL)
+	if (m == NULL) {
 		next = drbr_dequeue(ifp, txr->br);
-	else
+	} else if (drbr_needs_enqueue(ifp, txr->br)) {
+		if ((err = drbr_enqueue(ifp, txr->br, m)) != 0)
+			return (err);
+		next = drbr_dequeue(ifp, txr->br);
+	} else
 		next = m;
 	/* Process the queue */
 	while (next != NULL) {

Modified: user/imp/tbemd/sys/dev/ixgbe/ixgbe.c
==============================================================================
--- user/imp/tbemd/sys/dev/ixgbe/ixgbe.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sys/dev/ixgbe/ixgbe.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -861,7 +861,7 @@ ixgbe_mq_start_locked(struct ifnet *ifp,
 		goto process;
 
 	/* If nothing queued go right to xmit */
-	if (drbr_empty(ifp, txr->br)) {
+	if (!drbr_needs_enqueue(ifp, txr->br)) {
 		if ((err = ixgbe_xmit(txr, &m)) != 0) {
 			if (m != NULL)
 				err = drbr_enqueue(ifp, txr->br, m);

Modified: user/imp/tbemd/sys/dev/mxge/if_mxge.c
==============================================================================
--- user/imp/tbemd/sys/dev/mxge/if_mxge.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sys/dev/mxge/if_mxge.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -2249,7 +2249,7 @@ mxge_transmit_locked(struct mxge_slice_s
 		return (err);
 	}
 
-	if (drbr_empty(ifp, tx->br) &&
+	if (!drbr_needs_enqueue(ifp, tx->br) &&
 	    ((tx->mask - (tx->req - tx->done)) > tx->max_desc)) {
 		/* let BPF see it */
 		BPF_MTAP(ifp, m);

Modified: user/imp/tbemd/sys/fs/msdosfs/bootsect.h
==============================================================================
--- user/imp/tbemd/sys/fs/msdosfs/bootsect.h	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sys/fs/msdosfs/bootsect.h	Sun Feb 14 00:30:24 2010	(r203850)
@@ -16,6 +16,8 @@
  *
  * October 1992
  */
+#ifndef _FS_MSDOSFS_BOOTSECT_H_
+#define	_FS_MSDOSFS_BOOTSECT_H_
 
 /*
  * Format of a boot sector.  This is the first sector on a DOS floppy disk
@@ -91,3 +93,5 @@ union bootsector {
 #define	bsHiddenSecs	bsBPB.bpbHiddenSecs
 #define	bsHugeSectors	bsBPB.bpbHugeSectors
 #endif
+
+#endif /* !_FS_MSDOSFS_BOOTSECT_H_ */

Modified: user/imp/tbemd/sys/fs/msdosfs/bpb.h
==============================================================================
--- user/imp/tbemd/sys/fs/msdosfs/bpb.h	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sys/fs/msdosfs/bpb.h	Sun Feb 14 00:30:24 2010	(r203850)
@@ -17,6 +17,9 @@
  * October 1992
  */
 
+#ifndef _FS_MSDOSFS_BPB_H_
+#define	_FS_MSDOSFS_BPB_H_
+
 /*
  * BIOS Parameter Block (BPB) for DOS 3.3
  */
@@ -78,7 +81,7 @@ struct bpb710 {
 	u_int32_t	bpbRootClust;	/* start cluster for root directory */
 	u_int16_t	bpbFSInfo;	/* filesystem info structure sector */
 	u_int16_t	bpbBackup;	/* backup boot sector */
-	/* There is a 12 byte filler here, but we ignore it */
+	u_int8_t	bpbReserved[12]; /* reserved for future expansion */
 };
 
 /*
@@ -153,7 +156,7 @@ struct byte_bpb710 {
 	u_int8_t bpbRootClust[4];	/* start cluster for root directory */
 	u_int8_t bpbFSInfo[2];		/* filesystem info structure sector */
 	u_int8_t bpbBackup[2];		/* backup boot sector */
-	/* There is a 12 byte filler here, but we ignore it */
+	u_int8_t bpbReserved[12];	/* reserved for future expansion */
 };
 
 /*
@@ -168,3 +171,4 @@ struct fsinfo {
 	u_int8_t fsifill2[12];
 	u_int8_t fsisig3[4];
 };
+#endif /* !_FS_MSDOSFS_BPB_H_ */

Modified: user/imp/tbemd/sys/fs/msdosfs/denode.h
==============================================================================
--- user/imp/tbemd/sys/fs/msdosfs/denode.h	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sys/fs/msdosfs/denode.h	Sun Feb 14 00:30:24 2010	(r203850)
@@ -207,9 +207,6 @@ struct denode {
 	     ((dep)->de_Attributes & ATTR_DIRECTORY) ? 0 : (dep)->de_FileSize), \
 	 putushort((dp)->deHighClust, (dep)->de_StartCluster >> 16))
 
-#define	de_forw		de_chain[0]
-#define	de_back		de_chain[1]
-
 #ifdef _KERNEL
 
 #define	VTODE(vp)	((struct denode *)(vp)->v_data)

Modified: user/imp/tbemd/sys/fs/msdosfs/direntry.h
==============================================================================
--- user/imp/tbemd/sys/fs/msdosfs/direntry.h	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sys/fs/msdosfs/direntry.h	Sun Feb 14 00:30:24 2010	(r203850)
@@ -47,16 +47,17 @@
  *
  * October 1992
  */
+#ifndef _FS_MSDOSFS_DIRENTRY_H_
+#define	_FS_MSDOSFS_DIRENTRY_H_
 
 /*
  * Structure of a dos directory entry.
  */
 struct direntry {
-	u_int8_t	deName[8];	/* filename, blank filled */
+	u_int8_t	deName[11];	/* filename, blank filled */
 #define	SLOT_EMPTY	0x00		/* slot has never been used */
 #define	SLOT_E5		0x05		/* the real value is 0xe5 */
 #define	SLOT_DELETED	0xe5		/* file in this slot deleted */
-	u_int8_t	deExtension[3];	/* extension, blank filled */
 	u_int8_t	deAttributes;	/* file attributes */
 #define	ATTR_NORMAL	0x00		/* normal file */
 #define	ATTR_READONLY	0x01		/* file is readonly */
@@ -155,7 +156,8 @@ int	winChkName(struct mbnambuf *nbp, con
 	    int chksum, struct msdosfsmount *pmp);
 int	win2unixfn(struct mbnambuf *nbp, struct winentry *wep, int chksum,
 	    struct msdosfsmount *pmp);
-u_int8_t winChksum(struct direntry *dep);
+u_int8_t winChksum(u_int8_t *name);
 int	winSlotCnt(const u_char *un, size_t unlen, struct msdosfsmount *pmp);
 size_t	winLenFixup(const u_char *un, size_t unlen);
 #endif	/* _KERNEL */
+#endif	/* !_FS_MSDOSFS_DIRENTRY_H_ */

Modified: user/imp/tbemd/sys/fs/msdosfs/msdosfs_conv.c
==============================================================================
--- user/imp/tbemd/sys/fs/msdosfs/msdosfs_conv.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sys/fs/msdosfs/msdosfs_conv.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -741,22 +741,13 @@ win2unixfn(nbp, wep, chksum, pmp)
  * Compute the unrolled checksum of a DOS filename for Win95 LFN use.
  */
 u_int8_t
-winChksum(struct direntry *dep)
+winChksum(u_int8_t *name)
 {
+	int i;
 	u_int8_t s;
 
-	s = dep->deName[0];
-	s = ((s << 7) | (s >> 1)) + dep->deName[1];
-	s = ((s << 7) | (s >> 1)) + dep->deName[2];
-	s = ((s << 7) | (s >> 1)) + dep->deName[3];
-	s = ((s << 7) | (s >> 1)) + dep->deName[4];
-	s = ((s << 7) | (s >> 1)) + dep->deName[5];
-	s = ((s << 7) | (s >> 1)) + dep->deName[6];
-	s = ((s << 7) | (s >> 1)) + dep->deName[7];
-	s = ((s << 7) | (s >> 1)) + dep->deExtension[0];
-	s = ((s << 7) | (s >> 1)) + dep->deExtension[1];
-	s = ((s << 7) | (s >> 1)) + dep->deExtension[2];
-
+	for (s = 0, i = 11; --i >= 0; s += *name++)
+		s = (s << 7)|(s >> 1);
 	return (s);
 }
 

Modified: user/imp/tbemd/sys/fs/msdosfs/msdosfs_denode.c
==============================================================================
--- user/imp/tbemd/sys/fs/msdosfs/msdosfs_denode.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sys/fs/msdosfs/msdosfs_denode.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -144,11 +144,11 @@ deget(pmp, dirclust, diroffset, depp)
 	}
 
 	/*
-	 * Do the MALLOC before the getnewvnode since doing so afterward
+	 * Do the malloc before the getnewvnode since doing so afterward
 	 * might cause a bogus v_data pointer to get dereferenced
-	 * elsewhere if MALLOC should block.
+	 * elsewhere if malloc should block.
 	 */
-	ldep = malloc(sizeof(struct denode), M_MSDOSFSNODE, M_WAITOK);
+	ldep = malloc(sizeof(struct denode), M_MSDOSFSNODE, M_WAITOK | M_ZERO);
 
 	/*
 	 * Directory entry was not in cache, have to create a vnode and
@@ -161,7 +161,6 @@ deget(pmp, dirclust, diroffset, depp)
 		free(ldep, M_MSDOSFSNODE);
 		return error;
 	}
-	bzero((caddr_t)ldep, sizeof *ldep);
 	nvp->v_data = ldep;
 	ldep->de_vnode = nvp;
 	ldep->de_flag = 0;

Modified: user/imp/tbemd/sys/fs/msdosfs/msdosfs_lookup.c
==============================================================================
--- user/imp/tbemd/sys/fs/msdosfs/msdosfs_lookup.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sys/fs/msdosfs/msdosfs_lookup.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -276,7 +276,7 @@ msdosfs_lookup(ap)
 				/*
 				 * Check for a checksum or name match
 				 */
-				chksum_ok = (chksum == winChksum(dep));
+				chksum_ok = (chksum == winChksum(dep->deName));
 				if (!chksum_ok
 				    && (!olddos || bcmp(dosfilename, dep->deName, 11))) {
 					chksum = -1;
@@ -617,7 +617,7 @@ createde(dep, ddep, depp, cnp)
 	 * Now write the Win95 long name
 	 */
 	if (ddep->de_fndcnt > 0) {
-		u_int8_t chksum = winChksum(ndep);
+		u_int8_t chksum = winChksum(ndep->deName);
 		const u_char *un = (const u_char *)cnp->cn_nameptr;
 		int unlen = cnp->cn_namelen;
 		int cnt = 1;

Modified: user/imp/tbemd/sys/fs/msdosfs/msdosfs_vnops.c
==============================================================================
--- user/imp/tbemd/sys/fs/msdosfs/msdosfs_vnops.c	Sun Feb 14 00:18:32 2010	(r203849)
+++ user/imp/tbemd/sys/fs/msdosfs/msdosfs_vnops.c	Sun Feb 14 00:30:24 2010	(r203850)
@@ -1287,7 +1287,7 @@ static struct {
 	struct direntry dot;
 	struct direntry dotdot;
 } dosdirtemplate = {
-	{	".       ", "   ",			/* the . entry */
+	{	".          ",				/* the . entry */

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201002140030.o1E0UOuO006857>