Merge with upstream
This commit is contained in:
@@ -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;
|
||||
@@ -83,6 +84,12 @@ struct iscsi_context {
|
||||
|
||||
int fd;
|
||||
int is_connected;
|
||||
|
||||
int tcp_user_timeout;
|
||||
int tcp_keepcnt;
|
||||
int tcp_keepintvl;
|
||||
int tcp_keepidle;
|
||||
int tcp_syncnt;
|
||||
|
||||
int current_phase;
|
||||
int next_phase;
|
||||
@@ -120,6 +127,7 @@ struct iscsi_context {
|
||||
const char *portal;
|
||||
int no_auto_reconnect;
|
||||
int reconnect_deferred;
|
||||
int debug;
|
||||
};
|
||||
|
||||
#define ISCSI_PDU_IMMEDIATE 0x40
|
||||
@@ -274,7 +282,6 @@ unsigned long crc32c(char *buf, int len);
|
||||
|
||||
struct scsi_task *iscsi_scsi_get_task_from_pdu(struct iscsi_pdu *pdu);
|
||||
|
||||
int iscsi_reconnect(struct iscsi_context *iscsi);
|
||||
void iscsi_set_noautoreconnect(struct iscsi_context *iscsi, int state);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -231,6 +231,7 @@ enum scsi_status {
|
||||
SCSI_STATUS_GOOD = 0,
|
||||
SCSI_STATUS_CHECK_CONDITION = 2,
|
||||
SCSI_STATUS_RESERVATION_CONFLICT = 0x18,
|
||||
SCSI_STATUS_REDIRECT = 0x101,
|
||||
SCSI_STATUS_CANCELLED = 0x0f000000,
|
||||
SCSI_STATUS_ERROR = 0x0f000001
|
||||
};
|
||||
@@ -332,6 +333,15 @@ EXTERN int iscsi_full_connect_sync(struct iscsi_context *iscsi, const char *port
|
||||
*/
|
||||
EXTERN int iscsi_disconnect(struct iscsi_context *iscsi);
|
||||
|
||||
/*
|
||||
* Disconnect a connection to a target and try to reconnect.
|
||||
*
|
||||
* Returns:
|
||||
* 0 reconnect was successful
|
||||
* <0 error
|
||||
*/
|
||||
EXTERN int iscsi_reconnect(struct iscsi_context *iscsi);
|
||||
|
||||
/*
|
||||
* Asynchronous call to perform an ISCSI login.
|
||||
*
|
||||
@@ -956,6 +966,53 @@ 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); \
|
||||
if (iscsi->target_name) { \
|
||||
fprintf(stderr," [%s]",iscsi->target_name); \
|
||||
} \
|
||||
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);
|
||||
|
||||
/*
|
||||
* This function is to set the TCP_USER_TIMEOUT option. It has to be called after iscsi
|
||||
* context creation. The value given in ms is then applied each time a new socket is created.
|
||||
*/
|
||||
EXTERN void
|
||||
iscsi_set_tcp_user_timeout(struct iscsi_context *iscsi, int timeout_ms);
|
||||
|
||||
/*
|
||||
* This function is to set the TCP_KEEPIDLE option. It has to be called after iscsi
|
||||
* context creation.
|
||||
*/
|
||||
EXTERN void
|
||||
iscsi_set_tcp_keepidle(struct iscsi_context *iscsi, int value);
|
||||
|
||||
/*
|
||||
* This function is to set the TCP_KEEPCNT option. It has to be called after iscsi
|
||||
* context creation.
|
||||
*/
|
||||
EXTERN void
|
||||
iscsi_set_tcp_keepcnt(struct iscsi_context *iscsi, int value);
|
||||
|
||||
/*
|
||||
* This function is to set the TCP_KEEPINTVL option. It has to be called after iscsi
|
||||
* context creation.
|
||||
*/
|
||||
EXTERN void
|
||||
iscsi_set_tcp_keepintvl(struct iscsi_context *iscsi, int value);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user