Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Nov 2003 13:47:59 -0800 (PST)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 42585 for review
Message-ID:  <200311162147.hAGLlxJJ022287@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=42585

Change 42585 by peter@peter_daintree on 2003/11/16 13:47:20

	IFC @42573

Affected files ...

.. //depot/projects/hammer/Makefile.inc1#33 integrate
.. //depot/projects/hammer/bin/Makefile.inc#5 integrate
.. //depot/projects/hammer/lib/libc/posix1e/mac_get.3#5 integrate
.. //depot/projects/hammer/lib/libc/posix1e/mac_get.c#4 integrate
.. //depot/projects/hammer/lib/libc/posix1e/mac_set.3#4 integrate
.. //depot/projects/hammer/lib/libc/posix1e/mac_text.3#6 integrate
.. //depot/projects/hammer/lib/libc/sys/statfs.2#3 integrate
.. //depot/projects/hammer/lib/libpthread/thread/thr_spinlock.c#8 integrate
.. //depot/projects/hammer/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml#46 integrate
.. //depot/projects/hammer/sbin/Makefile.inc#4 integrate
.. //depot/projects/hammer/sbin/dump/main.c#10 integrate
.. //depot/projects/hammer/sbin/fsck_ffs/setup.c#8 integrate
.. //depot/projects/hammer/sbin/gpt/add.c#4 integrate
.. //depot/projects/hammer/sbin/gpt/migrate.c#5 integrate
.. //depot/projects/hammer/sbin/gpt/recover.c#4 integrate
.. //depot/projects/hammer/sbin/newfs/mkfs.c#12 integrate
.. //depot/projects/hammer/sbin/newfs/newfs.c#8 integrate
.. //depot/projects/hammer/sbin/newfs/newfs.h#4 integrate
.. //depot/projects/hammer/sbin/umount/umount.c#8 integrate
.. //depot/projects/hammer/share/examples/cvsup/cvs-supfile#4 integrate
.. //depot/projects/hammer/share/examples/cvsup/ports-supfile#4 integrate
.. //depot/projects/hammer/share/examples/cvsup/refuse#6 integrate
.. //depot/projects/hammer/share/examples/cvsup/refuse.README#6 integrate
.. //depot/projects/hammer/share/man/man4/miibus.4#4 integrate
.. //depot/projects/hammer/share/man/man4/uplcom.4#2 integrate
.. //depot/projects/hammer/share/man/man7/build.7#5 integrate
.. //depot/projects/hammer/sys/alpha/alpha/vm_machdep.c#10 integrate
.. //depot/projects/hammer/sys/alpha/include/sf_buf.h#1 branch
.. //depot/projects/hammer/sys/amd64/amd64/vm_machdep.c#17 integrate
.. //depot/projects/hammer/sys/amd64/include/sf_buf.h#1 branch
.. //depot/projects/hammer/sys/boot/i386/btx/btx/btx.s#3 integrate
.. //depot/projects/hammer/sys/compat/linux/linux_misc.c#15 integrate
.. //depot/projects/hammer/sys/conf/NOTES#31 integrate
.. //depot/projects/hammer/sys/conf/kmod.mk#13 integrate
.. //depot/projects/hammer/sys/conf/options#29 integrate
.. //depot/projects/hammer/sys/dev/usb/ubsa.c#8 integrate
.. //depot/projects/hammer/sys/dev/usb/ucom.c#8 integrate
.. //depot/projects/hammer/sys/dev/usb/umct.c#4 integrate
.. //depot/projects/hammer/sys/dev/usb/uplcom.c#7 integrate
.. //depot/projects/hammer/sys/dev/usb/usbdevs#21 integrate
.. //depot/projects/hammer/sys/dev/usb/usbdevs.h#20 integrate
.. //depot/projects/hammer/sys/dev/usb/usbdevs_data.h#20 integrate
.. //depot/projects/hammer/sys/dev/usb/uvscom.c#6 integrate
.. //depot/projects/hammer/sys/i386/i386/vm_machdep.c#15 integrate
.. //depot/projects/hammer/sys/i386/include/sf_buf.h#1 branch
.. //depot/projects/hammer/sys/i386/isa/cy.c#6 integrate
.. //depot/projects/hammer/sys/i386/linux/linux_dummy.c#4 integrate
.. //depot/projects/hammer/sys/i386/linux/linux_proto.h#6 integrate
.. //depot/projects/hammer/sys/i386/linux/linux_syscall.h#6 integrate
.. //depot/projects/hammer/sys/i386/linux/linux_sysent.c#7 integrate
.. //depot/projects/hammer/sys/i386/linux/syscalls.master#6 integrate
.. //depot/projects/hammer/sys/ia64/ia64/vm_machdep.c#16 integrate
.. //depot/projects/hammer/sys/ia64/include/sf_buf.h#1 branch
.. //depot/projects/hammer/sys/kern/uipc_cow.c#9 integrate
.. //depot/projects/hammer/sys/kern/uipc_socket.c#15 integrate
.. //depot/projects/hammer/sys/kern/uipc_syscalls.c#12 integrate
.. //depot/projects/hammer/sys/modules/uplcom/Makefile#2 integrate
.. //depot/projects/hammer/sys/netinet/ip_fastfwd.c#3 integrate
.. //depot/projects/hammer/sys/powerpc/include/sf_buf.h#1 branch
.. //depot/projects/hammer/sys/powerpc/powerpc/vm_machdep.c#9 integrate
.. //depot/projects/hammer/sys/security/mac/mac_internal.h#6 integrate
.. //depot/projects/hammer/sys/security/mac/mac_net.c#5 integrate
.. //depot/projects/hammer/sys/security/mac_stub/mac_stub.c#2 integrate
.. //depot/projects/hammer/sys/security/mac_test/mac_test.c#15 integrate
.. //depot/projects/hammer/sys/sparc64/include/sf_buf.h#1 branch
.. //depot/projects/hammer/sys/sparc64/sparc64/vm_machdep.c#9 integrate
.. //depot/projects/hammer/sys/sys/mac.h#14 integrate
.. //depot/projects/hammer/sys/sys/param.h#23 integrate
.. //depot/projects/hammer/sys/sys/sf_buf.h#1 branch
.. //depot/projects/hammer/sys/sys/socketvar.h#10 integrate
.. //depot/projects/hammer/sys/ufs/ffs/fs.h#4 integrate
.. //depot/projects/hammer/usr.sbin/ancontrol/ancontrol.c#5 integrate

