PERFORCE change 142275 for review

John Birrell jb at FreeBSD.org
Sun May 25 21:12:10 UTC 2008


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

Change 142275 by jb at freebsd3 on 2008/05/25 21:11:35

	IF6

Affected files ...

.. //depot/projects/dtrace6/src/etc/rc.d/dhclient#3 integrate
.. //depot/projects/dtrace6/src/etc/rc.d/ntpd#2 integrate
.. //depot/projects/dtrace6/src/etc/rc.subr#3 integrate
.. //depot/projects/dtrace6/src/include/protocols/dumprestore.h#2 integrate
.. //depot/projects/dtrace6/src/include/readpassphrase.h#2 integrate
.. //depot/projects/dtrace6/src/lib/libc/gen/readdir.c#2 integrate
.. //depot/projects/dtrace6/src/lib/libc/gen/telldir.c#2 integrate
.. //depot/projects/dtrace6/src/lib/libc/gen/telldir.h#2 integrate
.. //depot/projects/dtrace6/src/sbin/dhclient/bpf.c#2 integrate
.. //depot/projects/dtrace6/src/sbin/dump/dump.h#2 integrate
.. //depot/projects/dtrace6/src/sbin/dump/traverse.c#2 integrate
.. //depot/projects/dtrace6/src/sbin/ipfw/ipfw.8#5 integrate
.. //depot/projects/dtrace6/src/sbin/ipfw/ipfw2.c#5 integrate
.. //depot/projects/dtrace6/src/sbin/restore/dirs.c#2 integrate
.. //depot/projects/dtrace6/src/sbin/restore/extern.h#2 integrate
.. //depot/projects/dtrace6/src/sbin/restore/restore.h#2 integrate
.. //depot/projects/dtrace6/src/sbin/restore/tape.c#2 integrate
.. //depot/projects/dtrace6/src/share/man/man4/termios.4#2 integrate
.. //depot/projects/dtrace6/src/share/man/man5/fs.5#2 integrate
.. //depot/projects/dtrace6/src/sys/cam/scsi/scsi_da.c#3 integrate
.. //depot/projects/dtrace6/src/sys/compat/linux/linux_file.c#3 integrate
.. //depot/projects/dtrace6/src/sys/dev/bge/if_bge.c#4 integrate
.. //depot/projects/dtrace6/src/sys/dev/ciss/ciss.c#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/coretemp/coretemp.c#3 integrate
.. //depot/projects/dtrace6/src/sys/dev/fdc/fdc.c#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/mpt/mpt_pci.c#2 integrate
.. //depot/projects/dtrace6/src/sys/fs/devfs/devfs_rule.c#2 integrate
.. //depot/projects/dtrace6/src/sys/geom/vinum/geom_vinum_share.c#2 integrate
.. //depot/projects/dtrace6/src/sys/kern/kern_conf.c#3 integrate
.. //depot/projects/dtrace6/src/sys/kern/kern_lockf.c#3 integrate
.. //depot/projects/dtrace6/src/sys/kern/kern_switch.c#2 integrate
.. //depot/projects/dtrace6/src/sys/kern/vfs_syscalls.c#2 integrate
.. //depot/projects/dtrace6/src/sys/net/bpf.c#4 integrate
.. //depot/projects/dtrace6/src/sys/net/ethernet.h#2 integrate
.. //depot/projects/dtrace6/src/sys/netgraph/ng_base.c#7 integrate
.. //depot/projects/dtrace6/src/sys/netinet/ip_dummynet.c#3 integrate
.. //depot/projects/dtrace6/src/sys/netinet/ip_fw2.c#2 integrate
.. //depot/projects/dtrace6/src/sys/sparc64/include/bus_common.h#2 integrate
.. //depot/projects/dtrace6/src/sys/sparc64/include/iommuvar.h#2 integrate
.. //depot/projects/dtrace6/src/sys/sparc64/pci/psycho.c#3 integrate
.. //depot/projects/dtrace6/src/sys/sparc64/sbus/sbus.c#3 integrate
.. //depot/projects/dtrace6/src/sys/sparc64/sparc64/counter.c#2 integrate
.. //depot/projects/dtrace6/src/sys/sparc64/sparc64/iommu.c#2 integrate
.. //depot/projects/dtrace6/src/sys/sys/extattr.h#2 integrate
.. //depot/projects/dtrace6/src/sys/ufs/ffs/ffs_softdep.c#3 integrate
.. //depot/projects/dtrace6/src/sys/ufs/ffs/ffs_vfsops.c#3 integrate
.. //depot/projects/dtrace6/src/sys/ufs/ufs/extattr.h#2 integrate
.. //depot/projects/dtrace6/src/sys/ufs/ufs/quota.h#3 integrate
.. //depot/projects/dtrace6/src/sys/ufs/ufs/ufs_lookup.c#3 integrate
.. //depot/projects/dtrace6/src/sys/ufs/ufs/ufs_quota.c#3 integrate
.. //depot/projects/dtrace6/src/sys/ufs/ufs/ufs_vnops.c#4 integrate
.. //depot/projects/dtrace6/src/sys/vm/vm_mmap.c#2 integrate
.. //depot/projects/dtrace6/src/sys/vm/vm_pageout.c#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1#3 integrate
.. //depot/projects/dtrace6/src/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c#3 integrate
.. //depot/projects/dtrace6/src/usr.bin/fstat/fstat.c#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/getopt/README#2 delete
.. //depot/projects/dtrace6/src/usr.bin/getopt/getopt.c#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/truss/Makefile#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/truss/amd64-fbsd32.c#1 branch
.. //depot/projects/dtrace6/src/usr.bin/truss/amd64-linux32.c#1 branch
.. //depot/projects/dtrace6/src/usr.bin/truss/amd64linux32.conf#1 branch
.. //depot/projects/dtrace6/src/usr.bin/truss/extern.h#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/truss/fbsd32.conf#1 branch
.. //depot/projects/dtrace6/src/usr.bin/truss/main.c#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/truss/setup.c#2 integrate
.. //depot/projects/dtrace6/src/usr.sbin/moused/moused.8#2 integrate
.. //depot/projects/dtrace6/src/usr.sbin/moused/moused.c#3 integrate
.. //depot/projects/dtrace6/src/usr.sbin/sade/disks.c#2 integrate
.. //depot/projects/dtrace6/src/usr.sbin/sade/label.c#2 integrate
.. //depot/projects/dtrace6/src/usr.sbin/traceroute6/Makefile#2 integrate
.. //depot/projects/dtrace6/src/usr.sbin/traceroute6/traceroute6.8#2 integrate
.. //depot/projects/dtrace6/src/usr.sbin/traceroute6/traceroute6.c#2 integrate

