Add functions to control how IMMEDIATE_DATA and INITIAL_R2T is negotiated
This commit is contained in:
@@ -52,16 +52,6 @@ struct iscsi_in_pdu {
|
||||
void iscsi_free_iscsi_in_pdu(struct iscsi_context *iscsi, struct iscsi_in_pdu *in);
|
||||
void iscsi_free_iscsi_inqueue(struct iscsi_context *iscsi, struct iscsi_in_pdu *inqueue);
|
||||
|
||||
enum iscsi_initial_r2t {
|
||||
ISCSI_INITIAL_R2T_NO = 0,
|
||||
ISCSI_INITIAL_R2T_YES = 1
|
||||
};
|
||||
|
||||
enum iscsi_immediate_data {
|
||||
ISCSI_IMMEDIATE_DATA_NO = 0,
|
||||
ISCSI_IMMEDIATE_DATA_YES = 1
|
||||
};
|
||||
|
||||
struct iscsi_context {
|
||||
char initiator_name[MAX_STRING_SIZE+1];
|
||||
char target_name[MAX_STRING_SIZE+1];
|
||||
|
||||
@@ -84,6 +84,34 @@ struct iscsi_url {
|
||||
struct iscsi_context *iscsi;
|
||||
};
|
||||
|
||||
/*
|
||||
* This function is used to set the desired mode for immediate data.
|
||||
* This can be set on a context before it has been logged in to the target
|
||||
* and controls how the initiator will try to negotiate the immediate data.
|
||||
*
|
||||
* Default is for libiscsi to try to negotiate ISCSI_IMMEDIATE_DATA_YES
|
||||
*/
|
||||
enum iscsi_immediate_data {
|
||||
ISCSI_IMMEDIATE_DATA_NO = 0,
|
||||
ISCSI_IMMEDIATE_DATA_YES = 1
|
||||
};
|
||||
int iscsi_set_immediate_data(struct iscsi_context *iscsi, enum iscsi_immediate_data immediate_data);
|
||||
|
||||
/*
|
||||
* This function is used to set the desired mode for initial_r2t
|
||||
* This can be set on a context before it has been logged in to the target
|
||||
* and controls how the initiator will try to negotiate the initial r2t.
|
||||
*
|
||||
* Default is for libiscsi to try to negotiate ISCSI_INITIAL_R2T_YES
|
||||
*/
|
||||
enum iscsi_initial_r2t {
|
||||
ISCSI_INITIAL_R2T_NO = 0,
|
||||
ISCSI_INITIAL_R2T_YES = 1
|
||||
};
|
||||
int
|
||||
iscsi_set_initial_r2t(struct iscsi_context *iscsi, enum iscsi_initial_r2t initial_r2t);
|
||||
|
||||
|
||||
/*
|
||||
* This function is used to parse an iSCSI URL into a iscsi_url structure.
|
||||
* iSCSI URL format :
|
||||
|
||||
25
lib/init.c
25
lib/init.c
@@ -502,3 +502,28 @@ iscsi_set_initiator_username_pwd(struct iscsi_context *iscsi,
|
||||
strncpy(iscsi->passwd,passwd,MAX_STRING_SIZE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
iscsi_set_immediate_data(struct iscsi_context *iscsi, enum iscsi_immediate_data immediate_data)
|
||||
{
|
||||
if (iscsi->is_loggedin != 0) {
|
||||
iscsi_set_error(iscsi, "Already logged in when trying to set immediate_data");
|
||||
return -1;
|
||||
}
|
||||
|
||||
iscsi->want_immediate_data = immediate_data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
iscsi_set_initial_r2t(struct iscsi_context *iscsi, enum iscsi_initial_r2t initial_r2t)
|
||||
{
|
||||
if (iscsi->is_loggedin != 0) {
|
||||
iscsi_set_error(iscsi, "Already logged in when trying to set initial_r2t");
|
||||
return -1;
|
||||
}
|
||||
|
||||
iscsi->want_initial_r2t = initial_r2t;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +65,8 @@ iscsi_scsi_command_sync
|
||||
iscsi_scsi_cancel_task
|
||||
iscsi_service
|
||||
iscsi_set_alias
|
||||
iscsi_set_immediate_data
|
||||
iscsi_set_initial_r2t
|
||||
iscsi_set_log_level
|
||||
iscsi_set_log_fn
|
||||
iscsi_set_header_digest
|
||||
|
||||
@@ -63,6 +63,8 @@ iscsi_scsi_command_sync
|
||||
iscsi_scsi_cancel_task
|
||||
iscsi_service
|
||||
iscsi_set_alias
|
||||
iscsi_set_immediate_data
|
||||
iscsi_set_initial_r2t
|
||||
iscsi_set_log_level
|
||||
iscsi_set_log_fn
|
||||
iscsi_set_header_digest
|
||||
|
||||
Reference in New Issue
Block a user