mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Make iscsictl(8) automatically try to load the iscsi module. While here,
improve module loading in iscsid(8) and ctld(8). Approved by: re (delphij)
This commit is contained in:
parent
79ce8a649b
commit
c76e8a9aa0
3 changed files with 13 additions and 3 deletions
|
|
@ -30,6 +30,8 @@
|
|||
*/
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/linker.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
|
|
@ -512,7 +514,7 @@ main(int argc, char **argv)
|
|||
const char *conf_path = DEFAULT_CONFIG_PATH;
|
||||
char *nickname = NULL, *discovery_host = NULL, *host = NULL,
|
||||
*target = NULL, *user = NULL, *secret = NULL;
|
||||
int ch, error, iscsi_fd;
|
||||
int ch, error, iscsi_fd, retval, saved_errno;
|
||||
int failed = 0;
|
||||
struct conf *conf;
|
||||
struct target *targ;
|
||||
|
|
@ -672,6 +674,14 @@ main(int argc, char **argv)
|
|||
}
|
||||
|
||||
iscsi_fd = open(ISCSI_PATH, O_RDWR);
|
||||
if (iscsi_fd < 0 && errno == ENOENT) {
|
||||
saved_errno = errno;
|
||||
retval = kldload("iscsi");
|
||||
if (retval != -1)
|
||||
iscsi_fd = open(ISCSI_PATH, O_RDWR);
|
||||
else
|
||||
errno = saved_errno;
|
||||
}
|
||||
if (iscsi_fd < 0)
|
||||
err(1, "failed to open %s", ISCSI_PATH);
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ kernel_init(void)
|
|||
int retval, saved_errno;
|
||||
|
||||
ctl_fd = open(CTL_DEFAULT_DEV, O_RDWR);
|
||||
if (ctl_fd < 0) {
|
||||
if (ctl_fd < 0 && errno == ENOENT) {
|
||||
saved_errno = errno;
|
||||
retval = kldload("ctl");
|
||||
if (retval != -1)
|
||||
|
|
|
|||
|
|
@ -509,7 +509,7 @@ main(int argc, char **argv)
|
|||
}
|
||||
|
||||
iscsi_fd = open(ISCSI_PATH, O_RDWR);
|
||||
if (iscsi_fd < 0) {
|
||||
if (iscsi_fd < 0 && errno == ENOENT) {
|
||||
saved_errno = errno;
|
||||
retval = kldload("iscsi");
|
||||
if (retval != -1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue