📄 scs_error.c
字号:
#ifndef lintstatic char *sccsid = "@(#)scs_error.c 4.1 (ULTRIX) 7/2/90";#endif lint/************************************************************************ * * * Copyright (c) 1989 by * * Digital Equipment Corporation, Maynard, MA * * All rights reserved. * * * * This software is furnished under a license and may be used and * * copied only in accordance with the terms of such license and * * with the inclusion of the above copyright notice. This * * software or any other copies thereof may not be provided or * * otherwise made available to any other person. No title to and * * ownership of the software is hereby transferred. * * * * The information in this software is subject to change without * * notice and should not be construed as a commitment by Digital * * Equipment Corporation. * * * * Digital assumes no responsibility for the use or reliability * * of its software on equipment which is not supplied by Digital. * * * ************************************************************************ * * * Facility: Systems Communication Architecture * Systems Communication Services * * Abstract: This module contains Systems Communication Services( SCS ) * error processing routines and functions. * * Creator: Todd M. Katz Creation Date: February 10, 1989 * * Function/Routines: * * scs_abort_conn Abort Establishment of SCS Connection * scs_console_log Log SCS Events to Console Terminal * scs_log_event Log Local SCS SYSAP/Connection Specific Events * * Modification History: * * 19-Sep-1989 Pete Keilty * Added SCS errlogging level support. * * 13-May-1989 Todd M. Katz TMK0003 * Include header file smp_lock.h and rename external variable * sca_lk_db -> lk_scadb. * * 22-Mar-1989 Todd M. Katz TMK0002 * Fix several problems within the routine scs_log_event(): * 1. Correctly position to optional SCS event portions of error log * records. * 2. Correctly initialize remote system node name, remote system * identification number, and remote station address fields within * optional SCS connection information portions of error log records. * * 11-Feb-1989 Todd M. Katz TMK0001 * Add support for SCS event logging. Log local SYSAP initiated abortions * of SCS connection establishment. *//* Libraries and Include Files. */#include "../h/types.h"#include "../h/time.h"#include "../h/param.h"#include "../h/ksched.h"#include "../h/dyntypes.h"#include "../h/limits.h"#include "../h/utsname.h"#ifdef vax#include "../machine/mtpr.h"#endif vax#ifdef mips#include "../h/systm.h"#include "../h/vmmac.h"#endif mips#include "../machine/cpu.h"#include "../h/kmalloc.h"#include "../h/errlog.h"#include "../io/scs/sca.h"#include "../io/scs/scaparam.h"#include "../io/ci/cippdsysap.h"#include "../io/ci/cisysap.h"#include "../io/msi/msisysap.h"#include "../io/bi/bvpsysap.h"#include "../io/gvp/gvpsysap.h"#include "../io/uba/uqsysap.h"#include "../io/sysap/sysap.h"#include "../io/ci/cippdscs.h"#include "../io/ci/ciscs.h"#include "../io/msi/msiscs.h"#include "../io/bi/bvpscs.h"#include "../io/gvp/gvpscs.h"#include "../io/uba/uqscs.h"#include "../io/scs/scs.h"/* External Variables and Routines. */extern SCSIB lscs;extern struct lock_t lk_scadb;extern CBVTDB *scs_cbvtdb;extern u_short scs_severity;extern u_short scs_errlog;extern CLSTAB scs_cltab[ ES_W + 1 ];extern struct el_rec *ealloc();extern void scs_console_log(), scs_dealloc_cb(), scs_init_cmsb(), scs_log_event();/* Name: scs_abort_conn - Abort Establishment of SCS Connection * * Abstract: This routine completes the abortion of logical SCS connection. * The SYSAP initiating and aborting the connection is * asynchronously notified of the abortion of connection * establishment through invocation of its control event routine. * * An abortion is triggered only by a SYSAP requesting termination * of a connection it had initiated before its counterpart has * responded by accepting or rejecting the connection request. * This routine is always invoked by forking to it. * * Connection abortion involves CB removal from all internal * resource queues and the system-wide configuration database and * its deallocation along with all associated resources. The * CBVTE referencing the CB is also deallocated. * * Inputs: * * IPL_SOFTCLOCK - Interrupt processor level * cb - Connection Block pointer * cinfo.cstate - CS_CONN_SNT or CS_CONN_ACK * cinfo.status.abort_fork - 1 * lk_scadb - SCA database lock structure * * Outputs: * * IPL_SOFTCLOCK - Interrupt processor level * pb - Path Block pointer * pinfo.nconns - Number of connections * * SMP: The SCA database is locked for CB removal from the system-wide * configuration database and CBVTE deallocation. * * The CB is locked to synchronize access and for deletion. It is * indirectly locked through its CBVTE. Locking the CB also * prevents PB deletion as required by scs_init_cmsb(). */voidscs_abort_conn( id ) u_long id;{ CMSB cmsb; register CB *cb; register CBVTE *cbvte; register void ( *control )(); register u_long save_ipl = Splscs(); /* The steps involved in aborting SCS connection establishment are: * * 1. IPL is synchronized to IPL_SCS( IPL was lowered through forking ). * 2. Lock the SCA database. * 3. Retrieve and lock the CB. * 4. Log abortion of SCS connection establishment. * 5. Close the aborted connection. * 6. Remove the CB from the system-wide configuration database. * 7. Deallocate the CB along with all associated resources. * 8. Unlock the CB. * 9. Unlock the SCA database. * 10. Notify the local SYSAP of the abortion of connection establishment. * 11. Restore IPL before returning. * * Failure to retrieve the CB is not treated as an error. The path over * which the connection was to be established is assumed to have failed and * the CB deallocated during the PB clean up following path failure. */ Lock_scadb() if((( CONNID * )&id )->index > ( lscs.max_conns - 1 )) { ( void )panic( SCSPANIC_ABORT ); } cbvte = Get_cbvte((*( CONNID * )&id)); Lock_cbvte( cbvte ) if((( CONNID * )&id )->seq_num == cbvte->connid.seq_num ) { cb = Get_cb( cbvte ); if( !cb->cinfo.status.abort_fork || ( cb->cinfo.cstate != CS_CONN_SNT && cb->cinfo.cstate != CS_CONN_ACK )) { ( void )panic( SCSPANIC_NABORT ); } ( void )scs_init_cmsb( CRE_CONN_DONE, ADR_DISCONN, &cmsb, cb, cb->pb, 0 ); control = cb->control; ( void )scs_log_event( cb, W_ABORT_FCONN, CONN_EVENT ); Remove_cb( cb, cb->pb ) } else { cb = NULL; } Unlock_cbvte( cbvte ) Unlock_scadb() if( cb ) { ( void )( *control )( CRE_CONN_DONE, &cmsb ); } ( void )splx( save_ipl );}/* Name: scs_console_log - Log SCS Events to Console Terminal * * Abstract: This routine logs SCS events to the console terminal. The * event is always one of the following types: * * CONN_EVENT - Connection specific event * LSYSAP_EVENT - Local SYSAP specific event * * Explicit formatting information must be provided for each * event. This requires updating of the following tables each * time a new event is defined: * * 1. The appropriate entry within the SCS console logging table( * scs_cltab[] ) must be updated to reflect the new maximum * code represented within the associated format table. * * 2. The associated format table itself( scs_cli[], scs_clw[] ) * must be updated with both the class of variable information * and exact text to be displayed. However, the appropriate * table should be updated with a NULL entry when SCS is * specifically NOT to log the new event. Currently, no such * events fall into this category. * * NOTE: Console logging of events is bypassed whenever the event * severity does not warrant console logging according to * the current SCS severity level( scs_severity ). Such * bypassing is overridden when the ECLAWAYS bit is set in * the event code indicating that the event is always to be * logged regardless of the current severity level. * * NOTE: This routine does not log path specific error or severe * error events, all of which are candidates for application * of the path crash severity modifier( ESM_PC ). Logging * of such events is currently the responsibility of the * individual port drivers. * * Inputs: * * IPL_SCS - Interrupt processor level * cb - Connection Block pointer * event - Event logging code * event_type - CONN_EVENT, LSYSAP_EVENT * scs_cltab - SCS Console logging formatting table * scs_severity - SCS console logging severity level * * Outputs: * * IPL_SCS - Interrupt processor level * * SMP: The CB is locked( EXTERNALLY ) to synchronize access and * prevent premature deletion. It is locked through its CBVTE. * * PBs and PCCBs do NOT require locking when provided because only * static fields are accessed and because PBs are prevented from * deletion be EXTERNAL CB locks. SBs NEVER require locking. */void
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -