Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jun 2013 16:39:53 +0000 (UTC)
From:      Attilio Rao <attilio@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r252347 - in user/attilio/vmobj-readlock: crypto/openssh etc/defaults etc/rc.d include sbin/nvmecontrol sbin/swapon share/examples/etc share/man/man5 sys/amd64/include sys/amd64/vmm sys...
Message-ID:  <201306281639.r5SGdrg0018490@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: attilio
Date: Fri Jun 28 16:39:52 2013
New Revision: 252347
URL: http://svnweb.freebsd.org/changeset/base/252347

Log:
  MFC

Added:
  user/attilio/vmobj-readlock/etc/rc.d/swap
     - copied unchanged from r252344, user/attilio/vmcontention/etc/rc.d/swap
  user/attilio/vmobj-readlock/etc/rc.d/swaplate
     - copied unchanged from r252344, user/attilio/vmcontention/etc/rc.d/swaplate
  user/attilio/vmobj-readlock/sbin/nvmecontrol/devlist.c
     - copied unchanged from r252344, user/attilio/vmcontention/sbin/nvmecontrol/devlist.c
  user/attilio/vmobj-readlock/sbin/nvmecontrol/firmware.c
     - copied unchanged from r252344, user/attilio/vmcontention/sbin/nvmecontrol/firmware.c
  user/attilio/vmobj-readlock/sbin/nvmecontrol/identify.c
     - copied unchanged from r252344, user/attilio/vmcontention/sbin/nvmecontrol/identify.c
  user/attilio/vmobj-readlock/sbin/nvmecontrol/logpage.c
     - copied unchanged from r252344, user/attilio/vmcontention/sbin/nvmecontrol/logpage.c
  user/attilio/vmobj-readlock/sbin/nvmecontrol/nvmecontrol.h
     - copied unchanged from r252344, user/attilio/vmcontention/sbin/nvmecontrol/nvmecontrol.h
  user/attilio/vmobj-readlock/sbin/nvmecontrol/perftest.c
     - copied unchanged from r252344, user/attilio/vmcontention/sbin/nvmecontrol/perftest.c
  user/attilio/vmobj-readlock/sbin/nvmecontrol/reset.c
     - copied unchanged from r252344, user/attilio/vmcontention/sbin/nvmecontrol/reset.c
  user/attilio/vmobj-readlock/sys/kern/subr_vmem.c
     - copied unchanged from r252344, user/attilio/vmcontention/sys/kern/subr_vmem.c
  user/attilio/vmobj-readlock/sys/sys/vmem.h
     - copied unchanged from r252344, user/attilio/vmcontention/sys/sys/vmem.h
Deleted:
  user/attilio/vmobj-readlock/etc/rc.d/encswap
  user/attilio/vmobj-readlock/etc/rc.d/swap1
