PERFORCE change 160059 for review

Edward Tomasz Napierala trasz at FreeBSD.org
Tue Mar 31 08:21:08 PDT 2009


http://perforce.freebsd.org/chv.cgi?CH=160059

Change 160059 by trasz at trasz_victim7 on 2009/03/31 15:20:40

	IFC.

Affected files ...

.. //depot/projects/soc2008/trasz_nfs4acl/contrib/libpcap/pcap.h#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/etc/rc.d/ipfw#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/include/dlfcn.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/include/mpool.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/README#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/Symbol.map#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/btree/bt_debug.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/btree/bt_open.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/btree/bt_page.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/btree/bt_put.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/btree/bt_split.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/db/db.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/hash/README#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/hash/hash.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/hash/hash.h#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/hash/hash_bigkey.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/hash/hash_buf.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/hash/hash_func.c#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/hash/hash_log2.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/hash/hash_page.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/man/mpool.3#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/mpool/Makefile.inc#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/mpool/mpool-compat.c#1 branch
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/mpool/mpool.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/recno/rec_close.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/recno/rec_put.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/net/getaddrinfo.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libstand/gets.c#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libthr/Makefile#5 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/libexec/rtld-elf/rtld.c#6 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/libexec/rtld-elf/rtld.h#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sbin/gvinum/gvinum.8#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sbin/gvinum/gvinum.c#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man4/ed.4#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man4/lagg.4#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/Makefile#12 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_ACCESS.9#6 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_ATTRIB.9#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_CREATE.9#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_FSYNC.9#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_INACTIVE.9#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_IOCTL.9#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_LINK.9#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_LOCK.9#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_LOOKUP.9#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_OPENCLOSE.9#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_RDWR.9#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_READDIR.9#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_READLINK.9#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_REMOVE.9#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_RENAME.9#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/VOP_VPTOCNP.9#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/share/man/man9/refcount.9#1 branch
.. //depot/projects/soc2008/trasz_nfs4acl/sys/arm/conf/AVILA#11 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/arm/conf/CAMBRIA#5 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/compat/freebsd32/freebsd32_ioctl.c#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/compat/freebsd32/freebsd32_ioctl.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/conf/files#34 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/conf/files.amd64#12 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/conf/files.i386#14 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/conf/newvers.sh#6 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/conf/options#22 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/age/if_age.c#8 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/age/if_agereg.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ata/ata-pci.c#8 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ata/ata-pci.h#12 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ata/ata-sata.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ata/chipsets/ata-ahci.c#5 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ata/chipsets/ata-intel.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ata/chipsets/ata-jmicron.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ata/chipsets/ata-marvell.c#6 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ata/chipsets/ata-nvidia.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ata/chipsets/ata-promise.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ata/chipsets/ata-siliconimage.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ata/chipsets/ata-sis.c#5 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ata/chipsets/ata-via.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ath/if_ath.c#16 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ath/if_athvar.h#14 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/drm/drm_pci.c#7 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/drm/r600_cp.c#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ed/ax88x90reg.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ed/if_ed.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ed/if_ed_pccard.c#6 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ed/if_ed_wd80x3.c#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ed/if_edreg.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ed/if_edvar.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/if_ndis/if_ndis.c#12 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ipw/if_ipw.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/iwi/if_iwi.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/iwn/if_iwn.c#7 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/malo/if_malo.c#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/malo/if_malo_pci.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/malo/if_malohal.c#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/mii/axphy.c#1 branch
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/mii/axphyreg.h#1 branch
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/mii/miidevs#7 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ofw/ofw_standard.c#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ofw/openfirm.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ral/rt2560.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ral/rt2560var.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ral/rt2661.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/ral/rt2661var.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/re/if_re.c#13 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/sound/pci/hda/hdac.c#21 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/usb/usbdevs#24 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/usb/wlan/if_rum.c#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/usb/wlan/if_rumvar.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/usb/wlan/if_ural.c#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/usb/wlan/if_uralvar.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/usb/wlan/if_zyd.c#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/usb/wlan/usb_wlan.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/wi/if_wi.c#5 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/dev/wpi/if_wpi.c#7 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/part/g_part_ebr.c#6 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/part/g_part_gpt.c#7 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/part/g_part_mbr.c#5 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/part/g_part_pc98.c#9 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum.h#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_create.c#1 branch
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_drive.c#6 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_events.c#1 branch
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_init.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_list.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_move.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_plex.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_raid5.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_raid5.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_rename.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_rm.c#5 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_share.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_share.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_state.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_subr.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_var.h#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/geom/vinum/geom_vinum_volume.c#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/i386/cpufreq/hwpstate.c#1 branch
.. //depot/projects/soc2008/trasz_nfs4acl/sys/kern/sysv_sem.c#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/kern/vfs_cache.c#14 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/kern/vfs_mount.c#17 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/kern/vfs_subr.c#29 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/mips/include/bus.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/modules/ath/Makefile#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/modules/cpufreq/Makefile#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/modules/geom/geom_vinum/Makefile#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/modules/mii/Makefile#4 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net/if.c#17 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net80211/ieee80211.c#12 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net80211/ieee80211_ddb.c#14 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net80211/ieee80211_freebsd.c#7 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net80211/ieee80211_hostap.c#11 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net80211/ieee80211_ioctl.c#14 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net80211/ieee80211_ioctl.h#6 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net80211/ieee80211_node.c#15 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net80211/ieee80211_output.c#13 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net80211/ieee80211_proto.h#7 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net80211/ieee80211_scan.c#7 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net80211/ieee80211_scan.h#3 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net80211/ieee80211_sta.c#9 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net80211/ieee80211_superg.c#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net80211/ieee80211_superg.h#2 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/net80211/ieee80211_var.h#11 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/security/mac_biba/mac_biba.c#13 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/security/mac_bsdextended/mac_bsdextended.c#15 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/security/mac_mls/mac_mls.c#13 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/sys/elf_common.h#8 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/sys/vnode.h#25 integrate
.. //depot/projects/soc2008/trasz_nfs4acl/sys/tools/vnode_if.awk#3 integrate

