CVS commit: src

2014-02-10 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Mon Feb 10 08:20:05 UTC 2014

Modified Files:
src: build.sh

Log Message:
Move the -U or -E must be set for build as an unprivileged user.
test from sanitycheck() to validatemakeparams().  If MKUNPRIVED is set
in mk.conf (and not on the build.sh command line) then it's not yet
available for use in the sanitycheck function.

Also move some other code for consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.274 -r1.275 src/build.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.274 src/build.sh:1.275
--- src/build.sh:1.274	Mon Jan 13 20:00:20 2014
+++ src/build.sh	Mon Feb 10 08:20:05 2014
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.274 2014/01/13 20:00:20 apb Exp $
+#	$NetBSD: build.sh,v 1.275 2014/02/10 08:20:05 apb Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1282,14 +1282,6 @@ parseoptions()
 #
 sanitycheck()
 {
-	# Non-root should always use either the -U or -E flag.
-	#
-	if ! ${do_expertmode}  \
-	[ $id_u -ne 0 ]  \
-	[ ${MKUNPRIVED:-no} = no ] ; then
-		bomb -U or -E must be set for build as an unprivileged user.
-	fi
-
 	# Install as non-root is a bad idea.
 	#
 	if ${do_install}  [ $id_u -ne 0 ] ; then
@@ -1515,6 +1507,22 @@ validatemakeparams()
 		statusmsg2 MAKECONF file: ${MAKECONF} (File not found)
 	fi
 
+	# Normalise MKOBJDIRS, MKUNPRIVED, and MKUPDATE.
+	# These may be set as build.sh options or in mk.conf.
+	# Don't export them as they're only used for tests in build.sh.
+	#
+	MKOBJDIRS=$(getmakevar MKOBJDIRS)
+	MKUNPRIVED=$(getmakevar MKUNPRIVED)
+	MKUPDATE=$(getmakevar MKUPDATE)
+
+	# Non-root should always use either the -U or -E flag.
+	#
+	if ! ${do_expertmode}  \
+	[ $id_u -ne 0 ]  \
+	[ ${MKUNPRIVED} = no ] ; then
+		bomb -U or -E must be set for build as an unprivileged user.
+	fi
+
 	if [ ${runcmd} = echo ]; then
 		TOOLCHAIN_MISSING=no
 		EXTERNAL_TOOLCHAIN=
@@ -1536,14 +1544,6 @@ validatemakeparams()
 		exit 1
 	fi
 
-	# Normalise MKOBJDIRS, MKUNPRIVED, and MKUPDATE
-	# These may be set as build.sh options or in mk.conf.
-	# Don't export them as they're only used for tests in build.sh.
-	#
-	MKOBJDIRS=$(getmakevar MKOBJDIRS)
-	MKUNPRIVED=$(getmakevar MKUNPRIVED)
-	MKUPDATE=$(getmakevar MKUPDATE)
-
 	if [ ${MKOBJDIRS} != no ]; then
 		# Create the top-level object directory.
 		#
@@ -1745,7 +1745,7 @@ createmakewrapper()
 	eval cat EOF ${makewrapout}
 #! ${HOST_SH}
 # Set proper variables to allow easy make building of a NetBSD subtree.
-# Generated from:  \$NetBSD: build.sh,v 1.274 2014/01/13 20:00:20 apb Exp $
+# Generated from:  \$NetBSD: build.sh,v 1.275 2014/02/10 08:20:05 apb Exp $
 # with these arguments: ${_args}
 #
 



CVS commit: src/sys/miscfs

2014-02-10 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Feb 10 11:23:14 UTC 2014

Modified Files:
src/sys/miscfs/genfs: layer_subr.c layer_vfsops.c
src/sys/miscfs/nullfs: null_vfsops.c
src/sys/miscfs/overlay: overlay_vfsops.c
src/sys/miscfs/umapfs: umap_vfsops.c

Log Message:
Change layerfs_vget(), layerfs_fhtovp() and the various layer xxx_mount()
functions to unlock/relock the node for the call to layer_node_create().

Finally remove dirty hacks (LK_NOWAIT, kpause) from layer_node_find().


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/miscfs/genfs/layer_subr.c
cvs rdiff -u -r1.41 -r1.42 src/sys/miscfs/genfs/layer_vfsops.c
cvs rdiff -u -r1.84 -r1.85 src/sys/miscfs/nullfs/null_vfsops.c
cvs rdiff -u -r1.57 -r1.58 src/sys/miscfs/overlay/overlay_vfsops.c
cvs rdiff -u -r1.88 -r1.89 src/sys/miscfs/umapfs/umap_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/miscfs/genfs/layer_subr.c
diff -u src/sys/miscfs/genfs/layer_subr.c:1.34 src/sys/miscfs/genfs/layer_subr.c:1.35
--- src/sys/miscfs/genfs/layer_subr.c:1.34	Sun Feb  9 17:15:51 2014
+++ src/sys/miscfs/genfs/layer_subr.c	Mon Feb 10 11:23:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: layer_subr.c,v 1.34 2014/02/09 17:15:51 hannken Exp $	*/
+/*	$NetBSD: layer_subr.c,v 1.35 2014/02/10 11:23:14 hannken Exp $	*/
 
 /*
  * Copyright (c) 1999 National Aeronautics  Space Administration
@@ -69,7 +69,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: layer_subr.c,v 1.34 2014/02/09 17:15:51 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: layer_subr.c,v 1.35 2014/02/10 11:23:14 hannken Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -112,7 +112,7 @@ layerfs_done(void)
 /*
  * layer_node_find: find and return alias for lower vnode or NULL.
  *
- * = Return alias vnode locked and referenced. if already exists.
+ * = Return alias vnode referenced. if already exists.
  * = The layermp's hashlock must be held on entry, we will unlock on success.
  */
 struct vnode *
@@ -128,7 +128,7 @@ layer_node_find(struct mount *mp, struct
 	 * Find hash bucket and search the (two-way) linked list looking
 	 * for a layerfs node structure which is referencing the lower vnode.
 	 * If found, the increment the layer_node reference count, but NOT
-	 * the lower vnode's reference counter.  Return vnode locked.
+	 * the lower vnode's reference counter.
 	 */
 	KASSERT(mutex_owned(lmp-layerm_hashlock));
 	hd = LAYER_NHASH(lmp, lowervp);
@@ -142,29 +142,9 @@ loop:
 			continue;
 		}
 		mutex_enter(vp-v_interlock);
-		/*
-		 * If we find a node being cleaned out, then ignore it and
-		 * continue.  A thread trying to clean out the extant layer
-		 * vnode needs to acquire the shared lock (i.e. the lower
-		 * vnode's lock), which our caller already holds.  To allow
-		 * the cleaning to succeed the current thread must make
-		 * progress.  So, for a brief time more than one vnode in a
-		 * layered file system may refer to a single vnode in the
-		 * lower file system.
-		 */
-		if ((vp-v_iflag  VI_XLOCK) != 0) {
-			mutex_exit(vp-v_interlock);
-			continue;
-		}
 		mutex_exit(lmp-layerm_hashlock);
-		/*
-		 * We must not let vget() try to lock the layer vp, since
-		 * the lower vp is already locked and locking the layer vp
-		 * will involve locking the lower vp.
-		 */
-		error = vget(vp, LK_NOWAIT);
+		error = vget(vp, 0);
 		if (error) {
-			kpause(layerfs, false, 1, NULL);
 			mutex_enter(lmp-layerm_hashlock);
 			goto loop;
 		}

Index: src/sys/miscfs/genfs/layer_vfsops.c
diff -u src/sys/miscfs/genfs/layer_vfsops.c:1.41 src/sys/miscfs/genfs/layer_vfsops.c:1.42
--- src/sys/miscfs/genfs/layer_vfsops.c:1.41	Thu May 31 16:08:14 2012
+++ src/sys/miscfs/genfs/layer_vfsops.c	Mon Feb 10 11:23:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: layer_vfsops.c,v 1.41 2012/05/31 16:08:14 pgoyette Exp $	*/
+/*	$NetBSD: layer_vfsops.c,v 1.42 2014/02/10 11:23:14 hannken Exp $	*/
 
 /*
  * Copyright (c) 1999 National Aeronautics  Space Administration
@@ -74,7 +74,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: layer_vfsops.c,v 1.41 2012/05/31 16:08:14 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: layer_vfsops.c,v 1.42 2014/02/10 11:23:14 hannken Exp $);
 
 #include sys/param.h
 #include sys/sysctl.h
@@ -214,9 +214,16 @@ layerfs_vget(struct mount *mp, ino_t ino
 		*vpp = NULL;
 		return error;
 	}
+	VOP_UNLOCK(vp);
 	error = layer_node_create(mp, vp, vpp);
 	if (error) {
-		vput(vp);
+		vrele(vp);
+		*vpp = NULL;
+		return error;
+	}
+	error = vn_lock(*vpp, LK_EXCLUSIVE);
+	if (error) {
+		vrele(*vpp);
 		*vpp = NULL;
 		return error;
 	}
@@ -231,14 +238,22 @@ layerfs_fhtovp(struct mount *mp, struct 
 
 	error = VFS_FHTOVP(MOUNTTOLAYERMOUNT(mp)-layerm_vfs, fidp, vp);
 	if (error) {
+		*vpp = NULL;
 		return error;
 	}
+	VOP_UNLOCK(vp);
 	error = layer_node_create(mp, vp, vpp);
 	if (error) {
 		vput(vp);
 		*vpp = NULL;
 		return 

CVS commit: src/lib/libc/inet

2014-02-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 10 16:30:54 UTC 2014

Modified Files:
src/lib/libc/inet: inet_ntop.c

Log Message:
remove unneeded code, and kill parens from return


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/inet/inet_ntop.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/inet/inet_ntop.c
diff -u src/lib/libc/inet/inet_ntop.c:1.10 src/lib/libc/inet/inet_ntop.c:1.11
--- src/lib/libc/inet/inet_ntop.c:1.10	Mon Feb 10 11:29:30 2014
+++ src/lib/libc/inet/inet_ntop.c	Mon Feb 10 11:30:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: inet_ntop.c,v 1.10 2014/02/10 16:29:30 christos Exp $	*/
+/*	$NetBSD: inet_ntop.c,v 1.11 2014/02/10 16:30:54 christos Exp $	*/
 
 /*
  * Copyright (c) 2004 by Internet Systems Consortium, Inc. (ISC)
@@ -22,7 +22,7 @@
 #if 0
 static const char rcsid[] = Id: inet_ntop.c,v 1.5 2005/11/03 22:59:52 marka Exp;
 #else
-__RCSID($NetBSD: inet_ntop.c,v 1.10 2014/02/10 16:29:30 christos Exp $);
+__RCSID($NetBSD: inet_ntop.c,v 1.11 2014/02/10 16:30:54 christos Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -74,12 +74,12 @@ inet_ntop(int af, const void *src, char 
 
 	switch (af) {
 	case AF_INET:
-		return (inet_ntop4(src, dst, size));
+		return inet_ntop4(src, dst, size);
 	case AF_INET6:
-		return (inet_ntop6(src, dst, size));
+		return inet_ntop6(src, dst, size);
 	default:
 		errno = EAFNOSUPPORT;
-		return (NULL);
+		return NULL;
 	}
 	/* NOTREACHED */
 }
@@ -106,12 +106,10 @@ inet_ntop4(const u_char *src, char *dst,
 
 	l = snprintf(tmp, sizeof(tmp), %u.%u.%u.%u,
 	src[0], src[1], src[2], src[3]);
-	if (l = 0 || (socklen_t) l = size) {
-		errno = ENOSPC;
-		return (NULL);
-	}
+	if (l = 0 || (socklen_t) l = size)
+		return NULL;
 	strlcpy(dst, tmp, size);
-	return (dst);
+	return dst;
 }
 
 /* const char *
@@ -224,7 +222,7 @@ inet_ntop6(const u_char *src, char *dst,
 	if ((size_t)(tp - tmp)  size)
 		goto out;
 	strlcpy(dst, tmp, size);
-	return (dst);
+	return dst;
 out:
 	errno = ENOSPC;
 	return NULL;



CVS commit: src/lib/libc/inet

2014-02-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 10 16:29:30 UTC 2014

Modified Files:
src/lib/libc/inet: inet_ntop.c

Log Message:
PR/48585: Henning Petersen: Always set errno when returning NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/inet/inet_ntop.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/inet/inet_ntop.c
diff -u src/lib/libc/inet/inet_ntop.c:1.9 src/lib/libc/inet/inet_ntop.c:1.10
--- src/lib/libc/inet/inet_ntop.c:1.9	Tue Mar 20 13:08:13 2012
+++ src/lib/libc/inet/inet_ntop.c	Mon Feb 10 11:29:30 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: inet_ntop.c,v 1.9 2012/03/20 17:08:13 matt Exp $	*/
+/*	$NetBSD: inet_ntop.c,v 1.10 2014/02/10 16:29:30 christos Exp $	*/
 
 /*
  * Copyright (c) 2004 by Internet Systems Consortium, Inc. (ISC)
@@ -22,7 +22,7 @@
 #if 0
 static const char rcsid[] = Id: inet_ntop.c,v 1.5 2005/11/03 22:59:52 marka Exp;
 #else
-__RCSID($NetBSD: inet_ntop.c,v 1.9 2012/03/20 17:08:13 matt Exp $);
+__RCSID($NetBSD: inet_ntop.c,v 1.10 2014/02/10 16:29:30 christos Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -189,7 +189,7 @@ inet_ntop6(const u_char *src, char *dst,
 		/* Are we following an initial run of 0x00s or any real hex? */
 		if (i != 0) {
 			if (tp + 1 = ep)
-return (NULL);
+goto out;
 			*tp++ = ':';
 		}
 		/* Is this address an encapsulated IPv4? */
@@ -197,36 +197,37 @@ inet_ntop6(const u_char *src, char *dst,
 		(best.len == 6 ||
 		(best.len == 7  words[7] != 0x0001) ||
 		(best.len == 5  words[5] == 0x))) {
-			if (!inet_ntop4(src+12, tp, (socklen_t)(ep - tp)))
-return (NULL);
+			if (!inet_ntop4(src + 12, tp, (socklen_t)(ep - tp)))
+goto out;
 			tp += strlen(tp);
 			break;
 		}
 		advance = snprintf(tp, (size_t)(ep - tp), %x, words[i]);
 		if (advance = 0 || advance = ep - tp)
-			return (NULL);
+			goto out;
 		tp += advance;
 	}
 	/* Was it a trailing run of 0x00's? */
 	if (best.base != -1  (best.base + best.len) == 
 	(NS_IN6ADDRSZ / NS_INT16SZ)) {
 		if (tp + 1 = ep)
-			return (NULL);
+			goto out;
 		*tp++ = ':';
 	}
 	if (tp + 1 = ep)
-		return (NULL);
+		goto out;
 	*tp++ = '\0';
 
 	/*
 	 * Check for overflow, copy, and we're done.
 	 */
-	if ((size_t)(tp - tmp)  size) {
-		errno = ENOSPC;
-		return (NULL);
-	}
+	if ((size_t)(tp - tmp)  size)
+		goto out;
 	strlcpy(dst, tmp, size);
 	return (dst);
+out:
+	errno = ENOSPC;
+	return NULL;
 }
 
 /*! \file */



CVS commit: src

2014-02-10 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Mon Feb 10 08:20:05 UTC 2014

Modified Files:
src: build.sh

Log Message:
Move the -U or -E must be set for build as an unprivileged user.
test from sanitycheck() to validatemakeparams().  If MKUNPRIVED is set
in mk.conf (and not on the build.sh command line) then it's not yet
available for use in the sanitycheck function.

Also move some other code for consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.274 -r1.275 src/build.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/miscfs

2014-02-10 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Feb 10 11:23:14 UTC 2014

Modified Files:
src/sys/miscfs/genfs: layer_subr.c layer_vfsops.c
src/sys/miscfs/nullfs: null_vfsops.c
src/sys/miscfs/overlay: overlay_vfsops.c
src/sys/miscfs/umapfs: umap_vfsops.c

Log Message:
Change layerfs_vget(), layerfs_fhtovp() and the various layer xxx_mount()
functions to unlock/relock the node for the call to layer_node_create().

Finally remove dirty hacks (LK_NOWAIT, kpause) from layer_node_find().


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/miscfs/genfs/layer_subr.c
cvs rdiff -u -r1.41 -r1.42 src/sys/miscfs/genfs/layer_vfsops.c
cvs rdiff -u -r1.84 -r1.85 src/sys/miscfs/nullfs/null_vfsops.c
cvs rdiff -u -r1.57 -r1.58 src/sys/miscfs/overlay/overlay_vfsops.c
cvs rdiff -u -r1.88 -r1.89 src/sys/miscfs/umapfs/umap_vfsops.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/inet

2014-02-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 10 16:30:54 UTC 2014

Modified Files:
src/lib/libc/inet: inet_ntop.c

Log Message:
remove unneeded code, and kill parens from return


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/inet/inet_ntop.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/lib/libc/inet

2014-02-10 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 10 16:29:30 UTC 2014

Modified Files:
src/lib/libc/inet: inet_ntop.c

Log Message:
PR/48585: Henning Petersen: Always set errno when returning NULL.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/inet/inet_ntop.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.