Differences ...

==== //depot/projects/hammer/Makefile.inc1#33 (text+ko) ====

@@ -1,7 +1,8 @@
 #
-# $FreeBSD: src/Makefile.inc1,v 1.396 2003/11/12 17:09:12 harti Exp $
+# $FreeBSD: src/Makefile.inc1,v 1.397 2003/11/16 21:17:43 gordon Exp $
 #
 # Make command line options:
+#	-DNO_DYNAMICROOT do not link /bin and /sbin dynamically
 #	-DNO_KERBEROS Do not build Heimdal (Kerberos 5)
 #	-DNO_RESCUE do not build rescue binaries
 #	-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
@@ -52,7 +53,7 @@
 # When upgrading to a dynamically linked root, install the runtime
 # linker early into its new location before make(1) has a chance
 # to run the dynamically linked /bin/sh.
-.if defined(WITH_DYNAMICROOT) && !defined(NOPIC) && \
+.if !defined(NO_DYNAMICROOT) && !defined(NOPIC) && \
     (!defined(TARGET_ARCH) || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \
     !defined(DISTDIR) && \
     (!defined(DESTDIR) || empty(DESTDIR) || ${DESTDIR} == "/") && \

==== //depot/projects/hammer/bin/Makefile.inc#5 (text+ko) ====

@@ -1,9 +1,9 @@
 #	@(#)Makefile.inc	8.1 (Berkeley) 5/31/93
-# $FreeBSD: src/bin/Makefile.inc,v 1.18 2003/11/02 06:47:38 ru Exp $
+# $FreeBSD: src/bin/Makefile.inc,v 1.19 2003/11/16 04:57:28 gordon Exp $
 
 BINDIR?=	/bin
 WARNS?=		6
 
-.if !defined(WITH_DYNAMICROOT)
+.if defined(NO_DYNAMICROOT)
 NOSHARED?=	YES
 .endif

==== //depot/projects/hammer/lib/libc/posix1e/mac_get.3#5 (text+ko) ====

@@ -28,7 +28,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/lib/libc/posix1e/mac_get.3,v 1.7 2003/09/12 21:54:10 ru Exp $
+.\" $FreeBSD: src/lib/libc/posix1e/mac_get.3,v 1.8 2003/11/16 20:18:24 rwatson Exp $
 .\"
 .Dd December 21, 2001
 .Dt MAC_GET 3
@@ -47,39 +47,46 @@
 .Ft int
 .Fn mac_get_fd "int fd" "mac_t label"
 .Ft int
+.Fn mac_get_peer "int fd" "mac_t label"
+.Ft int
 .Fn mac_get_pid "pid_t pid" "mac_t label"
 .Ft int
 .Fn mac_get_proc "mac_t label"
 .Sh DESCRIPTION
 The
 .Fn mac_get_file
-and
+system call returns the label associated with a file specified by
+pathname.
+.Pp
+The
 .Fn mac_get_fd
-functions fill in
-.Fa label
-(which must first be allocated by
-.Xr mac_prepare 3 )
-with the MAC label associated with the file referenced by
-.Fa path
-or the file descriptor specified by
-.Fa fd ,
-respectively.
-Note that this function will fail on socket descriptors.
-For information on
-getting MAC labels on socket descriptors see
-.Xr getsockopt 2 .
+system call returns the label associated with an object referenced by
+the specified file descriptor.
+Note that in the case of a file system socket, the label returned will
+be the socket label, which may be different from the label of the
+on-disk node acting as a rendezvous for the socket.
+The
+.Fn mac_get_peer
+system call returns the label associated with the remote endpoint of
+a socket; the exact semantics of this call will depend on the protocol
+domain, communications type, and endpoint; typically this label will
+be cached when a connection-oriented protocol instance is first set up,
+and is undefined for datagram protocols.
 .Pp
 The
+.Fn mac_get_pid
+and
 .Fn mac_get_proc
-and
-.Fn mac_get_pid
-functions fill in
-.Fa label
-(which must first be allocated by
-.Xr mac_prepare 3 )
-with the MAC label associated
-with the requesting process
-or the specified process, respectively.
+system calls return the process label associated with an arbitrary
+process id, or the current process.
+.Pp
+Label storage for use with these calls must first be allocated and
+prepared using the
+.Xr mac_prepare 3
+functions.
+When an application is done using a label, the memory may be returned
+using
+.Xr mac_free 3 .
 .Sh ERRORS
 .Bl -tag -width Er
 .It Bq Er EACCES
@@ -88,6 +95,9 @@
 is not searchable,
 or MAC read access to the file
 is denied.
+.It Bq Er EINVAL
+The requested label operation is not valid for the object referenced by
+.Fa fd .
 .It Bq Er ENAMETOOLONG
 The pathname pointed to by
 .Fa path

==== //depot/projects/hammer/lib/libc/posix1e/mac_get.c#4 (text+ko) ====

@@ -28,14 +28,12 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/lib/libc/posix1e/mac_get.c,v 1.3 2003/02/16 17:29:10 nectar Exp $
+ * $FreeBSD: src/lib/libc/posix1e/mac_get.c,v 1.4 2003/11/16 20:18:24 rwatson Exp $
  */
 
 #include <sys/types.h>
 #include <sys/mac.h>
-
-#include <errno.h>
-#include <stdlib.h>
+#include <sys/socket.h>
 
 extern int __mac_get_fd(int fd, struct mac *mac_p);
 extern int __mac_get_file(const char *path_p, struct mac *mac_p);
@@ -64,6 +62,15 @@
 	return (__mac_get_link(path, label));
 }
 