Modified:
  user/attilio/vmobj-readlock/crypto/openssh/sshd_config
  user/attilio/vmobj-readlock/crypto/openssh/sshd_config.5
  user/attilio/vmobj-readlock/etc/defaults/rc.conf
  user/attilio/vmobj-readlock/etc/rc.d/Makefile
  user/attilio/vmobj-readlock/etc/rc.d/addswap
  user/attilio/vmobj-readlock/etc/rc.d/fsck
  user/attilio/vmobj-readlock/etc/rc.d/mdconfig
  user/attilio/vmobj-readlock/include/paths.h
  user/attilio/vmobj-readlock/sbin/nvmecontrol/Makefile
  user/attilio/vmobj-readlock/sbin/nvmecontrol/nvmecontrol.8
  user/attilio/vmobj-readlock/sbin/nvmecontrol/nvmecontrol.c
  user/attilio/vmobj-readlock/sbin/swapon/swapon.8
  user/attilio/vmobj-readlock/sbin/swapon/swapon.c
  user/attilio/vmobj-readlock/share/examples/etc/make.conf
  user/attilio/vmobj-readlock/share/man/man5/fstab.5
  user/attilio/vmobj-readlock/sys/amd64/include/acpica_machdep.h
  user/attilio/vmobj-readlock/sys/amd64/vmm/x86.c
  user/attilio/vmobj-readlock/sys/arm/arm/db_trace.c
  user/attilio/vmobj-readlock/sys/arm/arm/exception.S
  user/attilio/vmobj-readlock/sys/arm/include/asmacros.h
  user/attilio/vmobj-readlock/sys/arm/ti/am335x/am335x_lcd.c
  user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  user/attilio/vmobj-readlock/sys/cddl/dev/dtmalloc/dtmalloc.c
  user/attilio/vmobj-readlock/sys/conf/files
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/acpica_prep.sh
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/changes.txt   (contents, props changed)
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/common/dmrestag.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/common/dmtable.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/common/dmtbdump.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/common/dmtbinfo.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/compiler/aslcompile.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/compiler/aslmessages.h
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/compiler/asltree.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/compiler/aslutils.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/compiler/dtfield.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/compiler/dtio.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/compiler/dttable.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/compiler/dttemplate.h
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/compiler/dtutils.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/compiler/preprocess.h
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/compiler/prscan.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/debugger/dbcmds.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/debugger/dbdisply.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/debugger/dbinput.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/debugger/dbnames.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/disassembler/dmbuffer.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/disassembler/dmopcode.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/disassembler/dmresrcl.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/disassembler/dmresrcl2.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/events/evgpeinit.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/executer/exdump.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/namespace/nsdump.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/namespace/nsrepair2.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/namespace/nsxfname.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/resources/rsdump.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/resources/rsutils.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/tables/tbxfroot.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/utilities/uteval.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/utilities/utstring.c
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/include/acdisasm.h
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/include/acpixf.h
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/include/actables.h
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/include/actypes.h
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/include/acutils.h
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/include/platform/acfreebsd.h
  user/attilio/vmobj-readlock/sys/dev/acpi_support/atk0110.c
  user/attilio/vmobj-readlock/sys/dev/acpica/acpi_pcib_acpi.c
  user/attilio/vmobj-readlock/sys/dev/cxgbe/t4_main.c
  user/attilio/vmobj-readlock/sys/dev/isci/scil/sati_passthrough.c
  user/attilio/vmobj-readlock/sys/dev/nvme/nvme.h
  user/attilio/vmobj-readlock/sys/dev/nvme/nvme_ctrlr.c
  user/attilio/vmobj-readlock/sys/dev/nvme/nvme_private.h
  user/attilio/vmobj-readlock/sys/dev/nvme/nvme_qpair.c
  user/attilio/vmobj-readlock/sys/dev/pci/pci.c
  user/attilio/vmobj-readlock/sys/dev/pci/pci_private.h
  user/attilio/vmobj-readlock/sys/dev/re/if_re.c
  user/attilio/vmobj-readlock/sys/dev/usb/serial/u3g.c
  user/attilio/vmobj-readlock/sys/dev/usb/usbdevs
  user/attilio/vmobj-readlock/sys/dev/xen/blkfront/blkfront.c
  user/attilio/vmobj-readlock/sys/dev/xen/blkfront/block.h
  user/attilio/vmobj-readlock/sys/fs/ext2fs/ext2_extern.h
  user/attilio/vmobj-readlock/sys/geom/geom_io.c
  user/attilio/vmobj-readlock/sys/i386/include/acpica_machdep.h
  user/attilio/vmobj-readlock/sys/ia64/include/acpica_machdep.h
  user/attilio/vmobj-readlock/sys/kern/kern_clock.c
  user/attilio/vmobj-readlock/sys/kern/kern_descrip.c
  user/attilio/vmobj-readlock/sys/kern/subr_bus.c
  user/attilio/vmobj-readlock/sys/kern/vfs_bio.c
  user/attilio/vmobj-readlock/sys/sys/bus.h
  user/attilio/vmobj-readlock/sys/sys/malloc.h
  user/attilio/vmobj-readlock/sys/vm/vm.h
  user/attilio/vmobj-readlock/sys/vm/vm_init.c
  user/attilio/vmobj-readlock/sys/vm/vm_kern.c
  user/attilio/vmobj-readlock/sys/vm/vm_kern.h
  user/attilio/vmobj-readlock/sys/vm/vm_object.c
  user/attilio/vmobj-readlock/sys/vm/vm_pager.c
  user/attilio/vmobj-readlock/sys/vm/vm_pager.h
  user/attilio/vmobj-readlock/usr.sbin/acpi/acpidb/acpidb.c
  user/attilio/vmobj-readlock/usr.sbin/acpi/acpidump/acpi.c
  user/attilio/vmobj-readlock/usr.sbin/bhyve/atpic.c
  user/attilio/vmobj-readlock/usr.sbin/bhyve/pci_emul.c
Directory Properties:
  user/attilio/vmobj-readlock/   (props changed)
  user/attilio/vmobj-readlock/crypto/openssh/   (props changed)
  user/attilio/vmobj-readlock/sbin/   (props changed)
  user/attilio/vmobj-readlock/sys/   (props changed)
  user/attilio/vmobj-readlock/sys/amd64/vmm/   (props changed)
  user/attilio/vmobj-readlock/sys/cddl/contrib/opensolaris/   (props changed)
  user/attilio/vmobj-readlock/sys/conf/   (props changed)
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/   (props changed)
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/common/   (props changed)
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/compiler/   (props changed)
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/debugger/   (props changed)
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/disassembler/   (props changed)
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/events/   (props changed)
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/executer/   (props changed)
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/namespace/   (props changed)
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/resources/   (props changed)
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/tables/   (props changed)
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/components/utilities/   (props changed)
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/include/   (props changed)
  user/attilio/vmobj-readlock/sys/contrib/dev/acpica/os_specific/   (props changed)
  user/attilio/vmobj-readlock/usr.sbin/bhyve/   (props changed)

Modified: user/attilio/vmobj-readlock/crypto/openssh/sshd_config
==============================================================================
--- user/attilio/vmobj-readlock/crypto/openssh/sshd_config	Fri Jun 28 16:33:45 2013	(r252346)
+++ user/attilio/vmobj-readlock/crypto/openssh/sshd_config	Fri Jun 28 16:39:52 2013	(r252347)
@@ -105,7 +105,7 @@
 #PrintLastLog yes
 #TCPKeepAlive yes
 #UseLogin no
-#UsePrivilegeSeparation sandbox
+#UsePrivilegeSeparation yes
 #PermitUserEnvironment no
 #Compression delayed
 #ClientAliveInterval 0

