PERFORCE change 82940 for review

Peter Wemm peter at FreeBSD.org
Wed Aug 31 20:57:32 GMT 2005


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

Change 82940 by peter at peter_daintree on 2005/08/31 20:56:53

	IFC @82939

Affected files ...

.. //depot/projects/hammer/bin/ls/ls.1#20 integrate
.. //depot/projects/hammer/etc/login.conf#3 integrate
.. //depot/projects/hammer/etc/periodic/security/550.ipfwlimit#7 integrate
.. //depot/projects/hammer/etc/rc.d/sendmail#11 integrate
.. //depot/projects/hammer/games/fortune/datfiles/startrek#8 integrate
.. //depot/projects/hammer/lib/libdevinfo/devinfo.h#4 integrate
.. //depot/projects/hammer/lib/libpthread/thread/thr_kern.c#37 integrate
.. //depot/projects/hammer/lib/libufs/Makefile#7 integrate
.. //depot/projects/hammer/lib/libufs/getino.3#4 delete
.. //depot/projects/hammer/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml#105 integrate
.. //depot/projects/hammer/sbin/dhclient/dhclient.c#7 integrate
.. //depot/projects/hammer/sbin/gpt/add.c#9 integrate
.. //depot/projects/hammer/sbin/gpt/create.c#8 integrate
.. //depot/projects/hammer/sbin/gpt/destroy.c#5 integrate
.. //depot/projects/hammer/sbin/gpt/gpt.8#10 integrate
.. //depot/projects/hammer/sbin/gpt/gpt.c#8 integrate
.. //depot/projects/hammer/sbin/gpt/gpt.h#7 integrate
.. //depot/projects/hammer/sbin/gpt/map.c#4 integrate
.. //depot/projects/hammer/sbin/gpt/map.h#5 integrate
.. //depot/projects/hammer/sbin/gpt/migrate.c#10 integrate
.. //depot/projects/hammer/sbin/gpt/mkdisk.sh#4 delete
.. //depot/projects/hammer/sbin/gpt/recover.c#7 integrate
.. //depot/projects/hammer/sbin/gpt/remove.c#4 integrate
.. //depot/projects/hammer/sbin/gpt/show.c#8 integrate
.. //depot/projects/hammer/sbin/mdconfig/mdconfig.c#20 integrate
.. //depot/projects/hammer/share/man/man4/ata.4#19 integrate
.. //depot/projects/hammer/share/man/man5/autofs.5#4 delete
.. //depot/projects/hammer/share/man/man9/bus_dma.9#18 integrate
.. //depot/projects/hammer/share/zoneinfo/Makefile#3 integrate
.. //depot/projects/hammer/sys/boot/forth/loader.conf#25 integrate
.. //depot/projects/hammer/sys/compat/ndis/kern_ndis.c#34 integrate
.. //depot/projects/hammer/sys/dev/ed/if_ed_cbus.c#13 integrate
.. //depot/projects/hammer/sys/dev/fdc/fdc.c#28 integrate
.. //depot/projects/hammer/sys/dev/md/md.c#51 integrate
.. //depot/projects/hammer/sys/dev/pccard/pccarddevs#39 integrate
.. //depot/projects/hammer/sys/dev/syscons/scmouse.c#8 integrate
.. //depot/projects/hammer/sys/dev/syscons/scvesactl.c#6 integrate
.. //depot/projects/hammer/sys/dev/syscons/scvidctl.c#6 integrate
.. //depot/projects/hammer/sys/dev/syscons/syscons.c#33 integrate
.. //depot/projects/hammer/sys/dev/syscons/syscons.h#9 integrate
.. //depot/projects/hammer/sys/dev/txp/if_txp.c#20 integrate
.. //depot/projects/hammer/sys/kern/kern_cpu.c#9 integrate
.. //depot/projects/hammer/sys/kern/uipc_mbuf.c#32 integrate
.. //depot/projects/hammer/sys/net/if_vlan.c#28 integrate
.. //depot/projects/hammer/sys/net/if_vlan_var.h#9 integrate
.. //depot/projects/hammer/sys/net80211/ieee80211_ioctl.c#23 integrate
.. //depot/projects/hammer/sys/netatalk/ddp_output.c#11 integrate
.. //depot/projects/hammer/sys/netgraph/bluetooth/include/ng_l2cap.h#4 integrate
.. //depot/projects/hammer/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c#6 integrate
.. //depot/projects/hammer/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c#11 integrate
.. //depot/projects/hammer/sys/netgraph/netgraph.h#22 integrate
.. //depot/projects/hammer/sys/netgraph/ng_pptpgre.c#12 integrate
.. //depot/projects/hammer/sys/netinet/ip_input.c#53 integrate
.. //depot/projects/hammer/sys/netinet/ip_output.c#51 integrate
.. //depot/projects/hammer/sys/netinet/tcp_subr.c#49 integrate
.. //depot/projects/hammer/sys/netinet6/ip6_output.c#35 integrate
.. //depot/projects/hammer/sys/pci/if_ste.c#37 integrate
.. //depot/projects/hammer/sys/pci/if_stereg.h#11 integrate
.. //depot/projects/hammer/sys/pci/if_wb.c#28 integrate
.. //depot/projects/hammer/sys/pci/if_wbreg.h#5 integrate
.. //depot/projects/hammer/sys/sys/mbuf.h#44 integrate
.. //depot/projects/hammer/tools/tools/ath/athctrl.sh#1 branch
.. //depot/projects/hammer/usr.bin/rpcgen/Makefile#2 integrate
.. //depot/projects/hammer/usr.bin/rpcgen/rpc_cout.c#3 integrate
.. //depot/projects/hammer/usr.bin/rpcgen/rpc_main.c#7 integrate
.. //depot/projects/hammer/usr.bin/rpcgen/rpc_util.h#2 integrate
.. //depot/projects/hammer/usr.bin/split/split.1#5 integrate
.. //depot/projects/hammer/usr.bin/split/split.c#4 integrate
.. //depot/projects/hammer/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c#5 integrate

