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

📄 dteei.c

📁 Linux磁盘测试的源代码,测试磁盘的读写性能
💻 C
📖 第 1 页 / 共 5 页
字号:
	Fprint (" - ");	if (eei->flags & EEI_CAM_STATUS_VALID)		Fprint ("CAM_STATUS ");	if (eei->flags & EEI_SCSI_STATUS_VALID)		Fprint ("SCSI_STATUS ");	if (eei->flags & EEI_SCSI_SENSE_VALID)		Fprint ("SCSI_SENSE ");	if (eei->flags & EEI_CAM_DATA_VALID)		Fprint ("CAM_DATA");	Fprint("\n");	PrintAscii ("CAM Status", "", DNL);	if (eei->flags & EEI_CAM_STATUS_VALID) {	    print_cam_status (eei->arch.cam.cam_status);	} else {	    Fprint ("%s\n", not_valid_str);	}	PrintAscii ("SCSI Status", "", DNL);	if (eei->flags & EEI_SCSI_STATUS_VALID) {	    print_scsi_status(eei->arch.cam.scsi_status);	} else {	    Fprint ("%s\n", not_valid_str);	}	if (eei->flags & EEI_SCSI_SENSE_VALID) {	    print_sense_data (eei->arch.cam.scsi_sense);	} else {	    PrintAscii ("SCSI Sense Data", not_valid_str, PNL);	}}/* * Dissect the mt_erreg field of the mtget structure */voidprint_erreg(short erreg){	Fprint ("(%s)\n", cdbg_SenseKeyTable[erreg&0xF]);	if (erreg & 0xE0) {	/* check these three flags */		Fprint("\t\t\t");		if (erreg & FILE_MARK)			Fprint("FILE_MARK ");		if (erreg & EOM)			Fprint("EOM ");		if (erreg & ILI)			Fprint("ILI ");		Fprint("\n");	}}/* * Display the EEI status code: */voidprint_eei_status(u_int eei_status){	Fprint ("%s (%#x) - %s\n",		cdbg_EEIStatus(eei_status, CDBG_BRIEF),		eei_status, cdbg_EEIStatus(eei_status, CDBG_FULL));}/* * Dissect the cam_status field of the mtget structure */voidprint_cam_status(u_int cam_status){	Fprint ("%s (%#x) - %s\n",		cdbg_CamStatus(cam_status, CDBG_BRIEF),		cam_status, cdbg_CamStatus(cam_status, CDBG_FULL));}/* * Dissect the scsi_status field of the mtget structure */voidprint_scsi_status(u_char scsi_status){	Fprint ("%s (%#x) - %s\n",		cdbg_ScsiStatus(scsi_status, CDBG_BRIEF),		scsi_status, cdbg_ScsiStatus(scsi_status, CDBG_FULL));}/* * Print the SCSI sense data. */voidprint_sense_data(u_char *scsi_sense_ptr){	struct all_req_sns_data *sdp = (struct all_req_sns_data *) scsi_sense_ptr;	int sense_length = (int) sdp->addition_len + 8;	u_short ascq;	u_int info;	Fprint ("\nSCSI Request Sense Information:\n\n");	PrintHex ("Error Code", sdp->error_code, DNL);	if (sdp->error_code == ALL_IMED_ERR_CODE) {	    Fprint (" (Current Error)\n");	} else if (sdp->error_code == ALL_DEFER_ERR_CODE) {	    Fprint (" (Deferred Error)\n");	} else if (sdp->error_code == ALL_VENDOR_SPECIFIC) {	    Fprint (" (Vendor Specific)\n");	} else {	    Fprint ("\n");	}	PrintHex ("Valid Bit", sdp->valid, DNL);	Fprint ("%s\n", (sdp->valid) ? " (Information field is valid)" : "");	PrintHex ("Segment Number", sdp->segment, PNL);	PrintHex ("Sense Key", sdp->sns_key, DNL);	Fprint (" (%s)\n", cdbg_SenseKeyTable[sdp->sns_key]);	PrintHex ("Illegal Length", sdp->ili, PNL);	PrintHex ("End Of Media", sdp->eom, PNL);	PrintHex ("File Mark", sdp->filemark, PNL);	info = (u_int)( ((u_int)sdp->info_byte3 << 24) +			((u_int)sdp->info_byte2 << 16) +			((u_int)sdp->info_byte1 << 8) +			 (sdp->info_byte0) );	PrintHex ("Information Field", info, (info) ? DNL : PNL);	if (info) Fprint (" (%d)\n", info);	PrintHex ("Additional Sense Length", sdp->addition_len, PNL);	if ( (sense_length -= 8) > 0) {	    info = (u_int)( ((u_int)sdp->cmd_specific3 << 24) +			    ((u_int)sdp->cmd_specific2 << 16) +			    ((u_int)sdp->cmd_specific1 << 8) +			     (sdp->cmd_specific0) );	    PrintHex ("Command Specific Information", info, (info) ? DNL : PNL);	    if (info) Fprint (" (%d)\n", info);	    sense_length -= 4;	}	if (sense_length > 0) {	    char *ascq_msg = cdbg_SenseMessage (sdp);	    ASCQ_TO_USHORT (sdp, ascq);	    PrintAscii ("Additional Sense Code/Qualifier", "", DNL);	    Fprint ("(%#x, %#x) = %s\n", sdp->asc, sdp->asq,					(ascq_msg) ? ascq_msg : "Unknown");	    sense_length -= 2;	}	if (sense_length-- > 0) {	    PrintHex ("Field Replaceable Unit Code", sdp->fru, PNL);	}	/*	 * Sense specific sense data.	 */	if (sense_length > 0) {	    struct all_sks_ill_req *sksi;	    sksi = &sdp->sense_specific.sks_ill_req;	    if (sksi->sksv && (sdp->sns_key == ALL_ILLEGAL_REQ) ) {		u_short field_ptr = ((sksi->field_ptr1 << 8) + sksi->field_ptr0);		PrintHex ("Bit Pointer to Field in Error", sksi->bit_pointer,					(sksi->bit_pointer) ? DNL : PNL);		if (sksi->bpv) {		    Fprint (" (valid, bit %u)\n", (sksi->bit_pointer + 1));		}		PrintHex ("Error Field Command/Data (C/D)", sksi->c_or_d, DNL);		Fprint (" (%s)\n", (sksi->c_or_d) ? "Illegal parameter in CDB bytes"						  : "Illegal parameter in Data Sent");		PrintHex ("Byte Pointer to Field in Error", field_ptr,						(field_ptr) ? DNL : PNL);		if (field_ptr) {		    Fprint (" (byte %u)\n", (field_ptr + 1)); /* zero-based */		}		sense_length -= sizeof(*sksi);	    } else if (sksi->sksv && ( (sdp->sns_key == ALL_RECOVER_ERR) ||				       (sdp->sns_key == ALL_HARDWARE_ERR) ||				       (sdp->sns_key == ALL_MEDIUM_ERR) ) ) {		struct all_sks_retry_cnt *sksr;		sksr = &sdp->sense_specific.sks_retry_cnt;		PrintHex ("Actual Retry Count",			    ((sksr->retry_cnt1 << 8) + sksr->retry_cnt0), PNL);		sense_length -= sizeof(*sksr);	    } else if (sksi->sksv && (sdp->sns_key == ALL_NOT_READY) &&				     (ascq == ASCQ_LUN_NRDY_FMT) ) {		u_short progress;		struct all_sks_prog_cnt *sksp;		sksp = &sdp->sense_specific.sks_prog_cnt;		progress = ((sksp->progress1 << 8) + sksp->progress0);		PrintDecimal ("Format Progress Indication", progress, DNL);		/*Fprint (" (%d%% complete)\n", FormatProgress(progress));*/		sense_length -= sizeof(*sksp);	    } else {		PrintAscii ("Sense Specific Bytes", "", DNL);		PrintFields ((u_char *) &sdp->sense_specific,					sizeof(sdp->sense_specific));		sense_length -= sizeof(sdp->sense_specific);	    }	}	/*	 * Additional sense bytes (if any);	 */	if (sense_length > 0) {	    PrintAscii ("Additional Sense Bytes", "", DNL);	    PrintFields ((u_char *)sdp->additional_sense.other_sns,							sense_length);	}}/* * Dissect the stat field of a devio structure *  or the mt_dsreg field of the mtget structure */voidprint_stat(long stat){	Fprint("                        ");	if (stat & DEV_BOM)		Fprint("DEV_BOM ");	if (stat & DEV_EOM)		Fprint("DEV_EOM ");	if (stat & DEV_OFFLINE)		Fprint("DEV_OFFLINE ");	if (stat & DEV_WRTLCK)		Fprint("DEV_WRTLCK ");	if (stat & DEV_BLANK)		Fprint("DEV_BLANK ");	if (stat & DEV_WRITTEN)		Fprint("DEV_WRITTEN ");	if (stat & DEV_CSE)		Fprint("DEV_CSE ");	if (stat & DEV_SOFTERR)		Fprint("DEV_SOFTERR ");	if (stat & DEV_HARDERR)		Fprint("DEV_HARDERR ");	if (stat & DEV_DONE)		Fprint("DEV_DONE ");	if (stat & DEV_RETRY)		Fprint("DEV_RETRY ");	if (stat & DEV_ERASED)		Fprint("DEV_ERASED ");#if defined(STEELOS)	if (stat & DEV_TAPE_MARK)		Fprint("TPMARK ");	if (stat & DEV_SHORT_REC)		Fprint("SHRTREC ");	if (stat & DEV_TPMRK_PEND)		Fprint("TPMARK_PENDING ");	if (stat & DEV_REWINDING)		Fprint("REWINDING ");	if (stat & DEV_READ_OPP)		Fprint("READING_OPPOSITE ");#else /* !defined(STEELOS) */	if (stat & CTAPE_TPMARK)		Fprint("TPMARK ");	if (stat & CTAPE_SHRTREC)		Fprint("SHRTREC ");	if (stat & CTAPE_TPMARK_PENDING)		Fprint("TPMARK_PENDING ");	if (stat & CTAPE_REWINDING)		Fprint("REWINDING ");#endif /* defined(STEELOS) */	Fprint("\n");}/* * Dissect the category_stat field of a devio structure * * With the advent of the DEVGETINFO ioctl, we may get densities that are * unknown with the DEV_xxxBPI bitmasks. Thus, rather than simply * stating "unspecified density", if the devinfop exists and has a * non-zero density, we'll dummy up a DEV_xxxBPI name. */voidprint_category(long stat, device_info_t *devinfop){	Fprint("                        ");	if (stat & DEV_TPMARK)		Fprint("DEV_TPMARK ");	if (stat & DEV_SHRTREC)		Fprint("DEV_SHRTREC ");	if (stat & DEV_RDOPP)		Fprint("DEV_RDOPP ");	if (stat & DEV_RWDING)		Fprint("DEV_RWDING ");	if (stat & DEV_LOADER)		Fprint("DEV_LOADER ");	if (stat & DEV_800BPI) {		Fprint("DEV_800BPI");	} else if (stat & DEV_1600BPI) {		Fprint("DEV_1600BPI");	} else if (stat & DEV_6250BPI) {		Fprint("DEV_6250BPI");	} else if (stat & DEV_6666BPI) {		Fprint("DEV_6666BPI");	} else if (stat & DEV_10240BPI) {		Fprint("DEV_10240BPI");	} else if (stat & DEV_38000BPI) {		Fprint("DEV_38000BPI");#ifdef DEV_38000_CP	} else if (stat & DEV_38000_CP) {		Fprint("DEV_38000_CP");	} else if (stat & DEV_76000BPI) {		Fprint("DEV_76000BPI");	} else if (stat & DEV_76000_CP) {		Fprint("DEV_76000_CP");#endif /* DEV_38000_CP */	} else if (stat & DEV_8000_BPI) {		Fprint("DEV_8000_BPI");	} else if (stat & DEV_10000_BPI) {		Fprint("DEV_10000_BPI");	} else if (stat & DEV_16000_BPI) {		Fprint("DEV_16000_BPI");	} else if (stat & DEV_54000_BPI) {		Fprint("DEV_54000_BPI");	} else if (stat & DEV_61000_BPI) {		Fprint ("DEV_61000_BPI");	} else if (stat & DEV_45434_BPI) {		Fprint ("DEV_45434_BPI");	} else if (stat & DEV_42500_BPI) {		Fprint ("DEV_42500_BPI");	} else if (stat & DEV_62500_BPI) {		Fprint ("DEV_62500_BPI");	} else if (stat & DEV_40640_BPI) {		Fprint ("DEV_40640_BPI");	} else if (stat & DEV_36000_BPI) {		Fprint ("DEV_36000_BPI");	} else if (stat & DEV_81630_BPI) {		Fprint ("DEV_81630_BPI");	} else {		if (devinfop && devinfop->v1.devinfo.tape.density_bpi) {			Fprint("DEV_%ld_%s",				devinfop->v1.devinfo.tape.density_bpi,				((devinfop->v1.devinfo.tape.unit_status &					TPDEV_COMPACTING) ? "CP" : "BPI"));		} else			Fprint("<unspecified density>");	}	Fprint("\n");}/* * Strings used by Common Printing Functions. */#define ASCII_FIELD	"%34.34s: %s"#define EMPTY_FIELD	"%36.36s%s"#define NUMERIC_FIELD	"%34.34s: %lu"#define HEX_FIELD	"%34.34s: %#lx"#define FIELD_WIDTH	36		/* The field width (see above).	*/#define DEFAULT_WIDTH	80		/* Default tty display width.	*/int OutputRadix = DEC_RADIX;		/* Default to decimal output.	*/voidPrintNumeric (char *field_str, u_long numeric_value, int nl_flag){	char *Fprint_str;	if (OutputRadix == HEX_RADIX) {		Fprint_str = HEX_FIELD;	} else {		Fprint_str = NUMERIC_FIELD;	}	Fprint (Fprint_str, field_str, numeric_value);	if (nl_flag) Fprint ("\n");}voidPrintDecimal (char *field_str, u_long numeric_value, int nl_flag){	char *Fprint_str = NUMERIC_FIELD;	Fprint (Fprint_str, field_str, numeric_value);	if (nl_flag) Fprint ("\n");}voidPrintHex (char *field_str, u_long numeric_value, int nl_flag){	char *Fprint_str = HEX_FIELD;	Fprint (Fprint_str, field_str, numeric_value);	if (nl_flag) Fprint ("\n");}voidPrintAscii (char *field_str, char *ascii_str, int nl_flag){	int length = strlen(field_str);	char *Fprint_str = ((length) ? ASCII_FIELD : EMPTY_FIELD);	Fprint (Fprint_str, field_str, ascii_str);	if (nl_flag) Fprint ("\n");}voidPrintFields (u_char *bptr, int length){	int field_entrys = ((DEFAULT_WIDTH - FIELD_WIDTH) / 3) - 1;	int count = 0;	while (count < length) {	    if ((++count % field_entrys) == 0) {

⌨️ 快捷键说明

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