Modified: user/attilio/vmobj-readlock/crypto/openssh/sshd_config.5
==============================================================================
--- user/attilio/vmobj-readlock/crypto/openssh/sshd_config.5	Fri Jun 28 16:33:45 2013	(r252346)
+++ user/attilio/vmobj-readlock/crypto/openssh/sshd_config.5	Fri Jun 28 16:39:52 2013	(r252347)
@@ -1169,7 +1169,7 @@ the privilege of the authenticated user.
 The goal of privilege separation is to prevent privilege
 escalation by containing any corruption within the unprivileged processes.
 The default is
-.Dq sandbox .
+.Dq yes .
 If
 .Cm UsePrivilegeSeparation
 is set to

Modified: user/attilio/vmobj-readlock/etc/defaults/rc.conf
==============================================================================
--- user/attilio/vmobj-readlock/etc/defaults/rc.conf	Fri Jun 28 16:33:45 2013	(r252346)
+++ user/attilio/vmobj-readlock/etc/defaults/rc.conf	Fri Jun 28 16:39:52 2013	(r252347)
@@ -32,8 +32,6 @@ early_late_divider="FILESYSTEMS"	# Scrip
 always_force_depends="NO"	# Set to check that indicated dependencies are
 				# running during boot (can increase boot time).
 
-swapfile="NO"		# Set to name of swapfile if aux swapfile desired.
-swapfile_mdunit="99"	# Swapfile md(4) unit number created by mdconfig(8).
 apm_enable="NO"		# Set to YES to enable APM BIOS functions (or NO).
 apmd_enable="NO"	# Run apmd to handle APM event from userland.
 apmd_flags=""		# Flags to apmd (if enabled).
@@ -85,9 +83,6 @@ geli_autodetach="YES"	# Automatically de
 #geli_da1_autodetach="NO"
 #geli_mirror_home_flags="-k /etc/geli/home.keys"
 
-geli_swap_flags="-e aes -l 256 -s 4096 -d"	# Options for GELI-encrypted
-						# swap partitions.
-
 root_rw_mount="YES"	# Set to NO to inhibit remounting root read-write.
 fsck_y_enable="NO"	# Set to YES to do fsck -y if the initial preen fails.
 fsck_y_flags=""		# Additional flags for fsck -y

Modified: user/attilio/vmobj-readlock/etc/rc.d/Makefile
==============================================================================
--- user/attilio/vmobj-readlock/etc/rc.d/Makefile	Fri Jun 28 16:33:45 2013	(r252346)
+++ user/attilio/vmobj-readlock/etc/rc.d/Makefile	Fri Jun 28 16:39:52 2013	(r252347)
@@ -37,7 +37,6 @@ FILES=	DAEMON \
 	dhclient \
 	dmesg \
 	dumpon \
-	encswap \
 	faith \
 	fsck \
 	ftp-proxy \
@@ -139,7 +138,8 @@ FILES=	DAEMON \
 	static_arp \
 	static_ndp \
 	stf \
-	swap1 \
+	swap \
+	swaplate \
 	syscons \
 	sysctl \
 	syslogd \

Modified: user/attilio/vmobj-readlock/etc/rc.d/addswap
==============================================================================
--- user/attilio/vmobj-readlock/etc/rc.d/addswap	Fri Jun 28 16:33:45 2013	(r252346)
+++ user/attilio/vmobj-readlock/etc/rc.d/addswap	Fri Jun 28 16:39:52 2013	(r252347)
@@ -13,57 +13,12 @@
 . /etc/rc.subr
 
 name="addswap"
-start_cmd="addswap_start"
-stop_cmd="addswap_stop"
+start_cmd=":"
+stop_cmd=":"
+rcvar=
 
-addswap_start()
-{
-	case ${swapfile} in
-	[Nn][Oo] | '')
-		;;
-	*)
-		if [ -w "${swapfile}" ]; then
-			check_startmsgs && echo "Adding ${swapfile} as additional swap"
-
-			if [ -n "${swapfile_mdunit}" ]; then
-				mdev="/dev/md${swapfile_mdunit#md}"
-				mdconfig -a -t vnode -f "${swapfile}" -u ${swapfile_mdunit}
-			else
-				mdev="/dev/`mdconfig -a -t vnode -f "${swapfile}"`"
-			fi
-
-			if [ $? -eq 0 ]; then
-				swapon ${mdev}
-			else
-				echo "error creating swapfile device"
-			fi
-		fi
-		;;
-	esac
-}
-
-addswap_stop()
-{
-	case ${swapfile} in
-	[Nn][Oo] | '')
-		;;
-	*)
-		if [ -n "${swapfile_mdunit}" ]; then
-			mdev="/dev/md${swapfile_mdunit#md}"
-		else
-			mdev="/dev/`mdconfig -lv | grep "${swapfile}" | cut -f1`"
-			swapfile_mdunit=${mdev#md}
-		fi
-		if [ -n "${swapfile_mdunit}" ]; then
-			swapctl -l | grep -q ${mdev}
-			if [ $? -eq 0 ]; then
-				echo "Dismounting swapfile ${swapfile}"
-				swapoff ${mdev} && mdconfig -d -u ${swapfile_mdunit}
-			fi
-		fi
-		;;
-	esac
-}
+set_rcvar_obsolete swapfile
+set_rcvar_obsolete geli_swap_flags
 
 load_rc_config $name
 run_rc_command "$1"

Modified: user/attilio/vmobj-readlock/etc/rc.d/fsck
==============================================================================
--- user/attilio/vmobj-readlock/etc/rc.d/fsck	Fri Jun 28 16:33:45 2013	(r252346)
+++ user/attilio/vmobj-readlock/etc/rc.d/fsck	Fri Jun 28 16:39:52 2013	(r252347)
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: fsck
-# REQUIRE: localswap
+# REQUIRE: swap
 # KEYWORD: nojail
 
 . /etc/rc.subr

