From 4c3ac5464a1727542d30a8a813aa0adacb8ec02e Mon Sep 17 00:00:00 2001 From: zhenwei pi Date: Fri, 3 Nov 2023 12:18:30 +0800 Subject: [PATCH] Dump opcode string in iscsi_dump_pdu_header() Now we have more friendly opcode message once error occurs: libiscsi:1 command timed out from waitqueue [...] libiscsi:2 PDU header: 01 c1 ... e9 88[READ16] 00 00 00 ... ^(human readable opcode string) Signed-off-by: zhenwei pi --- lib/pdu.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/pdu.c b/lib/pdu.c index dc7685f..5b67bee 100644 --- a/lib/pdu.c +++ b/lib/pdu.c @@ -79,12 +79,18 @@ iscsi_itt_post_increment(struct iscsi_context *iscsi) { } void iscsi_dump_pdu_header(struct iscsi_context *iscsi, unsigned char *data) { - char dump[ISCSI_RAW_HEADER_SIZE*3+1]={0}; + char dump1[33*3+1]={0}; + char dump2[(ISCSI_RAW_HEADER_SIZE-33)*3+1]={0}; + const char *opcode; int i; - for (i=0;i