+
+int
+mac_get_peer(int fd, struct mac *label)
+{
+	socklen_t len;
+
+	len = sizeof(*label);
+	return (getsockopt(fd, SOL_SOCKET, SO_PEERLABEL, label, &len));
+}
 int
 mac_get_pid(pid_t pid, struct mac *label)
 {

==== //depot/projects/hammer/lib/libc/posix1e/mac_set.3#4 (text+ko) ====

@@ -28,7 +28,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/lib/libc/posix1e/mac_set.3,v 1.9 2003/08/22 18:01:03 rwatson Exp $
+.\" $FreeBSD: src/lib/libc/posix1e/mac_set.3,v 1.10 2003/11/16 20:21:21 rwatson Exp $
 .\"
 .Dd January 14, 2003
 .Dt MAC_SET 3
@@ -63,15 +63,15 @@
 or to the file descriptor
 .Fa fd ,
 respectively.
-Note that this function will fail on socket descriptors.
-For information on
-setting MAC labels on socket descriptors see
-.Xr setsockopt 2 .
+Note that when a file descriptor references a socket, label operations
+on the file descriptor act on the socket, not on the file that may
+have been used as a rendezvous when binding the socket.
 The
 .Fn mac_set_link
 function is the same as
 .Fn mac_set_file ,
 except that it does not follow symlinks.
+.Pp
 The
 .Fn mac_set_proc
 function associates the MAC label
@@ -99,7 +99,9 @@
 The
 .Fa label
 argument
-is not a valid MAC label.
+is not a valid MAC label, or the object referenced by
+.Fa fd
+is not appropriate for label operations.
 .It Bq Er EOPNOTSUPP
 Setting MAC labels is not supported
 by the file referenced by

==== //depot/projects/hammer/lib/libc/posix1e/mac_text.3#6 (text+ko) ====

@@ -28,7 +28,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/lib/libc/posix1e/mac_text.3,v 1.9 2003/08/22 18:01:03 rwatson Exp $
+.\" $FreeBSD: src/lib/libc/posix1e/mac_text.3,v 1.10 2003/11/16 04:32:46 rwatson Exp $
 .\"
 .Dd December 21, 2001
 .Dt MAC_TEXT 3
@@ -54,7 +54,7 @@
 and places it in
 .Fa *mac ,
 which must later be freed with
-.Xr mac_free 3 .
+.Xr free 3 .
 .Pp
 The
 .Fn mac_to_text
@@ -72,6 +72,19 @@
 POSIX.1e does not define
 a format for text representations
 of MAC labels.
+.Pp
+POSIX.1e requires that text strings allocated using
+.Fn mac_to_text
+be freed using
+.Xr mac_free 3 ;
+in the
+.Fx
+implementation, they must be freed using
+.Xr free 3 ,
+as
+.Xr mac_free 3
+is used only to free memory used for type
+.Dv mac_t .
 .Sh ERRORS
 .Bl -tag -width Er
 .It Bq Er ENOMEM
@@ -79,8 +92,8 @@
 to allocate internal storage.
 .El
 .Sh SEE ALSO
+.Xr free 3 ,
 .Xr mac 3 ,
-.Xr mac_free 3 ,
 .Xr mac_get 3 ,
 .Xr mac_is_present_np 3 ,
 .Xr mac_prepare 3 ,

==== //depot/projects/hammer/lib/libc/sys/statfs.2#3 (text+ko) ====

@@ -30,9 +30,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)statfs.2	8.5 (Berkeley) 5/24/95
-.\" $FreeBSD: src/lib/libc/sys/statfs.2,v 1.21 2002/12/19 09:40:25 ru Exp $
+.\" $FreeBSD: src/lib/libc/sys/statfs.2,v 1.22 2003/11/16 04:08:16 tjr Exp $
 .\"