Differences ...

==== //depot/projects/hammer/bin/ls/ls.1#20 (text+ko) ====

@@ -30,7 +30,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)ls.1	8.7 (Berkeley) 7/29/94
-.\" $FreeBSD: src/bin/ls/ls.1,v 1.89 2005/06/03 11:38:35 dd Exp $
+.\" $FreeBSD: src/bin/ls/ls.1,v 1.90 2005/08/31 17:58:38 garys Exp $
 .\"
 .Dd June 2, 2005
 .Dt LS 1
@@ -180,29 +180,17 @@
 .It Fl i
 For each file, print the file's file serial number (inode number).
 .It Fl k
-If the
-.Fl s
-option is specified, print the file size allocation in kilobytes,
-not blocks.
-This option overrides the environment variable
-.Ev BLOCKSIZE .
-Note that
-.Fl k
-is mutually exclusive to
-.Fl h ,
-and later
-.Fl k
-will nullify earlier
-.Fl h .
+This has the same effect as setting environment variable
+.Ev BLOCKSIZE
+to 1024, except that it also nullifies any
+.Fl h
+options to its left.
 .It Fl l
 (The lowercase letter
 .Dq ell . )
-List in long format.
-(See below.)
-A total sum (in blocks, see the
-.Fl s
-option for the block size unit) for all the file
-sizes is output on a line before the long listing.
+List files in the long format, as described in the
+.Sx The Long Format
+subsection below.
 .It Fl m
 Stream output format; list files across the page, separated by commas.
 .It Fl n
@@ -226,13 +214,12 @@
 .It Fl r
 Reverse the order of the sort.
 .It Fl s
-Display the number of file system blocks actually used by each file, in units
-of 512 bytes, where partial units are rounded up to the next integer value.
-A total sum for all the file
-sizes is output on a line before the listing.
-The environment variable
-.Ev BLOCKSIZE
-overrides the unit size of 512 bytes.
+Display the number of blocks used in the file system by each file.
+Block sizes and directory totals are handled as decribed in
+.Sx The Long Format
+subsection below, except (if the long format is not also requested)
+the directory totals are not output when the output is in a
+single column, even if multi-column output is requested.
 .It Fl t
 Sort by time modified (most recently modified
 first) before sorting the operands in lexicographical
@@ -318,10 +305,6 @@
 month, day-of-month file was last modified,
 hour file last modified, minute file last
 modified, and the pathname.
-In addition, for each directory whose contents are displayed, the total
-number of 512-byte blocks used by the files in the directory is displayed
-on a line by itself immediately before the information for the files in the
-directory.
 .Pp
 If the modification time of the file is more than 6 months
 in the past or future, then the year of the last modification
@@ -340,6 +323,24 @@
 linked-to file is preceded by
 .Dq Li -> .
 .Pp
+The listing of a directory's contents is preceeded
+by a labeled total number of blocks used in the file system by the files
+which are listed as the directory's contents
+(which may or may not include
+.Pa \&.
+and
+.Pa ..
+and other files which start with a dot, depending on other options).
+.Pp
+The default block size is 512 bytes.
+The block size may be set with option
+.Fl k
+or environment variable
+.Ev BLOCKSIZE .
+Numbers of blocks in the output will have been rounded up so the
+numbers of bytes is at least as many as used by the corresponding
+file system blocks (which might have a different size).
+.Pp
 The file mode printed under the
 .Fl l
 option consists of the