Differences ...

==== //depot/projects/soc2008/trasz_nfs4acl/contrib/libpcap/pcap.h#3 (text+ko) ====

@@ -30,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/contrib/libpcap/pcap.h,v 1.15 2009/03/21 22:58:08 rpaulo Exp $
+ * $FreeBSD: src/contrib/libpcap/pcap.h,v 1.16 2009/03/31 11:04:51 rpaulo Exp $
  * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.59 2006/10/04 18:09:22 guy Exp $ (LBL)
  */
 
@@ -53,10 +53,6 @@
 
 #include <stdio.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 #define PCAP_VERSION_MAJOR 2
 #define PCAP_VERSION_MINOR 4
 

==== //depot/projects/soc2008/trasz_nfs4acl/etc/rc.d/ipfw#3 (text+ko) ====

@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $FreeBSD: src/etc/rc.d/ipfw,v 1.18 2008/07/05 15:27:39 mtm Exp $
+# $FreeBSD: src/etc/rc.d/ipfw,v 1.19 2009/03/30 21:31:52 emax Exp $
 #
 
 # PROVIDE: ipfw
@@ -23,10 +23,20 @@
 	if checkyesno dummynet_enable; then
 		required_modules="$required_modules dummynet"
 	fi
+
+	if checkyesno firewall_nat_enable; then
+		if ! checkyesno natd_enable; then
+			required_modules="$required_modules ipfw_nat"
+		fi
+	fi 
 }
 
 ipfw_start()
 {
+	local   _firewall_type
+
+	_firewall_type=$1 
+
 	# set the firewall rules script if none was specified
 	[ -z "${firewall_script}" ] && firewall_script=/etc/rc.firewall
 
@@ -34,7 +44,7 @@
 		if [ -f /etc/rc.d/natd ] ; then
 			/etc/rc.d/natd quietstart
 		fi
-		/bin/sh "${firewall_script}"
+		/bin/sh "${firewall_script}" "${_firewall_type}"
 		echo 'Firewall rules loaded.'
 	elif [ "`ipfw list 65535`" = "65535 deny ip from any to any" ]; then
 		echo 'Warning: kernel has firewall functionality, but' \
@@ -67,4 +77,4 @@
 }
 
 load_rc_config $name
-run_rc_command "$1"
+run_rc_command $*

==== //depot/projects/soc2008/trasz_nfs4acl/include/dlfcn.h#2 (text+ko) ====

@@ -30,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/include/dlfcn.h,v 1.20 2005/12/18 19:43:31 kan Exp $
+ * $FreeBSD: src/include/dlfcn.h,v 1.21 2009/03/30 08:47:28 kib Exp $
  */
 
 #ifndef _DLFCN_H_
@@ -47,6 +47,7 @@
 #define	RTLD_GLOBAL	0x100	/* Make symbols globally available. */
 #define	RTLD_LOCAL	0	/* Opposite of RTLD_GLOBAL, and the default. */
 #define	RTLD_TRACE	0x200	/* Trace loaded objects and exit. */
+#define	RTLD_NODELETE	0x01000	/* Do not remove members. */
 
 /*
  * Request arguments for dlinfo().

==== //depot/projects/soc2008/trasz_nfs4acl/include/mpool.h#2 (text+ko) ====

@@ -30,8 +30,8 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	@(#)mpool.h	8.2 (Berkeley) 7/14/94
- * $FreeBSD: src/include/mpool.h,v 1.9 2002/03/23 17:24:53 imp Exp $
+ *	@(#)mpool.h	8.4 (Berkeley) 11/2/95
+ * $FreeBSD: src/include/mpool.h,v 1.10 2009/03/28 07:31:02 delphij Exp $
  */
 
 #ifndef _MPOOL_H_