-.Dd May 24, 1995
+.Dd November 16, 2003
 .Dt STATFS 2
 .Os
 .Sh NAME
@@ -66,33 +66,39 @@
 typedef struct fsid { int32_t val[2]; } fsid_t; /* file system id type */
 
 /*
- * file system statistics
+ * filesystem statistics
  */
 
-#define MFSNAMELEN 16	/* length of fs type name, including null */
-#define MNAMELEN   90	/* length of buffer for returned name */
+#define	MFSNAMELEN	16		/* length of type name including null */
+#define	MNAMELEN	88		/* size of on/from name bufs */
+#define	STATFS_VERSION	0x20030518	/* current version number */
 
 struct statfs {
-long	f_bsize;	  /* fundamental file system block size */
-long	f_iosize;	  /* optimal transfer block size */
-long	f_blocks;	  /* total data blocks in file system */
-long	f_bfree;	  /* free blocks in fs */
-long	f_bavail;	  /* free blocks avail to non-superuser */
-long	f_files;	  /* total file nodes in file system */
-long	f_ffree;	  /* free file nodes in fs */
-fsid_t	f_fsid;		  /* file system id */
-uid_t	f_owner;	  /* user that mounted the file system */
-int	f_type;		  /* type of file system */
-int	f_flags;	  /* copy of mount flags */
-long    f_syncwrites;	  /* count of sync writes since mount */
-long    f_asyncwrites;	  /* count of async writes since mount */
-char	f_fstypename[MFSNAMELEN];/* fs type name */
-char	f_mntonname[MNAMELEN];	 /* mount point */
-long    f_syncreads;		 /* count of sync reads since mount */
-long    f_asyncreads;		 /* count of async reads since mount */
-char	f_mntfromname[MNAMELEN]; /* mounted file system */
+uint32_t f_version;		/* structure version number */
+uint32_t f_type;		/* type of filesystem */
+uint64_t f_flags;		/* copy of mount exported flags */
+uint64_t f_bsize;		/* filesystem fragment size */
+uint64_t f_iosize;		/* optimal transfer block size */
+uint64_t f_blocks;		/* total data blocks in filesystem */
+uint64_t f_bfree;		/* free blocks in filesystem */
+int64_t	 f_bavail;		/* free blocks avail to non-superuser */
+uint64_t f_files;		/* total file nodes in filesystem */
+int64_t	 f_ffree;		/* free nodes avail to non-superuser */
+uint64_t f_syncwrites;		/* count of sync writes since mount */
+uint64_t f_asyncwrites;		/* count of async writes since mount */
+uint64_t f_syncreads;		/* count of sync reads since mount */
+uint64_t f_asyncreads;		/* count of async reads since mount */
+uint64_t f_spare[10];		/* unused spare */
+uint32_t f_namemax;		/* maximum filename length */
+uid_t	  f_owner;		/* user that mounted the filesystem */
+fsid_t	  f_fsid;		/* filesystem id */
+char	  f_charspare[80];	    /* spare string space */
+char	  f_fstypename[MFSNAMELEN]; /* filesystem type name */
+char	  f_mntfromname[MNAMELEN];  /* mounted filesystem */
+char	  f_mntonname[MNAMELEN];    /* directory on which mounted */
 };
 .Ed
+.Pp
 The flags that may be returned include:
 .Bl -tag -width MNT_SYNCHRONOUS
 .It Dv MNT_RDONLY
@@ -108,6 +114,27 @@
 All I/O to the file system is done synchronously.
 .It Dv MNT_ASYNC
 No file system I/O is done synchronously.
+.It Dv MNT_SOFTDEP
+Soft updates being done (see
+.Xr ffs 7).
+.It Dv MNT_SUIDDIR
+Special handling of SUID bit on directories.
+.It Dv MNT_UNION
+Union with underlying filesystem.
+.It Dv MNT_NOSYMFOLLOW
+Symbolic links are not followed.
+.It Dv MNT_NOCLUSTERR
+Read clustering is disabled.
+.It Dv MNT_NOCLUSTERW
+Write clustering is disabled.
+.\".It Dv MNT_JAILDEVFS
+.\"XXX
+.It Dv MNT_MULTILABEL
+Mandatory Access Control (MAC) support for individual objects
+(see
+.Xr mac 4).
+.It Dv MNT_ACLS
+Access Control List (ACL) support enabled.
 .It Dv MNT_LOCAL
 The file system resides locally.
 .It Dv MNT_QUOTA
@@ -116,6 +143,12 @@
 Identifies the root file system.
 .It Dv MNT_EXRDONLY
 The file system is exported read-only.
+.It Dv MNT_NOATIME
+Updating of file access times is disabled.
+.It Dv MNT_USER
+The file system has been mounted by a user.
+.\".It Dv MNT_IGNORE
+.\"XXX
 .It Dv MNT_EXPORTED
 The file system is exported for both reading and writing.
 .It Dv MNT_DEFEXPORTED
@@ -124,6 +157,8 @@
 The file system maps all remote accesses to the anonymous user.
 .It Dv MNT_EXKERB
 The file system is exported with Kerberos uid mapping.
+.It Dv MNT_EXPUBLIC
+The file system is exported publicly (WebNFS).
 .El
 .Pp
 Fields that are undefined for a particular file system are set to -1.

