svn commit: r252417 - in user/attilio/vmobj-readlock: contrib/libstdc++/libsupc++ crypto/heimdal/lib/gssapi/gssapi include/gssapi lib/librt sbin/hastd sbin/ifconfig sbin/swapon sys/arm/conf sys/arm...

Attilio Rao attilio at FreeBSD.org
Sun Jun 30 13:32:06 UTC 2013


Author: attilio
Date: Sun Jun 30 13:32:02 2013
New Revision: 252417
URL: http://svnweb.freebsd.org/changeset/base/252417

Log:
  MFC

Added:
  user/attilio/vmobj-readlock/sys/arm/conf/ARNDALE
     - copied unchanged from r252416, user/attilio/vmcontention/sys/arm/conf/ARNDALE
  user/attilio/vmobj-readlock/sys/arm/samsung/
     - copied from r252416, user/attilio/vmcontention/sys/arm/samsung/
Modified:
  user/attilio/vmobj-readlock/contrib/libstdc++/libsupc++/unwind-cxx.h
  user/attilio/vmobj-readlock/crypto/heimdal/lib/gssapi/gssapi/gssapi_krb5.h
  user/attilio/vmobj-readlock/include/gssapi/gssapi.h
  user/attilio/vmobj-readlock/lib/librt/sigev_thread.c
  user/attilio/vmobj-readlock/sbin/hastd/refcnt.h
  user/attilio/vmobj-readlock/sbin/ifconfig/af_nd6.c
  user/attilio/vmobj-readlock/sbin/swapon/swapon.c
  user/attilio/vmobj-readlock/sys/arm/versatile/versatile_pci.c
  user/attilio/vmobj-readlock/sys/arm/versatile/versatile_sic.c
  user/attilio/vmobj-readlock/sys/cam/cam_ccb.h
  user/attilio/vmobj-readlock/sys/cam/scsi/scsi_xpt.c
  user/attilio/vmobj-readlock/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c
  user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
  user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  user/attilio/vmobj-readlock/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c
  user/attilio/vmobj-readlock/sys/dev/ath/if_ath_rx_edma.c
  user/attilio/vmobj-readlock/sys/dev/bce/if_bce.c
  user/attilio/vmobj-readlock/sys/dev/bce/if_bcereg.h
  user/attilio/vmobj-readlock/sys/dev/bge/if_bge.c
  user/attilio/vmobj-readlock/sys/dev/bge/if_bgereg.h
  user/attilio/vmobj-readlock/sys/dev/iwn/if_iwn.c
  user/attilio/vmobj-readlock/sys/dev/uart/uart.h
  user/attilio/vmobj-readlock/sys/dev/uart/uart_bus_fdt.c
  user/attilio/vmobj-readlock/sys/dev/uart/uart_cpu_fdt.c
  user/attilio/vmobj-readlock/sys/dev/uart/uart_subr.c
  user/attilio/vmobj-readlock/sys/dev/usb/wlan/if_urtwn.c
  user/attilio/vmobj-readlock/sys/fs/ext2fs/ext2_vfsops.c
  user/attilio/vmobj-readlock/sys/kern/kern_acct.c
  user/attilio/vmobj-readlock/sys/sys/stdatomic.h
  user/attilio/vmobj-readlock/usr.bin/calendar/calendars/calendar.freebsd
  user/attilio/vmobj-readlock/usr.bin/truss/syscalls.c
Directory Properties:
  user/attilio/vmobj-readlock/   (props changed)
  user/attilio/vmobj-readlock/contrib/libstdc++/   (props changed)
  user/attilio/vmobj-readlock/crypto/heimdal/   (props changed)
  user/attilio/vmobj-readlock/sbin/   (props changed)
  user/attilio/vmobj-readlock/sys/   (props changed)
  user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/   (props changed)
  user/attilio/vmobj-readlock/usr.bin/calendar/   (props changed)

Modified: user/attilio/vmobj-readlock/contrib/libstdc++/libsupc++/unwind-cxx.h
==============================================================================
--- user/attilio/vmobj-readlock/contrib/libstdc++/libsupc++/unwind-cxx.h	Sun Jun 30 13:29:07 2013	(r252416)
+++ user/attilio/vmobj-readlock/contrib/libstdc++/libsupc++/unwind-cxx.h	Sun Jun 30 13:32:02 2013	(r252417)
@@ -133,7 +133,7 @@ extern "C" void __cxa_bad_typeid ();
 // throws, and if bad_exception needs to be thrown.  Called from the
 // compiler.
 extern "C" void __cxa_call_unexpected (void *) __attribute__((noreturn));
-extern "C" void __cxa_call_terminate (void*) __attribute__((noreturn));
+extern "C" void __cxa_call_terminate (_Unwind_Exception*) __attribute__((noreturn));
 
 #ifdef __ARM_EABI_UNWINDER__
 // Arm EABI specified routines.

Modified: user/attilio/vmobj-readlock/crypto/heimdal/lib/gssapi/gssapi/gssapi_krb5.h
==============================================================================
--- user/attilio/vmobj-readlock/crypto/heimdal/lib/gssapi/gssapi/gssapi_krb5.h	Sun Jun 30 13:29:07 2013	(r252416)
+++ user/attilio/vmobj-readlock/crypto/heimdal/lib/gssapi/gssapi/gssapi_krb5.h	Sun Jun 30 13:32:02 2013	(r252417)
@@ -36,7 +36,7 @@
 #ifndef GSSAPI_KRB5_H_
 #define GSSAPI_KRB5_H_
 
-#include <gssapi.h>
+#include <gssapi/gssapi.h>
 
 GSSAPI_CPP_START
 