Modified: user/attilio/vmobj-readlock/etc/rc.d/mdconfig
==============================================================================
--- user/attilio/vmobj-readlock/etc/rc.d/mdconfig	Fri Jun 28 16:33:45 2013	(r252346)
+++ user/attilio/vmobj-readlock/etc/rc.d/mdconfig	Fri Jun 28 16:39:52 2013	(r252347)
@@ -28,7 +28,7 @@
 #
 
 # PROVIDE: mdconfig
-# REQUIRE: localswap root
+# REQUIRE: swap root
 
 . /etc/rc.subr
 

Copied: user/attilio/vmobj-readlock/etc/rc.d/swap (from r252344, user/attilio/vmcontention/etc/rc.d/swap)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/attilio/vmobj-readlock/etc/rc.d/swap	Fri Jun 28 16:39:52 2013	(r252347, copy of r252344, user/attilio/vmcontention/etc/rc.d/swap)
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: swap
+# REQUIRE: disks
+# KEYWORD: nojail shutdown
+
+. /etc/rc.subr
+
+name="swap"
+start_cmd='/sbin/swapon -aq'
+stop_cmd=':'
+
+load_rc_config $name
+run_rc_command "$1"

Copied: user/attilio/vmobj-readlock/etc/rc.d/swaplate (from r252344, user/attilio/vmcontention/etc/rc.d/swaplate)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/attilio/vmobj-readlock/etc/rc.d/swaplate	Fri Jun 28 16:39:52 2013	(r252347, copy of r252344, user/attilio/vmcontention/etc/rc.d/swaplate)
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: swaplate
+# REQUIRE: mountlate
+# KEYWORD: nojail shutdown
+
+. /etc/rc.subr
+
+name="swaplate"
+start_cmd='/sbin/swapon -aLq'
+stop_cmd='/sbin/swapoff -aq'
+
+load_rc_config swap
+run_rc_command "$1"

Modified: user/attilio/vmobj-readlock/include/paths.h
==============================================================================
--- user/attilio/vmobj-readlock/include/paths.h	Fri Jun 28 16:33:45 2013	(r252346)
+++ user/attilio/vmobj-readlock/include/paths.h	Fri Jun 28 16:39:52 2013	(r252347)
@@ -57,6 +57,8 @@
 #define	_PATH_ETC	"/etc"
 #define	_PATH_FTPUSERS	"/etc/ftpusers"
 #define	_PATH_FWMEM	"/dev/fwmem"
+#define	_PATH_GBDE	"/sbin/gbde"
+#define	_PATH_GELI	"/sbin/geli"
 #define	_PATH_HALT	"/sbin/halt"
 #ifdef COMPAT_32BIT
 #define	_PATH_I18NMODULE	"/usr/lib32/i18n"

Modified: user/attilio/vmobj-readlock/sbin/nvmecontrol/Makefile
==============================================================================
--- user/attilio/vmobj-readlock/sbin/nvmecontrol/Makefile	Fri Jun 28 16:33:45 2013	(r252346)
+++ user/attilio/vmobj-readlock/sbin/nvmecontrol/Makefile	Fri Jun 28 16:39:52 2013	(r252347)
@@ -1,6 +1,8 @@
 # $FreeBSD$
 
 PROG=	nvmecontrol
+SRCS=	nvmecontrol.c devlist.c firmware.c identify.c logpage.c	\
+	perftest.c reset.c
 MAN=	nvmecontrol.8
 
 .include <bsd.prog.mk>

