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

📄 mscp_tape.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 5 页
字号:
#define RETRY_COUNT 		1200		/* 20 minutes */#define RETRY_REPOS_COUNT 	4200		/* 70 minutes *//* set up one variable to hold the position where we may have been is the * connection is lost.  This will allow us to move back to that position * and continue from there. *//* External Variables and Routines. */extern	void		mscp_datagram();extern	void		mscp_dealloc_all();extern	void		mscp_restart_next();extern	REQB		*mscp_alloc_reqb();extern	u_long		mscp_alloc_rspid();extern	void		mscp_control();extern	u_long		tmscp_invevent();extern	u_long		mscp_alloc_msg();extern	void		mscp_common_init();extern	void		mscp_dealloc_reqb();extern	void		mscp_message();extern	u_long		mscp_map_buffer();extern	u_long		mscp_onlgtuntem();extern	u_long		mscp_recycle_rspid();extern	u_long		mscp_send_msg();extern  u_long		scs_restart();extern  u_long		scs_crsh_path();extern	void		mscp_system_poll();extern	void		mscp_timer();extern	CLASSB		tmscp_classb;extern	RSPID_TBL	mscp_rspid_tbl[];extern	LISTHD		mscp_rspid_lh;extern	int		hz;extern	int		lbolt;extern	int		wakeup();extern	UNITB		*tmscp_unit_tbl[];	u_long		tmscp_onlineinit();	u_long		tmscp_onlineem();	u_long		tmscp_onlinecm();	u_long		tmscp_onlgtuntem();	u_long		tmscp_abortem();	u_long		tmscp_abortcm();	u_long		tmscp_availem();	u_long		tmscp_availcm();	u_long		tmscp_eraseem();	u_long		tmscp_erasecm();	u_long		tmscp_flushcm();	u_long		tmscp_flushem();	u_long		tmscp_gtuntcm();	u_long		tmscp_gtuntem(); 	u_long		gtuntem_body();	u_long		tmscp_invevent();	u_long		tmscp_datagram(); 	u_long		tmscp_recovinit(); 	u_long		tmscp_recovnext();	u_long		tmscp_recover_loc(); 	u_long		tmscp_reposem(); 	u_long		tmscp_reposcm(); 	u_long		tmscp_repreccm();	u_long		tmscp_setunitcm();	u_long		tmscp_setunitem();	u_long		tmscp_transferem();	u_long		tmscp_transfercm();	u_long		tmscp_writetmem();	u_long		tmscp_writetmcm();	void		tmscp_init_driver();/* ABORT COMMAND STATES */#define ST_ABO_INITIAL		ST_CMN_INITIAL/* UNIT AVAILABLE STATES. */#define ST_AV_T_INITIAL		ST_CMN_INITIAL/* UNIT DUMP STATES. */#define ST_DU_T_INITIAL		ST_CMN_INITIAL/* ERASE TAPE STATES */#define ST_ERA_INITIAL		ST_CMN_INITIAL/* FLUSH CACHE STATES */#define ST_FLU_INITIAL		ST_CMN_INITIAL/* TAPE DATAGRAM PROCESSING STATES */#define TAPE_DATAGRAM		ST_CMN_INITIAL/* GET UNIT STATUS COMMAND STATES */#define ST_GTU_INITIAL		ST_CMN_INITIAL/* TMSCP ON LINE STATES */#define ST_ON_T_INITIAL		ST_CMN_INITIAL#define ST_ON_T_GTUNT		1#define ST_ON_T_STUNT		2#define ST_ON_T_AVAIL		3/* TMSCP RECOVERY STATES */#define TAPE_RECOVERY_INITIAL	ST_CMN_INITIAL#define TAPE_RECOVERY_GTUNT	1#define TAPE_RECOVERY_STUNT	2#define TAPE_RECOVERY_REPOS	3#define TAPE_RECOVERY_AVAIL	4/* REPOSITION COMMAND STATES */#define ST_RPO_INITIAL		ST_CMN_INITIAL/* WRITE TAPE MARK STATES */#define ST_WTM_INITIAL		ST_CMN_INITIAL/* Bring unit online states. */STATE tmscp_onl_states[] = {    /* Unit online initial state.     */    { ST_ON_T_INITIAL,	tmscp_invevent },		/* EV_NULL	      */    { ST_ON_T_INITIAL,	tmscp_onlineinit },		/* EV_INITIAL	      */    { ST_ON_T_INITIAL,	mscp_alloc_msg },		/* EV_RSPID	      */    { ST_ON_T_INITIAL,	tmscp_onlinecm },		/* EV_MSGBUF	      */    { ST_ON_T_INITIAL,	tmscp_invevent },		/* EV_MAPPING	      */    { ST_ON_T_GTUNT,	tmscp_onlineem },		/* EV_ENDMSG	      */    { ST_ON_T_INITIAL,	tmscp_invevent },		/* EV_TIMEOUT	      */    { ST_ON_T_INITIAL,	tmscp_invevent },		/* 		      */    { ST_ON_T_INITIAL,	tmscp_invevent },		/* 		      */    { ST_ON_T_INITIAL,	tmscp_invevent },		/* 		      */    { ST_ON_T_INITIAL,	tmscp_invevent },		/* 		      */    { ST_ON_T_INITIAL,	tmscp_invevent },		/*		      */    { ST_ON_T_INITIAL,	tmscp_invevent },		/*		      */    { ST_ON_T_INITIAL,	tmscp_invevent },		/*		      */    { ST_ON_T_INITIAL,	tmscp_invevent },		/*		      */    { ST_ON_T_INITIAL,	tmscp_invevent },		/*		      */    /* Unit online get unit status message proceesing     */    { ST_ON_T_GTUNT,	tmscp_invevent },		/* EV_NULL	      */    { ST_ON_T_GTUNT,	tmscp_invevent },		/* EV_INITIAL	      */    { ST_ON_T_GTUNT,	tmscp_invevent },		/* EV_RSPID	      */    { ST_ON_T_GTUNT,	tmscp_invevent },		/* EV_MSGBUF	      */    { ST_ON_T_GTUNT,	tmscp_invevent },		/* EV_MAPPING	      */    { ST_ON_T_STUNT,	tmscp_onlgtuntem },		/* EV_ENDMSG	      */    { ST_ON_T_GTUNT,	tmscp_invevent },		/* EV_TIMEOUT	      */    { ST_ON_T_GTUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_GTUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_GTUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_GTUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_GTUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_GTUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_GTUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_GTUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_AVAIL,	tmscp_availcm },		/* EV_ONLERROR	      */    /* Unit online set unit characteristics message proceesing     */    { ST_ON_T_STUNT,	tmscp_invevent },		/* EV_NULL	      */    { ST_ON_T_STUNT,	tmscp_invevent },		/* EV_INITIAL	      */    { ST_ON_T_STUNT,	tmscp_invevent },		/* EV_RSPID	      */    { ST_ON_T_STUNT,	tmscp_invevent },		/* EV_MSGBUF	      */    { ST_ON_T_STUNT,	tmscp_invevent },		/* EV_MAPPING	      */    { ST_ON_T_STUNT,	tmscp_setunitem },		/* EV_ENDMSG	      */    { ST_ON_T_STUNT,	tmscp_invevent },		/* EV_TIMEOUT	      */    { ST_ON_T_STUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_STUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_STUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_STUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_STUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_STUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_STUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_STUNT,	tmscp_invevent },		/*		      */    { ST_ON_T_AVAIL,	tmscp_availcm },		/* EV_ONLERROR	      */    /* Unit online available end message processing.     */    { ST_ON_T_AVAIL,	tmscp_invevent },		/* EV_NULL	      */    { ST_ON_T_AVAIL,	tmscp_invevent },		/* EV_INITIAL	      */    { ST_ON_T_AVAIL,	tmscp_invevent },		/* EV_RSPID	      */    { ST_ON_T_AVAIL,	tmscp_invevent },		/* EV_MSGBUF	      */    { ST_ON_T_AVAIL,	tmscp_invevent },		/* EV_MAPPING	      */    { ST_ON_T_AVAIL,	tmscp_availem },		/* EV_ENDMSG	      */    { ST_ON_T_AVAIL,	tmscp_invevent },		/* EV_TIMEOUT	      */    { ST_ON_T_AVAIL,	tmscp_invevent },		/*		      */    { ST_ON_T_AVAIL,	tmscp_invevent },		/*		      */    { ST_ON_T_AVAIL,	tmscp_invevent },		/*		      */    { ST_ON_T_AVAIL,	tmscp_invevent },		/*		      */    { ST_ON_T_AVAIL,	tmscp_invevent },		/*		      */    { ST_ON_T_AVAIL,	tmscp_invevent },		/*		      */    { ST_ON_T_AVAIL,	tmscp_invevent },		/*		      */    { ST_ON_T_AVAIL,	tmscp_invevent },		/*		      */    { ST_ON_T_AVAIL,	tmscp_invevent },		/*		      */};/* unit recovery states. * * This state machine will only be entered by the connection * recovery code that is in common with the mscp disk driver. * The address of this state table will be loaded in the connection * block, and if the conection needs to be re-established; then this * is entered after the conection is re-made.  This will bring the * unit back online and reposition the tape at the point where the last * successful read/write was done.  When the state machine exits the * outstanding I/O (what ever) will be done as usual.  If the recovery * fails the I/O will then fail normally because the the unit will be offline. */STATE tmscp_recovery_states[] = {    /* Unit recovery initial state.     */    { TAPE_RECOVERY_INITIAL,	tmscp_invevent },	/* EV_NULL	      */    { TAPE_RECOVERY_INITIAL,	tmscp_recovinit },	/* EV_INITIAL	      */    { TAPE_RECOVERY_INITIAL,	mscp_alloc_msg },	/* EV_RSPID	      */    { TAPE_RECOVERY_INITIAL,	tmscp_onlinecm },	/* EV_MSGBUF	      */    { TAPE_RECOVERY_INITIAL,	tmscp_invevent },	/* EV_MAPPING	      */    { TAPE_RECOVERY_GTUNT,	tmscp_onlineem },	/* EV_ENDMSG	      */    { TAPE_RECOVERY_INITIAL,	tmscp_invevent },	/* EV_TIMEOUT	      */    { TAPE_RECOVERY_INITIAL,	tmscp_invevent },	/* 		      */    { TAPE_RECOVERY_INITIAL,	tmscp_invevent },	/* 		      */    { TAPE_RECOVERY_INITIAL,	tmscp_invevent },	/* 		      */    { TAPE_RECOVERY_INITIAL,	tmscp_invevent },	/* 		      */    { TAPE_RECOVERY_INITIAL,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_INITIAL,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_INITIAL,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_INITIAL,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_INITIAL,	tmscp_invevent },	/*		      */    /* Unit recovery get unit status message processing     */    { TAPE_RECOVERY_GTUNT,	tmscp_invevent },	/* EV_NULL	      */    { TAPE_RECOVERY_GTUNT,	tmscp_invevent },	/* EV_INITIAL	      */    { TAPE_RECOVERY_GTUNT,	tmscp_invevent },	/* EV_RSPID	      */    { TAPE_RECOVERY_GTUNT,	tmscp_invevent },	/* EV_MSGBUF	      */    { TAPE_RECOVERY_GTUNT,	tmscp_invevent },	/* EV_MAPPING	      */    { TAPE_RECOVERY_STUNT,	tmscp_onlgtuntem },	/* EV_ENDMSG	      */    { TAPE_RECOVERY_GTUNT,	tmscp_invevent },	/* EV_TIMEOUT	      */    { TAPE_RECOVERY_GTUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_GTUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_GTUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_GTUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_GTUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_GTUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_GTUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_GTUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_AVAIL,	tmscp_availcm },	/* EV_ONLERROR	      */    /* Unit recovery set unit characteristics message processing     */    { TAPE_RECOVERY_STUNT,	tmscp_invevent },	/* EV_NULL	      */    { TAPE_RECOVERY_STUNT,	tmscp_invevent },	/* EV_INITIAL	      */    { TAPE_RECOVERY_STUNT,	tmscp_invevent },	/* EV_RSPID	      */    { TAPE_RECOVERY_STUNT,	tmscp_invevent },	/* EV_MSGBUF	      */    { TAPE_RECOVERY_STUNT,	tmscp_invevent },	/* EV_MAPPING	      */    { TAPE_RECOVERY_REPOS,	tmscp_recover_loc },	/* EV_ENDMSG	      */    { TAPE_RECOVERY_STUNT,	tmscp_invevent },	/* EV_TIMEOUT	      */    { TAPE_RECOVERY_STUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_STUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_STUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_STUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_STUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_STUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_STUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_STUNT,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_AVAIL,	tmscp_availcm },	/* EV_ONLERROR	      */    /* Unit recovery reposition message processing     */    { TAPE_RECOVERY_REPOS,	tmscp_invevent },	/* EV_NULL	      */    { TAPE_RECOVERY_REPOS,	tmscp_invevent },	/* EV_INITIAL	      */    { TAPE_RECOVERY_REPOS,	tmscp_invevent },	/* EV_RSPID	      */    { TAPE_RECOVERY_REPOS,	tmscp_invevent },	/* EV_MSGBUF	      */    { TAPE_RECOVERY_REPOS,	tmscp_invevent },	/* EV_MAPPING	      */    { TAPE_RECOVERY_REPOS,	tmscp_reposem },	/* EV_ENDMSG	      */    { TAPE_RECOVERY_REPOS,	tmscp_invevent },	/* EV_TIMEOUT	      */    { TAPE_RECOVERY_REPOS,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_REPOS,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_REPOS,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_REPOS,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_REPOS,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_INITIAL,	tmscp_onlinecm },	/* EV_ONLDONEXT	      */    { TAPE_RECOVERY_REPOS,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_REPOS,	tmscp_recovnext },	/* EV_ONLCOMPLETE     */    { TAPE_RECOVERY_AVAIL,	tmscp_availcm },	/* EV_ONLERROR	      */    /* Unit recovery available end message processing.     */    { TAPE_RECOVERY_AVAIL,	tmscp_invevent },	/* EV_NULL	      */    { TAPE_RECOVERY_AVAIL,	tmscp_invevent },	/* EV_INITIAL	      */    { TAPE_RECOVERY_AVAIL,	tmscp_invevent },	/* EV_RSPID	      */    { TAPE_RECOVERY_AVAIL,	tmscp_invevent },	/* EV_MSGBUF	      */    { TAPE_RECOVERY_AVAIL,	tmscp_invevent },	/* EV_MAPPING	      */    { TAPE_RECOVERY_AVAIL,	tmscp_availem },	/* EV_ENDMSG	      */    { TAPE_RECOVERY_AVAIL,	tmscp_invevent },	/* EV_TIMEOUT	      */    { TAPE_RECOVERY_AVAIL,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_AVAIL,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_AVAIL,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_AVAIL,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_AVAIL,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_INITIAL,	tmscp_onlinecm },	/* EV_ONLDONEXT	      */    { TAPE_RECOVERY_AVAIL,	tmscp_invevent },	/*		      */    { TAPE_RECOVERY_AVAIL,	tmscp_recovnext },	/* EV_ONLCOMPLETE     */    { TAPE_RECOVERY_AVAIL,	tmscp_invevent },	/* EV_ONLERROR	      */};/* Make unit available states. */STATE tmscp_avl_states[] = {    /* Unit available initial state.     */    { ST_AV_T_INITIAL,	tmscp_invevent },		/* EV_NULL	      */    { ST_AV_T_INITIAL,	mscp_alloc_rspid },		/* EV_INITIAL	      */    { ST_AV_T_INITIAL,	mscp_alloc_msg },		/* EV_RSPID	      */    { ST_AV_T_INITIAL,	tmscp_availcm },		/* EV_MSGBUF	      */    { ST_AV_T_INITIAL,	tmscp_invevent },		/* EV_MAPPING	      */    { ST_AV_T_INITIAL,	tmscp_availem },		/* EV_ENDMSG	      */    { ST_AV_T_INITIAL,	tmscp_invevent},			/* EV_TIMEOUT	      */    { ST_AV_T_INITIAL,	tmscp_invevent },		/*		      */    { ST_AV_T_INITIAL,	tmscp_invevent },		/*		      */    { ST_AV_T_INITIAL,	tmscp_invevent },		/*		      */    { ST_AV_T_INITIAL,	tmscp_invevent },		/*		      */    { ST_AV_T_INITIAL,	tmscp_invevent },		/*		      */    { ST_AV_T_INITIAL,	tmscp_invevent },		/*		      */    { ST_AV_T_INITIAL,	tmscp_invevent },		/*		      */    { ST_AV_T_INITIAL,	tmscp_invevent },		/*		      */    { ST_AV_T_INITIAL,	tmscp_invevent },		/*		      */};/* Abort running command states. */STATE tmscp_abo_states[] = {    /* Abort long running command initial state.     */    { ST_ABO_INITIAL,	tmscp_invevent },		/* EV_NULL	      */    { ST_ABO_INITIAL,	mscp_alloc_rspid },		/* EV_INITIAL	      */    { ST_ABO_INITIAL,	mscp_alloc_msg },		/* EV_RSPID	      */    { ST_ABO_INITIAL,	tmscp_abortcm },		/* EV_MSGBUF	      */    { ST_ABO_INITIAL,	tmscp_invevent },		/* EV_MAPPING	      */    { ST_ABO_INITIAL,	tmscp_abortem },		/* EV_ENDMSG	      */    { ST_ABO_INITIAL,	tmscp_invevent},			/* EV_TIMEOUT	      */    { ST_ABO_INITIAL,	tmscp_invevent },		/*		      */    { ST_ABO_INITIAL,	tmscp_invevent },		/*		      */    { ST_ABO_INITIAL,	tmscp_invevent },		/*		      */    { ST_ABO_INITIAL,	tmscp_invevent },		/*		      */    { ST_ABO_INITIAL,	tmscp_invevent },		/*		      */    { ST_ABO_INITIAL,	tmscp_invevent },		/*		      */    { ST_ABO_INITIAL,	tmscp_invevent },		/*		      */    { ST_ABO_INITIAL,	tmscp_invevent },		/*		      */    { ST_ABO_INITIAL,	tmscp_invevent },		/*		      */};/* Process a datagram message. */STATE tmscp_datagram_states[] = {    /* Process a datagram message.     */    { TAPE_DATAGRAM,	tmscp_invevent },		/* EV_NULL	      */    { TAPE_DATAGRAM,	tmscp_datagram },		/* EV_INITIAL	      */    { TAPE_DATAGRAM,	tmscp_invevent },		/* 		      */    { TAPE_DATAGRAM,	tmscp_invevent },		/* 		      */    { TAPE_DATAGRAM,	tmscp_invevent },		/* 		      */    { TAPE_DATAGRAM,	tmscp_invevent },		/* 		      */    { TAPE_DATAGRAM,	tmscp_invevent },		/* 		      */

⌨️ 快捷键说明

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