@@ -446,12 +447,15 @@
 .Nm :
 .Bl -tag -width ".Ev CLICOLOR_FORCE"
 .It Ev BLOCKSIZE
-If the environment variable
-.Ev BLOCKSIZE
-is set, the block counts
-(see
-.Fl s )
-will be displayed in units of that size block.
+If this is set, its value, rounded up to 512 or down to a
+multiple of 512, will be used as the block size in bytes by the
+.Fl l
+and
+.Fl s
+options.
+See
+.Sx The Long Format
+subsection for more information.
 .It Ev CLICOLOR
 Use
 .Tn ANSI
@@ -663,3 +667,10 @@
 .Sh BUGS
 To maintain backward compatibility, the relationships between the many
 options are quite complex.
+.Pp
+The exception mentioned in the
+.Fl s
+option description might be a feature that was
+based on the fact that single-column output
+usually goes to something other than a terminal.
+It is debatable whether this is a design bug.

==== //depot/projects/hammer/etc/login.conf#3 (text+ko) ====

@@ -7,7 +7,7 @@
 # This file controls resource limits, accounting limits and
 # default user environment settings.
 #
-# $FreeBSD: src/etc/login.conf,v 1.49 2004/06/06 11:46:27 schweikh Exp $
+# $FreeBSD: src/etc/login.conf,v 1.50 2005/08/31 15:02:11 keramida Exp $
 #
 
 # Default settings effectively disable resource limits, see the
@@ -16,6 +16,11 @@
 # defaults
 # These settings are used by login(1) by default for classless users
 # Note that entries like "cputime" set both "cputime-cur" and "cputime-max"
+#
+# Note that since a colon ':' is used to separate capability entries,
+# a \c escape sequence must be used to embed a literal colon in the
+# value or name of a capability (see the ``CGETNUM AND CGETSTR SYNTAX
+# AND SEMANTICS'' section of getcap(3) for more escape sequences).
 
 default:\
 	:passwd_format=md5:\

==== //depot/projects/hammer/etc/periodic/security/550.ipfwlimit#7 (text+ko) ====

@@ -24,7 +24,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: src/etc/periodic/security/550.ipfwlimit,v 1.8 2005/08/20 09:41:49 glebius Exp $
+# $FreeBSD: src/etc/periodic/security/550.ipfwlimit,v 1.9 2005/08/31 08:31:14 glebius Exp $
 #
 
 # Show ipfw rules which have reached the log limit
@@ -44,8 +44,8 @@
     [Yy][Ee][Ss])
 	TMP=`mktemp -t security`
 	IPFW_LOG_LIMIT=`sysctl -n net.inet.ip.fw.verbose_limit 2> /dev/null`
-	if [ $? -eq 0 ]; then
-		IPFW_LOG_LIMIT=0
+	if [ $? -ne 0 ]; then
+		exit 0
 	fi
 	ipfw -a list | grep " log " | \
 	grep '^[[:digit:]]\+[[:space:]]\+[[:digit:]]\+' | \

==== //depot/projects/hammer/etc/rc.d/sendmail#11 (text+ko) ====

@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # $NetBSD: sendmail,v 1.14 2002/02/12 01:26:36 lukem Exp $
-# $FreeBSD: src/etc/rc.d/sendmail,v 1.14 2005/01/16 03:12:03 obrien Exp $
+# $FreeBSD: src/etc/rc.d/sendmail,v 1.15 2005/08/30 03:41:59 gshapiro Exp $
 #
 
 # PROVIDE: mail
@@ -17,6 +17,7 @@
 name="sendmail"
 rcvar=`set_rcvar`
 required_files="/etc/mail/${name}.cf"
+start_precmd="sendmail_precmd"
 
 load_rc_config $name
 command=${sendmail_program:-/usr/sbin/sendmail}

==== //depot/projects/hammer/games/fortune/datfiles/startrek#8 (text+ko) ====

@@ -1,4 +1,4 @@
-%% $FreeBSD: src/games/fortune/datfiles/startrek,v 1.7 2005/04/24 15:31:11 schweikh Exp $
+%% $FreeBSD: src/games/fortune/datfiles/startrek,v 1.8 2005/08/30 16:33:39 schweikh Exp $
 A father doesn't destroy his children.
 		-- Lt. Carolyn Palamas, "Who Mourns for Adonais?",
 		   stardate 3468.1.
@@ -269,8 +269,8 @@
 hers.
 		-- Spock, "Amok Time", stardate 3372.7
 %
-It would be illogical to assume that all conditions remain stable
-		-- Spock, "The Enterprise" Incident", stardate 5027.3
+It would be illogical to assume that all conditions remain stable.
+		-- Spock, "The Enterprise Incident", stardate 5027.3
 %
 It would be illogical to kill without reason
 		-- Spock, "Journey to Babel", stardate 3842.4