@@ -47,7 +47,7 @@
  * pool is handed an opaque MPOOL cookie which stores all of this information.
  */
 #define	HASHSIZE	128
-#define	HASHKEY(pgno)	((pgno - 1) % HASHSIZE)
+#define	HASHKEY(pgno)	((pgno - 1 + HASHSIZE) % HASHSIZE)
 
 /* The BKT structures are the elements of the queues. */
 typedef struct _bkt {
@@ -58,6 +58,7 @@
 
 #define	MPOOL_DIRTY	0x01		/* page needs to be written */
 #define	MPOOL_PINNED	0x02		/* page is pinned into memory */
+#define	MPOOL_INUSE	0x04		/* page address is valid */
 	u_int8_t flags;			/* flags */
 } BKT;
 
@@ -68,7 +69,7 @@
 	pgno_t	curcache;		/* current number of cached pages */
 	pgno_t	maxcache;		/* max number of cached pages */
 	pgno_t	npages;			/* number of pages in the file */
-	u_long	pagesize;		/* file page size */
+	unsigned long	pagesize;	/* file page size */
 	int	fd;			/* file descriptor */
 					/* page in conversion routine */
 	void    (*pgin)(void *, pgno_t, void *);
@@ -76,25 +77,32 @@
 	void    (*pgout)(void *, pgno_t, void *);
 	void	*pgcookie;		/* cookie for page in/out routines */
 #ifdef STATISTICS
-	u_long	cachehit;
-	u_long	cachemiss;
-	u_long	pagealloc;
-	u_long	pageflush;
-	u_long	pageget;
-	u_long	pagenew;
-	u_long	pageput;
-	u_long	pageread;
-	u_long	pagewrite;
+	unsigned long	cachehit;
+	unsigned long	cachemiss;
+	unsigned long	pagealloc;
+	unsigned long	pageflush;
+	unsigned long	pageget;
+	unsigned long	pagenew;
+	unsigned long	pageput;
+	unsigned long	pageread;
+	unsigned long	pagewrite;
 #endif
 } MPOOL;
 
+#define	MPOOL_IGNOREPIN	0x01		/* Ignore if the page is pinned. */
+#define	MPOOL_PAGE_REQUEST	0x01	/* Allocate a new page with a
+					   specific page number. */
+#define	MPOOL_PAGE_NEXT		0x02	/* Allocate a new page with the next
+					  page number. */
+
 __BEGIN_DECLS
 MPOOL	*mpool_open(void *, int, pgno_t, pgno_t);
 void	 mpool_filter(MPOOL *, void (*)(void *, pgno_t, void *),
 	    void (*)(void *, pgno_t, void *), void *);
-void	*mpool_new(MPOOL *, pgno_t *);
-void	*mpool_get(MPOOL *, pgno_t, u_int);
-int	 mpool_put(MPOOL *, void *, u_int);
+void	*mpool_new(MPOOL *, pgno_t *, unsigned int);
+void	*mpool_get(MPOOL *, pgno_t, unsigned int);
+int	 mpool_delete(MPOOL *, void *);
+int	 mpool_put(MPOOL *, void *, unsigned int);
 int	 mpool_sync(MPOOL *);
 int	 mpool_close(MPOOL *);
 #ifdef STATISTICS

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/README#2 (text+ko) ====

@@ -1,4 +1,5 @@
 #	@(#)README	8.27 (Berkeley) 9/1/94
+# $FreeBSD: src/lib/libc/db/README,v 1.2 2009/03/28 04:00:46 delphij Exp $
 
 This is version 1.85 of the Berkeley DB code.
 
@@ -31,10 +32,3 @@
 recno		The fixed/variable length record routines.
 test		Test package.
 
-============================================
-Debugging:
-
-If you're running a memory checker (e.g. Purify) on DB, make sure that
-you recompile it with "-DPURIFY" in the CFLAGS, first.  By default,
-allocated pages are not initialized by the DB code, and they will show
-up as reads of uninitialized memory in the buffer write routines.

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/Symbol.map#2 (text) ====

@@ -1,5 +1,5 @@
 /*
- * $FreeBSD: src/lib/libc/db/Symbol.map,v 1.2 2007/04/29 14:05:16 deischen Exp $
+ * $FreeBSD: src/lib/libc/db/Symbol.map,v 1.3 2009/03/28 07:31:02 delphij Exp $
  */
 
 FBSD_1.0 {
@@ -16,7 +16,6 @@
 	dbm_dirfno;
 	mpool_open;
 	mpool_filter;
-	mpool_new;
 	mpool_get;
 	mpool_put;
 	mpool_close;
@@ -24,6 +23,11 @@
 	mpool_stat;
 };
 