==== //depot/projects/hammer/lib/libpthread/thread/thr_spinlock.c#8 (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/libpthread/thread/thr_spinlock.c,v 1.18 2003/11/08 06:07:04 davidxu Exp $
+ * $FreeBSD: src/lib/libpthread/thread/thr_spinlock.c,v 1.19 2003/11/16 15:01:26 deischen Exp $
  *
  */
 
@@ -45,7 +45,7 @@
 struct spinlock_extra {
 	spinlock_t	*owner;
 	struct lock	lock;
-	struct pthread	*crit;
+	kse_critical_t	crit;
 };
 
 static void	init_spinlock(spinlock_t *lck);
@@ -64,11 +64,12 @@
 _spinunlock(spinlock_t *lck)
 {
 	struct spinlock_extra *extra;
-	struct pthread *curthr = _get_curthread();
+	kse_critical_t crit;
 
 	extra = (struct spinlock_extra *)lck->fname;
-	THR_ASSERT(extra->crit == curthr, "_spinunlock called without owned.");
-	THR_LOCK_RELEASE(curthr, &extra->lock);
+	crit = extra->crit;
+	KSE_LOCK_RELEASE(_get_curkse(), &extra->lock);
+	_kse_critical_leave(crit);
 }
 
 
@@ -81,8 +82,8 @@
 void
 _spinlock(spinlock_t *lck)
 {
-	struct spinlock_extra	*extra;
-	struct pthread		*curthr;
+	struct spinlock_extra *extra;
+	kse_critical_t crit;
 
 	THR_ASSERT(__isthreaded != 0, "Spinlock called when not threaded.");
 	THR_ASSERT(initialized != 0, "Spinlocks not initialized.");
@@ -90,12 +91,12 @@
 	 * Try to grab the lock and loop if another thread grabs
 	 * it before we do.
 	 */
-	curthr = _get_curthread();
+	crit = _kse_critical_enter();
 	if (lck->fname == NULL)
 		init_spinlock(lck);
 	extra = (struct spinlock_extra *)lck->fname;
-	THR_LOCK_ACQUIRE(curthr, &extra->lock);
-	extra->crit = curthr;
+	KSE_LOCK_ACQUIRE(_get_curkse(), &extra->lock);
+	extra->crit = crit;
 }
 
 /*
@@ -117,15 +118,15 @@
 static void
 init_spinlock(spinlock_t *lck)
 {
-	struct pthread *curthr = _get_curthread();
+	struct kse *curkse = _get_curkse();
 
-	THR_LOCK_ACQUIRE(curthr, &spinlock_static_lock);
+	KSE_LOCK_ACQUIRE(curkse, &spinlock_static_lock);
 	if ((lck->fname == NULL) && (spinlock_count < MAX_SPINLOCKS)) {
 		lck->fname = (char *)&extra[spinlock_count];
 		extra[spinlock_count].owner = lck;
 		spinlock_count++;
 	}
-	THR_LOCK_RELEASE(curthr, &spinlock_static_lock);
+	KSE_LOCK_RELEASE(curkse, &spinlock_static_lock);
 	THR_ASSERT(lck->fname != NULL, "Exceeded max spinlocks");
 }
 
@@ -136,19 +137,19 @@
 
 	if (initialized != 0) {
 		_lock_reinit(&spinlock_static_lock, LCK_ADAPTIVE,
-		    _thr_lock_wait, _thr_lock_wakeup);
+		    _kse_lock_wait, _kse_lock_wakeup);
 		for (i = 0; i < spinlock_count; i++) {
 			_lock_reinit(&extra[i].lock, LCK_ADAPTIVE,
-			    _thr_lock_wait, _thr_lock_wakeup);
+			    _kse_lock_wait, _kse_lock_wakeup);
 		}
 		spinlock_count = 0;
 	} else {
 		if (_lock_init(&spinlock_static_lock, LCK_ADAPTIVE,
-		    _thr_lock_wait, _thr_lock_wakeup) != 0)
+		    _kse_lock_wait, _kse_lock_wakeup) != 0)
 			PANIC("Cannot initialize spinlock_static_lock");
 		for (i = 0; i < MAX_SPINLOCKS; i++) {
 			if (_lock_init(&extra[i].lock, LCK_ADAPTIVE,
-			    _thr_lock_wait, _thr_lock_wakeup) != 0)
+			    _kse_lock_wait, _kse_lock_wakeup) != 0)
 				PANIC("Cannot initialize spinlock extra");
 		}
 		initialized = 1;

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

@@ -3,7 +3,7 @@
 
   <corpauthor>The FreeBSD Project</corpauthor>
 
-  <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml,v 1.651 2003/11/15 02:19:46 bmah Exp $</pubdate>
+  <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml,v 1.652 2003/11/16 20:34:46 bmah Exp $</pubdate>
 
   <copyright>
     <year>2000</year>
@@ -691,15 +691,18 @@
       &man.rescue.8;.
       </para>
 
-    <para>It is now possible to build <filename>/bin</filename> and
-      <filename>/sbin</filename> directories containing
-      dynamically-linked executables.  This feature brings support for
+    <para>Executables in <filename>/bin</filename> and
+      <filename>/sbin</filename> are now built using dynamic, rather
+      than static linking.  This feature brings support for
       loadable PAM and NSS modules to base system utilities located in
       those directories.  It also reduces the storage requirements for
       the root filesystem due to the use of shared libraries.  This
-      feature can be enabled in a <literal>buildworld</literal> by
+      feature can be disabled in a <literal>buildworld</literal> by
       defining the Makefile variable
-      <varname>WITH_DYNAMICROOT</varname>.</para>
+      <varname>WITHOUT_DYNAMICROOT</varname>.  Note that
+      statically-linked, crunched executables are available in the
+      <filename>/rescue</filename> directory for use during system
+      repair and recovery operations.</para>
 
   </sect2>
 

==== //depot/projects/hammer/sbin/Makefile.inc#4 (text+ko) ====

@@ -1,9 +1,9 @@
 #	@(#)Makefile.inc	8.1 (Berkeley) 6/8/93
-# $FreeBSD: src/sbin/Makefile.inc,v 1.10 2003/11/02 06:47:39 ru Exp $
+# $FreeBSD: src/sbin/Makefile.inc,v 1.11 2003/11/16 04:57:28 gordon Exp $
 
 BINDIR?=	/sbin
 WARNS?=	2
 
-.if !defined(WITH_DYNAMICROOT)
+.if defined(NO_DYNAMICROOT)
 NOSHARED?=	YES
 .endif

==== //depot/projects/hammer/sbin/dump/main.c#10 (text+ko) ====

@@ -42,7 +42,7 @@
 static char sccsid[] = "@(#)main.c	8.6 (Berkeley) 5/1/95";
 #endif
 static const char rcsid[] =
-  "$FreeBSD: src/sbin/dump/main.c,v 1.54 2003/11/14 13:07:38 johan Exp $";
+  "$FreeBSD: src/sbin/dump/main.c,v 1.55 2003/11/16 08:01:58 mckusick Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -317,20 +317,16 @@
 			msg("WARNING: %s\n",
 			    "should use -L when dumping live filesystems!");
 		} else {
-			struct ufs_args args;
-			char snapname[BUFSIZ];
+			char snapname[BUFSIZ], snapcmd[BUFSIZ];
 
-			snprintf(snapname, sizeof snapname, "%s/.dump_snapshot",
-			    mntpt);
-			args.fspec = snapname;
-			while (mount("ffs", mntpt,
-			    mntflags | MNT_UPDATE | MNT_SNAPSHOT,
-			    &args) < 0) {
-				if (errno == EEXIST && unlink(snapname) == 0)
-					continue;
+			snprintf(snapname, sizeof snapname,
+			    "%s/.snap/dump_snapshot", mntpt);
+			snprintf(snapcmd, sizeof snapcmd,
+			    "mksnap_ffs %s %s", mntpt, snapname);
+			unlink(snapname);
+			if (system(snapcmd) != 0)
 				errx(X_STARTUP, "Cannot create %s: %s\n",
 				    snapname, strerror(errno));
-			}
 			if ((diskfd = open(snapname, O_RDONLY)) < 0) {
 				unlink(snapname);
 				errx(X_STARTUP, "Cannot open %s: %s\n",

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

@@ -37,7 +37,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/fsck_ffs/setup.c,v 1.44 2003/08/01 11:31:19 ru Exp $");
+__FBSDID("$FreeBSD: src/sbin/fsck_ffs/setup.c,v 1.45 2003/11/16 07:10:55 wes Exp $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -288,6 +288,10 @@
  */
 static int sblock_try[] = SBLOCKSEARCH;
 
