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

📄 mscp.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 3 页
字号:
#ifndef	lint static char *sccsid = "@(#)mscp.c	4.1	(ULTRIX)	7/17/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:	MSCP data structure formatter for the crash utility. * *   Abstract:	This module contains the routines used to display the *		contents of MSCP data structures.  Routines are also *		provided to traverse data structure lists. * *   Author:	Tim Burke	September 13, 1989 * *   Modification History: * *	23-Oct-1989	Tim Burke *	Added the print_uniq_id routine to display the contents of a  *	UNIQ_ID data structure. * *	22-Nov-1989	Tim Burke *	Added the print_lbhandle routine so that the local buffer handle *	field is properly translated as well as the following field which *	is the request block state. */#include 	<sys/types.h>#include 	<sys/buf.h>#include 	<sys/devio.h>#include 	<sys/mtio.h>#include 	<sys/param.h>#include	<fs/ufs/fs.h>#include	<io/scs/sca.h>#include	<io/ci/cippdsysap.h>#include	<io/ci/cisysap.h>#include	<io/msi/msisysap.h>#include	<io/uba/uqsysap.h>#include	<io/bi/bvpsysap.h>#include	<io/gvp/gvpsysap.h>#include	<io/sysap/sysap.h>#include	<io/sysap/mscp_msg.h>#include	<io/sysap/mscp_defs.h>#include	"crash.h"#include	<stdio.h>/* * Defines related to displaying MSCP data structures. *//* * MSCP sysap types */#define MSCP_TAPE	0x01		/* TMSCP - tape class subysstem */#define MSCP_DISK	0x02		/* MSCP  - disk class subysstem *//* * MSCP printing levels - controls ammount of output. */#define MSCP_PRINTFULL	0x01		/* Verbose printing		*/#define MSCP_PRINTBRIEF	0x02		/* Brief printing		*/#define DEVNAME_SIZE	80	/* String length for device name */char *token();c_mscp(c)	char *c;{	char *arg;	int index, majno, minno;	unsigned int addr;	arg = token();	if (arg == NULL) {		(void)printmscp(MSCP_TAPE | MSCP_DISK, MSCP_PRINTFULL);		return;	}	else if (strcmp(arg,"-disk") == 0) {		(void)printmscp(MSCP_DISK, MSCP_PRINTFULL);	}	else if (strcmp(arg,"-tape") == 0) {		(void)printmscp(MSCP_TAPE, MSCP_PRINTFULL);	}	else if (strcmp(arg,"-config") == 0) {		(void)printmscp(MSCP_TAPE|MSCP_DISK, MSCP_PRINTBRIEF);	}	else if (strcmp(arg,"-dtable") == 0) {		(void)print_unit_table(MSCP_DISK, MSCP_PRINTFULL);	}	else if (strcmp(arg,"-ttable") == 0) {		(void)print_unit_table(MSCP_TAPE, MSCP_PRINTFULL);	}	else if (strcmp(arg,"-connb") == 0) {		arg = token();		if (arg == NULL) {			printf("usage: -connb requires address\n");			return;		}		addr = scan_vaddr(arg);		(void)printmscp_connb(addr, MSCP_PRINTFULL);	}	else if (strcmp(arg,"-reqb") == 0) {		arg = token();		if (arg == NULL) {			printf("usage: -reqb requires address\n");			return;		}		addr = scan_vaddr(arg);		(void)printmscp_reqb(addr, MSCP_PRINTFULL);	}	else if (strcmp(arg,"-classb") == 0) {		arg = token();		if (arg == NULL) {			printf("usage: -classb requires address\n");			return;		}		addr = scan_vaddr(arg);		(void)printmscp_classb(addr, MSCP_PRINTFULL);	}	else if (strcmp(arg,"-unitb") == 0) {		arg = token();		if (arg == NULL) {			printf("usage: -unitb requires address\n");			return;		}		addr = scan_vaddr(arg);		(void)printmscp_unitb(addr, MSCP_PRINTFULL);	}	else if (strcmp(arg,"-devunit") == 0) {		arg = token();		if (arg == NULL) {			printf("usage: -devunit requires major/minor numbers\n");			return;		}		majno = atoi(arg);		arg = token();		if (arg == NULL) {			printf("usage: -devunit requires major/minor numbers\n");			return;		}		minno = atoi(arg);		(void)printmscp_devunit(majno, minno, MSCP_PRINTFULL);	}	else {		printf("Invalid mscp parameter: %s\n",arg);	}	while(token()!=NULL);}/* * *   Name:	printmscp	- Traverse and display data structs * *   Abstract:	This routine will start at the connection block and *	        traverse the data structures printing results. * *   Inputs:    subsys_name 	- The name of the particular subsystem. *		printmode	- Controlls output level. * *   Return	NONE *   Values: */int printmscp(subsys_name, printmode)    int		subsys_name;    int		printmode;{	CLASSB *mscp_classb;	CLASSB *tmscp_classb;	mscp_classb = (CLASSB *)Mscp_classb.s_value;	tmscp_classb = (CLASSB *)Tmscp_classb.s_value;	if (subsys_name & MSCP_DISK) {		printf("\n");		printf("MSCP SUBSYSTEM:\n");		printmscp_classb(mscp_classb, printmode);		mscp_follow_connections(mscp_classb, printmode);	}	if (subsys_name & MSCP_TAPE) {		printf("\n");		printf("TMSCP SUBSYSTEM:\n");		printmscp_classb(tmscp_classb, printmode);		mscp_follow_connections(tmscp_classb, printmode);	}}/* * *   Name:	mscp_follow_connections	- Follow a list of connection blocks *			starting with a class block pointer. * *   Abstract:	This routine is used to traverse the mscp connections. *		call the appropriate routine to print out the contents of *		the connection blocks. * *   Inputs:    classp	 	- Pointer to a class block *		printmode	- Controlls output level. * *   Return	NONE *   Values: */int mscp_follow_connections(classp, printmode)    CLASSB	*classp;    int		printmode;{	CLASSB class_st;	CONNB  conn_st, *conn_pt;	if (classp == 0) {		printf("\tNULL class block pointer\n");		return;	}	if(readmem((char *) &class_st, (int)classp, sizeof(CLASSB)) !=	    sizeof(CLASSB)) {		printf("could not read class block at 0x%x.\n",classp);		return;	}	if ((class_st.flink == class_st.blink) &&	    (class_st.flink == (CONNB *)classp)) {		printf("\n\tThis class block does not have any connections.\n");		return;	}		conn_pt = class_st.flink;	do {	    printmscp_connb(conn_pt, printmode);	    mscp_follow_units(conn_pt, printmode);	    if(readmem((char *) &conn_st, (int)conn_pt, sizeof(CONNB)) !=	        sizeof(CONNB)) {		    printf("could not read connection block at 0x%x\n",conn_pt);		    return;	    }	    conn_pt = conn_st.flink;	} while  (conn_pt != (CONNB *)classp);}/* * *   Name:	mscp_follow_units	- Follow a list of unit blocks *			starting with a connection block pointer. * *   Abstract:	This routine is used to traverse the mscp units. *		Call the appropriate routine to print out the contents of *		the unit blocks. * *   Inputs:    connp	 	- Pointer to a connection block *		printmode	- Controlls output level. * *   Return	NONE *   Values: */int mscp_follow_units(connp, printmode)    CONNB	*connp;    int		printmode;{	CONNB  conn_st;	UNITB  unit_st, *unit_pt;	char   *no_units;	int    offset;	if (connp == 0) {		printf("\tNULL connection block pointer\n");		return;	}	if(readmem((char *) &conn_st, (int)connp, sizeof(CONNB)) !=	    sizeof(CONNB)) {		printf("could not read connection block at 0x%x.\n",connp);		return;	}	/*	 * If there are no units the unit.flink and unit.blink will both point	 * to the address of the unit.flink which is the 4th element in the 	 * connection block data struct.  Set no_units to this address.	 */	offset = (int)(&conn_st.unit.flink) - (int)(&conn_st.flink);	no_units = (char *) ((char *)connp + offset);	if ((conn_st.unit.flink == conn_st.unit.blink) && 	    (conn_st.unit.flink == (UNITB *)no_units)) {		printf("\n\tThis connection block does not have any units.\n");		return;	}		unit_pt = conn_st.unit.flink;	do {	    printmscp_unitb(unit_pt, printmode);	    mscp_follow_reqb(unit_pt, printmode);	    if(readmem((char *) &unit_st, (int)unit_pt, sizeof(UNITB)) !=	        sizeof(UNITB)) {		    printf("could not read unit block at 0x%x\n",unit_pt);		    return;	    }	    unit_pt = unit_st.flink;	} while  (unit_pt != (UNITB *)no_units);}/* * *   Name:	mscp_follow_reqb	- Follow a list of request blocks *			starting with a unit block pointer. * *   Abstract:	This routine is used to traverse the mscp request queues. *		Call the appropriate routine to print out the contents of *		the request blocks. * *   Inputs:    unitp	 	- Pointer to a unit block *		printmode	- Controlls output level. * *   Return	NONE *   Values: */int mscp_follow_reqb(unitp, printmode)    UNITB	*unitp;    int		printmode;{	UNITB  unit_st;	REQB   reqb_st, *reqb_pt;	char   *no_req;	int    offset;	if (unitp == 0) {		printf("\tNULL unit block pointer\n");		return;	}	if(readmem((char *) &unit_st, (int)unitp, sizeof(UNITB)) !=	    sizeof(UNITB)) {		printf("could not read unit block at 0x%x.\n",unitp);		return;	}	/*	 * If there are no requests the request flink and request blink 	 * will both point	 * to the address of the request queue which is the 5th element in the 	 * unit block data struct.  Set no_req to this address.

⌨️ 快捷键说明

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