+FBSD_1.1 {
+	mpool_new;
+	mpool_delete;
+};
+
 FBSDprivate_1.0 {
 	__bt_open;
 	__dbpanic;

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/btree/bt_debug.c#4 (text+ko) ====

@@ -34,7 +34,7 @@
 static char sccsid[] = "@(#)bt_debug.c	8.5 (Berkeley) 8/17/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_debug.c,v 1.6 2009/03/23 23:22:09 delphij Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_debug.c,v 1.7 2009/03/28 07:31:02 delphij Exp $");
 
 #include <sys/param.h>
 
@@ -83,10 +83,9 @@
 	}
 #undef X
 
-	for (i = P_ROOT; (h = mpool_get(t->bt_mp, i, 0)) != NULL; ++i) {
+	for (i = P_ROOT;
+	    (h = mpool_get(t->bt_mp, i, MPOOL_IGNOREPIN)) != NULL; ++i)
 		__bt_dpage(h);
-		(void)mpool_put(t->bt_mp, h, 0);
-	}
 }
 
 /*
@@ -135,10 +134,8 @@
 	PAGE *h;
 
 	t = dbp->internal;
-	if ((h = mpool_get(t->bt_mp, pgno, 0)) != NULL) {
+	if ((h = mpool_get(t->bt_mp, pgno, MPOOL_IGNOREPIN)) != NULL)
 		__bt_dpage(h);
-		(void)mpool_put(t->bt_mp, h, 0);
-	}
 }
 
 /*
@@ -257,7 +254,8 @@
 	t = dbp->internal;
 	pcont = pinternal = pleaf = 0;
 	nkeys = ifree = lfree = 0;
-	for (i = P_ROOT; (h = mpool_get(t->bt_mp, i, 0)) != NULL; ++i) {
+	for (i = P_ROOT;
+	    (h = mpool_get(t->bt_mp, i, MPOOL_IGNOREPIN)) != NULL; ++i)
 		switch (h->flags & P_TYPE) {
 		case P_BINTERNAL:
 		case P_RINTERNAL:
@@ -274,22 +272,18 @@
 			++pcont;
 			break;
 		}
-		(void)mpool_put(t->bt_mp, h, 0);
-	}
 
 	/* Count the levels of the tree. */
 	for (i = P_ROOT, levels = 0 ;; ++levels) {
-		h = mpool_get(t->bt_mp, i, 0);
+		h = mpool_get(t->bt_mp, i, MPOOL_IGNOREPIN);
 		if (h->flags & (P_BLEAF|P_RLEAF)) {
 			if (levels == 0)
 				levels = 1;
-			(void)mpool_put(t->bt_mp, h, 0);
 			break;
 		}
 		i = F_ISSET(t, R_RECNO) ?
 		    GETRINTERNAL(h, 0)->pgno :
 		    GETBINTERNAL(h, 0)->pgno;
-		(void)mpool_put(t->bt_mp, h, 0);
 	}
 
 	(void)fprintf(stderr, "%d level%s with %lu keys",

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/btree/bt_open.c#4 (text+ko) ====

@@ -34,7 +34,7 @@
 static char sccsid[] = "@(#)bt_open.c	8.10 (Berkeley) 8/17/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_open.c,v 1.15 2009/03/23 23:43:07 delphij Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_open.c,v 1.18 2009/03/28 07:31:02 delphij Exp $");
 
 /*
  * Implementation of btree access method for 4.4BSD.
@@ -156,9 +156,8 @@
 		goto einval;
 
 	/* Allocate and initialize DB and BTREE structures. */
-	if ((t = (BTREE *)malloc(sizeof(BTREE))) == NULL)
+	if ((t = (BTREE *)calloc(1, sizeof(BTREE))) == NULL)
 		goto err;
-	memset(t, 0, sizeof(BTREE));
 	t->bt_fd = -1;			/* Don't close unopened fd on error. */
 	t->bt_lorder = b.lorder;
 	t->bt_order = NOT;
@@ -166,9 +165,8 @@
 	t->bt_pfx = b.prefix;
 	t->bt_rfd = -1;
 
-	if ((t->bt_dbp = dbp = (DB *)malloc(sizeof(DB))) == NULL)
+	if ((t->bt_dbp = dbp = (DB *)calloc(1, sizeof(DB))) == NULL)
 		goto err;
-	memset(t->bt_dbp, 0, sizeof(DB));
 	if (t->bt_lorder != machine_lorder)
 		F_SET(t, B_NEEDSWAP);
 
@@ -354,18 +352,25 @@
 	PAGE *meta, *root;
 	pgno_t npg;
 
-	if ((meta = mpool_get(t->bt_mp, 0, 0)) != NULL) {
-		mpool_put(t->bt_mp, meta, 0);
-		return (RET_SUCCESS);
+	if ((root = mpool_get(t->bt_mp, 1, 0)) != NULL) {
+		if (root->lower == 0 &&
+		    root->pgno == 0 &&
+		    root->linp[0] == 0) {
+			mpool_delete(t->bt_mp, root);
+			errno = EINVAL;
+		} else {
+			mpool_put(t->bt_mp, root, 0);
+			return (RET_SUCCESS);
+		}
 	}
 	if (errno != EINVAL)		/* It's OK to not exist. */
 		return (RET_ERROR);
 	errno = 0;
 
-	if ((meta = mpool_new(t->bt_mp, &npg)) == NULL)
+	if ((meta = mpool_new(t->bt_mp, &npg, MPOOL_PAGE_NEXT)) == NULL)
 		return (RET_ERROR);
 
-	if ((root = mpool_new(t->bt_mp, &npg)) == NULL)
+	if ((root = mpool_new(t->bt_mp, &npg, MPOOL_PAGE_NEXT)) == NULL)
 		return (RET_ERROR);
 
 	if (npg != P_ROOT)
@@ -385,14 +390,18 @@
 tmp(void)
 {
 	sigset_t set, oset;
-	int fd;
+	int fd, len;
 	char *envtmp = NULL;
 	char path[MAXPATHLEN];
 
 	if (issetugid() == 0)
 		envtmp = getenv("TMPDIR");
-	(void)snprintf(path,
+	len = snprintf(path,
 	    sizeof(path), "%s/bt.XXXXXXXXXX", envtmp ? envtmp : "/tmp");
+	if (len < 0 || len >= (int)sizeof(path)) {
+		errno = ENAMETOOLONG;
+		return(-1);
+	}
 
 	(void)sigfillset(&set);
 	(void)_sigprocmask(SIG_BLOCK, &set, &oset);

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/btree/bt_page.c#3 (text+ko) ====

@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)bt_page.c	8.3 (Berkeley) 7/14/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_page.c,v 1.5 2009/03/02 23:47:18 delphij Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_page.c,v 1.6 2009/03/28 07:31:02 delphij Exp $");
 
 #include <sys/types.h>
 
@@ -90,5 +90,5 @@
 		F_SET(t, B_METADIRTY);
 		return (h);
 	}
-	return (mpool_new(t->bt_mp, npg));
+	return (mpool_new(t->bt_mp, npg, MPOOL_PAGE_NEXT));
 }

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/btree/bt_put.c#3 (text+ko) ====

@@ -34,7 +34,7 @@
 static char sccsid[] = "@(#)bt_put.c	8.8 (Berkeley) 7/26/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_put.c,v 1.8 2009/03/04 00:58:04 delphij Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_put.c,v 1.9 2009/03/28 05:45:29 delphij Exp $");
 
 #include <sys/types.h>
 
@@ -197,7 +197,7 @@
 	 * into the offset array, shift the pointers up.
 	 */
 	nbytes = NBLEAFDBT(key->size, data->size);
-	if (h->upper - h->lower < nbytes + sizeof(indx_t)) {
+	if ((u_int32_t)(h->upper - h->lower) < nbytes + sizeof(indx_t)) {
 		if ((status = __bt_split(t, h, key,
 		    data, dflags, nbytes, idx)) != RET_SUCCESS)
 			return (status);
@@ -278,7 +278,7 @@
 	 * have to search to get split stack.
 	 */
 	nbytes = NBLEAFDBT(key->size, data->size);
-	if (h->upper - h->lower < nbytes + sizeof(indx_t))
+	if ((u_int32_t)(h->upper - h->lower) < nbytes + sizeof(indx_t))
 		goto miss;
 
 	if (t->bt_order == FORWARD) {

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/btree/bt_split.c#3 (text+ko) ====

@@ -34,7 +34,7 @@
 static char sccsid[] = "@(#)bt_split.c	8.9 (Berkeley) 7/26/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_split.c,v 1.10 2009/03/04 00:58:04 delphij Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_split.c,v 1.12 2009/03/28 05:45:29 delphij Exp $");
 
 #include <sys/types.h>
 
@@ -205,7 +205,7 @@
 		}
 
 		/* Split the parent page if necessary or shift the indices. */
-		if (h->upper - h->lower < nbytes + sizeof(indx_t)) {
+		if ((u_int32_t)(h->upper - h->lower) < nbytes + sizeof(indx_t)) {
 			sp = h;
 			h = h->pgno == P_ROOT ?
 			    bt_root(t, h, &l, &r, &skip, nbytes) :
@@ -372,13 +372,10 @@
 	}
 
 	/* Put the new left page for the split into place. */
-	if ((l = (PAGE *)malloc(t->bt_psize)) == NULL) {
+	if ((l = (PAGE *)calloc(1, t->bt_psize)) == NULL) {
 		mpool_put(t->bt_mp, r, 0);
 		return (NULL);
 	}
-#ifdef PURIFY
-	memset(l, 0xff, t->bt_psize);
-#endif
 	l->pgno = h->pgno;
 	l->nextpg = r->pgno;
 	l->prevpg = h->prevpg;

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/db/db.c#3 (text+ko) ====

@@ -31,7 +31,7 @@
 static char sccsid[] = "@(#)db.c	8.4 (Berkeley) 2/21/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/db/db.c,v 1.4 2009/03/02 23:47:18 delphij Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/db/db/db.c,v 1.5 2009/03/28 07:26:00 delphij Exp $");
 
 #include <sys/types.h>
 
@@ -50,8 +50,8 @@
 
 #define	DB_FLAGS	(DB_LOCK | DB_SHMEM | DB_TXN)
 #define	USE_OPEN_FLAGS							\
-	(O_CREAT | O_EXCL | O_EXLOCK | O_NONBLOCK | O_RDONLY |		\
-	 O_RDWR | O_SHLOCK | O_TRUNC)
+	(O_CREAT | O_EXCL | O_EXLOCK | O_NOFOLLOW | O_NONBLOCK | 	\
+	 O_RDONLY | O_RDWR | O_SHLOCK | O_SYNC | O_TRUNC)
 
 	if ((flags & ~(USE_OPEN_FLAGS | DB_FLAGS)) == 0)
 		switch (type) {

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/hash/README#2 (text+ko) ====

@@ -1,4 +1,5 @@
 #	@(#)README	8.1 (Berkeley) 6/4/93
+# $FreeBSD: src/lib/libc/db/hash/README,v 1.2 2009/03/28 07:31:02 delphij Exp $
 
 This package implements a superset of the hsearch and dbm/ndbm libraries.
 
@@ -44,10 +45,6 @@
 
 NOTES:
 
-The file search.h is provided for using the hsearch compatible interface
-on BSD systems.  On System V derived systems, search.h should appear in 
-/usr/include.
-
 The man page ../man/db.3 explains the interface to the hashing system.
 The file hash.ps is a postscript copy of a paper explaining
 the history, implementation, and performance of the hash package.

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/hash/hash.c#3 (text+ko) ====

@@ -34,7 +34,7 @@
 static char sccsid[] = "@(#)hash.c	8.9 (Berkeley) 6/16/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash.c,v 1.15 2009/03/02 23:47:18 delphij Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash.c,v 1.21 2009/03/28 07:20:39 delphij Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
@@ -120,25 +120,15 @@
 	 */
 	hashp->flags = flags;
 
-	new_table = 0;
-	if (!file || (flags & O_TRUNC) ||
-	    (stat(file, &statbuf) && (errno == ENOENT))) {
-		if (errno == ENOENT)
-			errno = 0; /* Just in case someone looks at errno */
-		new_table = 1;
-	}
 	if (file) {
 		if ((hashp->fp = _open(file, flags, mode)) == -1)
 			RETURN_ERROR(errno, error0);
+		(void)_fcntl(hashp->fp, F_SETFD, 1);
+		new_table = _fstat(hashp->fp, &statbuf) == 0 &&
+		    statbuf.st_size == 0 && (flags & O_ACCMODE) != O_RDONLY;
+	} else
+		new_table = 1;
 
-		/* if the .db file is empty, and we had permission to create
-		   a new .db file, then reinitialize the database */
-		if ((flags & O_CREAT) &&
-		     _fstat(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
-			new_table = 1;
-
-		(void)_fcntl(hashp->fp, F_SETFD, 1);
-	}
 	if (new_table) {
 		if (!(hashp = init_hash(hashp, file, info)))
 			RETURN_ERROR(errno, error1);
@@ -164,7 +154,7 @@
 		if (hashp->VERSION != HASHVERSION &&
 		    hashp->VERSION != OLDHASHVERSION)
 			RETURN_ERROR(EFTYPE, error1);
-		if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY)
+		if ((int32_t)hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY)
 			RETURN_ERROR(EFTYPE, error1);
 		/*
 		 * Figure out how many segments we need.  Max_Bucket is the
@@ -173,7 +163,6 @@
 		 */
 		nsegs = (hashp->MAX_BUCKET + 1 + hashp->SGSIZE - 1) /
 			 hashp->SGSIZE;
-		hashp->nsegs = 0;
 		if (alloc_segs(hashp, nsegs))
 			/*
 			 * If alloc_segs fails, table will have been destroyed
@@ -347,8 +336,7 @@
 static int
 init_htab(HTAB *hashp, int nelem)
 {
-	int nbuckets, nsegs;
-	int l2;
+	int nbuckets, nsegs, l2;
 
 	/*
 	 * Divide number of elements by the fill factor and determine a
@@ -428,6 +416,10 @@
 	for (i = 0; i < hashp->nmaps; i++)
 		if (hashp->mapp[i])
 			free(hashp->mapp[i]);
+	if (hashp->tmp_key)
+		free(hashp->tmp_key);
+	if (hashp->tmp_buf)
+		free(hashp->tmp_buf);
 
 	if (hashp->fp != -1)
 		(void)_close(hashp->fp);
@@ -495,8 +487,7 @@
 	whdrp = &whdr;
 	swap_header_copy(&hashp->hdr, whdrp);
 #endif
-	if ((lseek(fp, (off_t)0, SEEK_SET) == -1) ||
-	    ((wsize = _write(fp, whdrp, sizeof(HASHHDR))) == -1))
+	if ((wsize = pwrite(fp, whdrp, sizeof(HASHHDR), (off_t)0)) == -1)
 		return (-1);
 	else
 		if (wsize != sizeof(HASHHDR)) {
@@ -541,8 +532,7 @@
 
 	hashp = (HTAB *)dbp->internal;
 	if (flag && flag != R_NOOVERWRITE) {
-		hashp->error = EINVAL;
-		errno = EINVAL;
+		hashp->error = errno = EINVAL;
 		return (ERROR);
 	}
 	if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
@@ -721,7 +711,7 @@
 		hashp->cndx = 1;
 		hashp->cpage = NULL;
 	}
-
+ next_bucket:
 	for (bp = NULL; !bp || !bp[0]; ) {
 		if (!(bufp = hashp->cpage)) {
 			for (bucket = hashp->cbucket;
@@ -736,12 +726,22 @@
 					break;
 			}
 			hashp->cbucket = bucket;
-			if (hashp->cbucket > hashp->MAX_BUCKET) {
+			if ((u_int32_t)hashp->cbucket > hashp->MAX_BUCKET) {
 				hashp->cbucket = -1;
 				return (ABNORMAL);
 			}
-		} else
+		} else {
 			bp = (u_int16_t *)hashp->cpage->page;
+			if (flag == R_NEXT) {
+				hashp->cndx += 2;
+				if (hashp->cndx > bp[0]) {
+					hashp->cpage = NULL;
+					hashp->cbucket++;
+					hashp->cndx = 1;
+					goto next_bucket;
+				}
+			}
+		}
 
 #ifdef DEBUG
 		assert(bp);
@@ -765,17 +765,12 @@
 		if (__big_keydata(hashp, bufp, key, data, 1))
 			return (ERROR);
 	} else {
+		if (hashp->cpage == 0)
+			return (ERROR);
 		key->data = (u_char *)hashp->cpage->page + bp[ndx];
 		key->size = (ndx > 1 ? bp[ndx - 1] : hashp->BSIZE) - bp[ndx];
 		data->data = (u_char *)hashp->cpage->page + bp[ndx + 1];
 		data->size = bp[ndx] - bp[ndx + 1];
-		ndx += 2;
-		if (ndx > bp[0]) {
-			hashp->cpage = NULL;
-			hashp->cbucket++;
-			hashp->cndx = 1;
-		} else
-			hashp->cndx = ndx;
 	}
 	return (SUCCESS);
 }
@@ -858,7 +853,7 @@
 u_int32_t
 __call_hash(HTAB *hashp, char *k, int len)
 {
-	int n, bucket;
+	unsigned int n, bucket;
 
 	n = hashp->hash(k, len);
 	bucket = n & hashp->HIGH_MASK;
@@ -887,15 +882,18 @@
 		errno = save_errno;
 		return (-1);
 	}
+	hashp->nsegs = nsegs;
+	if (nsegs == 0)
+		return (0);
 	/* Allocate segments */
-	if ((store =
-	    (SEGMENT)calloc(nsegs << hashp->SSHIFT, sizeof(SEGMENT))) == NULL) {
+	if ((store = (SEGMENT)calloc(nsegs << hashp->SSHIFT,
+	    sizeof(SEGMENT))) == NULL) {
 		save_errno = errno;
 		(void)hdestroy(hashp);
 		errno = save_errno;
 		return (-1);
 	}
-	for (i = 0; i < nsegs; i++, hashp->nsegs++)
+	for (i = 0; i < nsegs; i++)
 		hashp->dir[i] = &store[i << hashp->SSHIFT];
 	return (0);
 }

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/hash/hash.h#3 (text+ko) ====

@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)hash.h	8.3 (Berkeley) 5/31/94
- * $FreeBSD: src/lib/libc/db/hash/hash.h,v 1.8 2009/03/04 01:17:05 delphij Exp $
+ * $FreeBSD: src/lib/libc/db/hash/hash.h,v 1.9 2009/03/28 05:45:29 delphij Exp $
  */
 
 /* Operations */
@@ -71,11 +71,11 @@
 	int32_t		ovfl_point;	/* Where overflow pages are being 
 					 * allocated */
 	int32_t		last_freed;	/* Last overflow page freed */
-	int32_t		max_bucket;	/* ID of Maximum bucket in use */
-	int32_t		high_mask;	/* Mask to modulo into entire table */
-	int32_t		low_mask;	/* Mask to modulo into lower half of 
+	u_int32_t	max_bucket;	/* ID of Maximum bucket in use */
+	u_int32_t	high_mask;	/* Mask to modulo into entire table */
+	u_int32_t	low_mask;	/* Mask to modulo into lower half of 
 					 * table */
-	int32_t		ffactor;	/* Fill factor */
+	u_int32_t	ffactor;	/* Fill factor */
 	int32_t		nkeys;		/* Number of keys in hash table */
 	int32_t		hdrpages;	/* Size of table header */
 	int32_t		h_charkey;	/* value of hash(CHARKEY) */

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/hash/hash_bigkey.c#3 (text+ko) ====

@@ -34,7 +34,7 @@
 static char sccsid[] = "@(#)hash_bigkey.c	8.3 (Berkeley) 5/31/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_bigkey.c,v 1.8 2009/03/04 00:58:04 delphij Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_bigkey.c,v 1.10 2009/03/28 06:47:05 delphij Exp $");
 
 /*
  * PACKAGE: hash
@@ -86,7 +86,8 @@
 __big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
 {
 	u_int16_t *p;
-	int key_size, n, val_size;
+	int key_size, n;
+	unsigned int val_size;
 	u_int16_t space, move_bytes, off;
 	char *cp, *key_data, *val_data;
 
@@ -117,18 +118,30 @@
 			return (-1);
 		n = p[0];
 		if (!key_size) {
-			if (FREESPACE(p)) {
-				move_bytes = MIN(FREESPACE(p), val_size);
+			space = FREESPACE(p);
+			if (space) {
+				move_bytes = MIN(space, val_size);
+				/*
+				 * If the data would fit exactly in the
+				 * remaining space, we must overflow it to the
+				 * next page; otherwise the invariant that the
+				 * data must end on a page with FREESPACE
+				 * non-zero would fail.
+				 */
+				if (space == val_size && val_size == val->size)
+					goto toolarge;
 				off = OFFSET(p) - move_bytes;
-				p[n] = off;
 				memmove(cp + off, val_data, move_bytes);
 				val_data += move_bytes;
 				val_size -= move_bytes;
+				p[n] = off;
 				p[n - 2] = FULL_KEY_DATA;
 				FREESPACE(p) = FREESPACE(p) - move_bytes;
 				OFFSET(p) = off;
-			} else
+			} else {
+			toolarge:
 				p[n - 2] = FULL_KEY;
+			}
 		}
 		p = (u_int16_t *)bufp->page;
 		cp = bufp->page;
@@ -238,12 +251,12 @@
 	n -= 2;
 	bp[0] = n;
 	FREESPACE(bp) = hashp->BSIZE - PAGE_META(n);
-	OFFSET(bp) = hashp->BSIZE - 1;
+	OFFSET(bp) = hashp->BSIZE;
 
 	bufp->flags |= BUF_MOD;
 	if (rbufp)
 		__free_ovflpage(hashp, rbufp);
-	if (last_bfp != rbufp)
+	if (last_bfp && last_bfp != rbufp)
 		__free_ovflpage(hashp, last_bfp);
 
 	hashp->NKEYS--;

==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/db/hash/hash_buf.c#3 (text+ko) ====

@@ -34,7 +34,7 @@
 static char sccsid[] = "@(#)hash_buf.c	8.5 (Berkeley) 7/15/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_buf.c,v 1.9 2009/03/02 23:47:18 delphij Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_buf.c,v 1.12 2009/03/28 06:40:48 delphij Exp $");
 
 /*
  * PACKAGE: hash
@@ -57,6 +57,7 @@
 #include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #ifdef DEBUG
 #include <assert.h>
@@ -163,24 +164,38 @@
 
 	oaddr = 0;
 	bp = LRU;
+
+        /* It is bad to overwrite the page under the cursor. */
+        if (bp == hashp->cpage) {
+                BUF_REMOVE(bp);

>>> TRUNCATED FOR MAIL (1000 lines) <<<


More information about the p4-projects mailing list