==== //depot/projects/hammer/lib/libdevinfo/devinfo.h#4 (text+ko) ====

@@ -24,9 +24,12 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/lib/libdevinfo/devinfo.h,v 1.4 2002/09/20 02:16:33 imp Exp $
+ *	$FreeBSD: src/lib/libdevinfo/devinfo.h,v 1.5 2005/08/31 14:57:39 rodrigc Exp $
  */
 
+#ifndef _DEVINFO_H_INCLUDED
+#define _DEVINFO_H_INCLUDED
+
 #include <sys/cdefs.h>
 #include <sys/_types.h>
 
@@ -77,6 +80,8 @@
 	/* XXX add flags */
 };
 
+__BEGIN_DECLS
+
 /*
  * Acquire a coherent copy of the kernel's device and resource tables.
  * This must return success (zero) before any other interfaces will
@@ -136,3 +141,7 @@
 extern int
 	devinfo_foreach_rman(int (* fn)(struct devinfo_rman *rman, void *arg),
 	    void *arg);
+
+__END_DECLS
+
+#endif /* ! _DEVINFO_H_INCLUDED */

==== //depot/projects/hammer/lib/libpthread/thread/thr_kern.c#37 (text+ko) ====

@@ -33,7 +33,7 @@
  *
  */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libpthread/thread/thr_kern.c,v 1.117 2005/08/29 13:49:18 deischen Exp $");
+__FBSDID("$FreeBSD: src/lib/libpthread/thread/thr_kern.c,v 1.118 2005/08/30 12:42:00 deischen Exp $");
 
 #include <sys/types.h>
 #include <sys/kse.h>
