Before I patch again, would like to show you the files. Have added a default
case in the err_code_to_string() function. Also removed the extra err_string
variable I used previously in the function. Each case now directly returns
the appropriate message from the table directly, as no other work is done.
Please let me know if there is anything else I am still missing.
Thanks,
Aastha.
On 3 September 2011 22:30, Aastha Mehta <[email protected]> wrote:
> Hi,
>
> I have not done any changes to prom_lex.c. The diff shows something because
> of difference in the two git sources downloaded. How do I drop the changes?
> Will git diff --check suffice?
> Please confirm if I should #define the error messages or not. If yes, will
> macro name pattern like M_ISCSI_ERR_DATASN or ISCSI_ERR_DATASN_MSG be fine?
>
> Thanks,
> Aastha.
>
>
>
> On 3 September 2011 10:23, Mike Christie <[email protected]> wrote:
>
>> On 08/31/2011 11:57 AM, Aastha Mehta wrote:
>> > Hello,
>> >
>> > Attached is the patch for the first kernel TODO item in the TODO list
>> > circulated earlier. I could not send the patch through git send-email,
>> so
>> > have attached it here.
>> >
>> > Thanks,
>> > Aastha.
>> >
>>
>> - You do not need the changes to a/utils/fwparam_ibft/prom_lex.c. Drop
>> them.
>>
>> - err_table should be renamed to kern_err_table to reflect it is the
>> table for errors that the kernel is notifying userspace of.
>>
>> - __ERRTABLE_H__ should be __KERN_ERR_TABLE_H_
>>
>>
>> - err_table should be static, becuase it is only used in that file.
>>
>> - ISCSI_OK could be "ISCSI_OK: operation successful"
>>
>> - ISCSI_ERR_DATASN should be "ISCSI_ERR_DATASN: Received invalid data
>> sequence number from target"
>>
>> - "ISCSI_ERR_DATA_OFFSET: Seeking offset beyond the size of the iscsi
>> segment" should be "ISCSI_ERR_DATA_OFFSET: Seeking offset beyond the
>> size of the iSCSI segment"
>>
>> "ISCSI_ERR_MAX_CMDSN: Sequence no. is greater than the maximum allowed
>> value" should be "ISCSI_ERR_MAX_CMDSN: Received invalid iSCSI command
>> sequence number from target".
>>
>> "ISCSI_ERR_EXP_CMDSN: not the expected sequence no. of the iscsi
>> command" should be "ISCSI_ERR_EXP_CMDSN: Received invalid expected
>> command sequence number from target
>>
>> "ISCSI_ERR_BAD_OPCODE: Got an invalid iSCSI opcode" should
>> be"ISCSI_ERR_BAD_OPCODE: Received an invalid iSCSI opcode".
>>
>> "ISCSI_ERR_AHSLEN: Invalid AHS len" should be "ISCSI_ERR_AHSLEN:
>> Received an invalid AHS length from target".
>>
>> "ISCSI_ERR_PROTO: Some protocol not followed correctly" should be
>> "ISCSI_ERR_PROTO: iSCSI protocol violation".
>>
>> "ISCSI_ERR_BAD_ITT: Invalid invitation to transmit" should be
>> "ISCSI_ERR_BAD_ITT: Received invalid initiator task tag from target.
>>
>> "ISCSI_ERR_R2TSN: Invalid sequence no. of iSCSI R2T response" should be
>> "ISCSI_ERR_R2TSN: Received invalid R2T (Ready to Transfer) data sequence
>> number from target".
>>
>> "ISCSI_ERR_PARAM_NOT_FOUND: Parameters not found" should be
>> "ISCSI_ERR_PARAM_NOT_FOUND: Parameter not found".
>>
>> "ISCSI_ERR_NO_SCSI_CMD: No SCSI command to execute" should be
>> "ISCSI_ERR_NO_SCSI_CMD: could not look up SCSI command".
>>
>> "ISCSI_ERR_INVALID_HOST: Got an invalid host", "ISCSI_ERR_INVALID_HOST:
>> iSCSI host is in a invalid state".
>>
>>
>> ISCSI_ERR_SCSI_EH_SESSION_RST should be "ISCSI_ERR_SCSI_EH_SESSION_RST:
>> session was dropped as a result of SCSI error recovery".
>>
>
>
>
> --
> Aastha Mehta
> B.E. (Hons.) Computer Science
> BITS Pilani
> E-mail: [email protected]
>
>
>
--
Aastha Mehta
B.E. (Hons.) Computer Science
BITS Pilani
E-mail: [email protected]
--
You received this message because you are subscribed to the Google Groups
"open-iscsi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/open-iscsi?hl=en.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"kern_error_table.h"
#define NUM_ERRORS 22
char *err_code_to_string(int code){
static const char *kern_err_table[NUM_ERRORS] = {
"ISCSI_OK: operation successful",
"ISCSI_ERR_DATASN: Received invalid data sequence number from target",
"ISCSI_ERR_DATA_OFFSET: Seeking offset beyond the size of the iSCSI segment",
"ISCSI_ERR_MAX_CMDSN: Received invalid command sequence number from target",
"ISCSI_ERR_EXP_CMDSN: Received invalid expected command sequence number from target",
"ISCSI_ERR_BAD_OPCODE: Received an invalid iSCSI opcode",
"ISCSI_ERR_DATALEN: Invalid R2T, unexpected datalen value",
"ISCSI_ERR_AHSLEN: Received an invalid AHS len",
"ISCSI_ERR_PROTO: iSCSI protocol violation",
"ISCSI_ERR_LUN: LUN mismatch",
"ISCSI_ERR_BAD_ITT: Received invalid initiator task tag from target",
"ISCSI_ERR_CONN_FAILED: iSCSI connection failed",
"ISCSI_ERR_R2TSN: Received invalid R2T (Ready to Transfer) data sequence number from target",
"ISCSI_ERR_SESSION_FAILED: iSCSI session failed",
"ISCSI_ERR_HDR_DGST: Header digest mismatch",
"ISCSI_ERR_DATA_DGST: Data digest mismatch",
"ISCSI_ERR_PARAM_NOT_FOUND: Parameter not found",
"ISCSI_ERR_NO_SCSI_CMD: Could not look up SCSI command",
"ISCSI_ERR_INVALID_HOST: iSCSI host is in an invalid state",
"ISCSI_ERR_XMIT_FAILED: Transmission of iSCSI packet failed",
"ISCSI_ERR_TCP_CONN_CLOSE: TCP connection closed down",
"ISCSI_ERR_SCSI_EH_SESSION_RST: Session was dropped as a result of SCSI error discovery"
};
switch(code%1000){
case 0: return kern_err_table[0];
case 1: return kern_err_table[1];
case 2: return kern_err_table[2];
case 3: return kern_err_table[3];
case 4: return kern_err_table[4];
case 5: return kern_err_table[5];
case 6: return kern_err_table[6];
case 7: return kern_err_table[7];
case 8: return kern_err_table[8];
case 9: return kern_err_table[9];
case 10: return kern_err_table[10];
case 11: return kern_err_table[11];
case 12: return kern_err_table[12];
case 13: return kern_err_table[13];
case 14: return kern_err_table[14];
case 15: return kern_err_table[15];
case 16: return kern_err_table[16];
case 17: return kern_err_table[17];
case 18: return kern_err_table[18];
case 19: return kern_err_table[19];
case 20: return kern_err_table[20];
case 21: return kern_err_table[21];
default: return "Invalid error code";
}
}
#ifndef __KERN_ERR_TABLE_H__
#define __KERN_ERR_TABLE_H__
extern char *err_code_to_string(int);
#endif