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 <pizhenwei@bytedance.com>
This commit is contained in:
@@ -79,12 +79,18 @@ iscsi_itt_post_increment(struct iscsi_context *iscsi) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void iscsi_dump_pdu_header(struct iscsi_context *iscsi, unsigned char *data) {
|
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;
|
int i;
|
||||||
for (i=0;i<ISCSI_RAW_HEADER_SIZE;i++) {
|
for (i=0;i<33;i++) {
|
||||||
snprintf(&dump[i * 3], 4, " %02x", data[i]);
|
snprintf(&dump1[i * 3], 4, " %02x", data[i]);
|
||||||
}
|
}
|
||||||
ISCSI_LOG(iscsi, 2, "PDU header:%s", dump);
|
opcode = scsi_opcode_str(data[32]);
|
||||||
|
for (;i<ISCSI_RAW_HEADER_SIZE;i++) {
|
||||||
|
snprintf(&dump2[(i-33) * 3], 4, " %02x", data[i]);
|
||||||
|
}
|
||||||
|
ISCSI_LOG(iscsi, 2, "PDU header:%s[%s]%s", dump1, opcode, dump2);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct iscsi_pdu*
|
struct iscsi_pdu*
|
||||||
|
|||||||
Reference in New Issue
Block a user