+#define BAD_MAGIC_MSG \
+"The previous newfs operation on this volume did not complete.\n" \
+"You must complete newfs before mounting this volume.\n"
+
 /*
  * Read in the super block and its summary info.
  */
@@ -301,6 +305,10 @@
 		super = bflag;
 		if ((bread(fsreadfd, (char *)&sblock, super, (long)SBLOCKSIZE)))
 			return (0);
+		if (sblock.fs_magic == FS_BAD2_MAGIC) {
+			fprintf(stderr, BAD_MAGIC_MSG);
+			exit(11);
+		}
 		if (sblock.fs_magic != FS_UFS1_MAGIC &&
 		    sblock.fs_magic != FS_UFS2_MAGIC) {
 			fprintf(stderr, "%d is not a file system superblock\n",
@@ -313,6 +321,10 @@
 			if ((bread(fsreadfd, (char *)&sblock, super,
 			    (long)SBLOCKSIZE)))
 				return (0);
+			if (sblock.fs_magic == FS_BAD2_MAGIC) {
+				fprintf(stderr, BAD_MAGIC_MSG);
+				exit(11);
+			}
 			if ((sblock.fs_magic == FS_UFS1_MAGIC ||
 			     (sblock.fs_magic == FS_UFS2_MAGIC &&
 			      sblock.fs_sblockloc == sblock_try[i])) &&

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

@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sbin/gpt/add.c,v 1.4 2002/11/30 22:51:46 marcel Exp $
+ * $FreeBSD: src/sbin/gpt/add.c,v 1.5 2003/11/16 06:45:26 kensmith Exp $
  */
 
 #include <sys/types.h>
@@ -65,13 +65,14 @@
 
 	gpt = map_find(MAP_TYPE_PRI_GPT_HDR);
 	if (gpt == NULL) {
-		warnx("%s: error: device does not contain a GPT", device_name);
+		warnx("%s: error: no primary GPT header; run create or recover",
+		    device_name);
 		return;
 	}
 
 	tpg = map_find(MAP_TYPE_SEC_GPT_HDR);
 	if (tpg == NULL) {
-		warnx("%s: error: no secundary table; run recover",
+		warnx("%s: error: no secondary GPT header; run recover",
 		    device_name);
 		return;
 	}

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

@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sbin/gpt/migrate.c,v 1.5 2002/12/02 01:42:03 marcel Exp $
+ * $FreeBSD: src/sbin/gpt/migrate.c,v 1.6 2003/11/16 06:43:25 kensmith Exp $
  */
 
 #include <sys/types.h>
@@ -41,6 +41,17 @@
 #include "map.h"
 #include "gpt.h"
 
+/*
+ * Allow compilation on platforms that do not have a BSD label.
+ * The values are valid for amd64, i386 and ia64 disklabels.
+ */
+#ifndef LABELOFFSET
+#define	LABELOFFSET	0
+#endif
+#ifndef LABELSECTOR
+#define	LABELSECTOR	1
+#endif
+
 int keep, slice;
 
 static void

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

@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sbin/gpt/recover.c,v 1.3 2002/11/10 20:22:25 marcel Exp $
+ * $FreeBSD: src/sbin/gpt/recover.c,v 1.4 2003/11/16 06:45:26 kensmith Exp $
  */
 
 #include <sys/types.h>
@@ -51,10 +51,97 @@
 }
 
 static void
-recover(int fd __unused)
+recover(int fd)
 {
+	off_t last;
+	map_t *gpt, *tpg;
+	map_t *tbl, *lbt;
+	struct gpt_hdr *hdr;
+
+	if (map_find(MAP_TYPE_MBR) != NULL) {
+		warnx("%s: error: device contains a MBR", device_name);
+		return;
+	}
+
+	gpt = map_find(MAP_TYPE_PRI_GPT_HDR);
+	tpg = map_find(MAP_TYPE_SEC_GPT_HDR);
+	tbl = map_find(MAP_TYPE_PRI_GPT_TBL);
+	lbt = map_find(MAP_TYPE_SEC_GPT_TBL);
 
-	/* TODO */
+	if (gpt == NULL && tpg == NULL) {
+		warnx("%s: no primary or secondary GPT headers, can't recover",
+		    device_name);
+		return;
+	}
+	if (tbl == NULL && lbt == NULL) {
+		warnx("%s: no primary or secondary GPT tables, can't recover",
+		    device_name);
+		return;
+	}
+
+	last = mediasz / secsz - 1LL;
+
+	if (tbl != NULL && lbt == NULL) {
+		lbt = map_add(last - tbl->map_size, tbl->map_size,
+		    MAP_TYPE_SEC_GPT_TBL, tbl->map_data);
+		if (lbt == NULL) {
+			warnx("%s: adding secondary GPT table failed",
+			    device_name);
+			return;
+		}
+		gpt_write(fd, lbt);
+		warnx("%s: recovered secondary GPT table from primary",
+		    device_name);
+	} else if (tbl == NULL && lbt != NULL) {
+		tbl = map_add(2LL, lbt->map_size, MAP_TYPE_PRI_GPT_TBL,
+		    lbt->map_data);
+		if (tbl == NULL) {
+			warnx("%s: adding primary GPT table failed",
+			    device_name);
+			return;
+		}
+		gpt_write(fd, tbl);
+		warnx("%s: recovered primary GPT table from secondary",
+		    device_name);
+	}
+
+	if (gpt != NULL && tpg == NULL) {
+		tpg = map_add(last, 1LL, MAP_TYPE_SEC_GPT_HDR,
+		    calloc(1, secsz));
+		if (tpg == NULL) {
+			warnx("%s: adding secondary GPT header failed",
+			    device_name);
+			return;
+		}
+		memcpy(tpg->map_data, gpt->map_data, secsz);
+		hdr = tpg->map_data;
+		hdr->hdr_lba_self = tpg->map_start;
+		hdr->hdr_lba_alt = gpt->map_start;
+		hdr->hdr_lba_table = lbt->map_start;
+		hdr->hdr_crc_self = 0;
+		hdr->hdr_crc_self = crc32(hdr, hdr->hdr_size);
+		gpt_write(fd, tpg);
+		warnx("%s: recovered secondary GPT header from primary",
+		    device_name);
+	} else if (gpt == NULL && tpg != NULL) {
+		gpt = map_add(1LL, 1LL, MAP_TYPE_PRI_GPT_HDR,
+		    calloc(1, secsz));
+		if (gpt == NULL) {
+			warnx("%s: adding primary GPT header failed",
+			    device_name);
+			return;
+		}
+		memcpy(gpt->map_data, tpg->map_data, secsz);
+		hdr = gpt->map_data;
+		hdr->hdr_lba_self = gpt->map_start;
+		hdr->hdr_lba_alt = tpg->map_start;
+		hdr->hdr_lba_table = tbl->map_start;
+		hdr->hdr_crc_self = 0;
+		hdr->hdr_crc_self = crc32(hdr, hdr->hdr_size);
+		gpt_write(fd, gpt);
+		warnx("%s: recovered primary GPT header from secondary",
+		    device_name);
+	}
 }
 
 int

==== //depot/projects/hammer/sbin/newfs/mkfs.c#12 (text+ko) ====

@@ -46,7 +46,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/newfs/mkfs.c,v 1.79 2003/11/04 07:34:32 mckusick Exp $");
+__FBSDID("$FreeBSD: src/sbin/newfs/mkfs.c,v 1.81 2003/11/16 07:17:30 wes Exp $");
 
 #include <err.h>
 #include <grp.h>
@@ -259,7 +259,7 @@
 		sblock.fs_old_postblformat = 1;
 		sblock.fs_old_nrpos = 1;
 	} else {
-		sblock.fs_magic = FS_UFS2_MAGIC;
+		sblock.fs_magic = FS_BAD2_MAGIC;
 		sblock.fs_sblockloc = SBLOCK_UFS2;
 		sblock.fs_nindir = sblock.fs_bsize / sizeof(ufs2_daddr_t);
 		sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs2_dinode);
@@ -449,6 +449,16 @@
 	                    chdummy, SBLOCKSIZE);
 		}
 	}