@@ -2365,6 +2365,11 @@
 	if ((thread == NULL) &&
 	    ((thread = malloc(sizeof(struct pthread))) != NULL)) {
 		bzero(thread, sizeof(struct pthread));
+		thread->siginfo = calloc(_SIG_MAXSIG, sizeof(siginfo_t));
+		if (thread->siginfo == NULL) {
+			free(thread);
+			return (NULL);
+		}
 		if (curthread) {
 			_pthread_mutex_lock(&_tcb_mutex);
 			thread->tcb = _tcb_ctor(thread, 0 /* not initial tls */);
@@ -2372,27 +2377,23 @@
 		} else {
 			thread->tcb = _tcb_ctor(thread, 1 /* initial tls */);
 		}
-		thread->siginfo = calloc(_SIG_MAXSIG, sizeof(siginfo_t));
-		if ((thread->tcb == NULL) || (thread->siginfo == NULL)) {
-			if (thread->siginfo != NULL)
-				free(thread->siginfo);
+		if (thread->tcb == NULL) {
+			free(thread->siginfo);
 			free(thread);
-			thread = NULL;
-		} else {
-			/*
-			 * Initialize thread locking.
-			 * Lock initializing needs malloc, so don't
-			 * enter critical region before doing this!
-			 */
-			if (_lock_init(&thread->lock, LCK_ADAPTIVE,
-			    _thr_lock_wait, _thr_lock_wakeup) != 0)
-				PANIC("Cannot initialize thread lock");
-			for (i = 0; i < MAX_THR_LOCKLEVEL; i++) {
-				_lockuser_init(&thread->lockusers[i],
-				    (void *)thread);
-				_LCK_SET_PRIVATE2(&thread->lockusers[i],
-				    (void *)thread);
-			}
+			return (NULL);
+		}
+		/*
+		 * Initialize thread locking.
+		 * Lock initializing needs malloc, so don't
+		 * enter critical region before doing this!
+		 */
+		if (_lock_init(&thread->lock, LCK_ADAPTIVE,
+		    _thr_lock_wait, _thr_lock_wakeup) != 0)
+			PANIC("Cannot initialize thread lock");
+		for (i = 0; i < MAX_THR_LOCKLEVEL; i++) {
+			_lockuser_init(&thread->lockusers[i], (void *)thread);
+			_LCK_SET_PRIVATE2(&thread->lockusers[i],
+			    (void *)thread);
 		}
 	}
 	return (thread);

==== //depot/projects/hammer/lib/libufs/Makefile#7 (text+ko) ====

@@ -1,12 +1,11 @@
-# $FreeBSD: src/lib/libufs/Makefile,v 1.11 2005/08/25 10:22:29 trhodes Exp $
+# $FreeBSD: src/lib/libufs/Makefile,v 1.12 2005/08/31 07:44:45 trhodes Exp $
 
 LIB=	ufs
 SHLIBDIR?= /lib
 SRCS=	block.c cgroup.c inode.c sblock.c type.c
 INCS=	libufs.h
-MAN=	bread.3 cgread.3 getino.3 libufs.3 sbread.3 ufs_disk_close.3
+MAN=	bread.3 cgread.3 libufs.3 sbread.3 ufs_disk_close.3
 MLINKS+= bread.3 bwrite.3
-MLINKS+= getino.3 putino.3
 MLINKS+= cgread.3 cgread1.3
 MLINKS+= sbread.3 sbwrite.3
 MLINKS+= ufs_disk_close.3 ufs_disk_fillout.3

==== //depot/projects/hammer/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml#105 (text+ko) ====

@@ -3,7 +3,7 @@
 
   <corpauthor>The &os; Project</corpauthor>
 
-  <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml,v 1.887 2005/08/28 04:43:48 gshapiro Exp $</pubdate>
+  <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml,v 1.888 2005/08/30 22:25:22 brueffer Exp $</pubdate>
 
   <copyright>
     <year>2000</year>
@@ -139,7 +139,9 @@
     <sect3 id="proc">
       <title>Hardware Support</title>
 
-      <para></para>
+      <para>Support for the PadLock Security Co-processor in VIA C3
+	processors has been added to the &man.crypto.9; subsystem.
+	&merged;</para>
 
       <sect4 id="mm">
 	<title>Multimedia Support</title>
@@ -150,7 +152,22 @@
       <sect4 id="net-if">
 	<title>Network Interface Support</title>
 
-	<para></para>
+	<para>The &man.dc.4; driver has been marked MPSAFE. &merged;</para>
+
+	<para>The &man.de.4; driver has been converted to the &man.bus.dma.9;
+	  API and marked MPSAFE.</para>
+
+	<para>The &man.ed.4; driver has been marked MPSAFE.</para>
+
+	<para>The &man.el.4; driver has been removed.</para>
+
+	<para>The &man.my.4; driver has been marked MPSAFE. &merged;</para>
+
+	<para>The &man.pcn.4; driver has been marked MPSAFE. &merged;</para>
+
+	<para>The &man.sf.4; driver has been marked MPSAFE. &merged;</para>
+
+	<para>The &man.ste.4; driver has been marked MPSAFE.</para>
       </sect4>
     </sect3>
 
@@ -169,6 +186,11 @@
 	status reporting, and sysctl variables for volume
 	re-synchronization rate, volume member write cache status,
 	and volume transaction queue depth.</para>
+
+      <para>A new GEOM-based disk encryption facility, GEOM_ELI, has been
+	added.  It uses the &man.crypto.9; framework for hardware acceleration
+	and supports different cryptographic algorithms.  See &man.geli.8; for
+	more information. &merged;</para>
     </sect3>
 
     <sect3 id="fs">
@@ -197,7 +219,7 @@
       in tracking kernel memory statistics.  It provides an
       abstracted interface to &man.uma.9; and &man.malloc.9;
       statistics, wrapped around the binary stream sysctl variables
-      for the allocators.</para>
+      for the allocators. &merged;</para>
 
     <sect3 id="rc-scripts">
       <title><filename>/etc/rc.d</filename> Scripts</title>

==== //depot/projects/hammer/sbin/dhclient/dhclient.c#7 (text+ko) ====

@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/dhclient/dhclient.c,v 1.9 2005/08/23 23:59:55 brooks Exp $");
+__FBSDID("$FreeBSD: src/sbin/dhclient/dhclient.c,v 1.10 2005/08/30 18:20:46 brooks Exp $");
 
 #include "dhcpd.h"
 #include "privsep.h"
@@ -73,6 +73,7 @@
 #define	alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) || \
 	    ((c) >= 0x61 && (c) <= 0x7a))
 #define	digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
+#define	whitechar(c) ((c) == ' ' || (c) == '\t')
 
 #define	borderchar(c) (alphachar(c) || digitchar(c))
 #define	middlechar(c) (borderchar(c) || hyphenchar(c))
@@ -116,6 +117,7 @@
 int		 check_option(struct client_lease *l, int option);
 int		 ipv4addrs(char * buf);
 int		 res_hnok(const char *dn);
+int		 check_search(const char *srch);
 char		*option_as_string(unsigned int code, unsigned char *data, int len);
 int		 fork_privchld(int, int);
 
@@ -2250,6 +2252,14 @@
 		}
 		return (1);
 	case DHO_DOMAIN_NAME:
+		if (!res_hnok(sbuf)) {
+			if (!check_search(sbuf)) {
+				warning("Bogus domain search list %d: %s (%s)",
+				    option, sbuf, opbuf);
+				return (0);
+			}
+		}
+		return (1);
 	case DHO_PAD:
 	case DHO_TIME_OFFSET:
 	case DHO_BOOT_SIZE:
@@ -2325,6 +2335,52 @@
 	return (1);
 }
 
+int
+check_search(const char *srch)
+{
+        int pch = PERIOD, ch = *srch++;
+	int domains = 1;
+
+	/* 256 char limit re resolv.conf(5) */
+	if (strlen(srch) > 256)
+		return (0);
+
+	while (whitechar(ch))
+		ch = *srch++;
+
+        while (ch != '\0') {
+                int nch = *srch++;
+
+                if (periodchar(ch) || whitechar(ch)) {
+                        ;
+                } else if (periodchar(pch)) {
+                        if (!borderchar(ch))
+                                return (0);
+                } else if (periodchar(nch) || nch == '\0') {
+                        if (!borderchar(ch))
+                                return (0);
+                } else {
+                        if (!middlechar(ch))
+                                return (0);
+                }
+		if (!whitechar(ch)) {
+			pch = ch;
+		} else {
+			while (whitechar(nch)) {
+				nch = *srch++;
+			}
+			if (nch != '\0')
+				domains++;
+			pch = PERIOD;
+		}
+		ch = nch;
+        }
+	/* 6 domain limit re resolv.conf(5) */
+	if (domains > 6)
+		return (0);
+        return (1);
+}
+
 /* Does buf consist only of dotted decimal ipv4 addrs?
  * return how many if so,
  * otherwise, return 0

==== //depot/projects/hammer/sbin/gpt/add.c#9 (text+ko) ====

@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 2002 Marcel Moolenaar
  * All rights reserved.
  *
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.11 2005/04/24 20:08:29 des Exp $");
+__FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.12 2005/08/31 01:47:19 marcel Exp $");
 
 #include <sys/types.h>
 

==== //depot/projects/hammer/sbin/gpt/create.c#8 (text+ko) ====

@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 2002 Marcel Moolenaar
  * All rights reserved.
  *
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/gpt/create.c,v 1.10 2004/11/13 05:13:33 marcel Exp $");
+__FBSDID("$FreeBSD: src/sbin/gpt/create.c,v 1.11 2005/08/31 01:47:19 marcel Exp $");
 
 #include <sys/types.h>
 

==== //depot/projects/hammer/sbin/gpt/destroy.c#5 (text+ko) ====

@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 2002 Marcel Moolenaar
  * All rights reserved.
  *
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/gpt/destroy.c,v 1.5 2004/10/25 03:39:31 marcel Exp $");
+__FBSDID("$FreeBSD: src/sbin/gpt/destroy.c,v 1.6 2005/08/31 01:47:19 marcel Exp $");
 
 #include <sys/types.h>
 

==== //depot/projects/hammer/sbin/gpt/gpt.8#10 (text+ko) ====

@@ -22,7 +22,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/sbin/gpt/gpt.8,v 1.13 2005/06/14 11:24:55 ru Exp $
+.\" $FreeBSD: src/sbin/gpt/gpt.8,v 1.14 2005/08/31 05:56:21 marcel Exp $
 .\"
 .Dd November 12, 2004
 .Os
@@ -229,11 +229,25 @@
 command accepts.
 This can cause multiple partitions to be removed.
 .\" ==== show ====
-.It Nm Ic show Ar device ...
+.It Nm Ic show Oo Fl lu Oc Ar device ...
 The
 .Ic show
 command displays the current partitioning on the listed devices and gives
 an overall view of the disk contents.
+With the
+.Fl l
+option the GPT partition label will be displayed instead of the GPT partition
+type.
+The option has no effect on non-GPT partitions.
+With the
+.Fl u
+option the GPT partition type is displayed as an UUID instead of in an
+user friendly form.
+The
+.Fl l
+option takes precedence over the
+.Fl u
+option.
 .El
 .Sh SEE ALSO
 .Xr fdisk 8 ,

==== //depot/projects/hammer/sbin/gpt/gpt.c#8 (text+ko) ====

@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 2002 Marcel Moolenaar
  * All rights reserved.
  *
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.10 2005/04/24 20:08:29 des Exp $");
+__FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.12 2005/08/31 05:40:41 marcel Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -118,13 +118,112 @@
 	return crc ^ ~0U;
 }
 
+uint8_t *
+utf16_to_utf8(uint16_t *s16)
+{
+	static uint8_t *s8 = NULL;
+	static size_t s8len = 0;
+	size_t s8idx, s16idx, s16len;
+	uint32_t utfchar;
+	unsigned int c;
+
+	s16len = 0;
+	while (s16[s16len++] != 0)
+		;
+	if (s8len < s16len * 3) {
+		if (s8 != NULL)
+			free(s8);
+		s8len = s16len * 3;
+		s8 = calloc(s16len, 3);
+	}
+	s8idx = s16idx = 0;
+	while (s16idx < s16len) {
+		utfchar = le16toh(s16[s16idx++]);
+		if ((utfchar & 0xf800) == 0xd800) {
+			c = le16toh(s16[s16idx]);
+			if ((utfchar & 0x400) != 0 || (c & 0xfc00) != 0xdc00)
+				utfchar = 0xfffd;
+			else
+				s16idx++;
+		}
+		if (utfchar < 0x80) {
+			s8[s8idx++] = utfchar;
+		} else if (utfchar < 0x800) {
+			s8[s8idx++] = 0xc0 | (utfchar >> 6);
+			s8[s8idx++] = 0x80 | (utfchar & 0x3f);
+		} else if (utfchar < 0x10000) {
+			s8[s8idx++] = 0xe0 | (utfchar >> 12);
+			s8[s8idx++] = 0x80 | ((utfchar >> 6) & 0x3f);
+			s8[s8idx++] = 0x80 | (utfchar & 0x3f);
+		} else if (utfchar < 0x200000) {
+			s8[s8idx++] = 0xf0 | (utfchar >> 18);
+			s8[s8idx++] = 0x80 | ((utfchar >> 12) & 0x3f);
+			s8[s8idx++] = 0x80 | ((utfchar >> 6) & 0x3f);
+			s8[s8idx++] = 0x80 | (utfchar & 0x3f);
+		}
+	}
+	return (s8);
+}
+
 void
-unicode16(short *dst, const wchar_t *src, size_t len)
+utf8_to_utf16(const uint8_t *s8, uint16_t *s16, size_t s16len)
 {
-	while (len-- && *src != 0)
-		*dst++ = *src++;
-	if (len)
-		*dst = 0;
+	size_t s16idx, s8idx, s8len;
+	uint32_t utfchar;
+	unsigned int c, utfbytes;
+
+	s8len = 0;
+	while (s8[s8len++] != 0)
+		;
+	s8idx = s16idx = 0;
+	utfbytes = 0;
+	do {
+		c = s8[s8idx++];
+		if ((c & 0xc0) != 0x80) {
+			/* Initial characters. */
+			if (utfbytes != 0) {
+				/* Incomplete encoding. */
+				s16[s16idx++] = 0xfffd;
+				if (s16idx == s16len) {
+					s16[--s16idx] = 0;
+					return;
+				}
+			}
+			if ((c & 0xf8) == 0xf0) {
+				utfchar = c & 0x07;
+				utfbytes = 3;
+			} else if ((c & 0xf0) == 0xe0) {
+				utfchar = c & 0x0f;
+				utfbytes = 2;
+			} else if ((c & 0xe0) == 0xc0) {
+				utfchar = c & 0x1f;
+				utfbytes = 1;
+			} else {
+				utfchar = c & 0x7f;
+				utfbytes = 0;
+			}
+		} else {
+			/* Followup characters. */
+			if (utfbytes > 0) {
+				utfchar = (utfchar << 6) + (c & 0x3f);
+				utfbytes--;
+			} else if (utfbytes == 0)
+				utfbytes = -1;
+		}
+		if (utfbytes == 0) {
+			if (utfchar >= 0x10000 && s16idx + 2 >= s16len)
+				utfchar = 0xfffd;
+			if (utfchar >= 0x10000) {
+				s16[s16idx++] = 0xd800 | ((utfchar>>10)-0x40);
+				s16[s16idx++] = 0xdc00 | (utfchar & 0x3ff);
+			} else
+				s16[s16idx++] = utfchar;
+			if (s16idx == s16len) {
+				s16[--s16idx] = 0;
+				return;
+			}
+		}
+	} while (c != 0);
 }
 
 void

==== //depot/projects/hammer/sbin/gpt/gpt.h#7 (text+ko) ====

@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 2002 Marcel Moolenaar
  * All rights reserved.
  *
@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sbin/gpt/gpt.h,v 1.7 2005/04/24 20:08:29 des Exp $
+ * $FreeBSD: src/sbin/gpt/gpt.h,v 1.9 2005/08/31 05:40:41 marcel Exp $
  */
 
 #ifndef _GPT_H_
@@ -70,7 +70,9 @@
 int	gpt_open(const char *);
 void*	gpt_read(int, off_t, size_t);
 int	gpt_write(int, map_t *);
-void	unicode16(short *, const wchar_t *, size_t);
+
+uint8_t *utf16_to_utf8(uint16_t *);
+void	utf8_to_utf16(const uint8_t *, uint16_t *, size_t);
 
 int	cmd_add(int, char *[]);
 int	cmd_create(int, char *[]);

==== //depot/projects/hammer/sbin/gpt/map.c#4 (text+ko) ====

@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 2002 Marcel Moolenaar
  * All rights reserved.
  *
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/gpt/map.c,v 1.5 2004/08/07 06:24:25 marcel Exp $");
+__FBSDID("$FreeBSD: src/sbin/gpt/map.c,v 1.6 2005/08/31 01:47:19 marcel Exp $");
 
 #include <sys/types.h>
 #include <err.h>

==== //depot/projects/hammer/sbin/gpt/map.h#5 (text+ko) ====

@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 2002 Marcel Moolenaar
  * All rights reserved.
  *
@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sbin/gpt/map.h,v 1.5 2004/08/07 07:41:37 marcel Exp $
+ * $FreeBSD: src/sbin/gpt/map.h,v 1.6 2005/08/31 01:47:19 marcel Exp $
  */
 
 #ifndef _MAP_H_

==== //depot/projects/hammer/sbin/gpt/migrate.c#10 (text+ko) ====

@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 2002 Marcel Moolenaar
  * All rights reserved.
  *
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/gpt/migrate.c,v 1.13 2004/11/13 05:44:02 marcel Exp $");
+__FBSDID("$FreeBSD: src/sbin/gpt/migrate.c,v 1.15 2005/08/31 05:40:41 marcel Exp $");
 
 #include <sys/types.h>
 #include <sys/disklabel.h>
@@ -100,22 +100,22 @@
 		case FS_SWAP: {
 			uuid_t swap = GPT_ENT_TYPE_FREEBSD_SWAP;
 			le_uuid_enc(&ent->ent_type, &swap);
-			unicode16(ent->ent_name,
-			    L"FreeBSD swap partition", 36);
+			utf8_to_utf16("FreeBSD swap partition",
+			    ent->ent_name, 36);
 			break;
 		}
 		case FS_BSDFFS: {
 			uuid_t ufs = GPT_ENT_TYPE_FREEBSD_UFS;
 			le_uuid_enc(&ent->ent_type, &ufs);
-			unicode16(ent->ent_name,
-			    L"FreeBSD UFS partition", 36);
+			utf8_to_utf16("FreeBSD UFS partition",
+			    ent->ent_name, 36);
 			break;
 		}
 		case FS_VINUM: {
 			uuid_t vinum = GPT_ENT_TYPE_FREEBSD_VINUM;
 			le_uuid_enc(&ent->ent_type, &vinum);
-			unicode16(ent->ent_name,
-			    L"FreeBSD vinum partition", 36);
+			utf8_to_utf16("FreeBSD vinum partition",
+			    ent->ent_name, 36);
 			break;
 		}
 		default:
@@ -255,8 +255,8 @@
 				le_uuid_enc(&ent->ent_type, &freebsd);
 				ent->ent_lba_start = htole64((uint64_t)start);
 				ent->ent_lba_end = htole64(start + size - 1LL);
-				unicode16(ent->ent_name,
-				    L"FreeBSD disklabel partition", 36);
+				utf8_to_utf16("FreeBSD disklabel partition",
+				    ent->ent_name, 36);
 				ent++;
 			} else
 				ent = migrate_disklabel(fd, start, ent);
@@ -267,7 +267,8 @@
 			le_uuid_enc(&ent->ent_type, &efi_slice);
 			ent->ent_lba_start = htole64((uint64_t)start);
 			ent->ent_lba_end = htole64(start + size - 1LL);
-			unicode16(ent->ent_name, L"EFI system partition", 36);
+			utf8_to_utf16("EFI system partition",
+			    ent->ent_name, 36);
 			ent++;
 			break;
 		}

==== //depot/projects/hammer/sbin/gpt/recover.c#7 (text+ko) ====

@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 2002 Marcel Moolenaar
  * All rights reserved.
  *
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/gpt/recover.c,v 1.7 2004/10/25 03:39:31 marcel Exp $");
+__FBSDID("$FreeBSD: src/sbin/gpt/recover.c,v 1.8 2005/08/31 01:47:19 marcel Exp $");
 
 #include <sys/types.h>
 

==== //depot/projects/hammer/sbin/gpt/remove.c#4 (text+ko) ====

@@ -1,4 +1,4 @@
-/*
+/*-
  * Copyright (c) 2004 Marcel Moolenaar
  * All rights reserved.
  *
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/gpt/remove.c,v 1.4 2005/04/24 20:08:29 des Exp $");
+__FBSDID("$FreeBSD: src/sbin/gpt/remove.c,v 1.6 2005/08/31 01:47:19 marcel Exp $");
 
 #include <sys/types.h>
 
@@ -64,7 +64,7 @@
 	map_t *m;
 	struct gpt_hdr *hdr;
 	struct gpt_ent *ent;
-	unsigned int i, removed;
+	unsigned int i;
 
 	gpt = map_find(MAP_TYPE_PRI_GPT_HDR);
 	if (gpt == NULL) {
@@ -87,8 +87,6 @@
 		return;
 	}
 
-	removed = 0;
-

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


More information about the p4-projects mailing list