Add debugging framework

This patch adds a user configurable debug level. For testing
it includes connection info and reporting errors.
This commit is contained in:
Peter Lieven
2012-10-18 10:36:26 +02:00
parent c4592550d6
commit 4cb845477d
9 changed files with 53 additions and 5 deletions

View File

@@ -65,6 +65,7 @@ struct iscsi_context {
const char *initiator_name;
const char *target_name;
const char *target_address; /* If a redirect */
const char *connected_portal;
const char *alias;
const char *user;
@@ -120,6 +121,7 @@ struct iscsi_context {
const char *portal;
int no_auto_reconnect;
int reconnect_deferred;
int debug;
};
#define ISCSI_PDU_IMMEDIATE 0x40

View File

@@ -958,6 +958,14 @@ iscsi_scsi_task_cancel(struct iscsi_context *iscsi,
EXTERN void
iscsi_scsi_cancel_all_tasks(struct iscsi_context *iscsi);
#define DPRINTF(iscsi,level,fmt,args...) do { if ((iscsi)->debug >= level) {fprintf(stderr,"libiscsi: ");fprintf(stderr, (fmt), ##args); fprintf(stderr,"\n");} } while (0);
/*
* This function is to set the debugging level (0=disabled).
*/
EXTERN void
iscsi_set_debug(struct iscsi_context *iscsi, int level);
#ifdef __cplusplus
}
#endif