+	if (!Nflag)
+		sbwrite(&disk, 0);
+	if (Eflag == 1) {
+		printf("** Exiting on Eflag 1\n");
+		exit(0);
+	}
+	if (Eflag == 2)
+		printf("** Leaving BAD MAGIC on Eflag 2\n");
+	else
+		sblock.fs_magic = FS_UFS2_MAGIC;
 
 	/*
 	 * Now build the cylinders group blocks and
@@ -504,6 +514,10 @@
 		sblock.fs_old_cstotal.cs_nifree = sblock.fs_cstotal.cs_nifree;
 		sblock.fs_old_cstotal.cs_nffree = sblock.fs_cstotal.cs_nffree;
 	}
+	if (Eflag == 3) {
+		printf("** Exiting on Eflag 3\n");
+		exit(0);
+	}
 	if (!Nflag)
 		sbwrite(&disk, 0);
 	for (i = 0; i < sblock.fs_cssize; i += sblock.fs_bsize)

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

@@ -52,7 +52,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sbin/newfs/newfs.c,v 1.73 2003/05/03 18:41:58 obrien Exp $");
+__FBSDID("$FreeBSD: src/sbin/newfs/newfs.c,v 1.74 2003/11/16 07:17:30 wes Exp $");
 
 /*
  * newfs: friendly front end to mkfs
@@ -119,6 +119,7 @@
 int	Oflag = 2;		/* file system format (1 => UFS1, 2 => UFS2) */
 int	Rflag;			/* regression test */
 int	Uflag;			/* enable soft updates for file system */
