aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ctl/ctl_frontend.c
diff options
context:
space:
mode:
authorMarcelo Araujo <araujo@FreeBSD.org>2018-05-10 03:50:20 +0000
committerMarcelo Araujo <araujo@FreeBSD.org>2018-05-10 03:50:20 +0000
commit8951f05525ee4e9a93cc568dccd154405aae7419 (patch)
tree503e8ca76afeb0231224fd5f2522663ca24ca5f6 /sys/cam/ctl/ctl_frontend.c
parent3429b518c9bfbce5a16d76949d75a843567ba2de (diff)
downloadsrc-8951f05525ee4e9a93cc568dccd154405aae7419.tar.gz
src-8951f05525ee4e9a93cc568dccd154405aae7419.zip
Rework CTL frontend & backend options to use nv(3), allow creating multiple
ioctl frontend ports. This revision introduces two changes to CTL: - Changes the way options are passed to CTL_LUN_REQ and CTL_PORT_REQ ioctls. Removes ctl_be_arg structure and associated logic and replaces it with nv(3)-based logic for passing in and out arguments. - Allows creating multiple ioctl frontend ports using either ctladm(8) or ctld(8). New frontend ports are represented by /dev/cam/ctl<pp>.<vp> nodes, eg /dev/cam/ctl5.3. Those device nodes respond only to CTL_IO ioctl. New command-line options for ctladm: # creates new ioctl frontend port with using free pp and vp=0 ctladm port -c # creates new ioctl frontend port with pp=10 and vp=0 ctladm port -c -O pp=10 # creates new ioctl frontend port with pp=11 and vp=12 ctladm port -c -O pp=11 -O vp=12 # removes port with number 4 (it's a "targ_port" number, not pp number) ctladm port -r -p 4 New syntax for ctl.conf: target ... { port ioctl/<pp> ... } target ... { port ioctl/<pp>/<vp> ... Note: Most of this work was made by jceel@, thank you. Submitted by: jceel Reworked by: myself Reviewed by: mav (earlier versions and recently during the rework) Obtained from: FreeNAS and TrueOS Relnotes: Yes Sponsored by: iXsystems Inc. Differential Revision: https://reviews.freebsd.org/D9299
Notes
Notes: svn path=/head/; revision=333446
Diffstat (limited to 'sys/cam/ctl/ctl_frontend.c')
-rw-r--r--sys/cam/ctl/ctl_frontend.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/cam/ctl/ctl_frontend.c b/sys/cam/ctl/ctl_frontend.c
index 9a206d0c1423..d481c1b8f003 100644
--- a/sys/cam/ctl/ctl_frontend.c
+++ b/sys/cam/ctl/ctl_frontend.c
@@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$");
#include <sys/endian.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
+#include <sys/nv.h>
+#include <sys/dnv.h>
#include <cam/scsi/scsi_all.h>
#include <cam/scsi/scsi_da.h>
@@ -200,8 +202,8 @@ error:
}
port->targ_port = port_num;
port->ctl_pool_ref = pool;
- if (port->options.stqh_first == NULL)
- STAILQ_INIT(&port->options);
+ if (port->options == NULL)
+ port->options = nvlist_create(0);
port->stats.item = port_num;
mtx_init(&port->port_lock, "CTL port", NULL, MTX_DEF);
@@ -240,7 +242,7 @@ ctl_port_deregister(struct ctl_port *port)
mtx_unlock(&softc->ctl_lock);
ctl_pool_free(pool);
- ctl_free_opts(&port->options);
+ nvlist_destroy(port->options);
ctl_lun_map_deinit(port);
free(port->port_devid, M_CTL);
@@ -333,7 +335,7 @@ ctl_port_online(struct ctl_port *port)
port->port_online(port->onoff_arg);
mtx_lock(&softc->ctl_lock);
if (softc->is_single == 0) {
- value = ctl_get_opt(&port->options, "ha_shared");
+ value = dnvlist_get_string(port->options, "ha_shared", NULL);
if (value != NULL && strcmp(value, "on") == 0)
port->status |= CTL_PORT_STATUS_HA_SHARED;
else