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

📄 mscp.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
📖 第 1 页 / 共 3 页
字号:
	printf("\n\t-----------------  UNIT BLOCK  ------------------------\n");	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 (printmode & MSCP_PRINTFULL) {	printf("\tUnit block address is 0x%x\n",unitp);	printf("\tUnit block list: \(flink\) 0x%x, \(blink\) 0x%x\n",		unit_st.flink, unit_st.blink);	printf("\tConnection block: 0x%x, ubadev: 0x%x\n",		unit_st.connb, unit_st.ubdev);	printf("\tRequest block list: \(flink\) 0x%x, \(blink\) 0x%x\n",		unit_st.request.flink, unit_st.request.blink);	printf("\tState: 0x%x\n", unit_st.state);	printf("\tFlags: ");		if (unit_st.flags.alonl)			printf("alonl ");		if (unit_st.flags.busy)			printf("busy ");		if (unit_st.flags.online)			printf("online ");		if (unit_st.flags.online_ip)			printf("online_ip ");		if (unit_st.flags.close_ip)			printf("close_ip ");		if (unit_st.flags.rct_pres)			printf("rct_pres ");		if (unit_st.flags.wrtp)			printf("wrtp ");		if (unit_st.flags.force_scan_ip)			printf("force_scan_ip ");		if (unit_st.flags.wait_bump)			printf("wait_bump ");		if (unit_st.flags.excl_acc)			printf("excl_acc ");		if (unit_st.flags.mscp_wait)			printf("mscp_wait ");	printf("\n");	printf("\tUnit number: %d\n", unit_st.unit);	printf("\tResource wait counter: %d, partition mask: %d, dev: 0x%x\n",		unit_st.rwaitct, unit_st.part_mask, unit_st.dev);	printf("\tMulti-unit code: %d, Unit flags: 0x%x:\n",		unit_st.mult_unt, unit_st.unt_flgs);	print_uniq_id(&unit_st.unit_id);	mscp_media_to_ascii( unit_st.media_id, device_name );	printf("\tMedia ID: \(0x%x\) %s\n", unit_st.media_id, device_name);	printf("\tShadow unit: %d, shadow status: 0x%x\n",		unit_st.shdw_unt, unit_st.shdw_sts);	printf("\tTrack size: %d, group size: %d, cylinder size: %d\n",		unit_st.track, unit_st.group, unit_st.cylinder);	printf("\tUnit SW version: %d, unit HW version: %d, RCT size: %d\n",		unit_st.unit_svr, unit_st.unit_hvr, unit_st.rct_size);	printf("\tRBNs per track: %d, RCT copies: %d, unit size: %d\n",		unit_st.rbns, unit_st.rct_cpys, unit_st.unt_size);	printf("\tVolume serial: %d, total size: %d, 1st bad lbn: %d\n",		unit_st.vol_ser, unit_st.tot_size, unit_st.acc_badlbn);	printf("\tAccess byte ct: %d, access status: 0x%x, access flags: 0x%x\n"		,unit_st.acc_bytecnt, unit_st.acc_status, unit_st.acc_flags);	printf("\tTms soft errors: %d, tms hard errors: %d\n",		unit_st.tms_softcnt, unit_st.tms_hardcnt);	printf("\tTms category: 0x%x, tms position: 0x%x, tms max xfer 0x%x\n",		unit_st.tms_category_flags, unit_st.tms_position, 		unit_st.tms_bcount);	printf("\tTms format: 0x%x, tms speed: 0x%x\n",		unit_st.tms_format, unit_st.tms_speed);	printf("\tTms noise: 0x%x, tms format menu: 0x%x\n",		unit_st.tms_noise, unit_st.format_menu);	printf("\tTms state flags: ");		if (unit_st.state_flags.Sflags.tms_serex)			printf("tms_serex ");		if (unit_st.state_flags.Sflags.tms_clserex)			printf("tms_clserex ");		if (unit_st.state_flags.Sflags.tms_eom)			printf("tms_eom ");		if (unit_st.state_flags.Sflags.tms_tm)			printf("tms_tm ");		if (unit_st.state_flags.Sflags.tms_write)			printf("tms_write ");		if (unit_st.state_flags.Sflags.tms_lost)			printf("tms_lost ");		if (unit_st.state_flags.Sflags.tms_bufmark)			printf("tms_bufmark ");		if (unit_st.state_flags.Sflags.tms_cach)			printf("tms_cach ");		if (unit_st.state_flags.Sflags.tms_cach_on)			printf("tms_cach_on ");		if (unit_st.state_flags.Sflags.tms_cache_lost)			printf("tms_cache_lost ");		if (unit_st.state_flags.Sflags.tms_inuse)			printf("tms_inuse ");		if (unit_st.state_flags.Sflags.tms_wait)			printf("tms_wait ");		if (unit_st.state_flags.Sflags.tms_cach_write)			printf("tms_cach_write ");	printf("\n");	printf("\tSel: 0x%x, tms endcode: 0x%x, tms status: 0x%x\n",		unit_st.sel, unit_st.tms_endcode, unit_st.tms_status);	printf("\tTms flags: 0x%x, tms resid: %d, command reference: 0x%x\n",		unit_st.tms_flags, unit_st.tms_resid, unit_st.cmd_ref);	printf("\tRecovery location: 0x%x\n",unit_st.tms_recovery_location);	printf("\tMedia type: ");	if (unit_st.mscp_device)		printf("%s\n", unit_st.mscp_device);	else		printf("NULL\n");	printf("\tPartition info struct: 0x%x\n",unit_st.part_info);	printf("\tEmbedded raw buf struct: 0x%x\n",unit_st.rawbuf);	printf("\tEmbedded ioctl buf struct: 0x%x\n",unit_st.ioctlbuf);    }    else if (printmode & MSCP_PRINTBRIEF) {	printf("\tUnit block address is 0x%x\n",unitp);	printf("\tUnit number: %d, ", unit_st.unit);	mscp_media_to_ascii( unit_st.media_id, device_name );	printf("\tMedia ID: %s\n", device_name);    }}/* * *   Name:	mscp_media_to_ascii - Convert MSCP media code to ASCII. * *   Abstract:	Convert the mscp media identifier to an ascii string. *		Don't ask me how this works! * *   Inputs:    media	The mscp media id number. *		ascii	A character array which will contain the ascii string *			corresponding to the media id number. * *   Outputs:	NONE * * *   Return	NONE *   Values: */mscp_media_to_ascii( media, ascii )    register u_long		media;    register u_char		*ascii;{    register u_long		temp;    *ascii++ = (( media >> 17 ) & 0x1f ) + 'A' - 1;    if( temp = (( media >> 12 ) & 0x1f )) {	*ascii++ = ( temp + 'A' - 1 );	if( temp = (( media >> 7 ) & 0x1f ))	    *ascii++ = ( temp + 'A' - 1 );    }    *ascii++ = (( media & 0x7f ) / 10 ) + '0';    *ascii++ = (( media & 0x7f ) % 10 ) + '0';    *ascii = '\0';}/* * *   Name:      print_unit_table        - Display unit table. * *   Abstract:  This routine will print out the unit blocks in the unit *              table.  It uses global symbols (mscp_unit_tbl and *              tmscp_unit_tbl) to determine the starting address of the *              tables. * *   Inputs:    subsys_name     - The name of the particular subsystem. *              printmode       - Controlls output level. * *   Return     NONE *   Values: */intprint_unit_table(subsys_name, printmode)    int         subsys_name;    int         printmode;{        UNITB *unitb_addr;	int   *unit_ptr;        int   slot_number, numslots;	char  title[80], tablename[80];        if (subsys_name & MSCP_DISK) {		strcpy(title,"MSCP DISK UNIT TABLE");		strcpy(tablename,"mscp_unit_tbl");		unit_ptr = (int *)Mscp_utable.s_value;		numslots = NUNIT;	}        if (subsys_name & MSCP_TAPE) {		strcpy(title,"TMSCP TAPE UNIT TABLE");		strcpy(tablename,"tmscp_unit_tbl");		unit_ptr = (int *)Tmscp_utable.s_value;		numslots = NTUNIT;	}       printf("\n");       printf("%s \(0x%x\):\n",title, unit_ptr);       for (slot_number = 0; slot_number < numslots; slot_number++) {		if (unit_ptr == 0) {			printf("\tNULL unit block pointer\n");			return;		}		if(readmem((char *) &unitb_addr, (int)unit_ptr, 			sizeof(UNITB *)) != sizeof(UNITB *)) {    					printf("could not read unit block pointer at 0x%x.\n",unit_ptr);			return;		}		printf("%s[%d] : ",tablename, slot_number);		if (unitb_addr != 0)			printmscp_unitb(unitb_addr, printmode);		else			printf(" NULL\n");                unit_ptr++;       }}/* * *   Name:	printmscp_devunit	- Print unit block for a given dev_t. * *   Abstract:	Print out the contents of a unit block that corresponds to the *		major and minor number passed in as agruments. * *   Inputs:    majno		- Major number of device special file. *   		minno		- Minor number of device special file. *		printmode	- Controlls output level. * *   Return	NONE *   Values: */int printmscp_devunit(majno, minno, printmode)    int		majno;    int		minno;    int		printmode;{	dev_t devt;	int   unit_number;        UNITB *unitb_addr;	int  *unit_ptr;		/*	 * Setup the dev_t with the low 8 bits as the minor number and the 	 * high 8 bits as the major number.	 */	devt = minno & 0xFF;	devt |= (majno & 0xFF) << 8;	/*	 * Make sure the major/minor pairs correspond to an MSCP disk or a 	 * TMSCP tape.  MSCP disks are in a range of major numbers; the	 * MSCP character special devs are checked by MSCP_C_DEV, the MSCP	 * block devices are checked by MSCP_B_DEV.  For TMSCP devices the 	 * character major number is 36 and the block special file is not	 * supported.	 */	if ((MSCP_C_DEV(devt) == 0) && (MSCP_B_DEV(devt) == 0) &&		(majno != 36) ) {		printf("The dev_t 0x%x does not correspond to an MSCP device\n",			devt);		return;	}	/*	 * Make sure the unit number looks reasonable.	 * Setup unit_ptr to point to the base of the corresponding unit table.	 */	if (majno == 36) {	/* TMSCP */		unit_number = UNIT(devt);		if (unit_number > NUNIT) {			printf("Specified unit %d is > max unit number %d\n", 				unit_number, NUNIT);			return;		}		unit_ptr = (int *)Tmscp_utable.s_value;	}	else {			/* MSCP */		unit_number = Ux(devt);		if (unit_number > NUNIT) {			printf("Specified unit %d is > max unit number %d\n", 				unit_number, NUNIT);			return;		}		unit_ptr = (int *)Mscp_utable.s_value;	}	/*	 * Offset within the unit table to the appropriate unit block and 	 * print out the contents.	 */	unit_ptr += unit_number;	if(readmem((char *) &unitb_addr, (int)unit_ptr, 		sizeof(UNITB *)) != sizeof(UNITB *)) {		printf("could not read unit block pointer at 0x%x.\n",unit_ptr);		return;	}	printmscp_unitb(unitb_addr, printmode);}/* * *   Name:	print_uniq_id	- Print  out a UNIQ_ID structure * *   Abstract:	Print out the contents of a UNIQ_ID structure.  This involves *		translating the 3 elements of the structure. * *   Inputs:    uniq_id		- pointer to a UNIQ_ID data struct * *   Return	NONE *   Values: */int print_uniq_id(uniq_id)	UNIQ_ID *uniq_id;{	printf("\tDevice_no: 0x%x, ", uniq_id->device_no);	printf("Model number: %d, Device class: %d \(",		uniq_id->model, uniq_id->class);	/*	 * This should be done by reading in the "cu_class" table and	 * looking for matches there.	 */	switch( uniq_id->class ) {		case 0:	printf("Reserved"); break;		case 1:	printf("Mass storage"); break;		case 2:	printf("Disk"); break;		case 3:	printf("Tape"); break;		case 4:	printf("Disk"); break;		case 5:	printf("Loader"); break;		default: printf("Unknown");	}	printf("\)\n");}/* * *   Name:	print_lbhandle	- Local Buffer Handle * *   Abstract:	Print out the contents of a BHANDLE structure.  This involves *		translating the 3 elements of the structure. * *   Inputs:    lbhandle	- pointer to a BHANDLE data struct * *   Return	NONE *   Values: */int print_lbhandle(lbhandle)	BHANDLE *lbhandle;{	printf("\tLocal Buffer Handle: ");	/*	 * This should be enhanced to more fully display the pd element.	 */	printf("pd handle not translated, ");	printf("scsid 0x%x",lbhandle->scsid);	printf("\n");}

⌨️ 快捷键说明

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