+int	Eflag = 0;		/* exit in middle of newfs for testing */
 quad_t	fssize;			/* file system size */
 int	sectorsize;		/* bytes/sector */
 int	realsectorsize;		/* bytes/sector in hardware */
@@ -156,8 +157,11 @@
 	off_t mediasize;
 
 	while ((ch = getopt(argc, argv,
-	    "L:NO:RS:T:Ua:b:c:d:e:f:g:h:i:m:o:s:")) != -1)
+	    "EL:NO:RS:T:Ua:b:c:d:e:f:g:h:i:m:o:s:")) != -1)
 		switch (ch) {
+		case 'E':
+			Eflag++;
+			break;
 		case 'L':
 			volumelabel = optarg;
 			i = -1;

==== //depot/projects/hammer/sbin/newfs/newfs.h#4 (text+ko) ====

@@ -39,7 +39,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sbin/newfs/newfs.h,v 1.13 2003/02/14 21:05:35 mckusick Exp $
+ * $FreeBSD: src/sbin/newfs/newfs.h,v 1.14 2003/11/16 07:17:30 wes Exp $
  */
 
 #include <libufs.h>
@@ -52,6 +52,7 @@
 extern int	Oflag;		/* build UFS1 format file system */
 extern int	Rflag;		/* regression test */
 extern int	Uflag;		/* enable soft updates for file system */
+extern int	Eflag;		/* exit as if error, for testing */
 extern quad_t	fssize;		/* file system size */
 extern int	sectorsize;	/* bytes/sector */
 extern int	realsectorsize;	/* bytes/sector in hardware*/

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

@@ -42,7 +42,7 @@
 static char sccsid[] = "@(#)umount.c	8.8 (Berkeley) 5/8/95";
 #endif
 static const char rcsid[] =
-  "$FreeBSD: src/sbin/umount/umount.c,v 1.40 2003/10/29 17:44:36 iedowse Exp $";
+  "$FreeBSD: src/sbin/umount/umount.c,v 1.41 2003/11/16 16:48:18 iedowse Exp $";
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -359,7 +359,10 @@
 	snprintf(fsidbuf, sizeof(fsidbuf), "FSID:%d:%d", sfs->f_fsid.val[0],
 	    sfs->f_fsid.val[1]);
 	if (unmount(fsidbuf, fflag | MNT_BYFSID) != 0) {
-		warn("unmount of %s failed", sfs->f_mntonname);
+		/* XXX, non-root users get a zero fsid, so don't warn. */
+		if (errno != ENOENT || sfs->f_fsid.val[0] != 0 ||

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



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