diff options
author | Enji Cooper <ngie@FreeBSD.org> | 2017-03-30 04:56:27 +0000 |
---|---|---|
committer | Enji Cooper <ngie@FreeBSD.org> | 2017-03-30 04:56:27 +0000 |
commit | 653e7d639682be855c34415b1b7542d9388aafd6 (patch) | |
tree | b8a0d37377f1f1c0cafa1aaf20ee95d266860cf1 /usr.sbin | |
parent | 3aeacc55a5f01aaf03762fff5de1ff9c98c28a90 (diff) | |
download | src-test2-653e7d639682be855c34415b1b7542d9388aafd6.tar.gz src-test2-653e7d639682be855c34415b1b7542d9388aafd6.zip |
Notes
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ctladm/Makefile | 6 | ||||
-rw-r--r-- | usr.sbin/ctladm/ctladm.c | 8 | ||||
-rw-r--r-- | usr.sbin/ctld/Makefile | 6 | ||||
-rw-r--r-- | usr.sbin/ctld/kernel.c | 9 |
4 files changed, 29 insertions, 0 deletions
diff --git a/usr.sbin/ctladm/Makefile b/usr.sbin/ctladm/Makefile index c5e7e87f7a72..5b74668bf571 100644 --- a/usr.sbin/ctladm/Makefile +++ b/usr.sbin/ctladm/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +.include <src.opts.mk> + PROG= ctladm SRCS= ctladm.c util.c ctl_util.c ctl_scsi_all.c .PATH: ${SRCTOP}/sys/cam/ctl @@ -17,4 +19,8 @@ WARNS?= 3 LIBADD= cam sbuf bsdxml util MAN= ctladm.8 +.if ${MK_ISCSI} != "no" +CFLAGS+= -DWANT_ISCSI +.endif + .include <bsd.prog.mk> diff --git a/usr.sbin/ctladm/ctladm.c b/usr.sbin/ctladm/ctladm.c index cedfb12115ad..dffa3734ec4b 100644 --- a/usr.sbin/ctladm/ctladm.c +++ b/usr.sbin/ctladm/ctladm.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include <sys/callout.h> #include <sys/ioctl.h> #include <sys/linker.h> +#include <sys/module.h> #include <sys/queue.h> #include <sys/sbuf.h> #include <sys/stat.h> @@ -4152,6 +4153,13 @@ main(int argc, char **argv) retval = 1; goto bailout; } +#ifdef WANT_ISCSI + else { + if (modfind("cfiscsi") == -1 && + kldload("cfiscsi") == -1) + warn("couldn't load cfiscsi"); + } +#endif } else if ((command != CTLADM_CMD_HELP) && ((cmdargs & CTLADM_ARG_DEVICE) == 0)) { fprintf(stderr, "%s: you must specify a device with the " diff --git a/usr.sbin/ctld/Makefile b/usr.sbin/ctld/Makefile index 7c342568fe35..944b94d663c8 100644 --- a/usr.sbin/ctld/Makefile +++ b/usr.sbin/ctld/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +.include <src.opts.mk> + CFLAGS+=-I${SRCTOP}/contrib/libucl/include .PATH: ${SRCTOP}/contrib/libucl/include @@ -21,4 +23,8 @@ CLEANFILES= y.tab.c y.tab.h y.output WARNS?= 6 NO_WMISSING_VARIABLE_DECLARATIONS= +.if ${MK_ISCSI} != "no" +CFLAGS+= -DWANT_ISCSI +.endif + .include <bsd.prog.mk> diff --git a/usr.sbin/ctld/kernel.c b/usr.sbin/ctld/kernel.c index b646bc7795ab..b56364a1463e 100644 --- a/usr.sbin/ctld/kernel.c +++ b/usr.sbin/ctld/kernel.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include <sys/callout.h> #include <sys/ioctl.h> #include <sys/linker.h> +#include <sys/module.h> #include <sys/queue.h> #include <sys/sbuf.h> #include <sys/stat.h> @@ -90,6 +91,14 @@ kernel_init(void) } if (ctl_fd < 0) log_err(1, "failed to open %s", CTL_DEFAULT_DEV); +#ifdef WANT_ISCSI + else { + saved_errno = errno; + if (modfind("cfiscsi") == -1 && kldload("cfiscsi") == -1) + log_warn("couldn't load cfiscsi"); + errno = saved_errno; + } +#endif } /* |