summaryrefslogtreecommitdiffstats
path: root/usr.sbin/iscsid
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2014-04-20 12:22:16 +0000
committerclaudio <claudio@openbsd.org>2014-04-20 12:22:16 +0000
commit2e849a08102c012d4460cfd109741d19ebf0943f (patch)
tree45563c15d13a5b1dc4ac564294e4ab9f5a65c831 /usr.sbin/iscsid
parentWhen switching rdomains the sadl needs to be removed and re-added from the (diff)
downloadwireguard-openbsd-2e849a08102c012d4460cfd109741d19ebf0943f.tar.xz
wireguard-openbsd-2e849a08102c012d4460cfd109741d19ebf0943f.zip
Cleanup a bit, switch on bcopy to memcpy and move a function a bit up
Diffstat (limited to 'usr.sbin/iscsid')
-rw-r--r--usr.sbin/iscsid/iscsid.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c
index a73bd85846c..d2dc36a9871 100644
--- a/usr.sbin/iscsid/iscsid.c
+++ b/usr.sbin/iscsid/iscsid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iscsid.c,v 1.10 2014/04/07 19:55:46 claudio Exp $ */
+/* $OpenBSD: iscsid.c,v 1.11 2014/04/20 12:22:16 claudio Exp $ */
/*
* Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org>
@@ -143,14 +143,28 @@ main(int argc, char *argv[])
event_dispatch();
- /* CLEANUP XXX */
+ /* do some cleanup on the way out */
control_cleanup(ctrlsock);
initiator_cleanup(initiator);
log_info("exiting.");
return 0;
}
-/* ARGSUSED */
+void
+shutdown_cb(int fd, short event, void *arg)
+{
+ struct timeval tv;
+
+ if (exit_rounds++ >= ISCSI_EXIT_WAIT || initiator_isdown(initiator))
+ event_loopexit(NULL);
+
+ timerclear(&tv);
+ tv.tv_sec = 1;
+
+ if (evtimer_add(&exit_ev, &tv) == -1)
+ fatal("shutdown_cb");
+}
+
void
main_sig_handler(int sig, short event, void *arg)
{
@@ -204,7 +218,7 @@ iscsid_ctrl_dispatch(void *ch, struct pdu *pdu)
break;
}
ic = pdu_getbuf(pdu, NULL, 1);
- bcopy(ic, &initiator->config, sizeof(initiator->config));
+ memcpy(&initiator->config, ic, sizeof(initiator->config));
control_compose(ch, CTRL_SUCCESS, NULL, 0);
break;
case CTRL_SESSION_CONFIG:
@@ -261,21 +275,6 @@ done:
pdu_free(pdu);
}
-void
-shutdown_cb(int fd, short event, void *arg)
-{
- struct timeval tv;
-
- if (exit_rounds++ >= ISCSI_EXIT_WAIT || initiator_isdown(initiator))
- event_loopexit(NULL);
-
- timerclear(&tv);
- tv.tv_sec = 1;
-
- if (evtimer_add(&exit_ev, &tv) == -1)
- fatal("shutdown_cb");
-}
-
#define MERGE_MIN(r, a, b, v) \
res->v = (mine->v < his->v ? mine->v : his->v)
#define MERGE_MAX(r, a, b, v) \