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

📄 mscp_config.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 2 页
字号:
		     cp->cnt_name,		     cp->cnt_number );	else	    printf( "mscp_find_controller: %s%d not config'ed\n",		     cp->cnt_name,		     cp->cnt_number );	um = NULL;    }    cp->ubctlr = um;    return;}/**/#define PTS_SAME_CTLR		20#define PTS_SAME_SLAVE		18#define PTS_WILD_CTLR		17#define PTS_WILD_SLAVE		16#define PTS_SAME_DRIVER		3#define PTS_EXACT_MATCH		PTS_SAME_DRIVER+PTS_SAME_CTLR+PTS_SAME_SLAVE/* * *   Name:	mscp_finddevice - Find unit in Unibus database. * *   Abstract:	 * *   Inputs: * *   Outputs: * * *   Return	NONE *   Values: */voidmscp_find_device( up )    register UNITB		*up;{    register struct uba_ctlr	*um = up->connb->ubctlr;    register char		*devname = up->connb->classb->dev_name;    register struct uba_device	*ui;    u_long			bestpoints = 0;    struct uba_device		*bestui= NULL;    char			name_string[10];    /* Scan the "Unibus" device data base, looking for the best     * match on device name, slave unit number, controller     * number and controller name.     */    for( ui = ubdinit; ui->ui_driver; ui++ ) {	register u_long		points = 0;	if ( !ui->ui_alive  && !mscp_strcmp( ui->ui_devname, devname )) {	    if( ui->ui_driver == um->um_driver ) {		points += PTS_SAME_DRIVER;		if( ui->ui_ctlr == um->um_ctlr ) points += PTS_SAME_CTLR;		else if( ui->ui_ctlr == '?' ) points += PTS_WILD_CTLR;		if( ui->ui_slave == up->unit ) points += PTS_SAME_SLAVE;		else if( ui->ui_slave == -1 ) points += PTS_WILD_SLAVE;	    } else if( ui->ui_driver == ( struct uba_driver * )&mscpdriver ) {		points += PTS_WILD_CTLR;		if( ui->ui_slave == up->unit ) points += PTS_SAME_SLAVE;		else if( ui->ui_slave == -1 ) points += PTS_WILD_SLAVE;	    }	    if( points > bestpoints ) {		bestpoints = points;		bestui = ui;	    }	    if( points == PTS_EXACT_MATCH )		break;	}    }    if( bestpoints >= ( PTS_WILD_CTLR + PTS_WILD_SLAVE )) {	register UNITB		**unit_tbl = up->connb->classb->unit_tbl;	ui = bestui;	if( unit_tbl[ ui->ui_unit ] == NULL ) {	    unit_tbl[ ui->ui_unit ] = up;	    ui->ui_alive = 1;	    ui->ui_driver = um->um_driver;	    ui->ui_ctlr = um->um_ctlr;	    ui->ui_slave = up->unit;	    ui->ui_ubanum = um->um_ubanum;	    ui->ui_adpt = um->um_adpt;	    ui->ui_nexus = um->um_nexus;	    ui->ui_rctlr = um->um_rctlr;	    ui->ui_hd = um->um_hd;	    ui->ui_addr = um->um_addr;	    if (ui->ui_addr != 0) {		ui->ui_physaddr = ( caddr_t )svtophy( ui->ui_addr );	    }	    ui->ui_mi = um;	    if((up->connb->classb->flags.disk) && (dkn < DK_NDRIVE)) {		ui->ui_dk = dkn++;	    }	    else {		ui->ui_dk = -1;	    }	    up->ubdev = ui;	    mscp_media_to_ascii( up->media_id, name_string );	    printf( "%s%d at %s%d slave %d (%s)\n",		ui->ui_devname, ui->ui_unit, um->um_ctlrname,		um->um_ctlr, ui->ui_slave, name_string );	}    }    return;}/**//* * *   Name:	mscp_find_model - Find controller model information * *   Abstract:	This routine fills in the connection block with *		model dependent information. * *   Inputs:	cp			Connection block pointer *		    cnt_id.model	Controller model number *		    rport_addr		Remote port address *   		model_tbl		Controller model table *		    bus_type		I/O bus type *		    config_name		Config's controller name  *		    host_timeout	Host timeout period (s.) *		    model		Controller model number *		    name		Controller model name *		model_ct		Controller model table entry count * *   Outputs:	cp			Connection block pointer *		    bus_type		I/O bus type *		    cnt_name		Config's controller name *		    cnt_number		Config's controller number *		    model_name		Controller model name * *   Return	NONE *   Values: */voidmscp_find_model( cp )    register CONNB	*cp;{    register MODEL	*modp;    ISB			isb;    LPIB		lpib;    /* Search the model table for an entry that matches the controller     * model number in the connection block.  If there is no matching     * entry, use the permanently reserved entry at the front of the model     * table.     * Fill in the connection block from the model table and extract     * the controller number from the remote port address.  If the bus     * type is unknown, get local port information from SCS and use     * the port type to determine the bus type and the controller name     * used by config.     */    for( modp = model_tbl;	 modp < model_tbl + model_ct &&	 cp->cnt_id.model > modp->model;	 modp++ ) {}    if( cp->cnt_id.model != modp->model ) {	modp = model_tbl;    }    cp->model_name = ( u_char * )modp->name;    cp->cnt_number =  Scaaddr_low( cp->rport_addr );    cp->cnt_name = "ERROR";    cp->bus_type = DEV_UNKBUS;    isb.next_lport_name = cp->lport_name;    if( scs_info_lport( &isb, &lpib ) == RET_SUCCESS ) {	switch( lpib.type.swtype ) {	case	SPT_UQSSP:	    cp->cnt_name = "uq";	    switch( lpib.type.ictype ) {	    case	ICT_BI:		cp->bus_type = DEV_BI;		break;	    case	ICT_XMI:		cp->bus_type = DEV_XMI;		break;	    case	ICT_UB:		cp->bus_type = DEV_UB;		break;	    case	ICT_QB:		cp->bus_type = DEV_QB;		break;	    default:		break;	    }	    break;	case	SPT_CI:	    cp->cnt_name = "hsc";	    switch( lpib.type.ictype ) {	    case	ICT_BI:		cp->bus_type = DEV_BICI;		break;	    case	ICT_XMI:		cp->bus_type = DEV_XMICI;		break;	    default:	        cp->bus_type = DEV_CI;	        break;	    }	    break;	case SPT_BVPSSP:	    cp->cnt_name = "bvpssp";	    cp->bus_type = DEV_BI;	    break;	case	SPT_MSI:	    cp->cnt_name = "dssc";	    cp->bus_type = DEV_MSI;	    break;	default:	    break;	}    }}/**//* * *   Name:	mscp_strcmp - Compare character strings for equality. * *   Abstract:	 * *   Inputs: * *   Outputs: * * *   Return	NONE *   Values: */intmscp_strcmp( s, t )    register u_char	*s;    register u_char	*t;{    while( *s == *t++ ) {	/* If end of string with all corresponding characters equal,	 * return equality.	 */	if( *s++ == '\0' )	    return( 0 );    }    /* Exit with inequality.     */    return( 1 );}/**//* * *   Name:	mscp_adapt_check - Check whether this controller attaches  *				   to this adapter as specified by the  *				   configuration. * *   Abstract:	Checks whether this controller attaches to this adapter *		as specified by the configuration. * * *   Inputs:  cmsb		Connection management service block *		rport_addr	Remote port address *		lport_name	Local port name and number * *   Outputs: * * *   Return *   Values: RET_SUCCESS = 1 *	     FAILURE     = 0 */intmscp_adapt_check( cmsb )    register CMSB 	*cmsb;{    register struct uba_ctlr	*um;    register struct config_adpt *ap;    register char		*cp;    register u_long		cnt_num = Scaaddr_low( cmsb->rport_addr );    register u_long		adapt_num = Ctrl_from_name( cmsb->lport_name );    register u_long		found = 0;    cp = (char *)&cmsb->lport_name;    if(( *cp == 'c' ) && ( *(cp+1) == 'i' )) {	for( um = ubminit; um->um_driver; um++ )	    if(( mscp_strcmp( um->um_ctlrname, "hsc" ) == 0 )		&& um->um_rctlr == cnt_num )		break;	if( um->um_driver ) {	    for( ap = config_adpt; ap->p_name; ap++ )		if(( ap->c_name == ( char * )um->um_driver ) && 		    ( ap->c_num == um->um_ctlr ) &&		    ( ap->c_type == 'C' ) &&		    ( mscp_strcmp( ap->p_name, "ci" ) == 0 ) &&		    ( ap->p_num == adapt_num || ap->p_num == '?' )) {   		    found = RET_SUCCESS;		    break;		}	}    } else {   	found = RET_SUCCESS;    }    return( found );}

⌨️ 快捷键说明

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