Differences ...

==== //depot/projects/dtrace6/src/etc/rc.d/dhclient#3 (text+ko) ====

@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $FreeBSD: src/etc/rc.d/dhclient,v 1.20.2.6 2008/03/12 17:41:37 brooks Exp $
+# $FreeBSD: src/etc/rc.d/dhclient,v 1.20.2.7 2008/05/15 01:53:46 brooks Exp $
 #
 
 # PROVIDE: dhclient
@@ -26,6 +26,10 @@
 			if [ -n "$pids" ]; then
 				exit 0
 			fi
+		elif [ -e /var/run/dhclient.pid ]; then
+			if [ -n "`pgrep -F /var/run/dhclient.pid`" ]; then
+				exit 0
+			fi
 		fi
 	fi
 

==== //depot/projects/dtrace6/src/etc/rc.d/ntpd#2 (text+ko) ====

@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $FreeBSD: src/etc/rc.d/ntpd,v 1.11.2.2 2006/06/06 11:17:08 flz Exp $
+# $FreeBSD: src/etc/rc.d/ntpd,v 1.11.2.3 2008/05/19 09:21:24 flz Exp $
 #
 
 # PROVIDE: ntpd
@@ -18,8 +18,6 @@
 
 load_rc_config $name
 
-required_files="${ntpd_config}"
-
 ntpd_precmd()
 {
 	rc_flags="-c ${ntpd_config} ${ntpd_flags}"

==== //depot/projects/dtrace6/src/etc/rc.subr#3 (text+ko) ====

@@ -1,5 +1,5 @@
 # $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $
-# $FreeBSD: src/etc/rc.subr,v 1.34.2.23 2007/10/25 14:04:18 mtm Exp $
+# $FreeBSD: src/etc/rc.subr,v 1.34.2.24 2008/05/12 07:28:03 mtm Exp $
 #
 # Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -171,11 +171,15 @@
 {
 	local always
 
-	if [ -n "$1" ] && checkyesno $1; then
+	case $1 in
+		#       "yes", "true", "on", or "1"
+	[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
 		always=true
-	else
+		;;
+	*)
 		always=false
-	fi
+		;;
+	esac
 	if [ "$autoboot" = yes -o "$always" = true ]; then
 		echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!"
 		kill -TERM ${RC_PID}

==== //depot/projects/dtrace6/src/include/protocols/dumprestore.h#2 (text+ko) ====

@@ -37,7 +37,7 @@
  *
  *	@(#)dumprestore.h	8.2 (Berkeley) 1/21/94
  *
- * $FreeBSD: src/include/protocols/dumprestore.h,v 1.10 2002/07/17 02:03:19 mckusick Exp $
+ * $FreeBSD: src/include/protocols/dumprestore.h,v 1.10.14.1 2008/05/23 18:08:31 mckusick Exp $
  */
 
 #ifndef _PROTOCOLS_DUMPRESTORE_H_
@@ -97,7 +97,8 @@
 		int64_t	c_birthtime;	    /* creation time, seconds */
 		int64_t	c_atime;	    /* last access time, seconds */
 		int64_t	c_mtime;	    /* last modified time, seconds */
-		int32_t	c_spare4[7];	    /* old block pointers */
+		int32_t	c_extsize;	    /* external attribute size */
+		int32_t	c_spare4[6];	    /* old block pointers */
 		u_int32_t c_file_flags;	    /* status flags (chflags) */
 		int32_t	c_spare5[2];	    /* old blocks, generation number */
 		u_int32_t c_uid;	    /* file owner */

==== //depot/projects/dtrace6/src/include/readpassphrase.h#2 (text+ko) ====

@@ -1,5 +1,5 @@
 /*	$OpenBSD: /usr/local/www/cvsroot/OpenBSD/src/include/readpassphrase.h,v 1.2 2002/02/16 21:27:17 millert Exp $	*/
-/*	$FreeBSD: src/include/readpassphrase.h,v 1.2 2002/03/08 20:52:52 green Exp $	*/
+/*	$FreeBSD: src/include/readpassphrase.h,v 1.2.18.1 2008/05/16 01:22:20 scf Exp $	*/
 
 /*
  * Copyright (c) 2000 Todd C. Miller <Todd.Miller at courtesan.com>
@@ -39,6 +39,12 @@
 #define RPP_SEVENBIT    0x10		/* Strip the high bit from input. */
 
 #include <sys/cdefs.h>
+#include <sys/_types.h>
+
+#ifndef _SIZE_T_DECLARED
+typedef	__size_t	size_t;
+#define	_SIZE_T_DECLARED
+#endif
 
 __BEGIN_DECLS
 char * readpassphrase(const char *, char *, size_t, int);

==== //depot/projects/dtrace6/src/lib/libc/gen/readdir.c#2 (text+ko) ====

@@ -35,7 +35,7 @@
 static char sccsid[] = "@(#)readdir.c	8.3 (Berkeley) 9/29/94";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/readdir.c,v 1.11 2002/02/26 21:39:32 alfred Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/readdir.c,v 1.11.14.1 2008/05/19 11:50:48 kib Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
@@ -51,8 +51,9 @@
  * get next entry in a directory.
  */
 struct dirent *
-_readdir_unlocked(dirp)
+_readdir_unlocked(dirp, skip)
 	DIR *dirp;
+	int skip;
 {
 	struct dirent *dp;
 
@@ -75,7 +76,7 @@
 		    dp->d_reclen > dirp->dd_len + 1 - dirp->dd_loc)
 			return (NULL);
 		dirp->dd_loc += dp->d_reclen;
-		if (dp->d_ino == 0)
+		if (dp->d_ino == 0 && skip)
 			continue;
 		if (dp->d_type == DT_WHT && (dirp->dd_flags & DTF_HIDEW))
 			continue;
@@ -91,11 +92,11 @@
 
 	if (__isthreaded) {
 		_pthread_mutex_lock((pthread_mutex_t *)&dirp->dd_lock);
-		dp = _readdir_unlocked(dirp);
+		dp = _readdir_unlocked(dirp, 1);
 		_pthread_mutex_unlock((pthread_mutex_t *)&dirp->dd_lock);
 	}
 	else
-		dp = _readdir_unlocked(dirp);
+		dp = _readdir_unlocked(dirp, 1);
 	return (dp);
 }
 
@@ -112,11 +113,11 @@
 	errno = 0;
 	if (__isthreaded) {
 		_pthread_mutex_lock((pthread_mutex_t *)&dirp->dd_lock);
-		if ((dp = _readdir_unlocked(dirp)) != NULL)
+		if ((dp = _readdir_unlocked(dirp, 1)) != NULL)
 			memcpy(entry, dp, _GENERIC_DIRSIZ(dp));
 		_pthread_mutex_unlock((pthread_mutex_t *)&dirp->dd_lock);
 	}
-	else if ((dp = _readdir_unlocked(dirp)) != NULL)
+	else if ((dp = _readdir_unlocked(dirp, 1)) != NULL)
 		memcpy(entry, dp, _GENERIC_DIRSIZ(dp));
 
 	if (errno != 0) {

==== //depot/projects/dtrace6/src/lib/libc/gen/telldir.c#2 (text+ko) ====

@@ -35,7 +35,7 @@
 static char sccsid[] = "@(#)telldir.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/telldir.c,v 1.8 2002/02/01 00:57:29 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/telldir.c,v 1.8.14.1 2008/05/19 11:50:48 kib Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
@@ -102,7 +102,7 @@
 	dirp->dd_seek = lp->loc_seek;
 	dirp->dd_loc = 0;
 	while (dirp->dd_loc < lp->loc_loc) {
-		dp = _readdir_unlocked(dirp);
+		dp = _readdir_unlocked(dirp, 0);
 		if (dp == NULL)
 			break;
 	}

==== //depot/projects/dtrace6/src/lib/libc/gen/telldir.h#2 (text+ko) ====

@@ -29,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libc/gen/telldir.h,v 1.2 2001/01/24 12:59:24 deischen Exp $
+ * $FreeBSD: src/lib/libc/gen/telldir.h,v 1.2.14.1 2008/05/19 11:50:48 kib Exp $
  */
 
 #ifndef _TELLDIR_H_
@@ -59,7 +59,7 @@
 	long	td_loccnt;	/* index of entry for sequential readdir's */
 };
 
-struct dirent	*_readdir_unlocked(DIR *);
+struct dirent	*_readdir_unlocked(DIR *, int);
 void 		_reclaim_telldir(DIR *);
 void 		_seekdir(DIR *, long);
 

==== //depot/projects/dtrace6/src/sbin/dhclient/bpf.c#2 (text+ko) ====

@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/dhclient/bpf.c,v 1.2.2.4 2006/09/29 03:07:41 brooks Exp $");
+__FBSDID("$FreeBSD: src/sbin/dhclient/bpf.c,v 1.2.2.5 2008/05/15 01:59:20 brooks Exp $");
 
 #include "dhcpd.h"
 #include <sys/ioctl.h>
@@ -245,6 +245,21 @@
 	unsigned char buf[256];
 	struct iovec iov[2];
 	int result, bufp = 0;
+	int sock;
+
+	if (to->sin_addr.s_addr != INADDR_BROADCAST) {
+		note("SENDING DIRECT");
+		/* We know who the server is, send the packet via
+		   normal socket interface */
+
+		if ((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) >= 0) {
+			result = sendto (sock, (char *)raw, len, 0,
+					 (struct sockaddr *)to, sizeof *to);
+			close(sock);
+			if (result > 0)
+				return result;
+			}
+		}
 
 	/* Assemble the headers... */
 	assemble_hw_header(interface, buf, &bufp, hto);

==== //depot/projects/dtrace6/src/sbin/dump/dump.h#2 (text+ko) ====

@@ -28,7 +28,7 @@
  *
  *	@(#)dump.h	8.2 (Berkeley) 4/28/95
  *
- * $FreeBSD: src/sbin/dump/dump.h,v 1.27 2004/12/02 13:56:53 maxim Exp $
+ * $FreeBSD: src/sbin/dump/dump.h,v 1.27.2.1 2008/05/23 18:08:31 mckusick Exp $
  */
 
 /*
@@ -105,8 +105,6 @@
 int	mapdirs(ino_t maxino, long *tapesize);
 
 /* file dumping routines */
-void	ufs1_blksout(ufs1_daddr_t *blkp, int frags, ino_t ino);
-void	ufs2_blksout(ufs2_daddr_t *blkp, int frags, ino_t ino);
 void	bread(ufs2_daddr_t blkno, char *buf, int size);
 ssize_t cread(int fd, void *buf, size_t nbytes, off_t offset);
 void	dumpino(union dinode *dp, ino_t ino);

==== //depot/projects/dtrace6/src/sbin/dump/traverse.c#2 (text+ko) ====

@@ -32,7 +32,7 @@
 static char sccsid[] = "@(#)traverse.c	8.7 (Berkeley) 6/15/95";
 #endif
 static const char rcsid[] =
-  "$FreeBSD: src/sbin/dump/traverse.c,v 1.36.2.2 2007/04/12 07:53:13 thomas Exp $";
+  "$FreeBSD: src/sbin/dump/traverse.c,v 1.36.2.3 2008/05/23 18:08:31 mckusick Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -75,7 +75,13 @@
 
 static	int dirindir(ino_t ino, ufs2_daddr_t blkno, int level, long *size,
     long *tapesize, int nodump, ino_t maxino);
-static	void dmpindir(ino_t ino, ufs2_daddr_t blk, int level, off_t *size);
+static	void dmpindir(union dinode *dp, ino_t ino, ufs2_daddr_t blk, int level,
+    off_t *size);
+static	void ufs1_blksout(ufs1_daddr_t *blkp, int frags, ino_t ino);
+static	void ufs2_blksout(union dinode *dp, ufs2_daddr_t *blkp, int frags,
+    ino_t ino, int last);
+static	int appendextdata(union dinode *dp);
+static	void writeextdata(union dinode *dp, ino_t ino, int added);
 static	int searchdir(ino_t ino, ufs2_daddr_t blkno, long size, long filesize,
     long *tapesize, int nodump, ino_t maxino);
 static	long blockest(union dinode *dp);
@@ -450,7 +456,7 @@
 void
 dumpino(union dinode *dp, ino_t ino)
 {
-	int ind_level, cnt;
+	int ind_level, cnt, last, added;
 	off_t size;
 	char buf[TP_BSIZE];
 
@@ -470,6 +476,7 @@
 	if (sblock->fs_magic == FS_UFS1_MAGIC) {
 		spcl.c_mode = dp->dp1.di_mode;
 		spcl.c_size = dp->dp1.di_size;
+		spcl.c_extsize = 0;
 		spcl.c_atime = _time32_to_time(dp->dp1.di_atime);
 		spcl.c_atimensec = dp->dp1.di_atimensec;
 		spcl.c_mtime = _time32_to_time(dp->dp1.di_mtime);
@@ -483,6 +490,7 @@
 	} else {
 		spcl.c_mode = dp->dp2.di_mode;
 		spcl.c_size = dp->dp2.di_size;
+		spcl.c_extsize = dp->dp2.di_extsize;
 		spcl.c_atime = _time64_to_time(dp->dp2.di_atime);
 		spcl.c_atimensec = dp->dp2.di_atimensec;
 		spcl.c_mtime = _time64_to_time(dp->dp2.di_mtime);
@@ -512,6 +520,7 @@
 		    DIP(dp, di_size) < sblock->fs_maxsymlinklen) {
 			spcl.c_addr[0] = 1;
 			spcl.c_count = 1;
+			added = appendextdata(dp);
 			writeheader(ino);
 			if (sblock->fs_magic == FS_UFS1_MAGIC)
 				memmove(buf, (caddr_t)dp->dp1.di_db,
@@ -521,6 +530,7 @@
 				    (u_long)DIP(dp, di_size));
 			buf[DIP(dp, di_size)] = '\0';
 			writerec(buf, 0);
+			writeextdata(dp, ino, added);
 			return;
 		}
 		/* FALLTHROUGH */
@@ -535,7 +545,9 @@
 	case S_IFSOCK:
 	case S_IFCHR:
 	case S_IFBLK:
+		added = appendextdata(dp);
 		writeheader(ino);
+		writeextdata(dp, ino, added);
 		return;
 
 	default:
@@ -543,18 +555,21 @@
 		    DIP(dp, di_mode) & IFMT);
 		return;
 	}
-	if (DIP(dp, di_size) > NDADDR * sblock->fs_bsize)
+	if (DIP(dp, di_size) > NDADDR * sblock->fs_bsize) {
 		cnt = NDADDR * sblock->fs_frag;
-	else
+		last = 0;
+	} else {
 		cnt = howmany(DIP(dp, di_size), sblock->fs_fsize);
+		last = 1;
+	}
 	if (sblock->fs_magic == FS_UFS1_MAGIC)
 		ufs1_blksout(&dp->dp1.di_db[0], cnt, ino);
 	else
-		ufs2_blksout(&dp->dp2.di_db[0], cnt, ino);
+		ufs2_blksout(dp, &dp->dp2.di_db[0], cnt, ino, last);
 	if ((size = DIP(dp, di_size) - NDADDR * sblock->fs_bsize) <= 0)
 		return;
 	for (ind_level = 0; ind_level < NIADDR; ind_level++) {
-		dmpindir(ino, DIP(dp, di_ib[ind_level]), ind_level, &size);
+		dmpindir(dp, ino, DIP(dp, di_ib[ind_level]), ind_level, &size);
 		if (size <= 0)
 			return;
 	}
@@ -564,13 +579,14 @@
  * Read indirect blocks, and pass the data blocks to be dumped.
  */
 static void
-dmpindir(ino_t ino, ufs2_daddr_t blk, int ind_level, off_t *size)
+dmpindir(union dinode *dp, ino_t ino, ufs2_daddr_t blk, int ind_level,
+	off_t *size)
 {
 	union {
 		ufs1_daddr_t ufs1[MAXBSIZE / sizeof(ufs1_daddr_t)];
 		ufs2_daddr_t ufs2[MAXBSIZE / sizeof(ufs2_daddr_t)];
 	} idblk;
-	int i, cnt;
+	int i, cnt, last;
 
 	if (blk != 0)
 		bread(fsbtodb(sblock, blk), (char *)&idblk,
@@ -578,23 +594,26 @@
 	else
 		memset(&idblk, 0, sblock->fs_bsize);
 	if (ind_level <= 0) {
-		if (*size < NINDIR(sblock) * sblock->fs_bsize)
+		if (*size > NINDIR(sblock) * sblock->fs_bsize) {
+			cnt = NINDIR(sblock) * sblock->fs_frag;
+			last = 0;
+		} else {
 			cnt = howmany(*size, sblock->fs_fsize);
-		else
-			cnt = NINDIR(sblock) * sblock->fs_frag;
+			last = 1;
+		}
 		*size -= NINDIR(sblock) * sblock->fs_bsize;
 		if (sblock->fs_magic == FS_UFS1_MAGIC)
 			ufs1_blksout(idblk.ufs1, cnt, ino);
 		else
-			ufs2_blksout(idblk.ufs2, cnt, ino);
+			ufs2_blksout(dp, idblk.ufs2, cnt, ino, last);
 		return;
 	}
 	ind_level--;
 	for (i = 0; i < NINDIR(sblock); i++) {
 		if (sblock->fs_magic == FS_UFS1_MAGIC)
-			dmpindir(ino, idblk.ufs1[i], ind_level, size);
+			dmpindir(dp, ino, idblk.ufs1[i], ind_level, size);
 		else
-			dmpindir(ino, idblk.ufs2[i], ind_level, size);
+			dmpindir(dp, ino, idblk.ufs2[i], ind_level, size);
 		if (*size <= 0)
 			return;
 	}
@@ -603,7 +622,7 @@
 /*
  * Collect up the data into tape record sized buffers and output them.
  */
-void
+static void
 ufs1_blksout(ufs1_daddr_t *blkp, int frags, ino_t ino)
 {
 	ufs1_daddr_t *bp;
@@ -638,13 +657,25 @@
 /*
  * Collect up the data into tape record sized buffers and output them.
  */
-void
-ufs2_blksout(ufs2_daddr_t *blkp, int frags, ino_t ino)
+static void
+ufs2_blksout(union dinode *dp, ufs2_daddr_t *blkp, int frags, ino_t ino,
+	int last)
 {
 	ufs2_daddr_t *bp;
-	int i, j, count, blks, tbperdb;
+	int i, j, count, resid, blks, tbperdb, added;
+	static int writingextdata = 0;
 
+	/*
+	 * Calculate the number of TP_BSIZE blocks to be dumped.
+	 * For filesystems with a fragment size bigger than TP_BSIZE,
+	 * only part of the final fragment may need to be dumped.
+	 */
 	blks = howmany(frags * sblock->fs_fsize, TP_BSIZE);
+	if (last) {
+		resid = howmany(fragoff(sblock, dp->dp2.di_size), TP_BSIZE);
+		if (resid > 0)
+			blks -= howmany(sblock->fs_fsize, TP_BSIZE) - resid;
+	}
 	tbperdb = sblock->fs_bsize >> tp_bshift;
 	for (i = 0; i < blks; i += TP_NINDIR) {
 		if (i + TP_NINDIR > blks)
@@ -657,6 +688,8 @@
 			else
 				spcl.c_addr[j - i] = 0;
 		spcl.c_count = count - i;
+		if (last && count == blks && !writingextdata)
+			added = appendextdata(dp);
 		writeheader(ino);
 		bp = &blkp[i / tbperdb];
 		for (j = i; j < count; j += tbperdb, bp++)
@@ -667,7 +700,122 @@
 					dumpblock(*bp, (count - j) * TP_BSIZE);
 			}
 		spcl.c_type = TS_ADDR;
+		spcl.c_count = 0;
+		if (last && count == blks && !writingextdata) {
+			writingextdata = 1;
+			writeextdata(dp, ino, added);
+			writingextdata = 0;
+		}
+	}
+}
+
+/*
+ * If there is room in the current block for the extended attributes
+ * as well as the file data, update the header to reflect the added
+ * attribute data at the end. Attributes are placed at the end so that
+ * old versions of restore will correctly restore the file and simply
+ * discard the extra data at the end that it does not understand.
+ * The attribute data is dumped following the file data by the
+ * writeextdata() function (below).
+ */
+static int
+appendextdata(union dinode *dp)
+{
+	int i, blks, tbperdb;
+
+	/*
+	 * If no extended attributes, there is nothing to do.
+	 */
+	if (spcl.c_extsize == 0)
+		return (0);
+	/*
+	 * If there is not enough room at the end of this block
+	 * to add the extended attributes, then rather than putting
+	 * part of them here, we simply push them entirely into a
+	 * new block rather than putting some here and some later.
+	 */
+	if (spcl.c_extsize > NXADDR * sblock->fs_bsize)
+		blks = howmany(NXADDR * sblock->fs_bsize, TP_BSIZE);
+	else
+		blks = howmany(spcl.c_extsize, TP_BSIZE);
+	if (spcl.c_count + blks > TP_NINDIR)
+		return (0);
+	/*
+	 * Update the block map in the header to indicate the added
+	 * extended attribute. They will be appended after the file
+	 * data by the writeextdata() routine.
+	 */
+	tbperdb = sblock->fs_bsize >> tp_bshift;
+	for (i = 0; i < blks; i++)
+		if (&dp->dp2.di_extb[i / tbperdb] != 0)
+				spcl.c_addr[spcl.c_count + i] = 1;
+			else
+				spcl.c_addr[spcl.c_count + i] = 0;
+	spcl.c_count += blks;
+	return (blks);
+}
+
+/*
+ * Dump the extended attribute data. If there was room in the file
+ * header, then all we need to do is output the data blocks. If there
+ * was not room in the file header, then an additional TS_ADDR header
+ * is created to hold the attribute data.
+ */
+static void
+writeextdata(union dinode *dp, ino_t ino, int added)
+{
+	int i, frags, blks, tbperdb, last;
+	ufs2_daddr_t *bp;
+	off_t size;
+
+	/*
+	 * If no extended attributes, there is nothing to do.
+	 */
+	if (spcl.c_extsize == 0)
+		return;
+	/*
+	 * If there was no room in the file block for the attributes,
+	 * dump them out in a new block, otherwise just dump the data.
+	 */
+	if (added == 0) {
+		if (spcl.c_extsize > NXADDR * sblock->fs_bsize) {
+			frags = NXADDR * sblock->fs_frag;
+			last = 0;
+		} else {
+			frags = howmany(spcl.c_extsize, sblock->fs_fsize);
+			last = 1;
+		}
+		ufs2_blksout(dp, &dp->dp2.di_extb[0], frags, ino, last);
+	} else {
+		if (spcl.c_extsize > NXADDR * sblock->fs_bsize)
+			blks = howmany(NXADDR * sblock->fs_bsize, TP_BSIZE);
+		else
+			blks = howmany(spcl.c_extsize, TP_BSIZE);
+		tbperdb = sblock->fs_bsize >> tp_bshift;
+		for (i = 0; i < blks; i += tbperdb) {
+			bp = &dp->dp2.di_extb[i / tbperdb];
+			if (*bp != 0) {
+				if (i + tbperdb <= blks)
+					dumpblock(*bp, (int)sblock->fs_bsize);
+				else
+					dumpblock(*bp, (blks - i) * TP_BSIZE);
+			}
+		}
+
 	}
+	/*
+	 * If an indirect block is added for extended attributes, then
+	 * di_exti below should be changed to the structure element
+	 * that references the extended attribute indirect block. This
+	 * definition is here only to make it compile without complaint.
+	 */
+#define di_exti di_spare[0]
+	/*
+	 * If the extended attributes fall into an indirect block,
+	 * dump it as well.
+	 */
+	if ((size = spcl.c_extsize - NXADDR * sblock->fs_bsize) > 0)
+		dmpindir(dp, ino, dp->dp2.di_exti, 0, &size);
 }
 
 /*

==== //depot/projects/dtrace6/src/sbin/ipfw/ipfw.8#5 (text+ko) ====

@@ -1,5 +1,5 @@
 .\"
-.\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.175.2.15 2008/04/25 10:29:26 oleg Exp $
+.\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.175.2.16 2008/05/20 11:32:03 dwmalone Exp $
 .\"
 .Dd May 4, 2007
 .Dt IPFW 8
@@ -1937,6 +1937,13 @@
 Even worse effects can result if you get packets from an
 interface with a much larger MTU, e.g.\& the loopback interface
 with its 16KB packets.
+The
+.Xr sysctl 8
+variables
+.Em net.inet.ip.dummynet.pipe_byte_limit
+and
+.Em net.inet.ip.dummynet.pipe_slot_limit
+control the maximum lengths that can be specified.
 .Pp
 .It Cm red | gred Ar w_q Ns / Ns Ar min_th Ns / Ns Ar max_th Ns / Ns Ar max_p
 Make use of the RED (Random Early Detection) queue management algorithm.
@@ -2092,6 +2099,13 @@
 .It Em net.inet.ip.dummynet.red_max_pkt_size : No 1500
 Parameters used in the computations of the drop probability
 for the RED algorithm.
+.It Va net.inet.ip.dummynet.pipe_byte_limit : No 1048576
+.It Va net.inet.ip.dummynet.pipe_slot_limit : No 100
+The maximum queue size that can be specified in bytes or packets.
+These limits prevent accidental exhaustion of resources such as mbufs.
+If you raise these limits,
+you should make sure the system is configured so that sufficient resources
+are available.
 .It Em net.inet.ip.fw.autoinc_step : No 100
 Delta between rule numbers when auto-generating them.
 The value must be in the range 1..1000.

==== //depot/projects/dtrace6/src/sbin/ipfw/ipfw2.c#5 (text+ko) ====

@@ -17,7 +17,7 @@
  *
  * NEW command line interface for IP firewall facility
  *
- * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.76.2.22 2008/04/25 10:35:53 oleg Exp $
+ * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.76.2.23 2008/05/20 11:32:03 dwmalone Exp $
  */
 
 #include <sys/param.h>
@@ -3485,11 +3485,25 @@
 			errx(EX_DATAERR, "weight must be <= 100");
 	}
 	if (p.fs.flags_fs & DN_QSIZE_IS_BYTES) {
-		if (p.fs.qsize > 1024*1024)
-			errx(EX_DATAERR, "queue size must be < 1MB");
+		size_t len;
+		long limit;
+
+		len = sizeof(limit);
+		if (sysctlbyname("net.inet.ip.dummynet.pipe_byte_limit",
+			&limit, &len, NULL, 0) == -1)
+			limit = 1024*1024;
+		if (p.fs.qsize > limit)
+			errx(EX_DATAERR, "queue size must be < %ldB", limit);
 	} else {
-		if (p.fs.qsize > 100)
-			errx(EX_DATAERR, "2 <= queue size <= 100");
+		size_t len;
+		long limit;
+
+		len = sizeof(limit);
+		if (sysctlbyname("net.inet.ip.dummynet.pipe_slot_limit",
+			&limit, &len, NULL, 0) == -1)
+			limit = 100;
+		if (p.fs.qsize > limit)
+			errx(EX_DATAERR, "2 <= queue size <= %ld", limit);
 	}
 	if (p.fs.flags_fs & DN_IS_RED) {
 		size_t len;
@@ -3507,7 +3521,6 @@
 		len = sizeof(int);
 		if (sysctlbyname("net.inet.ip.dummynet.red_lookup_depth",
 			&lookup_depth, &len, NULL, 0) == -1)
-
 		    errx(1, "sysctlbyname(\"%s\")",
 			"net.inet.ip.dummynet.red_lookup_depth");
 		if (lookup_depth == 0)

==== //depot/projects/dtrace6/src/sbin/restore/dirs.c#2 (text+ko) ====

@@ -37,7 +37,7 @@
 static char sccsid[] = "@(#)dirs.c	8.7 (Berkeley) 5/1/95";
 #endif
 static const char rcsid[] =
-  "$FreeBSD: src/sbin/restore/dirs.c,v 1.30 2005/04/03 16:35:58 imp Exp $";
+  "$FreeBSD: src/sbin/restore/dirs.c,v 1.30.2.1 2008/05/23 18:08:31 mckusick Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -85,6 +85,7 @@
 	uid_t uid;
 	gid_t gid;
 	int flags;
+	int extsize;
 };
 
 /*
@@ -114,6 +115,7 @@
 static struct inotab	*inotablookup(ino_t);
 static RST_DIR		*opendirfile(const char *);
 static void		 putdir(char *, long);
+static void		 putdirattrs(char *, long);
 static void		 putent(struct direct *);
 static void		 rst_seekdir(RST_DIR *, long, long);
 static long		 rst_telldir(RST_DIR *);
@@ -184,7 +186,7 @@
 			return;
 		}
 		itp = allocinotab(&curfile, seekpt);
-		getfile(putdir, xtrnull);
+		getfile(putdir, putdirattrs, xtrnull);
 		putent(&nulldir);
 		flushent();
 		itp->t_size = seekpt - itp->t_seekpt;
@@ -410,6 +412,17 @@
 }
 
 /*
+ * Save extended attributes for a directory entry to a file.
+ */
+static void
+putdirattrs(char *buf, long size)
+{
+
+	if (mf != NULL)
+		(void) fwrite(buf, 1, size, mf);
+}
+
+/*
  * Seek to an entry in a directory.
  * Only values returned by rst_telldir should be passed to rst_seekdir.
  * This routine handles many directories in a single file.
@@ -543,8 +556,9 @@
 	FILE *mf;
 	struct modeinfo node;
 	struct entry *ep;
-	char *cp;
+	char *cp, *buf;
 	const char *tmpdir;
+	int bufsize;
 
 	vprintf(stdout, "Set directory mode, owner, and times.\n");
 	if ((tmpdir = getenv("TMPDIR")) == NULL || tmpdir[0] == '\0')
@@ -564,10 +578,27 @@
 		return;
 	}
 	clearerr(mf);
+	bufsize = 0;
 	for (;;) {
 		(void) fread((char *)&node, 1, sizeof(struct modeinfo), mf);
 		if (feof(mf))
 			break;
+		if (node.extsize > 0) {
+			if (bufsize < node.extsize) {
+				if (bufsize > 0)
+					free(buf);
+				if ((buf = malloc(node.extsize)) != 0) {
+					bufsize = node.extsize;
+				} else {
+					bufsize = 0;
+				}
+			}
+			if (bufsize >= node.extsize) {
+				(void) fread(buf, 1, node.extsize, mf);
+			} else {
+				(void) fseek(mf, node.extsize, SEEK_CUR);
+			}
+		}
 		ep = lookupino(node.ino);
 		if (command == 'i' || command == 'x') {
 			if (ep == NULL)
@@ -582,18 +613,28 @@
 		}
 		if (ep == NULL) {
 			panic("cannot find directory inode %d\n", node.ino);
-		} else {
-			cp = myname(ep);
-			if (!Nflag) {
-				(void) chown(cp, node.uid, node.gid);
-				(void) chmod(cp, node.mode);
-				utimes(cp, node.ctimep);
-				utimes(cp, node.mtimep);
-				(void) chflags(cp, node.flags);
+			continue;
+		}
+		cp = myname(ep);
+		if (!Nflag) {
+			if (node.extsize > 0) {
+				if (bufsize >= node.extsize) {
+					set_extattr_file(cp, buf, node.extsize);
+				} else {
+					fprintf(stderr, "Cannot restore %s%s\n",
+					    "extended attributes for ", cp);
+				}
 			}
-			ep->e_flags &= ~NEW;
+			(void) chown(cp, node.uid, node.gid);
+			(void) chmod(cp, node.mode);
+			utimes(cp, node.ctimep);
+			utimes(cp, node.mtimep);
+			(void) chflags(cp, node.flags);
 		}
+		ep->e_flags &= ~NEW;
 	}
+	if (bufsize > 0)
+		free(buf);
 	if (ferror(mf))
 		panic("error setting directory modes\n");
 	(void) fclose(mf);
@@ -668,7 +709,7 @@
 
 	itp = calloc(1, sizeof(struct inotab));
 	if (itp == NULL)
-		panic("no memory directory table\n");
+		panic("no memory for directory table\n");
 	itp->t_next = inotab[INOHASH(ctxp->ino)];
 	inotab[INOHASH(ctxp->ino)] = itp;
 	itp->t_ino = ctxp->ino;
@@ -684,6 +725,7 @@
 	node.ctimep[0].tv_usec = ctxp->atime_nsec / 1000;
 	node.ctimep[1].tv_sec = ctxp->birthtime_sec;
 	node.ctimep[1].tv_usec = ctxp->birthtime_nsec / 1000;
+	node.extsize = ctxp->extsize;
 	node.mode = ctxp->mode;
 	node.flags = ctxp->file_flags;
 	node.uid = ctxp->uid;

==== //depot/projects/dtrace6/src/sbin/restore/extern.h#2 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)extern.h	8.2 (Berkeley) 1/7/94
- * $FreeBSD: src/sbin/restore/extern.h,v 1.10 2004/05/24 16:24:26 stefanf Exp $
+ * $FreeBSD: src/sbin/restore/extern.h,v 1.10.8.1 2008/05/23 18:08:31 mckusick Exp $
  */
 
 struct entry	*addentry(char *, ino_t, int);
@@ -54,7 +54,8 @@
 void		 freename(char *);
 int	 	 genliteraldir(char *, ino_t);
 char		*gentempname(struct entry *);
-void		 getfile(void (*)(char *, long), void (*)(char *, long));
+void		 getfile(void (*)(char *, long), void (*)(char *, long),
+			void (*)(char *, long));
 void		 getvol(long);
 void		 initsymtable(char *);
 int	 	 inodetype(ino_t);
@@ -86,6 +87,7 @@
 void		 rst_closedir(void *);
 void	 	 runcmdshell(void);
 char		*savename(char *);
+void		 set_extattr_file(char *, void *, int);
 void	 	 setdirmodes(int);
 void		 setinput(char *, int);
 void		 setup(void);

==== //depot/projects/dtrace6/src/sbin/restore/restore.h#2 (text+ko) ====

@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)restore.h	8.3 (Berkeley) 9/13/94
- * $FreeBSD: src/sbin/restore/restore.h,v 1.10 2005/04/03 05:18:28 imp Exp $
+ * $FreeBSD: src/sbin/restore/restore.h,v 1.10.2.1 2008/05/23 18:08:31 mckusick Exp $
  */
 
 /*
@@ -114,6 +114,7 @@
 	int	atime_nsec;	/* access time nanoseconds */
 	int	mtime_nsec;	/* modified time nanoseconds */
 	int	birthtime_nsec;	/* creation time nanoseconds */
+	int	extsize;	/* size of extended attribute data */
 	off_t	size;		/* size of file */
 	char	*name;		/* name of file */
 } curfile;

==== //depot/projects/dtrace6/src/sbin/restore/tape.c#2 (text+ko) ====

@@ -39,14 +39,17 @@
 #endif /* not lint */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/restore/tape.c,v 1.44.2.1 2006/10/08 05:52:49 maxim Exp $");
+__FBSDID("$FreeBSD: src/sbin/restore/tape.c,v 1.44.2.2 2008/05/23 18:08:31 mckusick Exp $");
 
 #include <sys/param.h>
 #include <sys/file.h>
 #include <sys/mtio.h>
 #include <sys/stat.h>
 #include <sys/time.h>
+#include <sys/extattr.h>
+#include <sys/acl.h>
 
+#include <ufs/ufs/extattr.h>
 #include <ufs/ufs/dinode.h>
 #include <protocols/dumprestore.h>
 
@@ -92,10 +95,16 @@
 
 #define	FLUSHTAPEBUF()	blkcnt = ntrec + 1
 
+char *namespace_names[] = EXTATTR_NAMESPACE_NAMES;
+
 static void	 accthdr(struct s_spcl *);
 static int	 checksum(int *);
 static void	 findinode(struct s_spcl *);
 static void	 findtapeblksize(void);
+static char	*setupextattr(int);
+static void	 xtrattr(char *, long);
+static void	 set_extattr_link(char *, void *, int);

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


More information about the p4-projects mailing list