Modified: user/attilio/vmobj-readlock/include/gssapi/gssapi.h
==============================================================================
--- user/attilio/vmobj-readlock/include/gssapi/gssapi.h	Sun Jun 30 13:29:07 2013	(r252416)
+++ user/attilio/vmobj-readlock/include/gssapi/gssapi.h	Sun Jun 30 13:32:02 2013	(r252417)
@@ -44,6 +44,33 @@ typedef	__ssize_t	ssize_t;
 #define	_SSIZE_T_DECLARED
 #endif
 
+/* Compatibility with Heimdal 1.5.1 */
+#ifndef GSSAPI_CPP_START
+#ifdef __cplusplus
+#define GSSAPI_CPP_START	extern "C" {
+#define GSSAPI_CPP_END		}
+#else
+#define GSSAPI_CPP_START
+#define GSSAPI_CPP_END
+#endif
+#endif
+
+/* Compatibility with Heimdal 1.5.1 */
+#ifndef BUILD_GSSAPI_LIB
+#define GSSAPI_LIB_FUNCTION
+#define GSSAPI_LIB_CALL
+#define GSSAPI_LIB_VARIABLE
+#endif
+
+/* Compatibility with Heimdal 1.5.1 */
+#ifndef GSSAPI_DEPRECATED_FUNCTION
+#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1 )))
+#define GSSAPI_DEPRECATED_FUNCTION(X) __attribute__((deprecated))
+#else
+#define GSSAPI_DEPRECATED_FUNCTION(X)
+#endif
+#endif
+
 #if 0
 /*
  * If the platform supports the xom.h header file, it should be

Modified: user/attilio/vmobj-readlock/lib/librt/sigev_thread.c
==============================================================================
--- user/attilio/vmobj-readlock/lib/librt/sigev_thread.c	Sun Jun 30 13:29:07 2013	(r252416)
+++ user/attilio/vmobj-readlock/lib/librt/sigev_thread.c	Sun Jun 30 13:32:02 2013	(r252417)
@@ -28,13 +28,13 @@
  */
 
 #include <sys/types.h>
-#include <machine/atomic.h>
 
 #include "namespace.h"
 #include <err.h>
 #include <errno.h>
 #include <ucontext.h>
 #include <sys/thr.h>
+#include <stdatomic.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -51,7 +51,7 @@ LIST_HEAD(sigev_list_head, sigev_node);
 static struct sigev_list_head	sigev_hash[HASH_QUEUES];
 static struct sigev_list_head	sigev_all;
 static LIST_HEAD(,sigev_thread)	sigev_threads;
-static unsigned int		sigev_generation;
+static atomic_int		sigev_generation;
 static pthread_mutex_t		*sigev_list_mtx;
 static pthread_once_t		sigev_once = PTHREAD_ONCE_INIT;
 static pthread_once_t		sigev_once_default = PTHREAD_ONCE_INIT;
@@ -196,7 +196,8 @@ __sigev_alloc(int type, const struct sig
 	if (sn != NULL) {
 		sn->sn_value = evp->sigev_value;
 		sn->sn_func  = evp->sigev_notify_function;
-		sn->sn_gen   = atomic_fetchadd_int(&sigev_generation, 1);
+		sn->sn_gen   = atomic_fetch_add_explicit(&sigev_generation, 1,
+		    memory_order_relaxed);
 		sn->sn_type  = type;
 		_pthread_attr_init(&sn->sn_attr);
 		_pthread_attr_setdetachstate(&sn->sn_attr, PTHREAD_CREATE_DETACHED);

Modified: user/attilio/vmobj-readlock/sbin/hastd/refcnt.h
==============================================================================
--- user/attilio/vmobj-readlock/sbin/hastd/refcnt.h	Sun Jun 30 13:29:07 2013	(r252416)
+++ user/attilio/vmobj-readlock/sbin/hastd/refcnt.h	Sun Jun 30 13:32:02 2013	(r252417)
@@ -32,24 +32,24 @@
 #ifndef __REFCNT_H__
 #define __REFCNT_H__
 
-#include <stdatomic.h>
+#include <machine/atomic.h>
 
 #include "pjdlog.h"
 
-typedef atomic_uint refcnt_t;
+typedef unsigned int refcnt_t;
 
 static __inline void
 refcnt_init(refcnt_t *count, unsigned int v)
 {
 
-	atomic_init(count, v);
+	*count = v;
 }
 
 static __inline void
 refcnt_acquire(refcnt_t *count)
 {
 
-	atomic_fetch_add_explicit(count, 1, memory_order_acquire);
+	atomic_add_acq_int(count, 1);
 }
 
 static __inline unsigned int
@@ -58,7 +58,7 @@ refcnt_release(refcnt_t *count)
 	unsigned int old;
 
 	/* XXX: Should this have a rel membar? */
-	old = atomic_fetch_sub(count, 1);
+	old = atomic_fetchadd_int(count, -1);
 	PJDLOG_ASSERT(old > 0);
 	return (old - 1);
 }

Modified: user/attilio/vmobj-readlock/sbin/ifconfig/af_nd6.c
==============================================================================
--- user/attilio/vmobj-readlock/sbin/ifconfig/af_nd6.c	Sun Jun 30 13:29:07 2013	(r252416)
+++ user/attilio/vmobj-readlock/sbin/ifconfig/af_nd6.c	Sun Jun 30 13:32:02 2013	(r252417)
@@ -148,7 +148,7 @@ nd6_status(int s)
 	memset(&nd, 0, sizeof(nd));
 	strncpy(nd.ifname, ifr.ifr_name, sizeof(nd.ifname));
 	if ((s6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
-		if (errno != EAFNOSUPPORT)
+		if (errno != EAFNOSUPPORT && error != EPROTONOSUPPORT)
 			warn("socket(AF_INET6, SOCK_DGRAM)");
 		return;
 	}

Modified: user/attilio/vmobj-readlock/sbin/swapon/swapon.c
==============================================================================
--- user/attilio/vmobj-readlock/sbin/swapon/swapon.c	Sun Jun 30 13:29:07 2013	(r252416)
+++ user/attilio/vmobj-readlock/sbin/swapon/swapon.c	Sun Jun 30 13:32:02 2013	(r252417)
@@ -65,19 +65,17 @@ __FBSDID("$FreeBSD$");
 #include <unistd.h>
 
 static void usage(void);
-static const char *swap_on_off(char *, int, char *);
-static const char *swap_on_off_gbde(char *, int);
-static const char *swap_on_off_geli(char *, char *, int);
-static const char *swap_on_off_md(char *, char *, int);
-static const char *swap_on_off_sfile(char *, int);
+static const char *swap_on_off(const char *, int, char *);
+static const char *swap_on_off_gbde(const char *, int);
+static const char *swap_on_off_geli(const char *, char *, int);
+static const char *swap_on_off_md(const char *, char *, int);
+static const char *swap_on_off_sfile(const char *, int);
 static void swaplist(int, int, int);
 static int run_cmd(int *, const char *, ...) __printflike(2, 3);
 
 static enum { SWAPON, SWAPOFF, SWAPCTL } orig_prog, which_prog = SWAPCTL;
 
 static int qflag;
-static char aalgo_default[] = "hmac/sha256";
-static char ealgo_default[] = "aes";
 
 int
 main(int argc, char **argv)
@@ -219,215 +217,231 @@ main(int argc, char **argv)
 }
 
 static const char *
-swap_on_off(char *name, int doingall, char *mntops)
+swap_on_off(const char *name, int doingall, char *mntops)
 {
 	char base[PATH_MAX];
 
 	/* Swap on vnode-backed md(4) device. */
 	if (mntops != NULL &&
-	    (fnmatch(_PATH_DEV MD_NAME "[0-9]*", name, 0) != FNM_NOMATCH ||
-	     fnmatch(MD_NAME "[0-9]*", name, 0) != FNM_NOMATCH ||
+	    (fnmatch(_PATH_DEV MD_NAME "[0-9]*", name, 0) == 0 ||
+	     fnmatch(MD_NAME "[0-9]*", name, 0) == 0 ||
 	     strncmp(_PATH_DEV MD_NAME, name,
 		sizeof(_PATH_DEV) + sizeof(MD_NAME)) == 0 ||
 	     strncmp(MD_NAME, name, sizeof(MD_NAME)) == 0))
 		return (swap_on_off_md(name, mntops, doingall));
 
-	/* Swap on encrypted device by GEOM_BDE. */
 	basename_r(name, base);
-	if (fnmatch("*.bde", base, 0) != FNM_NOMATCH)
+
+	/* Swap on encrypted device by GEOM_BDE. */
+	if (fnmatch("*.bde", base, 0) == 0)
 		return (swap_on_off_gbde(name, doingall));
 
 	/* Swap on encrypted device by GEOM_ELI. */
-	if (fnmatch("*.eli", base, 0) != FNM_NOMATCH)
+	if (fnmatch("*.eli", base, 0) == 0)
 		return (swap_on_off_geli(name, mntops, doingall));
 
 	/* Swap on special file. */
 	return (swap_on_off_sfile(name, doingall));
 }
 
-static const char *
-swap_on_off_gbde(char *name, int doingall)
+/* Strip off .bde or .eli suffix from swap device name */
+static char *
+swap_basename(const char *name)
 {
-	const char *ret;
-	char pass[64 * 2 + 1], bpass[64];
 	char *dname, *p;
-	int i, fd, error;
 
 	dname = strdup(name);
 	p = strrchr(dname, '.');
-	if (p == NULL) {
-		warnx("%s: Malformed device name", name);
-		return (NULL);
-	}
+	/* assert(p != NULL); */
 	*p = '\0';
 
-	fd = -1;
-	switch (which_prog) {
-	case SWAPON:
+	return (dname);
+}
+
+static const char *
+swap_on_off_gbde(const char *name, int doingall)
+{
+	const char *ret;
+	char pass[64 * 2 + 1], bpass[64];
+	char *dname;
+	int i, error;
+
+	dname = swap_basename(name);
+	if (dname == NULL)
+		return (NULL);
+
+	if (which_prog == SWAPON) {
 		arc4random_buf(bpass, sizeof(bpass));
 		for (i = 0; i < (int)sizeof(bpass); i++)
 			sprintf(&pass[2 * i], "%02x", bpass[i]);
 		pass[sizeof(pass) - 1] = '\0';
 
-		error = run_cmd(&fd, "%s init %s -P %s", _PATH_GBDE,
+		error = run_cmd(NULL, "%s init %s -P %s", _PATH_GBDE,
 		    dname, pass);
 		if (error) {
 			/* bde device found.  Ignore it. */
-			close(fd);
+			free(dname);
 			if (!qflag)
 				warnx("%s: Device already in use", name);
 			return (NULL);
 		}
-		close(fd);
-		error = run_cmd(&fd, "%s attach %s -p %s", _PATH_GBDE,
+		error = run_cmd(NULL, "%s attach %s -p %s", _PATH_GBDE,
 		    dname, pass);
+		free(dname);
 		if (error) {
-			close(fd);
 			warnx("gbde (attach) error: %s", name);
 			return (NULL);
 		}
-		break;
-	case SWAPOFF:
-		break;
-	default:
-		return (NULL);
-		break;
 	}
-	if (fd != -1)
-		close(fd);
+
 	ret = swap_on_off_sfile(name, doingall);
 
-	fd = -1;
-	switch (which_prog) {
-	case SWAPOFF:
-		error = run_cmd(&fd, "%s detach %s", _PATH_GBDE, dname);
+	if (which_prog == SWAPOFF) {
+		error = run_cmd(NULL, "%s detach %s", _PATH_GBDE, dname);
+		free(dname);
 		if (error) {
 			/* bde device not found.  Ignore it. */
 			if (!qflag)
-				warnx("%s: Device not found", dname);
+				warnx("%s: Device not found", name);
 			return (NULL);
 		}
-		break;
-	default:
-		return (NULL);
-		break;
 	}
 
-	if (fd != -1)
-		close(fd);
 	return (ret);
 }
 
+/* Build geli(8) arguments from mntopts */
+static char *
+swap_on_geli_args(const char *mntops)
+{
+	const char *aalgo, *ealgo, *keylen_str, *sectorsize_str;
+	const char *aflag, *eflag, *lflag, *sflag;
+	char *p;
+	char *args;
+	char *token, *string, *ops;
+	int argsize, pagesize;
+	size_t pagesize_len;
+	u_long ul;
+
+	/* Use built-in defaults for geli(8) */
+	aalgo = ealgo = keylen_str = "";
+	aflag = eflag = lflag = "";
+
+	/* We will always specify sectorsize */
+	sflag = " -s ";
+	sectorsize_str = NULL;
+
+	if (mntops != NULL) {
+		string = ops = strdup(mntops);
+
+		while ((token = strsep(&string, ",")) != NULL) {
+			if ((p = strstr(token, "aalgo=")) == token) {
+				aalgo = p + sizeof("aalgo=") - 1;
+				aflag = " -a ";
+			} else if ((p = strstr(token, "ealgo=")) == token) {
+				ealgo = p + sizeof("ealgo=") - 1;
+				eflag = " -e ";
+			} else if ((p = strstr(token, "keylen=")) == token) {
+				keylen_str = p + sizeof("keylen=") - 1;
+				errno = 0;
+				ul = strtoul(keylen_str, &p, 10);
+				if (errno == 0) {
+					if (*p != '\0' || ul > INT_MAX)
+						errno = EINVAL;
+				}
+				if (errno) {
+					warn("Invalid keylen: %s", keylen_str);
+					free(ops);
+					return (NULL);
+				}
+				lflag = " -l ";
+			} else if ((p = strstr(token, "sectorsize=")) == token) {
+				sectorsize_str = p + sizeof("sectorsize=") - 1;
+				errno = 0;
+				ul = strtoul(sectorsize_str, &p, 10);
+				if (errno == 0) {
+					if (*p != '\0' || ul > INT_MAX)
+						errno = EINVAL;
+				}
+				if (errno) {
+					warn("Invalid sectorsize: %s", sectorsize_str);
+					free(ops);
+					return (NULL);
+				}
+			} else if (strcmp(token, "sw") != 0) {
+				warnx("Invalid option: %s", token);
+				free(ops);
+				return (NULL);
+			}
+		}
+	} else
+		ops = NULL;
+
+	/*
+	 * If we do not have a sector size at this point, fill in
+	 * pagesize as sector size.
+	 */
+	if (sectorsize_str == NULL) {
+		/* Use pagesize as default sectorsize */
+		pagesize = getpagesize();
+		pagesize_len = snprintf(NULL, 0, "%d", pagesize) + 1;
+		p = alloca(pagesize_len);
+		snprintf(p, pagesize_len, "%d", pagesize);
+		sectorsize_str = p;
+	}
+
+	argsize = asprintf(&args, "%s%s%s%s%s%s%s%s -d",
+	    aflag, aalgo, eflag, ealgo, lflag, keylen_str,
+	    sflag, sectorsize_str);
+
+	free(ops);
+	return (args);
+}
+
 static const char *
-swap_on_off_geli(char *name, char *mntops, int doingall)
+swap_on_off_geli(const char *name, char *mntops, int doingall)
 {
-	char *ops, *aalgo, *ealgo, *keylen_str, *sectorsize_str;
-	char *dname, *p;
-	char args[4096];
+	char *dname;
+	char *args;
 	struct stat sb;
-	int fd, error, keylen, sectorsize;
-	u_long ul;
+	int error;
 
-	dname = strdup(name);
-	p = strrchr(dname, '.');
-	if (p == NULL) {
-		warnx("%s: Malformed device name", name);
-		return (NULL);
-	}
-	*p = '\0';
+	error = stat(name, &sb);
 
-	ops = strdup(mntops);
+	if (which_prog == SWAPON) do {
+		/* Skip if the .eli device already exists */
+		if (error == 0)
+			break;
 
-	/* Default parameters for geli(8). */
-	aalgo = aalgo_default;
-	ealgo = ealgo_default;
-	keylen = 256;
-	sectorsize = 4096;
-
-	if ((p = strstr(ops, "aalgo=")) != NULL) {
-		aalgo = p + sizeof("aalgo=") - 1;
-		p = strchr(aalgo, ',');
-		if (p != NULL)
-			*p = '\0';
-	}
-	if ((p = strstr(ops, "ealgo=")) != NULL) {
-		ealgo = p + sizeof("ealgo=") - 1;
-		p = strchr(ealgo, ',');
-		if (p != NULL)
-			*p = '\0';
-	}
-	if ((p = strstr(ops, "keylen=")) != NULL) {
-		keylen_str = p + sizeof("keylen=") - 1;
-		p = strchr(keylen_str, ',');
-		if (p != NULL)
-			*p = '\0';
-		errno = 0;
-		ul = strtoul(keylen_str, &p, 10);
-		if (errno == 0) {
-			if (*p != '\0' || ul > INT_MAX)
-				errno = EINVAL;
-		}
-		if (errno) {
-			warn("Invalid keylen: %s", keylen_str);
+		args = swap_on_geli_args(mntops);
+		if (args == NULL)
 			return (NULL);
-		}
-		keylen = (int)ul;
-	}
-	if ((p = strstr(ops, "sectorsize=")) != NULL) {
-		sectorsize_str = p + sizeof("sectorsize=") - 1;
-		p = strchr(sectorsize_str, ',');
-		if (p != NULL)
-			*p = '\0';
-		errno = 0;
-		ul = strtoul(sectorsize_str, &p, 10);
-		if (errno == 0) {
-			if (*p != '\0' || ul > INT_MAX)
-				errno = EINVAL;
-		}
-		if (errno) {
-			warn("Invalid sectorsize: %s", sectorsize_str);
+
+		dname = swap_basename(name);
+		if (dname == NULL) {
+			free(args);
 			return (NULL);
 		}
-		sectorsize = (int)ul;
-	}
-	snprintf(args, sizeof(args), "-a %s -e %s -l %d -s %d -d",
-	    aalgo, ealgo, keylen, sectorsize);
-	args[sizeof(args) - 1] = '\0';
-	free((void *)ops);
 
-	fd = -1;
-	switch (which_prog) {
-	case SWAPON:
-		error = run_cmd(&fd, "%s onetime %s %s", _PATH_GELI, args,
+		error = run_cmd(NULL, "%s onetime%s %s", _PATH_GELI, args,
 		    dname);
+
+		free(dname);
+		free(args);
+
 		if (error) {
-			/* eli device found.  Ignore it. */
-			close(fd);
+			/* error occured during creation */
 			if (!qflag)
-				warnx("%s: Device already in use "
-				    "or invalid parameters", name);
+				warnx("%s: Invalid parameters", name);
 			return (NULL);
 		}
-		break;
-	case SWAPOFF:
-		if (stat(name, &sb) == -1 && errno == ENOENT) {
-			if (!qflag)
-				warnx("%s: Device not found", name);
-			return (NULL);
-		}
-		break;
-	default:
-		return (NULL);
-		break;
-	}
-	if (fd != -1)
-		close(fd);
+	} while (0);
 
 	return (swap_on_off_sfile(name, doingall));
 }
 
 static const char *
-swap_on_off_md(char *name, char *mntops, int doingall)
+swap_on_off_md(const char *name, char *mntops, int doingall)
 {
 	FILE *sfd;
 	int fd, mdunit, error;
@@ -467,8 +481,7 @@ swap_on_off_md(char *name, char *mntops,
 		return (NULL);
 	}
 
-	switch (which_prog) {
-	case SWAPON:
+	if (which_prog == SWAPON) {
 		if (mdunit == -1) {
 			error = run_cmd(&fd, "%s -l -n -f %s",
 			    _PATH_MDCONFIG, vnodefile);
@@ -534,8 +547,7 @@ swap_on_off_md(char *name, char *mntops,
 				return (NULL);
 			}
 		}
-		break;
-	case SWAPOFF:
+	} else /* SWAPOFF */ {
 		if (mdunit == -1) {
 			error = run_cmd(&fd, "%s -l -n -f %s",
 			    _PATH_MDCONFIG, vnodefile);
@@ -590,17 +602,13 @@ swap_on_off_md(char *name, char *mntops,
 				return (NULL);
 			}
 		}
-		break;
-	default:
-		return (NULL);
 	}
 	snprintf(mdpath, sizeof(mdpath), "%s%s%d", _PATH_DEV,
 	    MD_NAME, mdunit);
 	mdpath[sizeof(mdpath) - 1] = '\0';
 	ret = swap_on_off_sfile(mdpath, doingall);
 
-	switch (which_prog) {
-	case SWAPOFF:
+	if (which_prog == SWAPOFF) {
 		if (ret != NULL) {
 			error = run_cmd(NULL, "%s -d -u %d",
 			    _PATH_MDCONFIG, mdunit);
@@ -608,9 +616,6 @@ swap_on_off_md(char *name, char *mntops,
 				warn("mdconfig (detach) detach failed: %s%s%d",
 				    _PATH_DEV, MD_NAME, mdunit);
 		}
-		break;
-	default:
-		break;
 	}
 err:
 	if (sfd != NULL)
@@ -695,21 +700,15 @@ run_cmd(int *ofd, const char *cmdline, .
 }
 
 static const char *
-swap_on_off_sfile(char *name, int doingall)
+swap_on_off_sfile(const char *name, int doingall)
 {
 	int error;
 
-	switch (which_prog) {
-	case SWAPON:
+	if (which_prog == SWAPON)
 		error = swapon(name);
-		break;
-	case SWAPOFF:
+	else /* SWAPOFF */
 		error = swapoff(name);
-		break;
-	default:
-		error = 0;
-		break;
-	}
+
 	if (error == -1) {
 		switch (errno) {
 		case EBUSY:

Copied: user/attilio/vmobj-readlock/sys/arm/conf/ARNDALE (from r252416, user/attilio/vmcontention/sys/arm/conf/ARNDALE)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/attilio/vmobj-readlock/sys/arm/conf/ARNDALE	Sun Jun 30 13:32:02 2013	(r252417, copy of r252416, user/attilio/vmcontention/sys/arm/conf/ARNDALE)
@@ -0,0 +1,135 @@
+# Kernel configuration for Arndale Board (Exynos5 Dual development platform).
+#
+# For more information on this file, please read the config(5) manual page,
+# and/or the handbook section on Kernel Configuration Files:
+#
+#    http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
+#
+# The handbook is also available locally in /usr/share/doc/handbook
+# if you've installed the doc distribution, otherwise always see the
+# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the
+# latest information.
+#
+# An exhaustive list of options and more detailed explanations of the
+# device lines is also present in the ../../conf/NOTES and NOTES files.
+# If you are in doubt as to the purpose or necessity of a line, check first
+# in NOTES.
+#
+# $FreeBSD$
+
+ident		ARNDALE
+
+include		"../samsung/exynos/std.exynos5"
+
+makeoptions	MODULES_OVERRIDE=""
+makeoptions	WITHOUT_MODULES="ahc"
+
+makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
+makeoptions	WERROR="-Werror"
+
+options		HZ=100 ##
+options		SCHED_4BSD		#4BSD scheduler
+options		INET			#InterNETworking
+options		INET6			#IPv6 communications protocols
+options		FFS			#Berkeley Fast Filesystem
+options		SOFTUPDATES
+options		UFS_ACL			#Support for access control lists
+options		UFS_DIRHASH		#Improve performance on big directories
+options		MSDOSFS			#MSDOS Filesystem
+options		CD9660			#ISO 9660 Filesystem
+options		PROCFS			#Process filesystem (requires PSEUDOFS)
+options		PSEUDOFS		#Pseudo-filesystem framework
+options		TMPFS
+options		COMPAT_43		#Compatible with BSD 4.3 [KEEP THIS!]
+options		SCSI_DELAY=5000		#Delay (in ms) before probing SCSI
+options		KTRACE
+options		SYSVSHM			#SYSV-style shared memory
+options		SYSVMSG			#SYSV-style message queues
+options		SYSVSEM			#SYSV-style semaphores
+options		_KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions
+options		KBD_INSTALL_CDEV
+options		PREEMPTION
+options		FREEBSD_BOOT_LOADER
+
+# Debugging
+makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
+options		BREAK_TO_DEBUGGER
+#options	VERBOSE_SYSINIT		#Enable verbose sysinit messages
+options		KDB
+options		DDB			#Enable the kernel debugger
+options		INVARIANTS		#Enable calls of extra sanity checking
+options		INVARIANT_SUPPORT	#Extra sanity checks of internal structures, required by INVARIANTS
+#options	WITNESS			#Enable checks to detect deadlocks and cycles
+#options	WITNESS_SKIPSPIN	#Don't run witness on spinlocks for speed
+options		DIAGNOSTIC
+
+# NFS support
+options		NFSCL			#Network Filesystem Client
+options		NFSLOCKD		#Network Lock Manager
+options		NFS_ROOT		#NFS usable as /, requires NFSCLIENT
+
+# Uncomment this for NFS root
+#options	NFS_ROOT		#NFS usable as /, requires NFSCL
+#options	BOOTP_NFSROOT
+#options	BOOTP_COMPAT
+#options	BOOTP
+#options	BOOTP_NFSV3
+#options	BOOTP_WIRED_TO=cpsw0
+
+device		mmc			# mmc/sd bus
+device		mmcsd			# mmc/sd flash cards
+device		sdhci			# generic sdhci
+
+options		ROOTDEVNAME=\"ufs:/dev/da0\"
+
+#options	SMP
+
+# Pseudo devices
+
+device		loop
+device		random
+device		pty
+device		md
+device		gpio
+
+# USB support
+device		usb
+options		USB_DEBUG
+#options	USB_REQ_DEBUG
+#options	USB_VERBOSE
+#device		musb
+device		ehci
+#device		ohci
+
+device		umass
+device		scbus			# SCSI bus (required for SCSI)
+device		da			# Direct Access (disks)
+device		pass
+
+# SATA
+#device		ata
+#device		atadisk
+#device		mvs
+
+# Serial ports
+device		uart
+
+# I2C (TWSI)
+#device		iic
+#device		iicbus
+
+# Ethernet
+device		ether
+device		mii
+device		smsc
+device		smscphy
+
+# USB ethernet support, requires miibus
+device		miibus
+device		axe			# ASIX Electronics USB Ethernet
+device		bpf			# Berkeley packet filter
+
+#FDT
+options		FDT
+options		FDT_DTB_STATIC
+makeoptions	FDT_DTS_FILE=exynos5250-arndale.dts

Modified: user/attilio/vmobj-readlock/sys/arm/versatile/versatile_pci.c
==============================================================================
--- user/attilio/vmobj-readlock/sys/arm/versatile/versatile_pci.c	Sun Jun 30 13:29:07 2013	(r252416)
+++ user/attilio/vmobj-readlock/sys/arm/versatile/versatile_pci.c	Sun Jun 30 13:32:02 2013	(r252417)
@@ -173,16 +173,17 @@ versatile_pci_attach(device_t dev)
 	/*
 	 * Setup memory windows
 	 */
-	versatile_pci_core_write_4(PCI_CORE_IMAP0, (PCI_IO_WINDOW >> 11));
-	versatile_pci_core_write_4(PCI_CORE_IMAP1, (PCI_NPREFETCH_WINDOW >> 11));
-	versatile_pci_core_write_4(PCI_CORE_IMAP2, (PCI_PREFETCH_WINDOW >> 11));
+	versatile_pci_core_write_4(PCI_CORE_IMAP0, (PCI_IO_WINDOW >> 28));
+	versatile_pci_core_write_4(PCI_CORE_IMAP1, (PCI_NPREFETCH_WINDOW >> 28));
+	versatile_pci_core_write_4(PCI_CORE_IMAP2, (PCI_PREFETCH_WINDOW >> 28));
 
 	/*
 	 * XXX: this is SDRAM offset >> 28
+	 * Unused as of QEMU 1.5
 	 */
-	versatile_pci_core_write_4(PCI_CORE_SMAP0, 0);
-	versatile_pci_core_write_4(PCI_CORE_SMAP1, 0);
-	versatile_pci_core_write_4(PCI_CORE_SMAP2, 0);
+	versatile_pci_core_write_4(PCI_CORE_SMAP0, (PCI_IO_WINDOW >> 28));
+	versatile_pci_core_write_4(PCI_CORE_SMAP1, (PCI_NPREFETCH_WINDOW >> 28));
+	versatile_pci_core_write_4(PCI_CORE_SMAP2, (PCI_NPREFETCH_WINDOW >> 28));
 
 	versatile_pci_sys_write_4(SYS_PCICTL, 1);
 
@@ -307,7 +308,7 @@ versatile_pci_alloc_resource(device_t bu
 	struct resource *rv;
 	struct rman *rm;
 
-	printf("Alloc resources %d, %08lx..%08lx, %ld\n", type, start, end, count);
+	dprintf("Alloc resources %d, %08lx..%08lx, %ld\n", type, start, end, count);
 
 	switch (type) {
 	case SYS_RES_IOPORT:
@@ -344,20 +345,23 @@ versatile_pci_activate_resource(device_t
     struct resource *r)
 {
 	vm_offset_t vaddr;
-	int res = (BUS_ACTIVATE_RESOURCE(device_get_parent(bus),
-	    child, type, rid, r));
+	int res;
 
-	if (!res) {
-		switch(type) {
-		case SYS_RES_MEMORY:
-		case SYS_RES_IOPORT:
-			vaddr = (vm_offset_t)pmap_mapdev(rman_get_start(r),
-					rman_get_size(r));
-			rman_set_bushandle(r, vaddr);
-			rman_set_bustag(r, versatile_bus_space_pcimem);
-			break;
-		}
+	switch(type) {
+	case SYS_RES_MEMORY:
+	case SYS_RES_IOPORT:
+		vaddr = (vm_offset_t)pmap_mapdev(rman_get_start(r),
+				rman_get_size(r));
+		rman_set_bushandle(r, vaddr);
+		rman_set_bustag(r, versatile_bus_space_pcimem);
+		res = rman_activate_resource(r);
+		break;
+	case SYS_RES_IRQ:
+		res = (BUS_ACTIVATE_RESOURCE(device_get_parent(bus),
+		    child, type, rid, r));
+		break;
 	}
+
 	return (res);
 }
 

Modified: user/attilio/vmobj-readlock/sys/arm/versatile/versatile_sic.c
==============================================================================
--- user/attilio/vmobj-readlock/sys/arm/versatile/versatile_sic.c	Sun Jun 30 13:29:07 2013	(r252416)
+++ user/attilio/vmobj-readlock/sys/arm/versatile/versatile_sic.c	Sun Jun 30 13:32:02 2013	(r252417)
@@ -110,7 +110,7 @@ versatile_sic_attach(device_t dev)
 	 * Let PCI and Ethernet interrupts pass through
 	 * IRQ25, IRQ27..IRQ31
 	 */
-	pass_irqs = (7 << 27) | (1 << 25);
+	pass_irqs = (0x1f << 27) | (1 << 25);
 	sic_write_4(sc, SIC_PICENSET, pass_irqs);
 
 	return (0);

Modified: user/attilio/vmobj-readlock/sys/cam/cam_ccb.h
==============================================================================
--- user/attilio/vmobj-readlock/sys/cam/cam_ccb.h	Sun Jun 30 13:29:07 2013	(r252416)
+++ user/attilio/vmobj-readlock/sys/cam/cam_ccb.h	Sun Jun 30 13:32:02 2013	(r252417)
@@ -1296,6 +1296,19 @@ cam_fill_smpio(struct ccb_smpio *smpio, 
 	smpio->smp_response_len = smp_response_len;
 }
 
+static __inline void
+cam_set_ccbstatus(union ccb *ccb, cam_status status)
+{
+	ccb->ccb_h.status &= ~CAM_STATUS_MASK;
+	ccb->ccb_h.status |= status;
+}
+
+static __inline cam_status
+cam_ccb_status(union ccb *ccb)
+{
+	return (ccb->ccb_h.status & CAM_STATUS_MASK);
+}
+
 void cam_calc_geometry(struct ccb_calc_geometry *ccg, int extended);
 
 __END_DECLS

Modified: user/attilio/vmobj-readlock/sys/cam/scsi/scsi_xpt.c
==============================================================================
--- user/attilio/vmobj-readlock/sys/cam/scsi/scsi_xpt.c	Sun Jun 30 13:29:07 2013	(r252416)
+++ user/attilio/vmobj-readlock/sys/cam/scsi/scsi_xpt.c	Sun Jun 30 13:32:02 2013	(r252417)
@@ -974,7 +974,7 @@ proberequestdefaultnegotiation(struct ca
 	cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
 	cts.type = CTS_TYPE_USER_SETTINGS;
 	xpt_action((union ccb *)&cts);
-	if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+	if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) {
 		return;
 	}
 	cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
@@ -996,7 +996,7 @@ proberequestbackoff(struct cam_periph *p
 	cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
 	cts.type = CTS_TYPE_CURRENT_SETTINGS;
 	xpt_action((union ccb *)&cts);
-	if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+	if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) {
 		if (bootverbose) {
 			xpt_print(periph->path,
 			    "failed to get current device settings\n");
@@ -1075,7 +1075,7 @@ proberequestbackoff(struct cam_periph *p
 		cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS;
 		cts.type = CTS_TYPE_CURRENT_SETTINGS;
 		xpt_action((union ccb *)&cts);
-		if ((cts.ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
+		if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) {
 			break;
 		}
 		CAM_DEBUG(periph->path, CAM_DEBUG_PROBE,
@@ -1105,7 +1105,7 @@ probedone(struct cam_periph *periph, uni
 	switch (softc->action) {
 	case PROBE_TUR:
 	{
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+		if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
 
 			if (cam_periph_error(done_ccb, 0,
 					     SF_NO_PRINT, NULL) == ERESTART) {
@@ -1128,7 +1128,7 @@ out:
 	case PROBE_INQUIRY:
 	case PROBE_FULL_INQUIRY:
 	{
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
+		if (cam_ccb_status(done_ccb) == CAM_REQ_CMP) {
 			struct scsi_inquiry_data *inq_buf;
 			u_int8_t periph_qual;
 
@@ -1246,7 +1246,7 @@ out:
 		nlun = scsi_4btoul(lp->length) / 8;
 		maxlun = (csio->dxfer_len / 8) - 1;
 
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+		if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
 			if (cam_periph_error(done_ccb, 0,
 			    done_ccb->ccb_h.target_lun > 0 ?
 			    SF_RETRY_UA|SF_QUIET_IR : SF_RETRY_UA,
@@ -1357,7 +1357,7 @@ out:
 
 		csio = &done_ccb->csio;
 		mode_hdr = (struct scsi_mode_header_6 *)csio->data_ptr;
-		if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) {
+		if (cam_ccb_status(done_ccb) == CAM_REQ_CMP) {
 			struct scsi_control_page *page;
 			u_int8_t *offset;
 
@@ -1492,7 +1492,7 @@ probe_device_check:
 			/*
 			 * Don't process the command as it was never sent
 			 */
-		} else if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP
+		} else if (cam_ccb_status(done_ccb) == CAM_REQ_CMP
 			&& (serial_buf->length > 0)) {
 
 			have_serialnum = 1;
@@ -1577,7 +1577,7 @@ probe_device_check:
 	}
 	case PROBE_TUR_FOR_NEGOTIATION:
 	case PROBE_DV_EXIT:
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+		if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
 			cam_periph_error(done_ccb, 0,
 			    SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY, NULL);
 		}
@@ -1628,7 +1628,7 @@ probe_device_check:
 		struct scsi_inquiry_data *nbuf;
 		struct ccb_scsiio *csio;
 
-		if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+		if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) {
 			cam_periph_error(done_ccb, 0,
 			    SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY, NULL);
 		}
@@ -1984,7 +1984,7 @@ scsi_scan_bus(struct cam_periph *periph,
 
 		oldpath = request_ccb->ccb_h.path;
 
-		status = request_ccb->ccb_h.status & CAM_STATUS_MASK;
+		status = cam_ccb_status(request_ccb);
 		/* Reuse the same CCB to query if a device was really found */
 		scan_info = (scsi_scan_bus_info *)request_ccb->ccb_h.ppriv_ptr0;
 		xpt_setup_ccb(&request_ccb->ccb_h, request_ccb->ccb_h.path,
@@ -2667,7 +2667,7 @@ scsi_set_transfer_settings(struct ccb_tr
 		cur_cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
 		cur_cts.type = cts->type;
 		xpt_action((union ccb *)&cur_cts);
-		if ((cur_cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) {
+		if (cam_ccb_status((union ccb *)&cur_cts) != CAM_REQ_CMP) {
 			return;
 		}
 		cur_scsi = &cur_cts.proto_specific.scsi;
@@ -2951,7 +2951,7 @@ scsi_announce_periph(struct cam_periph *
 	cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS;
 	cts.type = CTS_TYPE_CURRENT_SETTINGS;
 	xpt_action((union ccb*)&cts);
-	if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP)
+	if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP)
 		return;
 	/* Ask the SIM for its base transfer speed */
 	xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL);

Modified: user/attilio/vmobj-readlock/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c
==============================================================================
--- user/attilio/vmobj-readlock/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c	Sun Jun 30 13:29:07 2013	(r252416)
+++ user/attilio/vmobj-readlock/sys/cddl/compat/opensolaris/kern/opensolaris_cmn_err.c	Sun Jun 30 13:32:02 2013	(r252417)
@@ -75,7 +75,8 @@ cmn_err(int type, const char *fmt, ...)
 }
 
 int
-assfail(const char *a, const char *f, int l) {
+assfail(const char *a, const char *f, int l)
+{
 
 	panic("solaris assert: %s, file: %s, line: %d", a, f, l);
 
@@ -84,7 +85,8 @@ assfail(const char *a, const char *f, in
 
 void
 assfail3(const char *a, uintmax_t lv, const char *op, uintmax_t rv,
-    const char *f, int l) {
+    const char *f, int l)
+{
 
 	panic("solaris assert: %s (0x%jx %s 0x%jx), file: %s, line: %d",
 	    a, lv, op, rv, f, l);

Modified: user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
==============================================================================
--- user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c	Sun Jun 30 13:29:07 2013	(r252416)
+++ user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c	Sun Jun 30 13:32:02 2013	(r252417)
@@ -1258,8 +1258,6 @@ dsl_dir_rename_sync(void *arg, dmu_tx_t 
 	int error;
 	objset_t *mos = dp->dp_meta_objset;
 

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-user mailing list