Copied: user/attilio/vmobj-readlock/sbin/nvmecontrol/devlist.c (from r252344, user/attilio/vmcontention/sbin/nvmecontrol/devlist.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/attilio/vmobj-readlock/sbin/nvmecontrol/devlist.c	Fri Jun 28 16:39:52 2013	(r252347, copy of r252344, user/attilio/vmcontention/sbin/nvmecontrol/devlist.c)
@@ -0,0 +1,115 @@
+/*-
+ * Copyright (C) 2012-2013 Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+#include "nvmecontrol.h"
+
+static void
+devlist_usage(void)
+{
+	fprintf(stderr, "usage:\n");
+	fprintf(stderr, DEVLIST_USAGE);
+	exit(EX_USAGE);
+}
+
+static inline uint32_t
+ns_get_sector_size(struct nvme_namespace_data *nsdata)
+{
+
+	return (1 << nsdata->lbaf[0].lbads);
+}
+
+void
+devlist(int argc, char *argv[])
+{
+	struct nvme_controller_data	cdata;
+	struct nvme_namespace_data	nsdata;
+	char				name[64];
+	uint32_t			i;
+	int				ch, ctrlr, exit_code, fd, found;
+
+	exit_code = EX_OK;
+
+	while ((ch = getopt(argc, argv, "")) != -1) {
+		switch ((char)ch) {
+		default:
+			devlist_usage();
+		}
+	}
+
+	ctrlr = -1;
+	found = 0;
+
+	while (1) {
+		ctrlr++;
+		sprintf(name, "%s%d", NVME_CTRLR_PREFIX, ctrlr);
+
+		exit_code = open_dev(name, &fd, 0, 0);
+
+		if (exit_code == EX_NOINPUT)
+			break;
+		else if (exit_code == EX_NOPERM) {
+			printf("Could not open /dev/%s, errno = %d (%s)\n",
+			    name, errno, strerror(errno));
+			continue;
+		}
+
+		found++;
+		read_controller_data(fd, &cdata);
+		printf("%6s: %s\n", name, cdata.mn);
+
+		for (i = 0; i < cdata.nn; i++) {
+			sprintf(name, "%s%d%s%d", NVME_CTRLR_PREFIX, ctrlr,
+			    NVME_NS_PREFIX, i+1);
+			read_namespace_data(fd, i+1, &nsdata);
+			printf("  %10s (%lldGB)\n",
+				name,
+				nsdata.nsze *
+				(long long)ns_get_sector_size(&nsdata) /
+				1024 / 1024 / 1024);
+		}
+
+		close(fd);
+	}
+
+	if (found == 0)
+		printf("No NVMe controllers found.\n");
+
+	exit(EX_OK);
+}

Copied: user/attilio/vmobj-readlock/sbin/nvmecontrol/firmware.c (from r252344, user/attilio/vmcontention/sbin/nvmecontrol/firmware.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/attilio/vmobj-readlock/sbin/nvmecontrol/firmware.c	Fri Jun 28 16:39:52 2013	(r252347, copy of r252344, user/attilio/vmcontention/sbin/nvmecontrol/firmware.c)
@@ -0,0 +1,335 @@
+/*-
+ * Copyright (c) 2013 EMC Corp.
+ * All rights reserved.
+ *
+ * Copyright (C) 2012-2013 Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/ioccom.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+#include "nvmecontrol.h"
+
+static int
+slot_has_valid_firmware(int fd, int slot)
+{
+	struct nvme_firmware_page	fw;
+	int				has_fw = false;
+
+	read_logpage(fd, NVME_LOG_FIRMWARE_SLOT,
+	    NVME_GLOBAL_NAMESPACE_TAG, &fw, sizeof(fw));
+
+	if (fw.revision[slot-1] != 0LLU)
+		has_fw = true;
+
+	return (has_fw);
+}
+
+static void
+read_image_file(char *path, void **buf, ssize_t *size)
+{
+	struct stat	sb;
+	int		fd;
+
+	*size = 0;
+	*buf = NULL;
+
+	if ((fd = open(path, O_RDONLY)) < 0) {
+		fprintf(stderr, "Unable to open '%s'.\n", path);
+		exit(EX_IOERR);
+	}
+	if (fstat(fd, &sb) < 0) {
+		fprintf(stderr, "Unable to stat '%s'.\n", path);
+		close(fd);
+		exit(EX_IOERR);
+	}
+	if ((*buf = malloc(sb.st_size)) == NULL) {
+		fprintf(stderr, "Unable to malloc %zd bytes.\n",
+		    sb.st_size);
+		close(fd);
+		exit(EX_IOERR);
+	}
+	if ((*size = read(fd, *buf, sb.st_size)) < 0) {
+		fprintf(stderr, "Error reading '%s', errno=%d (%s)\n",
+		    path, errno, strerror(errno));
+		close(fd);
+		exit(EX_IOERR);
+	}
+	if (*size != sb.st_size) {
+		fprintf(stderr, "Error reading '%s', "
+		    "read %zd bytes, requested %zd bytes\n",
+		    path, *size, sb.st_size);
+		close(fd);
+		exit(EX_IOERR);
+	}
+}
+
+static void
+update_firmware(int fd, uint8_t *payload, uint32_t payload_size)
+{
+	struct nvme_pt_command	pt;
+	size_t			size;
+	void			*chunk;
+	uint32_t		off, resid;
+	int			exit_code = EX_OK;
+
+	off = 0;
+	resid = payload_size;
+
+	if ((chunk = malloc((size_t)NVME_MAX_XFER_SIZE)) == NULL) {
+		printf("Unable to malloc %d bytes.\n", NVME_MAX_XFER_SIZE);
+		exit(EX_IOERR);
+	}
+
+	while (resid > 0) {
+		size = (resid >= NVME_MAX_XFER_SIZE) ?
+		    NVME_MAX_XFER_SIZE : resid;
+		memcpy(chunk, payload + off, size);
+
+		memset(&pt, 0, sizeof(pt));
+		pt.cmd.opc = NVME_OPC_FIRMWARE_IMAGE_DOWNLOAD;
+		pt.cmd.cdw10 = (size / sizeof(uint32_t)) - 1;
+		pt.cmd.cdw11 = (off / sizeof(uint32_t));
+		pt.buf = chunk;
+		pt.len = size;
+		pt.is_read = 0;
+
+		if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) {
+			printf("Firmware image download request failed. "
+			    "errno=%d (%s)\n",
+			    errno, strerror(errno));
+			exit_code = EX_IOERR;
+			break;
+		}
+
+		if (nvme_completion_is_error(&pt.cpl)) {
+			printf("Passthrough command returned error.\n");
+			exit_code = EX_IOERR;
+			break;
+		}
+
+		resid -= size;
+		off += size;
+	}
+	
+	if (exit_code != EX_OK)
+		exit(exit_code);
+}
+
+static void
+activate_firmware(int fd, int slot, int activate_action)
+{
+	struct nvme_pt_command	pt;
+
+	memset(&pt, 0, sizeof(pt));
+	pt.cmd.opc = NVME_OPC_FIRMWARE_ACTIVATE;
+	pt.cmd.cdw10 = (activate_action << 3) | slot;
+	pt.is_read = 0;
+
+	if (ioctl(fd, NVME_PASSTHROUGH_CMD, &pt) < 0) {
+		printf("Firmware activate request failed. errno=%d (%s)\n",
+		    errno, strerror(errno));
+		exit(EX_IOERR);
+	}
+
+	if (nvme_completion_is_error(&pt.cpl)) {
+		printf("Passthrough command returned error.\n");
+		exit(EX_IOERR);
+	}
+}
+
+static void
+firmware_usage(void)
+{
+	fprintf(stderr, "usage:\n");
+	fprintf(stderr, FIRMWARE_USAGE);
+	exit(EX_USAGE);
+}
+
+void
+firmware(int argc, char *argv[])
+{
+	int				fd = -1, slot = 0;
+	int				a_flag, s_flag, f_flag;
+	char				ch, *p, *image = NULL;
+	char				*controller = NULL, prompt[64];
+	void				*buf = NULL;
+	ssize_t				size;
+	struct nvme_controller_data	cdata;
+
+	a_flag = s_flag = f_flag = false;
+
+	while ((ch = getopt(argc, argv, "af:s:")) != -1) {
+		switch (ch) {
+		case 'a':
+			a_flag = true;
+			break;
+		case 's':
+			slot = strtol(optarg, &p, 0);
+			if (p != NULL && *p != '\0') {
+				fprintf(stderr,
+				    "\"%s\" not valid slot.\n",
+				    optarg);
+				firmware_usage();
+			} else if (slot == 0) {
+				fprintf(stderr,
+				    "0 is not a valid slot number. "
+				    "Slot numbers start at 1.\n");
+				firmware_usage();
+			} else if (slot > 7) {
+				fprintf(stderr,
+				    "Slot number %s specified which is "
+				    "greater than max allowed slot number of "
+				    "7.\n", optarg);
+				firmware_usage();
+			}
+			s_flag = true;
+			break;
+		case 'f':
+			image = optarg;
+			f_flag = true;
+			break;
+		}
+	}
+
+	/* Check that a controller (and not a namespace) was specified. */
+	if (optind >= argc || strstr(argv[optind], NVME_NS_PREFIX) != NULL)
+		firmware_usage();
+
+	if (!f_flag && !a_flag) {
+		fprintf(stderr,
+		    "Neither a replace ([-f path_to_firmware]) nor "
+		    "activate ([-a]) firmware image action\n"
+		    "was specified.\n");
+		firmware_usage();
+	}
+
+	if (!f_flag && a_flag && slot == 0) {
+		fprintf(stderr,
+		    "Slot number to activate not specified.\n");
+		firmware_usage();
+	}
+
+	controller = argv[optind];
+	open_dev(controller, &fd, 1, 1);
+	read_controller_data(fd, &cdata);
+
+	if (cdata.oacs.firmware == 0) {
+		fprintf(stderr, 
+		    "Controller does not support firmware "
+		    "activate/download.\n");
+		exit(EX_IOERR);
+	}
+
+	if (f_flag && slot == 1 && cdata.frmw.slot1_ro) {
+		fprintf(stderr, "Slot %d is marked as read only.\n", slot);
+		exit(EX_IOERR);
+	}
+
+	if (slot > cdata.frmw.num_slots) {
+		fprintf(stderr,
+		    "Slot %d was specified but controller only "
+		    "supports %d firmware slots.\n",
+		    slot, cdata.frmw.num_slots);
+		exit(EX_IOERR);
+	}
+
+	if (!slot_has_valid_firmware(fd, slot)) {
+		fprintf(stderr,
+		    "Slot %d does not contain valid firmware.\n"
+		    "Try 'nvmecontrol logpage -p 3 %s' to get a list "
+		    "of available firmware images.\n",
+		    slot, controller);
+		exit(EX_IOERR);
+	}
+
+	if (f_flag && a_flag)
+		printf("You are about to download and activate "
+		       "firmware image (%s) to controller %s.\n"
+		       "This may damage your controller and/or "
+		       "overwrite an existing firmware image.\n",
+		       image, controller);
+	else if (a_flag)
+		printf("You are about to activate a new firmware "
+		       "image on controller %s.\n"
+		       "This may damage your controller.\n",
+		       controller);
+	else if (f_flag)
+		printf("You are about to download firmware image "
+		       "(%s) to controller %s.\n"
+		       "This may damage your controller and/or "
+		       "overwrite an existing firmware image.\n",
+		       image, controller);
+
+	printf("Are you sure you want to continue? (yes/no) ");
+	while (1) {
+		fgets(prompt, sizeof(prompt), stdin);
+		if (strncasecmp(prompt, "yes", 3) == 0)
+			break;
+		if (strncasecmp(prompt, "no", 2) == 0)
+			exit(EX_OK);
+		printf("Please answer \"yes\" or \"no\". ");
+	}
+
+	if (f_flag) {
+		read_image_file(image, &buf, &size);
+		update_firmware(fd, buf, size);
+		if (a_flag)
+			activate_firmware(fd, slot,
+			    NVME_AA_REPLACE_ACTIVATE);
+		else
+			activate_firmware(fd, slot,
+			    NVME_AA_REPLACE_NO_ACTIVATE);
+	} else {
+		activate_firmware(fd, slot, NVME_AA_ACTIVATE);
+	}
+
+	if (a_flag) {
+		printf("New firmware image activated and will take "
+		       "effect after next controller reset.\n"
+		       "Controller reset can be initiated via "
+		       "'nvmecontrol reset %s'\n",
+		       controller);
+	}
+
+	close(fd);
+	exit(EX_OK);
+}

