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

📄 aiclib.c

📁 h内核
💻 C
📖 第 1 页 / 共 4 页
字号:
/*      R       */{SST(0x57, 0x00, SS_RDEF,			"Unable to recover table-of-contents") },/*        O     */{SST(0x58, 0x00, SS_RDEF,			"Generation does not exist") },/*        O     */{SST(0x59, 0x00, SS_RDEF,			"Updated block read") },/* DTLPWRSOM    */{SST(0x5A, 0x00, SS_RDEF,			"Operator request or state change input") },/* DT  WR OM    */{SST(0x5A, 0x01, SS_RDEF,			"Operator medium removal request") },/* DT  W  O     */{SST(0x5A, 0x02, SS_RDEF,			"Operator selected write protect") },/* DT  W  O     */{SST(0x5A, 0x03, SS_RDEF,			"Operator selected write permit") },/* DTLPWRSOM    */{SST(0x5B, 0x00, SS_RDEF,			"Log exception") },/* DTLPWRSOM    */{SST(0x5B, 0x01, SS_RDEF,			"Threshold condition met") },/* DTLPWRSOM    */{SST(0x5B, 0x02, SS_RDEF,			"Log counter at maximum") },/* DTLPWRSOM    */{SST(0x5B, 0x03, SS_RDEF,			"Log list codes exhausted") },/* D      O     */{SST(0x5C, 0x00, SS_RDEF,			"RPL status change") },/* D      O     */{SST(0x5C, 0x01, SS_NOP|SSQ_PRINT_SENSE,			"Spindles synchronized") },/* D      O     */{SST(0x5C, 0x02, SS_RDEF,			"Spindles not synchronized") },/* DTLPWRSOMCAE */{SST(0x5D, 0x00, SS_RDEF,			"Failure prediction threshold exceeded") },/* DTLPWRSOMCAE */{SST(0x5D, 0xFF, SS_RDEF,			"Failure prediction threshold exceeded (false)") },/* DTLPWRSO CA  */{SST(0x5E, 0x00, SS_RDEF,			"Low power condition on") },/* DTLPWRSO CA  */{SST(0x5E, 0x01, SS_RDEF,			"Idle condition activated by timer") },/* DTLPWRSO CA  */{SST(0x5E, 0x02, SS_RDEF,			"Standby condition activated by timer") },/* DTLPWRSO CA  */{SST(0x5E, 0x03, SS_RDEF,			"Idle condition activated by command") },/* DTLPWRSO CA  */{SST(0x5E, 0x04, SS_RDEF,			"Standby condition activated by command") },/*       S      */{SST(0x60, 0x00, SS_RDEF,			"Lamp failure") },/*       S      */{SST(0x61, 0x00, SS_RDEF,			"Video acquisition error") },/*       S      */{SST(0x61, 0x01, SS_RDEF,			"Unable to acquire video") },/*       S      */{SST(0x61, 0x02, SS_RDEF,			"Out of focus") },/*       S      */{SST(0x62, 0x00, SS_RDEF,			"Scan head positioning error") },/*      R       */{SST(0x63, 0x00, SS_RDEF,			"End of user area encountered on this track") },/*      R       */{SST(0x63, 0x01, SS_FATAL|ENOSPC,			"Packet does not fit in available space") },/*      R       */{SST(0x64, 0x00, SS_RDEF,			"Illegal mode for this track") },/*      R       */{SST(0x64, 0x01, SS_RDEF,			"Invalid packet size") },/* DTLPWRSOMCAE */{SST(0x65, 0x00, SS_RDEF,			"Voltage fault") },/*       S      */{SST(0x66, 0x00, SS_RDEF,			"Automatic document feeder cover up") },/*       S      */{SST(0x66, 0x01, SS_RDEF,			"Automatic document feeder lift up") },/*       S      */{SST(0x66, 0x02, SS_RDEF,			"Document jam in automatic document feeder") },/*       S      */{SST(0x66, 0x03, SS_RDEF,			"Document miss feed automatic in document feeder") },/*           A  */{SST(0x67, 0x00, SS_RDEF,			"Configuration failure") },/*           A  */{SST(0x67, 0x01, SS_RDEF,			"Configuration of incapable logical units failed") },/*           A  */{SST(0x67, 0x02, SS_RDEF,			"Add logical unit failed") },/*           A  */{SST(0x67, 0x03, SS_RDEF,			"Modification of logical unit failed") },/*           A  */{SST(0x67, 0x04, SS_RDEF,			"Exchange of logical unit failed") },/*           A  */{SST(0x67, 0x05, SS_RDEF,			"Remove of logical unit failed") },/*           A  */{SST(0x67, 0x06, SS_RDEF,			"Attachment of logical unit failed") },/*           A  */{SST(0x67, 0x07, SS_RDEF,			"Creation of logical unit failed") },/*           A  */{SST(0x68, 0x00, SS_RDEF,			"Logical unit not configured") },/*           A  */{SST(0x69, 0x00, SS_RDEF,			"Data loss on logical unit") },/*           A  */{SST(0x69, 0x01, SS_RDEF,			"Multiple logical unit failures") },/*           A  */{SST(0x69, 0x02, SS_RDEF,			"Parity/data mismatch") },/*           A  */{SST(0x6A, 0x00, SS_RDEF,			"Informational, refer to log") },/*           A  */{SST(0x6B, 0x00, SS_RDEF,			"State change has occurred") },/*           A  */{SST(0x6B, 0x01, SS_RDEF,			"Redundancy level got better") },/*           A  */{SST(0x6B, 0x02, SS_RDEF,			"Redundancy level got worse") },/*           A  */{SST(0x6C, 0x00, SS_RDEF,			"Rebuild failure occurred") },/*           A  */{SST(0x6D, 0x00, SS_RDEF,			"Recalculate failure occurred") },/*           A  */{SST(0x6E, 0x00, SS_RDEF,			"Command to logical unit failed") },/*  T           */{SST(0x70, 0x00, SS_RDEF,			"Decompression exception short: ASCQ = Algorithm ID") },/*  T           */{SST(0x70, 0xFF, SS_RDEF|SSQ_RANGE,			NULL) }, /* Range 0x00 -> 0xFF *//*  T           */{SST(0x71, 0x00, SS_RDEF,			"Decompression exception long: ASCQ = Algorithm ID") },/*  T           */{SST(0x71, 0xFF, SS_RDEF|SSQ_RANGE,			NULL) }, /* Range 0x00 -> 0xFF */	/*      R       */{SST(0x72, 0x00, SS_RDEF,			"Session fixation error") },/*      R       */{SST(0x72, 0x01, SS_RDEF,			"Session fixation error writing lead-in") },/*      R       */{SST(0x72, 0x02, SS_RDEF,			"Session fixation error writing lead-out") },/*      R       */{SST(0x72, 0x03, SS_RDEF,			"Session fixation error - incomplete track in session") },/*      R       */{SST(0x72, 0x04, SS_RDEF,			"Empty or partially written reserved track") },/*      R       */{SST(0x73, 0x00, SS_RDEF,			"CD control error") },/*      R       */{SST(0x73, 0x01, SS_RDEF,			"Power calibration area almost full") },/*      R       */{SST(0x73, 0x02, SS_FATAL|ENOSPC,			"Power calibration area is full") },/*      R       */{SST(0x73, 0x03, SS_RDEF,			"Power calibration area error") },/*      R       */{SST(0x73, 0x04, SS_RDEF,			"Program memory area update failure") },/*      R       */{SST(0x73, 0x05, SS_RDEF,			"program memory area is full") }};static const int asc_table_size = sizeof(asc_table)/sizeof(asc_table[0]);struct asc_key{	int asc;	int ascq;};static intascentrycomp(const void *key, const void *member){	int asc;	int ascq;	const struct asc_table_entry *table_entry;	asc = ((const struct asc_key *)key)->asc;	ascq = ((const struct asc_key *)key)->ascq;	table_entry = (const struct asc_table_entry *)member;	if (asc >= table_entry->asc) {		if (asc > table_entry->asc)			return (1);		if (ascq <= table_entry->ascq) {			/* Check for ranges */			if (ascq == table_entry->ascq		 	 || ((table_entry->action & SSQ_RANGE) != 0		  	   && ascq >= (table_entry - 1)->ascq))				return (0);			return (-1);		}		return (1);	}	return (-1);}static intsenseentrycomp(const void *key, const void *member){	int sense_key;	const struct sense_key_table_entry *table_entry;	sense_key = *((const int *)key);	table_entry = (const struct sense_key_table_entry *)member;	if (sense_key >= table_entry->sense_key) {		if (sense_key == table_entry->sense_key)			return (0);		return (1);	}	return (-1);}static voidfetchtableentries(int sense_key, int asc, int ascq,		  struct scsi_inquiry_data *inq_data,		  const struct sense_key_table_entry **sense_entry,		  const struct asc_table_entry **asc_entry){	void *match;	const struct asc_table_entry *asc_tables[2];	const struct sense_key_table_entry *sense_tables[2];	struct asc_key asc_ascq;	size_t asc_tables_size[2];	size_t sense_tables_size[2];	int num_asc_tables;	int num_sense_tables;	int i;	/* Default to failure */	*sense_entry = NULL;	*asc_entry = NULL;	match = NULL;	if (inq_data != NULL)		match = cam_quirkmatch((void *)inq_data,				       (void *)sense_quirk_table,				       sense_quirk_table_size,				       sizeof(*sense_quirk_table),				       aic_inquiry_match);	if (match != NULL) {		struct scsi_sense_quirk_entry *quirk;		quirk = (struct scsi_sense_quirk_entry *)match;		asc_tables[0] = quirk->asc_info;		asc_tables_size[0] = quirk->num_ascs;		asc_tables[1] = asc_table;		asc_tables_size[1] = asc_table_size;		num_asc_tables = 2;		sense_tables[0] = quirk->sense_key_info;		sense_tables_size[0] = quirk->num_sense_keys;		sense_tables[1] = sense_key_table;		sense_tables_size[1] = sense_key_table_size;		num_sense_tables = 2;	} else {		asc_tables[0] = asc_table;		asc_tables_size[0] = asc_table_size;		num_asc_tables = 1;		sense_tables[0] = sense_key_table;		sense_tables_size[0] = sense_key_table_size;		num_sense_tables = 1;	}	asc_ascq.asc = asc;	asc_ascq.ascq = ascq;	for (i = 0; i < num_asc_tables; i++) {		void *found_entry;		found_entry = scsibsearch(&asc_ascq, asc_tables[i],					  asc_tables_size[i],					  sizeof(**asc_tables),					  ascentrycomp);		if (found_entry) {			*asc_entry = (struct asc_table_entry *)found_entry;			break;		}	}	for (i = 0; i < num_sense_tables; i++) {		void *found_entry;		found_entry = scsibsearch(&sense_key, sense_tables[i],					  sense_tables_size[i],					  sizeof(**sense_tables),					  senseentrycomp);		if (found_entry) {			*sense_entry =			    (struct sense_key_table_entry *)found_entry;			break;		}	}}static void *scsibsearch(const void *key, const void *base, size_t nmemb, size_t size,		 int (*compar)(const void *, const void *)){	const void *entry;	u_int l;	u_int u;	u_int m;	l = -1;	u = nmemb;	while (l + 1 != u) {		m = (l + u) / 2;		entry = base + m * size;		if (compar(key, entry) > 0)			l = m;		else			u = m;	}	entry = base + u * size;	if (u == nmemb	 || compar(key, entry) != 0)		return (NULL);	return ((void *)entry);}/* * Compare string with pattern, returning 0 on match. * Short pattern matches trailing blanks in name, * wildcard '*' in pattern matches rest of name, * wildcard '?' matches a single non-space character. */static intcam_strmatch(const uint8_t *str, const uint8_t *pattern, int str_len){	while (*pattern != '\0'&& str_len > 0) {  		if (*pattern == '*') {			return (0);		}		if ((*pattern != *str)		 && (*pattern != '?' || *str == ' ')) {			return (1);		}		pattern++;		str++;		str_len--;	}	while (str_len > 0 && *str++ == ' ')		str_len--;	return (str_len);}static caddr_tcam_quirkmatch(caddr_t target, caddr_t quirk_table, int num_entries,	       int entry_size, cam_quirkmatch_t *comp_func){	for (; num_entries > 0; num_entries--, quirk_table += entry_size) {		if ((*comp_func)(target, quirk_table) == 0)			return (quirk_table);	}	return (NULL);}voidaic_sense_desc(int sense_key, int asc, int ascq,	       struct scsi_inquiry_data *inq_data,	       const char **sense_key_desc, const char **asc_desc){	const struct asc_table_entry *asc_entry;	const struct sense_key_table_entry *sense_entry;	fetchtableentries(sense_key, asc, ascq,			  inq_data,

⌨️ 快捷键说明

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