summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2011-04-27 19:02:07 +0000
committerclaudio <claudio@openbsd.org>2011-04-27 19:02:07 +0000
commit6727bd69f81cab1072af6c108f8277582aa95bff (patch)
tree1f56d8f57acff6110cd823b6253d2d2c45a1b44e
parentAdd log_verbose() like all the other log.c users. (diff)
downloadwireguard-openbsd-6727bd69f81cab1072af6c108f8277582aa95bff.tar.xz
wireguard-openbsd-6727bd69f81cab1072af6c108f8277582aa95bff.zip
Rename task_cleanup() to conn_task_cleanup() seems a better place for
this function since it does connections scheduling.
-rw-r--r--usr.sbin/iscsid/connection.c19
-rw-r--r--usr.sbin/iscsid/initiator.c8
-rw-r--r--usr.sbin/iscsid/iscsid.h10
-rw-r--r--usr.sbin/iscsid/task.c18
-rw-r--r--usr.sbin/iscsid/vscsi.c10
5 files changed, 34 insertions, 31 deletions
diff --git a/usr.sbin/iscsid/connection.c b/usr.sbin/iscsid/connection.c
index 71da0a30644..8701d43d610 100644
--- a/usr.sbin/iscsid/connection.c
+++ b/usr.sbin/iscsid/connection.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: connection.c,v 1.9 2011/04/27 07:25:26 claudio Exp $ */
+/* $OpenBSD: connection.c,v 1.10 2011/04/27 19:02:07 claudio Exp $ */
/*
* Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org>
@@ -236,12 +236,27 @@ conn_task_schedule(struct connection *c)
}
if (t->callback == NULL) {
/* no callback, immediate command expecting no answer */
- task_cleanup(t, c);
+ conn_task_cleanup(c, t);
free(t);
}
}
void
+conn_task_cleanup(struct connection *c, struct task *t)
+{
+/* XXX THIS FEELS WRONG FOR NOW */
+ pdu_free_queue(&t->sendq);
+ pdu_free_queue(&t->recvq);
+ /* XXX need some state to know if queued or not */
+ if (c) {
+ TAILQ_REMOVE(&c->tasks, t, entry);
+ if (!TAILQ_EMPTY(&c->tasks))
+ conn_task_schedule(c);
+ }
+}
+
+
+void
conn_pdu_write(struct connection *c, struct pdu *p)
{
struct iscsi_pdu *ipdu;
diff --git a/usr.sbin/iscsid/initiator.c b/usr.sbin/iscsid/initiator.c
index b2e7e93879d..7d7975e8e85 100644
--- a/usr.sbin/iscsid/initiator.c
+++ b/usr.sbin/iscsid/initiator.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: initiator.c,v 1.6 2011/04/27 07:25:26 claudio Exp $ */
+/* $OpenBSD: initiator.c,v 1.7 2011/04/27 19:02:07 claudio Exp $ */
/*
* Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org>
@@ -204,7 +204,7 @@ initiator_login_cb(struct connection *c, void *arg, struct pdu *p)
log_debug("Unknown crap");
}
- task_cleanup(&tl->task, c);
+ conn_task_cleanup(c, &tl->task);
conn_loggedin(c);
free(tl);
pdu_free(p);
@@ -276,7 +276,7 @@ initiator_discovery_cb(struct connection *c, void *arg, struct pdu *p)
fail:
conn_fail(c);
}
- task_cleanup(t, c);
+ conn_task_cleanup(c, t);
free(t);
pdu_free(p);
}
@@ -350,7 +350,7 @@ initiator_logout_cb(struct connection *c, void *arg, struct pdu *p)
break;
}
- task_cleanup(&tl->task, c);
+ conn_task_cleanup(c, &tl->task);
free(tl);
pdu_free(p);
}
diff --git a/usr.sbin/iscsid/iscsid.h b/usr.sbin/iscsid/iscsid.h
index 251ecb2b84f..4eaf77598bd 100644
--- a/usr.sbin/iscsid/iscsid.h
+++ b/usr.sbin/iscsid/iscsid.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iscsid.h,v 1.6 2011/04/27 07:25:26 claudio Exp $ */
+/* $OpenBSD: iscsid.h,v 1.7 2011/04/27 19:02:07 claudio Exp $ */
/*
* Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org>
@@ -48,8 +48,10 @@ struct ctrlmsghdr {
/* Control message types */
#define CTRL_SUCCESS 1
#define CTRL_FAILURE 2
-#define CTRL_INITIATOR_CONFIG 3
-#define CTRL_SESSION_CONFIG 4
+#define CTRL_INPROGRESS 3
+#define CTRL_INITIATOR_CONFIG 4
+#define CTRL_SESSION_CONFIG 5
+#define CTRL_LOG_VERBOSE 6
TAILQ_HEAD(session_head, session);
@@ -289,6 +291,7 @@ void conn_free(struct connection *);
int conn_task_ready(struct connection *);
void conn_task_issue(struct connection *, struct task *);
void conn_task_schedule(struct connection *);
+void conn_task_cleanup(struct connection *c, struct task *);
void conn_pdu_write(struct connection *, struct pdu *);
void conn_logout(struct connection *);
void conn_fail(struct connection *);
@@ -319,7 +322,6 @@ void task_init(struct task *, struct session *, int, void *,
void (*)(struct connection *, void *, struct pdu *),
void (*)(void *));
void taskq_cleanup(struct taskq *);
-void task_cleanup(struct task *, struct connection *c);
void task_pdu_add(struct task *, struct pdu *);
void task_pdu_cb(struct connection *, struct pdu *);
diff --git a/usr.sbin/iscsid/task.c b/usr.sbin/iscsid/task.c
index 4339736c52d..16c41001dc5 100644
--- a/usr.sbin/iscsid/task.c
+++ b/usr.sbin/iscsid/task.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: task.c,v 1.7 2011/04/27 07:25:26 claudio Exp $ */
+/* $OpenBSD: task.c,v 1.8 2011/04/27 19:02:07 claudio Exp $ */
/*
* Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org>
@@ -66,27 +66,13 @@ taskq_cleanup(struct taskq *tq)
if (t->failback)
t->failback(t->callarg);
else {
- task_cleanup(t, NULL);
+ conn_task_cleanup(NULL, t);
free(t);
}
}
}
void
-task_cleanup(struct task *t, struct connection *c)
-{
-/* XXX THIS FEELS WRONG FOR NOW */
- pdu_free_queue(&t->sendq);
- pdu_free_queue(&t->recvq);
- /* XXX need some state to know if queued or not */
- if (c) {
- TAILQ_REMOVE(&c->tasks, t, entry);
- if (!TAILQ_EMPTY(&c->tasks))
- conn_task_schedule(c);
- }
-}
-
-void
task_pdu_add(struct task *t, struct pdu *p)
{
struct iscsi_pdu *ipdu;
diff --git a/usr.sbin/iscsid/vscsi.c b/usr.sbin/iscsid/vscsi.c
index f01ccd94423..10787d995c6 100644
--- a/usr.sbin/iscsid/vscsi.c
+++ b/usr.sbin/iscsid/vscsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vscsi.c,v 1.5 2011/04/27 07:25:26 claudio Exp $ */
+/* $OpenBSD: vscsi.c,v 1.6 2011/04/27 19:02:07 claudio Exp $ */
/*
* Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org>
@@ -188,7 +188,7 @@ vscsi_callback(struct connection *c, void *arg, struct pdu *p)
sresp = pdu_getbuf(p, NULL, PDU_HEADER);
switch (ISCSI_PDU_OPCODE(sresp->opcode)) {
case ISCSI_OP_SCSI_RESPONSE:
- task_cleanup(&t->task, c);
+ conn_task_cleanup(c, &t->task);
tag = t->tag;
free(t);
@@ -230,13 +230,13 @@ send_status:
fatal("This does not work as it should");
vscsi_data(VSCSI_DATA_READ, t->tag, buf, size);
if (sresp->flags & 1) {
- task_cleanup(&t->task, c);
+ conn_task_cleanup(c, &t->task);
vscsi_status(t->tag, status, NULL, 0);
free(t);
}
break;
case ISCSI_OP_R2T:
- task_cleanup(&t->task, c);
+ conn_task_cleanup(c, &t->task);
r2t = (struct iscsi_pdu_rt2 *)sresp;
if (ntohl(r2t->buffer_offs))
fatalx("vscsi: r2t bummer failure");
@@ -258,7 +258,7 @@ vscsi_fail(void *arg)
struct scsi_task *t = arg;
int tag;
- task_cleanup(&t->task, NULL);
+ conn_task_cleanup(NULL, &t->task);
tag = t->tag;
free(t);
vscsi_status(tag, VSCSI_STAT_RESET, NULL, 0);