diff options
Diffstat (limited to 'usr.sbin/ctladm')
-rw-r--r-- | usr.sbin/ctladm/ctladm.8 | 5 | ||||
-rw-r--r-- | usr.sbin/ctladm/ctladm.c | 10 |
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)); |