summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2014-04-20 12:22:17 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2014-04-20 12:22:17 +0000
commite378fdcbcf6511a91d1ee9b68993c8231c381421 (patch)
treed01da4c51f598cf4c8da96f4156be72cddfbca41
parent11b227bf165adc1deeab7bc14c94ed0f3530deb2 (diff)
Cleanup a bit, switch on bcopy to memcpy and move a function a bit up
-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) \