Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/iscsi/dist Add __printflike where needed. Fix v...
details: https://anonhg.NetBSD.org/src/rev/b68804846fa6
branches: trunk
changeset: 778071:b68804846fa6
user: joerg <joerg%NetBSD.org@localhost>
date: Thu Mar 15 04:06:54 2012 +0000
description:
Add __printflike where needed. Fix various format string issues.
diffstat:
external/bsd/iscsi/dist/include/iscsiutil.h | 11 ++-
external/bsd/iscsi/dist/src/lib/conffile.c | 4 +-
external/bsd/iscsi/dist/src/lib/disk.c | 6 +-
external/bsd/iscsi/dist/src/lib/initiator.c | 73 +++++++++++++--------------
external/bsd/iscsi/dist/src/lib/parameters.c | 2 +-
external/bsd/iscsi/dist/src/lib/protocol.c | 32 ++++++------
external/bsd/iscsi/dist/src/lib/util.c | 12 ++--
7 files changed, 71 insertions(+), 69 deletions(-)
diffs (truncated from 583 to 300 lines):
diff -r 18fde0988dba -r b68804846fa6 external/bsd/iscsi/dist/include/iscsiutil.h
--- a/external/bsd/iscsi/dist/include/iscsiutil.h Thu Mar 15 03:12:51 2012 +0000
+++ b/external/bsd/iscsi/dist/include/iscsiutil.h Thu Mar 15 04:06:54 2012 +0000
@@ -144,9 +144,12 @@
* Debugging Functions
*/
void set_debug(const char *);
-void iscsi_trace(const int, const char *, ...);
-void iscsi_warn(const char *, const int, const char *, ...);
-void iscsi_err(const char *, const int, const char *, ...);
+void iscsi_trace(const int, const char *, ...)
+ __printflike(2, 3);
+void iscsi_warn(const char *, const int, const char *, ...)
+ __printflike(3, 4);
+void iscsi_err(const char *, const int, const char *, ...)
+ __printflike(3, 4);
void iscsi_print_buffer(const char *, const size_t);
@@ -417,7 +420,7 @@
} iscsi_worker_t;
#define ISCSI_WORKER_EXIT(ME) do { \
- iscsi_trace(TRACE_ISCSI_DEBUG ,__FILE__, __LINE__, "exiting\n");\
+ iscsi_trace(TRACE_ISCSI_DEBUG, "%s:%d: %s", __FILE__, __LINE__, "exiting\n");\
(ME)->state |= ISCSI_WORKER_STATE_EXITING; \
return 0; \
/* NOTREACHED */ \
diff -r 18fde0988dba -r b68804846fa6 external/bsd/iscsi/dist/src/lib/conffile.c
--- a/external/bsd/iscsi/dist/src/lib/conffile.c Thu Mar 15 03:12:51 2012 +0000
+++ b/external/bsd/iscsi/dist/src/lib/conffile.c Thu Mar 15 04:06:54 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: conffile.c,v 1.2 2009/06/30 02:44:52 agc Exp $ */
+/* $NetBSD: conffile.c,v 1.3 2012/03/15 04:06:54 joerg Exp $ */
/*
* Copyright © 2006 Alistair Crooks. All rights reserved.
@@ -206,7 +206,7 @@
#endif
/* report an error and clear up */
-static int
+static __printflike(3, 4) int
report_error(FILE *fp, char *name, const char *fmt, ...)
{
va_list vp;
diff -r 18fde0988dba -r b68804846fa6 external/bsd/iscsi/dist/src/lib/disk.c
--- a/external/bsd/iscsi/dist/src/lib/disk.c Thu Mar 15 03:12:51 2012 +0000
+++ b/external/bsd/iscsi/dist/src/lib/disk.c Thu Mar 15 04:06:54 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: disk.c,v 1.6 2010/03/03 00:44:51 yamt Exp $ */
+/* $NetBSD: disk.c,v 1.7 2012/03/15 04:06:54 joerg Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -1397,7 +1397,7 @@
bytec, byte_offset);
if ((unsigned) bytec > MB(1)) {
- iscsi_err(__FILE__, __LINE__, "bytec > %u\n", bytec);
+ iscsi_err(__FILE__, __LINE__, "bytec > %" PRIu64 "m\n", bytec);
NO_CLEANUP;
return -1;
}
@@ -1480,7 +1480,7 @@
return -1;
}
if ((unsigned) bytec > MB(1)) {
- iscsi_err(__FILE__, __LINE__, "bytec > %u\n", bytec);
+ iscsi_err(__FILE__, __LINE__, "bytec > %" PRIu64 "\n", bytec);
NO_CLEANUP;
return -1;
}
diff -r 18fde0988dba -r b68804846fa6 external/bsd/iscsi/dist/src/lib/initiator.c
--- a/external/bsd/iscsi/dist/src/lib/initiator.c Thu Mar 15 03:12:51 2012 +0000
+++ b/external/bsd/iscsi/dist/src/lib/initiator.c Thu Mar 15 04:06:54 2012 +0000
@@ -201,7 +201,7 @@
int mutual_auth;
int one = 1;
- iscsi_trace(TRACE_ISCSI_DEBUG, "initializing session %llu\n", isid);
+ iscsi_trace(TRACE_ISCSI_DEBUG, "initializing session %" PRIu64 "\n", isid);
/* Get free session */
if ((*sess = iscsi_queue_remove(&g_session_q)) == NULL) {
@@ -294,7 +294,7 @@
/* Start Tx worker */
- iscsi_trace(TRACE_ISCSI_DEBUG, "starting Tx worker %llu\n", isid);
+ iscsi_trace(TRACE_ISCSI_DEBUG, "starting Tx worker %" PRIu64 "\n", isid);
if (iscsi_queue_init(&s->tx_queue, CONFIG_INITIATOR_QUEUE_DEPTH) == -1) {
iscsi_err(__FILE__, __LINE__, "iscsi_queue_init() failed\n");
return -1;
@@ -311,12 +311,12 @@
ISCSI_UNLOCK(&s->tx_worker.exit_mutex, return -1);
if (s->state == INITIATOR_SESSION_STATE_DESTROYING) {
iscsi_trace(TRACE_ISCSI_DEBUG,
- "session %llu is being destroyed, exiting\n", isid);
+ "session %" PRIu64 " is being destroyed, exiting\n", isid);
return -1;
}
if (s->tx_worker.state & ISCSI_WORKER_STATE_ERROR) {
iscsi_err(__FILE__, __LINE__,
- "Tx worker %llu started with an error\n", isid);
+ "Tx worker %" PRIu64 " started with an error\n", isid);
return -1;
}
iscsi_trace(TRACE_ISCSI_DEBUG, "got signal from Tx worker\n");
@@ -337,7 +337,7 @@
}
if (g_target[(int)sess->isid].has_session == 0) {
iscsi_err(__FILE__, __LINE__,
- "g_target[%llu].has_session==0??\n", sess->isid);
+ "g_target[%" PRIu64 "].has_session==0??\n", sess->isid);
return -1;
}
sess->state = INITIATOR_SESSION_STATE_DESTROYING;
@@ -354,15 +354,15 @@
if (sess->tx_worker.state & ISCSI_WORKER_STATE_STARTED) {
if (sess->tx_worker.state & ISCSI_WORKER_STATE_EXITING) {
iscsi_trace(TRACE_ISCSI_DEBUG,
- "Tx worker %llu already signalled for exit\n",
+ "Tx worker %" PRIu64 " already signalled for exit\n",
sess->isid);
} else {
iscsi_trace(TRACE_ISCSI_DEBUG,
- "signaling Tx worker %llu into exiting state\n",
+ "signaling Tx worker %" PRIu64 " into exiting state\n",
sess->isid);
ISCSI_LOCK(&sess->tx_worker.work_mutex, return -1);
iscsi_trace(TRACE_ISCSI_DEBUG,
- "signaling socket shutdown to Tx worker %llu\n", sess->isid);
+ "signaling socket shutdown to Tx worker %" PRIu64 "\n", sess->isid);
if (iscsi_sock_shutdown(sess->sock, 1) != 0) {
iscsi_err(__FILE__, __LINE__,
"iscsi_sock_shutdown() failed\n");
@@ -376,7 +376,7 @@
ISCSI_WORKER_STATE_EXITING) {
ISCSI_SPIN;
}
- iscsi_trace(TRACE_ISCSI_DEBUG, "Tx worker %llu has exited\n",
+ iscsi_trace(TRACE_ISCSI_DEBUG, "Tx worker %" PRIu64 " has exited\n",
sess->isid);
} else {
iscsi_trace(TRACE_ISCSI_DEBUG,
@@ -395,11 +395,11 @@
if (sess->rx_worker.state & ISCSI_WORKER_STATE_STARTED) {
if (sess->rx_worker.state & ISCSI_WORKER_STATE_EXITING) {
iscsi_trace(TRACE_ISCSI_DEBUG,
- "Rx worker %llu already signalled for exit\n",
+ "Rx worker %" PRIu64 " already signalled for exit\n",
sess->isid);
} else {
iscsi_trace(TRACE_ISCSI_DEBUG,
- "signaling Rx worker %llu into exiting state\n", sess->isid);
+ "signaling Rx worker %" PRIu64 " into exiting state\n", sess->isid);
if (iscsi_sock_shutdown(sess->sock, 0) != 0) {
iscsi_err(__FILE__, __LINE__,
"iscsi_sock_shutdown() failed\n");
@@ -411,7 +411,7 @@
ISCSI_WORKER_STATE_EXITING) {
ISCSI_SPIN;
}
- iscsi_trace(TRACE_ISCSI_DEBUG, "Rx worker %llu has exited\n",
+ iscsi_trace(TRACE_ISCSI_DEBUG, "Rx worker %" PRIu64 " has exited\n",
sess->isid);
} else {
iscsi_trace(TRACE_ISCSI_DEBUG,
@@ -561,7 +561,7 @@
/* Enqueue initiator command to Tx worker */
iscsi_trace(TRACE_ISCSI_DEBUG,
- "enqueing text command to tx worker %llu\n",
+ "enqueing text command to tx worker %" PRIu64 "\n",
sess->isid);
ISCSI_LOCK(&iwait.mutex, FFN_ERROR);
ISCSI_LOCK(&sess->tx_worker.work_mutex, FFN_ERROR);
@@ -1091,7 +1091,7 @@
initiator_cmd_t *ptr, *prev;
initiator_session_t *sess;
- iscsi_err(__FILE__, __LINE__, "aborting iSCSI cmd 0x%p (type %d, isid %llu)\n",
+ iscsi_err(__FILE__, __LINE__, "aborting iSCSI cmd 0x%p (type %d, isid %" PRIu64 ")\n",
cmd, cmd->type, cmd->isid);
hash_remove(&g_tag_hash, cmd->key);
@@ -1123,7 +1123,7 @@
return -1;
}
}
- iscsi_err(__FILE__, __LINE__, "successfully aborted iSCSI cmd 0x%p (type %d, isid %llu)\n",
+ iscsi_err(__FILE__, __LINE__, "successfully aborted iSCSI cmd 0x%p (type %d, isid %" PRIu64 ")\n",
cmd, cmd->type, cmd->isid);
return 0;
}
@@ -1171,7 +1171,7 @@
uint32_t tag;
if ((target = cmd->isid) >= CONFIG_INITIATOR_NUM_TARGETS) {
- iscsi_err(__FILE__, __LINE__, "target (%d) out of range [0..%d]\n", target, CONFIG_INITIATOR_NUM_TARGETS);
+ iscsi_err(__FILE__, __LINE__, "target (%" PRIu64 ") out of range [0..%d]\n", target, CONFIG_INITIATOR_NUM_TARGETS);
return -1;
}
sess = g_target[(int)target].sess;
@@ -1205,7 +1205,7 @@
ISCSI_LOCK(&sess->tx_worker.work_mutex, return -1);
ISCSI_SIGNAL(&sess->tx_worker.work_cond, return -1);
ISCSI_UNLOCK(&sess->tx_worker.work_mutex, return -1);
- iscsi_trace(TRACE_ISCSI_DEBUG, "initiator_cmd_t 0x%p given to tx_worker[%llu]\n", cmd, cmd->isid);
+ iscsi_trace(TRACE_ISCSI_DEBUG, "initiator_cmd_t 0x%p given to tx_worker[%" PRIu64 "]\n", cmd, cmd->isid);
} else {
/*
@@ -1263,7 +1263,7 @@
}
ISCSI_SET_TAG(&tag);
target = cmd->isid;
- iscsi_trace(TRACE_ISCSI_CMD, "enqueue_worker: dequeued initiator_cmd_t 0x%p (type %d, target %llu)\n", cmd, cmd->type, target);
+ iscsi_trace(TRACE_ISCSI_CMD, "enqueue_worker: dequeued initiator_cmd_t 0x%p (type %d, target %" PRIu64 ")\n", cmd, cmd->type, target);
switch (cmd->type) {
case ISCSI_SCSI_CMD:
scsi_cmd = (iscsi_scsi_cmd_args_t *) cmd->ptr;
@@ -1283,14 +1283,14 @@
/* Initialize session (if not already) */
initialize:
if (!g_target[(int)target].has_session) {
- iscsi_trace(TRACE_ISCSI_DEBUG, "enqueue_worker: initializing target %llu session\n", target);
+ iscsi_trace(TRACE_ISCSI_DEBUG, "enqueue_worker: initializing target %" PRIu64 " session\n", target);
if (session_init_i(&g_target[(int)target].sess, target) != 0) {
iscsi_err(__FILE__, __LINE__, "session_init_i() failed (ignoring command)\n");
goto next;
}
- iscsi_trace(TRACE_ISCSI_DEBUG, "enqueue_worker: target %llu session initialized\n", target);
+ iscsi_trace(TRACE_ISCSI_DEBUG, "enqueue_worker: target %" PRIu64 " session initialized\n", target);
} else {
- iscsi_trace(TRACE_ISCSI_DEBUG, "enqueue_worker: target %llu session already initialized\n", target);
+ iscsi_trace(TRACE_ISCSI_DEBUG, "enqueue_worker: target %" PRIu64 " session already initialized\n", target);
}
sess = g_target[(int)target].sess;
iscsi_trace(TRACE_ISCSI_DEBUG, "enqueue_worker: session 0x%p\n", sess);
@@ -1298,7 +1298,7 @@
/* Discovery login if TargetName is zero length */
if (strlen(g_target[(int)target].TargetName) == 0) {
- iscsi_trace(TRACE_ISCSI_DEBUG, "enqueue_worker: entering Discovery phase with target %llu\n", target);
+ iscsi_trace(TRACE_ISCSI_DEBUG, "enqueue_worker: entering Discovery phase with target %" PRIu64 "\n", target);
rc = discovery_phase((int)target, &g_target[(int)target].all_targets);
iscsi_trace(TRACE_ISCSI_DEBUG, "enqueue_worker: Discovery phase complete\n");
@@ -1331,12 +1331,12 @@
/* Get into full feature if we're not already */
if (sess->state != INITIATOR_SESSION_STATE_LOGGED_IN_NORMAL) {
- iscsi_trace(TRACE_ISCSI_DEBUG, "enqueue_worker: entering full feature with target %llu (sock %#x)\n", target, (int) sess->sock);
+ iscsi_trace(TRACE_ISCSI_DEBUG, "enqueue_worker: entering full feature with target %" PRIu64 " (sock %#x)\n", target, (int) sess->sock);
if (full_feature_phase(sess) != 0) {
iscsi_err(__FILE__, __LINE__, "enqueue_worker: full_feature_phase() failed (ignoring command)\n");
goto next;
} else {
- iscsi_trace(TRACE_ISCSI_DEBUG, "enqueue_worker: now full feature with target %llu\n", target);
+ iscsi_trace(TRACE_ISCSI_DEBUG, "enqueue_worker: now full feature with target %" PRIu64 "\n", target);
}
}
/*
@@ -1356,7 +1356,7 @@
}
ISCSI_SIGNAL(&sess->tx_worker.work_cond, goto done);
ISCSI_UNLOCK(&sess->tx_worker.work_mutex, goto done);
- iscsi_trace(TRACE_ISCSI_CMD, "enqueue_worker: gave initiator_cmd_t 0x%p to tx_worker[%llu]\n", cmd, cmd->isid);
+ iscsi_trace(TRACE_ISCSI_CMD, "enqueue_worker: gave initiator_cmd_t 0x%p to tx_worker[%" PRIu64 "]\n", cmd, cmd->isid);
next:
ISCSI_LOCK(&g_enqueue_worker.work_mutex, goto done);
} else {
@@ -1465,13 +1465,13 @@
ISCSI_UNLOCK(&me->work_mutex, return -1);
iscsi_trace(TRACE_ISCSI_CMD,
"tx_worker[%d]: dequeued initiator_cmd_t 0x%p "
- "(type %d, target %llu)\n",
+ "(type %d, target %" PRIu64 ")\n",
me->id, cmd, cmd->type, cmd->isid);
/* Make sure we've got the right command */
if (cmd->isid != (unsigned)me->id) {
iscsi_err(__FILE__, __LINE__,
- "got command %#x for target %llu, "
+ "got command %#x for target %" PRIu64 ", "
"expected %d\n", cmd->type,
cmd->isid, me->id);
goto done;
@@ -1902,7 +1902,7 @@
/* Enqueue to Tx worker */
- iscsi_trace(TRACE_ISCSI_DEBUG, "enqueing logout command to tx worker %llu\n", sess->isid);
+ iscsi_trace(TRACE_ISCSI_DEBUG, "enqueing logout command to tx worker %" PRIu64 "\n", sess->isid);
ISCSI_LOCK(&iwait.mutex, LO_ERROR);
ISCSI_LOCK(&sess->tx_worker.work_mutex, LO_ERROR);
if (iscsi_queue_insert(&sess->tx_queue, cmd) == -1) {
@@ -2016,7 +2016,7 @@
Home |
Main Index |
Thread Index |
Old Index