summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ctladm
diff options
context:
space:
mode:
authorsjg <sjg@FreeBSD.org>2013-04-12 20:48:55 +0000
committersjg <sjg@FreeBSD.org>2013-04-12 20:48:55 +0000
commit97d8b9495668afa398ab17c8c5f7e223b5fd2e89 (patch)
tree54038c9ac32a45f8741dcc23fb9a8ffc0e15ff89 /usr.sbin/ctladm
parent5ee3bfdb338e7c80af29a67f4425c4be24c7b866 (diff)
parent086d73aef6d0ab7d21daa2076fdc8d25961f9b05 (diff)
downloadFreeBSD-src-97d8b9495668afa398ab17c8c5f7e223b5fd2e89.zip
FreeBSD-src-97d8b9495668afa398ab17c8c5f7e223b5fd2e89.tar.gz
sync from head
Diffstat (limited to 'usr.sbin/ctladm')
-rw-r--r--usr.sbin/ctladm/ctladm.85
-rw-r--r--usr.sbin/ctladm/ctladm.c10
2 files changed, 13 insertions, 2 deletions
diff --git a/usr.sbin/ctladm/ctladm.8 b/usr.sbin/ctladm/ctladm.8
index 2e73aeb..68e79ff 100644
--- a/usr.sbin/ctladm/ctladm.8
+++ b/usr.sbin/ctladm/ctladm.8
@@ -34,7 +34,7 @@
.\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $
.\" $FreeBSD$
.\"
-.Dd March 6, 2012
+.Dd April 2, 2013
.Dt CTLADM 8
.Os
.Sh NAME
@@ -487,7 +487,7 @@ cache for the entire LUN.
.It Fl r
Specify relative addressing for the starting LBA. CTL does not support
relative addressing, since it only works for linked commands, and CTL
-doesn't support linked commands.
+does not support linked commands.
.It Fl i
Tell the target to return status immediately after issuing the SYHCHRONIZE CACHE
command rather than waiting for the cache to finish syncing. CTL does not
@@ -975,6 +975,7 @@ This will result in a sense key of NOT READY (0x02), and an ASC/ASCQ of
.Xr cam 3 ,
.Xr cam_cdbparse 3 ,
.Xr cam 4 ,
+.Xr ctl 4 ,
.Xr xpt 4 ,
.Xr camcontrol 8
.Sh HISTORY
diff --git a/usr.sbin/ctladm/ctladm.c b/usr.sbin/ctladm/ctladm.c
index 2a743da..bfbedc7 100644
--- a/usr.sbin/ctladm/ctladm.c
+++ b/usr.sbin/ctladm/ctladm.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
+#include <sys/linker.h>
#include <sys/queue.h>
#include <sys/callout.h>
#include <sys/sbuf.h>
@@ -3814,6 +3815,7 @@ main(int argc, char **argv)
int retval, fd;
int retries;
int initid;
+ int saved_errno;
retval = 0;
cmdargs = CTLADM_ARG_NONE;
@@ -3963,6 +3965,14 @@ main(int argc, char **argv)
if ((cmdargs & CTLADM_ARG_DEVICE)
&& (command != CTLADM_CMD_HELP)) {
fd = open(device, O_RDWR);
+ if (fd == -1 && errno == ENOENT) {
+ saved_errno = errno;
+ retval = kldload("ctl");
+ if (retval != -1)
+ fd = open(device, O_RDWR);
+ else
+ errno = saved_errno;
+ }
if (fd == -1) {
fprintf(stderr, "%s: error opening %s: %s\n",
argv[0], device, strerror(errno));
OpenPOWER on IntegriCloud