⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 overview-ini

📁 iscsi源代码 UNH的progect 有initiator端和target端的源码
💻
📖 第 1 页 / 共 2 页
字号:
2.	The struct parameter_type is defined in the file "common/text_param.h" as:		struct parameter_type	{								unsigned int		type;								unsigned int		int_value;								char				*str_value;								char				*value_list;								unsigned int		neg_info;								unsigned long long	special_key_flag;								};	type				- bit-set that defines type and attributes of each param	int_value			- valid only if type is NUMBER or NUMBER_RANGE; else 0	str_value			- valid only if type is not NUMBER; else NULL	value_list			- valid only if type is not NUMBER; else NULL	neg_info			- bit-set that defines negotiation options	special_key_flag	- bit-set that defines "special" processing3.	The possible values for each field are given as symbolic constants in	the file "common/text_param.h".  Each parameter must have a "primary type"	indication that must be chosen from 1 of the following bit constants:		NUMBER			- a numeric value		STRING			- an arbitrary (non-enumerated) string		ENUMERATED		- an enumerated string		BOOL_AND		- a boolean		BOOL_OR			- a boolean		NUMBER_RANGE	- a range of 2 numeric values4.	The "value selection" bit in the "type" field of struct parameter_type	further qualifies the "primary type", again by setting a single bit.	If the "primary type" is NUMBER, then one of the following bits defines	the range of numbers that are acceptable:		ONE_TO_65535		- range [1..65535]		N512_TO_16777215	- range [512..16777215]		ZERO_TO_3600		- range [0..3600]		ZERO_TO_2			- range [0..2]		ZERO_TO_65535		- range [0..65535]	If the "primary type" is STRING, then the following bits define what	characters are legal in the string:		UTF_8				- UTF-8 string		ISCSI_NAME			- iSCSI name		TARGET_ADDRESS_TYPE	- domainname:port,portal	If the "primary type" is ENUMERATED, then the following bits define what	list of key values are allowed in the string:		DIGEST_PARAM		- key is HeaderDigest or DataDigest		AUTH_PARAM			- key is an Authorization Key		DISCOVERY_NORMAL	- key accepts <normal|discovery>5.	In addition to the "primary type" and "value selection" bits, the following	bits can also be set for certain parameters:	If the "primary type" is NUMBER:		MIN_NUMBER		- an integer whose selection function is MIN		MAX_NUMBER		- an integer whose selection function is MAX6.	The table "config_params" contains one entry for each key parameter	defined in iscsi.  This table is defined and initialized at compile-	time in the file "common/text_param.h" as:		struct parameter_type config_params[MAX_CONFIG_PARAMS] = {						{}, {}, ... {} };	It is remains constant during the lifetime of the scsi_initiator module.7.	When the iscsi_initiator module is loaded, the function	"iscsi_initiator_detect" is called by the SCSI Mid-level to detect	all occurences of "iscsi adaptor" cards, of which there is only 1.	This function registers this adaptor card with the Mid-level,	and gets back a pointer to the "struct Scsi_Host" structure allocated	by the Mid-level for this card, which is stored in the global variable	global_host.  The end of this structure is itself the structure	struct iscsi_hostdata hostdata, which is the "private" data for this	adaptor and is defined in the file "iscsi_initiator.h".		struct iscsi_hostdata	{						unsigned int	force;						unsigned int	nop_period;						unsigned int	version_number;						struct session	*session_head;						struct parameter_type	(*param_tbl)[MAX_CONFIG_PARAMS];								};	The global variable global_hostdata is set to point to this structure.	As part of initializing the newly-loaded module, the "param_tbl" field	of this structure is dynamically allocated, and an exact copy of the	global "config_params" array is copied into it.	From this point onward, it is this table (global_hostdata->param_tbl)	that is modified when configuration changes are triggered via a write	by the user to the /proc/scsi/iscsi_initiator interface of a line of the	form:		iscsi_initiator manage n key=value 	where "n" is an integer number indicating what to do.  Note that if the	value of "n" indicates a "reset" function, then entire table	"global_hostdata->param_tbl" will be reset to a new copy of the	unmodified "config_params" table.8.	New sessions are triggered via a write by the user to the	/proc/scsi/iscsi_initiator interface of a line of the form:		iscsi-initiator ip 1234abcd port 4000 target 6 lun 0	This causes the function "create_session" to be called in order to create	a new "struct session" structure, initialize it, use it to login to a	target, and if that is successful, to then start up the read and write	threads for the new session.  As part of this initialization, the table		session->session_params	of type		struct parameter_type (*session_params)[MAX_CONFIG_PARAMS];	is dynamically allocated and filled with an exact copy of the		global_hostdata->param_tbl	From this point onward, these are the default parameters for this session,	and this table is used as the basis for all negotiations during the	login phase.  It will be modified during the login phase to reflect the	results of the negotiations.9.	If the login is successful, a final (fourth) table is filled in with	the final results of the login negotiations (the table is also	dynamically allocated, but this is actually done earlier, during session	initialization).  This is the table:		session->oper_param	of type		struct operational_parameters	*oper_param;	From this point onward, the values in this table are the ones used	to control operation during the Full Feature Phase.	This table has type		struct operational_parameters {};	which is defined in the file "common/iscsi_common.h".	Note that this final (fourth) table does not have the same format as the	previous 3 tables.  That is because this table is never used for	negotiations, and therefore does not contain key names or attributes	necessary for negotiations.  Rather, it simply contains the final values	arrived at by the negotiations, in a form in which they can be easily	used during Full Feature Phase operation.  The function	"set_session_parameters()", defined in the file "common/text_param.h",	does the work of converting the format from the "struct parameter_type"	format to the "struct operational_parameters" format.Connection States-----------------A connection is always in one of 7 possible states:	CONNECTION_NOT_PRESENT	CONNECTION_CONNECTED	CONNECTION_LOGGED_IN	CONNECTION_FULL_FEATURE_PHASE	CONNECTION_RECOVERY	CONNECTION_LOGGED_OUT	CONNECTION_DISCONNECTEDCONNECTION_NOT_PRESENT	Transitions into this state:		1.	Initial value set in build_session_skeleton() when connection			structure is first created and added to session->connection_head.		2.	from CONNECTION_CONNECTED in init_connection() when an error			occurs after a TCP connection was established		3.	from CONNECTION_FULL_FEATURE_PHASE in close_connection() when TCP			connection has been disconnected, rx thread has terminated,			rx buffers have been freed, and /proc entry for this connection			has been removed.	Transitions out of this state:		1.	to CONNECTION_CONNECTED in init_connection() when a TCP connection			is successfully establishedCONNECTION_CONNECTED	Transitions into this state:		1.  from CONNECTION_NOT_PRESENT in init_connection() after a TCP			connection to a target has been successfully established, all			the rx buffers have been created, and the /proc entry for this			connection has been established.	Transitions out of this state:		1.	to CONNECTION_LOGGED_IN in iscsi_initiator_login() after an			iscsi login phase has completed successfully.CONNECTION_LOGGED_IN	Transitions into this state:		1.	from CONNECTION_CONNECTED in iscsi_initiator_login() after an			iscsi login phase has completed successfully.	Transitions out of this state:		1.	to CONNECTION_FULL_FEATURE_PHASE in create_session() after the			rx_thread for this connection has started successfully.CONNECTION_FULL_FEATURE_PHASE	Transitions into this state:		1.	from CONNECTION_LOGGED_IN in create_session() after the			rx_thread for this connection has started successfully.	Transitions out of this state:		1.	to CONNECTION_NOT_PRESENT in close_connection() when the TCP			connection has been disconnected, rx thread has terminated,			rx buffers have been freed, and /proc entry for this connection			has been removed.		2.	to CONNECTION_LOGGED_OUT in drive_logout() when a			Logout Request PDU has been attached as a pending command.			This prevents the tx thread from sending pdus other than			those with opcode = Logout Request on this connection.CONNECTION_LOGGED_OUT	Transitions into this state:		1.	from CONNECTION_FULL_FEATURE_PHASE in drive_logout() when a			Logout Request PDU has been attached as a pending command.			This prevents the tx thread from sending pdus other than			those with opcode = Logout Request on this connection.CONNECTION_DISCONNECTED	Transitions into this state:		1.	from CONNECTION_FULL_FEATURE_PHASE in iscsi_initiator_rx_thread()			when the rx thread terminates after freeing any pending commands.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -