Re: Antw: Re: [patch] iscsiadm cli help update
Any update ? On Tue, Aug 30, 2011 at 8:44 PM, Vivek S vivek...@gmail.com wrote: Added comments for structures and functions. As for being a masochist, I tried, but couldn't take it ;-P. On Tue, Aug 30, 2011 at 12:31 PM, Ulrich Windl ulrich.wi...@rz.uni-regensburg.de wrote: Vivek S vivek...@gmail.com schrieb am 29.08.2011 um 21:00 in Nachricht CAAPU5rPY1F3bkYYyASAFbOtb6JrfGw7JSb6m=--KKUEZVmc=w...@mail.gmail.com: Removed ordering constrains between #defines and structure elements. Removed calculating tab width and defaulting to 8. Hope this will do :-) Hi! It looks like converging ;-) You could (I know it's non-hacker-like) add some comments on the struct def: int option; char *option_str; const char *help_str; BTW: shouldn't option_str be const char also? On +/* + * Global defines for all iscsiadm command line options. + */ +#define CMD_LINE_OPTION_PORTAL (1 0) Improve the comment by saying why you use bitmasks there, or say what those defines are going to be used for. If you feel like a masochist today, you could temporarily add some of the gcc options that I used myself years ago: -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wtraditional -Wstrict-prototypes -Wnested-externs -Wredundant-decls -Wconversion Maybe this helps you to clean out a few edges. Regards, Ulrich -- You received this message because you are subscribed to the Google Groups open-iscsi group. To post to this group, send email to open-iscsi@googlegroups.com. To unsubscribe from this group, send email to open-iscsi+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en. -- You received this message because you are subscribed to the Google Groups open-iscsi group. To post to this group, send email to open-iscsi@googlegroups.com. To unsubscribe from this group, send email to open-iscsi+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
Re: Antw: Re: [patch] iscsiadm cli help update
On 09/03/2011 04:02 AM, Vivek S wrote: Any update ? Looks ok. Thanks for all your work on it. And thanks to Ulrich for the review. Just one stye comment though. The coding style we follow has us put the leading { on the first line for structs, for, and if/else blocks. So +struct option_help +{ would be +struct option_help { + if ( (str_len + (num_tabs * TAB_WIDTH) - num_tabs) max_cols ) + { would be if ( (str_len + (num_tabs * TAB_WIDTH) - num_tabs) max_cols ) { Also in here you do not need the extra spaces between the ((s and at the end after max_cols and ) And + } + else + { would be } else { then here + for (i=0 ; istr_len ; i++) + { you want spaces between i and = and 0 and i and and str_len but not after str_len so it should be for (i = 0 ; i str_len; i++) If there is only one line and so {} are not needed then we do not add them + if (ioctl(0,TIOCGWINSZ,ws)!=0) + { + return 80; + } should be if (ioctl(0,TIOCGWINSZ, ws) != 0) return 80; I will fix these up when I merge it. I am having troubles logging into kernel.org to update the git tree due to the breakin. -- You received this message because you are subscribed to the Google Groups open-iscsi group. To post to this group, send email to open-iscsi@googlegroups.com. To unsubscribe from this group, send email to open-iscsi+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
Re: Antw: Re: [patch] iscsiadm cli help update
Thanks a lot Mike ! Will follow the coding style more rigourously the next time I submit a patch. On Sat, Sep 3, 2011 at 10:08 PM, Mike Christie micha...@cs.wisc.edu wrote: On 09/03/2011 04:02 AM, Vivek S wrote: Any update ? Looks ok. Thanks for all your work on it. And thanks to Ulrich for the review. Just one stye comment though. The coding style we follow has us put the leading { on the first line for structs, for, and if/else blocks. So +struct option_help +{ would be +struct option_help { + if ( (str_len + (num_tabs * TAB_WIDTH) - num_tabs) max_cols ) + { would be if ( (str_len + (num_tabs * TAB_WIDTH) - num_tabs) max_cols ) { Also in here you do not need the extra spaces between the ((s and at the end after max_cols and ) And + } + else + { would be } else { then here + for (i=0 ; istr_len ; i++) + { you want spaces between i and = and 0 and i and and str_len but not after str_len so it should be for (i = 0 ; i str_len; i++) If there is only one line and so {} are not needed then we do not add them + if (ioctl(0,TIOCGWINSZ,ws)!=0) + { + return 80; + } should be if (ioctl(0,TIOCGWINSZ, ws) != 0) return 80; I will fix these up when I merge it. I am having troubles logging into kernel.org to update the git tree due to the breakin. -- You received this message because you are subscribed to the Google Groups open-iscsi group. To post to this group, send email to open-iscsi@googlegroups.com. To unsubscribe from this group, send email to open-iscsi+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
Re: [PATCH 1/1] added code to display verbose messages on session connection errors
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 beISCSI_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. -- You received this message because you are subscribed to the Google Groups open-iscsi group. To post to this group, send email to open-iscsi@googlegroups.com. To unsubscribe from this group, send email to open-iscsi+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
Re: [PATCH 1/1] added code to display verbose messages on session connection errors
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 micha...@cs.wisc.edu 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 beISCSI_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: aasth...@gmail.com -- You received this message because you are subscribed to the Google Groups open-iscsi group. To post to this group, send email to open-iscsi@googlegroups.com. To unsubscribe from this group, send email to open-iscsi+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
Re: [PATCH 1/1] added code to display verbose messages on session connection errors
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 aasth...@gmail.com 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 micha...@cs.wisc.edu 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 beISCSI_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: aasth...@gmail.com -- Aastha Mehta B.E. (Hons.) Computer Science BITS Pilani E-mail: aasth...@gmail.com -- You received this message because you are subscribed to the Google Groups open-iscsi group. To post to this group, send email to open-iscsi@googlegroups.com. To unsubscribe from this group, send email to open-iscsi+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en. #includestdio.h #includestdlib.h #includestring.h #includekern_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