Copied: user/attilio/vmobj-readlock/sbin/nvmecontrol/identify.c (from r252344, user/attilio/vmcontention/sbin/nvmecontrol/identify.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/attilio/vmobj-readlock/sbin/nvmecontrol/identify.c	Fri Jun 28 16:39:52 2013	(r252347, copy of r252344, user/attilio/vmcontention/sbin/nvmecontrol/identify.c)
@@ -0,0 +1,291 @@
+/*-
+ * Copyright (C) 2012-2013 Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+#include "nvmecontrol.h"
+
+static void
+print_controller(struct nvme_controller_data *cdata)
+{
+	printf("Controller Capabilities/Features\n");
+	printf("================================\n");
+	printf("Vendor ID:                  %04x\n", cdata->vid);
+	printf("Subsystem Vendor ID:        %04x\n", cdata->ssvid);
+	printf("Serial Number:              %s\n", cdata->sn);
+	printf("Model Number:               %s\n", cdata->mn);
+	printf("Firmware Version:           %s\n", cdata->fr);
+	printf("Recommended Arb Burst:      %d\n", cdata->rab);
+	printf("IEEE OUI Identifier:        %02x %02x %02x\n",
+		cdata->ieee[0], cdata->ieee[1], cdata->ieee[2]);
+	printf("Multi-Interface Cap:        %02x\n", cdata->mic);
+	/* TODO: Use CAP.MPSMIN to determine true memory page size. */
+	printf("Max Data Transfer Size:     ");
+	if (cdata->mdts == 0)
+		printf("Unlimited\n");
+	else
+		printf("%d\n", PAGE_SIZE * (1 << cdata->mdts));
+	printf("\n");
+
+	printf("Admin Command Set Attributes\n");
+	printf("============================\n");
+	printf("Security Send/Receive:       %s\n",
+		cdata->oacs.security ? "Supported" : "Not Supported");
+	printf("Format NVM:                  %s\n",
+		cdata->oacs.format ? "Supported" : "Not Supported");
+	printf("Firmware Activate/Download:  %s\n",
+		cdata->oacs.firmware ? "Supported" : "Not Supported");
+	printf("Abort Command Limit:         %d\n", cdata->acl+1);
+	printf("Async Event Request Limit:   %d\n", cdata->aerl+1);
+	printf("Number of Firmware Slots:    ");
+	if (cdata->oacs.firmware != 0)
+		printf("%d\n", cdata->frmw.num_slots);
+	else
+		printf("N/A\n");
+	printf("Firmware Slot 1 Read-Only:   ");
+	if (cdata->oacs.firmware != 0)
+		printf("%s\n", cdata->frmw.slot1_ro ? "Yes" : "No");
+	else
+		printf("N/A\n");
+	printf("Per-Namespace SMART Log:     %s\n",
+		cdata->lpa.ns_smart ? "Yes" : "No");
+	printf("Error Log Page Entries:      %d\n", cdata->elpe+1);
+	printf("Number of Power States:      %d\n", cdata->npss+1);
+	printf("\n");
+
+	printf("NVM Command Set Attributes\n");
+	printf("==========================\n");
+	printf("Submission Queue Entry Size\n");
+	printf("  Max:                       %d\n", 1 << cdata->sqes.max);
+	printf("  Min:                       %d\n", 1 << cdata->sqes.min);
+	printf("Completion Queue Entry Size\n");
+	printf("  Max:                       %d\n", 1 << cdata->cqes.max);
+	printf("  Min:                       %d\n", 1 << cdata->cqes.min);
+	printf("Number of Namespaces:        %d\n", cdata->nn);
+	printf("Compare Command:             %s\n",
+		cdata->oncs.compare ? "Supported" : "Not Supported");
+	printf("Write Uncorrectable Command: %s\n",
+		cdata->oncs.write_unc ? "Supported" : "Not Supported");
+	printf("Dataset Management Command:  %s\n",
+		cdata->oncs.dsm ? "Supported" : "Not Supported");
+	printf("Volatile Write Cache:        %s\n",
+		cdata->vwc.present ? "Present" : "Not Present");
+}
+
+static void
+print_namespace(struct nvme_namespace_data *nsdata)
+{
+	uint32_t	i;
+
+	printf("Size (in LBAs):              %lld (%lldM)\n",
+		(long long)nsdata->nsze,
+		(long long)nsdata->nsze / 1024 / 1024);
+	printf("Capacity (in LBAs):          %lld (%lldM)\n",
+		(long long)nsdata->ncap,
+		(long long)nsdata->ncap / 1024 / 1024);
+	printf("Utilization (in LBAs):       %lld (%lldM)\n",
+		(long long)nsdata->nuse,
+		(long long)nsdata->nuse / 1024 / 1024);
+	printf("Thin Provisioning:           %s\n",
+		nsdata->nsfeat.thin_prov ? "Supported" : "Not Supported");
+	printf("Number of LBA Formats:       %d\n", nsdata->nlbaf+1);
+	printf("Current LBA Format:          LBA Format #%d\n",
+		nsdata->flbas.format);
+	for (i = 0; i <= nsdata->nlbaf; i++) {
+		printf("LBA Format #%d:\n", i);
+		printf("  LBA Data Size:             %d\n",
+			1 << nsdata->lbaf[i].lbads);
+	}
+}
+
+static void
+identify_usage(void)
+{
+	fprintf(stderr, "usage:\n");
+	fprintf(stderr, IDENTIFY_USAGE);
+	exit(EX_USAGE);
+}
+
+static void
+identify_ctrlr(int argc, char *argv[])
+{
+	struct nvme_controller_data	cdata;
+	int				ch, fd, hexflag = 0, hexlength;
+	int				verboseflag = 0;
+
+	while ((ch = getopt(argc, argv, "vx")) != -1) {
+		switch ((char)ch) {
+		case 'v':
+			verboseflag = 1;
+			break;
+		case 'x':
+			hexflag = 1;
+			break;
+		default:
+			identify_usage();
+		}
+	}
+
+	/* Check that a controller was specified. */
+	if (optind >= argc)
+		identify_usage();
+
+	open_dev(argv[optind], &fd, 1, 1);
+	read_controller_data(fd, &cdata);
+	close(fd);
+
+	if (hexflag == 1) {
+		if (verboseflag == 1)
+			hexlength = sizeof(struct nvme_controller_data);
+		else
+			hexlength = offsetof(struct nvme_controller_data,
+			    reserved5);
+		print_hex(&cdata, hexlength);
+		exit(EX_OK);
+	}
+
+	if (verboseflag == 1) {
+		printf("-v not currently supported without -x.\n");
+		identify_usage();
+	}
+
+	print_controller(&cdata);
+	exit(EX_OK);
+}
+
+static void
+identify_ns(int argc, char *argv[])
+{
+	struct nvme_namespace_data	nsdata;
+	char				path[64];
+	char				*nsloc;
+	int				ch, fd, hexflag = 0, hexlength, nsid;
+	int				verboseflag = 0;
+
+	while ((ch = getopt(argc, argv, "vx")) != -1) {
+		switch ((char)ch) {
+		case 'v':
+			verboseflag = 1;
+			break;
+		case 'x':
+			hexflag = 1;
+			break;
+		default:
+			identify_usage();
+		}
+	}
+
+	/* Check that a namespace was specified. */
+	if (optind >= argc)
+		identify_usage();
+
+	/*
+	 * Check if the specified device node exists before continuing.
+	 *  This is a cleaner check for cases where the correct controller
+	 *  is specified, but an invalid namespace on that controller.
+	 */
+	open_dev(argv[optind], &fd, 1, 1);
+	close(fd);
+
+	/*
+	 * Pull the namespace id from the string. +2 skips past the "ns" part
+	 *  of the string.  Don't search past 10 characters into the string,
+	 *  otherwise we know it is malformed.
+	 */
+	nsloc = strnstr(argv[optind], NVME_NS_PREFIX, 10);
+	if (nsloc != NULL)
+		nsid = strtol(nsloc + 2, NULL, 10);
+	if (nsloc == NULL || (nsid == 0 && errno != 0)) {
+		printf("Invalid namespace ID %s.\n", argv[optind]);
+		exit(EX_IOERR);
+	}
+
+	/*
+	 * We send IDENTIFY commands to the controller, not the namespace,
+	 *  since it is an admin cmd.  So the path should only include the
+	 *  nvmeX part of the nvmeXnsY string.
+	 */
+	snprintf(path, nsloc - argv[optind] + 1, "%s", argv[optind]);
+	open_dev(path, &fd, 1, 1);
+	read_namespace_data(fd, nsid, &nsdata);
+	close(fd);
+
+	if (hexflag == 1) {
+		if (verboseflag == 1)
+			hexlength = sizeof(struct nvme_namespace_data);
+		else
+			hexlength = offsetof(struct nvme_namespace_data,
+			    reserved6);
+		print_hex(&nsdata, hexlength);
+		exit(EX_OK);
+	}
+
+	if (verboseflag == 1) {
+		printf("-v not currently supported without -x.\n");
+		identify_usage();
+	}
+
+	print_namespace(&nsdata);
+	exit(EX_OK);
+}
+
+void
+identify(int argc, char *argv[])
+{
+	char	*target;
+
+	if (argc < 2)
+		identify_usage();
+
+	while (getopt(argc, argv, "vx") != -1) ;
+
+	target = argv[optind];
+
+	optreset = 1;
+	optind = 1;
+
+	/*
+	 * If device node contains "ns", we consider it a namespace,
+	 *  otherwise, consider it a controller.
+	 */
+	if (strstr(target, NVME_NS_PREFIX) == NULL)
+		identify_ctrlr(argc, argv);
+	else
+		identify_ns(argc, argv);
+}

Copied: user/attilio/vmobj-readlock/sbin/nvmecontrol/logpage.c (from r252344, user/attilio/vmcontention/sbin/nvmecontrol/logpage.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/attilio/vmobj-readlock/sbin/nvmecontrol/logpage.c	Fri Jun 28 16:39:52 2013	(r252347, copy of r252344, user/attilio/vmcontention/sbin/nvmecontrol/logpage.c)
@@ -0,0 +1,388 @@
+/*-
+ * Copyright (c) 2013 EMC Corp.
+ * All rights reserved.
+ *
+ * Copyright (C) 2012-2013 Intel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/ioccom.h>
+

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



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