xref: /titanic_52/usr/src/cmd/luxadm/errormsgs.c (revision 24fe0b3bf671e123467ce1df0b67cadd3614c8e4)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 
27 
28 
29 /*
30  * I18N message number ranges
31  *  This file: 10000 - 10499
32  *  Shared common messages: 1 - 1999
33  */
34 
35 /* #define	_POSIX_SOURCE 1 */
36 
37 
38 /*	Includes	*/
39 #include	<stdlib.h>
40 #include	<stdio.h>
41 #include	<fcntl.h>
42 #include	<nl_types.h>
43 #include	<sys/scsi/scsi.h>
44 #include	<string.h>
45 #include	<errno.h>
46 #include	"common.h"
47 #include	"errorcodes.h"
48 
49 
50 
51 /*	Defines		*/
52 #define	MAXLEN	1000
53 
54 /*
55  * Allocate space for and return a pointer to a string
56  * on the stack.  If the string is null, create
57  * an empty string.
58  */
59 char *
60 alloc_string(char *s)
61 {
62 	char	*ns;
63 
64 	if (s == (char *)NULL) {
65 		ns = (char *)calloc(1, 1);
66 	} else {
67 		ns = (char *)calloc(1, strlen(s) + 1);
68 		if (ns != NULL) {
69 			(void) strncpy(ns, s, (strlen(s) + 1));
70 		}
71 	}
72 	return (ns);
73 }
74 
75 
76 /*
77  * Decodes the SCSI sense byte to a string.
78  *
79  * RETURNS:
80  *	character string
81  */
82 static char *
83 decode_sense_byte(uchar_t status)
84 {
85 	switch (status & STATUS_MASK) {
86 		case STATUS_GOOD:
87 			return (MSGSTR(10000, "Good status"));
88 
89 		case STATUS_CHECK:
90 			return (MSGSTR(128, "Check condition"));
91 
92 		case STATUS_MET:
93 			return (MSGSTR(124, "Condition met"));
94 
95 		case STATUS_BUSY:
96 			return (MSGSTR(37, "Busy"));
97 
98 		case STATUS_INTERMEDIATE:
99 			return (MSGSTR(10001, "Intermediate"));
100 
101 		case STATUS_INTERMEDIATE_MET:
102 			return (MSGSTR(10002, "Intermediate - condition met"));
103 
104 		case STATUS_RESERVATION_CONFLICT:
105 			return (MSGSTR(10003, "Reservation_conflict"));
106 
107 		case STATUS_TERMINATED:
108 			return (MSGSTR(126, "Command terminated"));
109 
110 		case STATUS_QFULL:
111 			return (MSGSTR(83, "Queue full"));
112 
113 		default:
114 			return (MSGSTR(4, "Unknown status"));
115 	}
116 }
117 
118 
119 /*
120  * This function finds a predefined error string to a given
121  * error number (errornum), allocates memory for the string
122  * and returns the corresponding error message to the caller.
123  *
124  * RETURNS
125  *	error string	if O.K.
126  *	NULL		otherwise
127  */
128 char
129 *get_errString(int errornum)
130 {
131 char	err_msg[MAXLEN], *errStrg;
132 
133 	err_msg[0] = '\0'; /* Just in case */
134 	if (errornum < L_BASE) {
135 			/* Some sort of random system error most likely */
136 			errStrg = strerror(errno);
137 			if (errStrg != NULL) {
138 				(void) strcpy(err_msg, errStrg);
139 			} else { /* Something's _really_ messed up */
140 				(void) sprintf(err_msg,
141 					MSGSTR(10081,
142 					" Error: could not decode the"
143 					" error message.\n"
144 					" The given error message is not"
145 					" defined in the library.\n"
146 					" Message number: %d.\n"), errornum);
147 			}
148 
149 	/* Make sure ALL CASES set err_msg to something */
150 	} else switch (errornum) {
151 		case L_SCSI_ERROR:
152 			(void) sprintf(err_msg,
153 				MSGSTR(10096,
154 				" Error: SCSI failure."));
155 			break;
156 
157 		case L_PR_INVLD_TRNSFR_LEN:
158 			(void) sprintf(err_msg,
159 				MSGSTR(10005,
160 				" Error: Persistant Reserve command"
161 				" transfer length not word aligned."));
162 			break;
163 
164 		case L_RD_NO_DISK_ELEM:
165 			(void) sprintf(err_msg,
166 				MSGSTR(10006,
167 				" Error: Could not find the disk elements"
168 				" in the Receive Diagnostic pages."));
169 			break;
170 
171 		case L_RD_INVLD_TRNSFR_LEN:
172 			(void) sprintf(err_msg,
173 				MSGSTR(10007,
174 				" Error: Receive Diagnostic command"
175 				" transfer length not word aligned."));
176 			break;
177 
178 		case L_ILLEGAL_MODE_SENSE_PAGE:
179 			(void) sprintf(err_msg,
180 				MSGSTR(10008,
181 				" Error: Programming error - "
182 				"illegal Mode Sense parameter."));
183 			break;
184 
185 		case L_INVALID_NO_OF_ENVSEN_PAGES:
186 			(void) sprintf(err_msg,
187 				MSGSTR(10009,
188 				" Error: Invalid no. of sense pages.\n"
189 				" Could not get valid sense page"
190 				" information from the device."));
191 			break;
192 
193 		case L_INVALID_BUF_LEN:
194 			(void) sprintf(err_msg,
195 				MSGSTR(10010,
196 				" Error: Invalid buffer length.\n"
197 				" Could not get diagnostic "
198 				" information from the device."));
199 			break;
200 
201 		case L_INVALID_PATH:
202 			(void) sprintf(err_msg,
203 				MSGSTR(113,
204 				" Error: Invalid pathname"));
205 			break;
206 
207 		case L_NO_PHYS_PATH:
208 			(void) sprintf(err_msg,
209 				MSGSTR(10011,
210 				" Error: Could not get"
211 				" physical path to the device."));
212 			break;
213 
214 		case L_NO_SES_PATH:
215 			(void) sprintf(err_msg,
216 				MSGSTR(10098,
217 				" Error: No SES found"
218 				" for the device path."));
219 			break;
220 
221 		case L_INVLD_PATH_NO_SLASH_FND:
222 			(void) sprintf(err_msg,
223 				MSGSTR(10012,
224 				"Error in the device physical path."));
225 			break;
226 
227 		case L_INVLD_PATH_NO_ATSIGN_FND:
228 			(void) sprintf(err_msg,
229 				MSGSTR(10013,
230 				" Error in the device physical path:"
231 				" no @ found."));
232 			break;
233 
234 		case L_INVALID_SLOT:
235 			(void) sprintf(err_msg,
236 				MSGSTR(10014,
237 				" Error: Invalid path format."
238 				" Invalid slot."));
239 			break;
240 
241 		case L_INVALID_LED_RQST:
242 			(void) sprintf(err_msg,
243 				MSGSTR(10015,
244 				" Error: Invalid LED request."));
245 			break;
246 
247 		case L_INVALID_PATH_FORMAT:
248 			(void) sprintf(err_msg,
249 				MSGSTR(10016,
250 				" Error: Invalid path format."));
251 			break;
252 
253 		case L_OPEN_PATH_FAIL:
254 			(void) sprintf(err_msg,
255 				MSGSTR(10017,
256 				" Error opening the path."));
257 			break;
258 
259 		case L_INVALID_PASSWORD_LEN:
260 			(void) sprintf(err_msg,
261 				MSGSTR(10018,
262 				"Error: Invalid password length."));
263 			break;
264 
265 		case L_INVLD_PHYS_PATH_TO_DISK:
266 			(void) sprintf(err_msg,
267 				MSGSTR(10019,
268 				" Error: Physical path not of a disk."));
269 			break;
270 
271 		case L_INVLD_ID_FOUND:
272 			(void) sprintf(err_msg,
273 				MSGSTR(10020,
274 				" Error in the device physical path:"
275 				" Invalid ID found in the path."));
276 			break;
277 
278 		case L_INVLD_WWN_FORMAT:
279 			(void) sprintf(err_msg,
280 				MSGSTR(10021,
281 				" Error in the device physical path:"
282 				" Invalid wwn format."));
283 
284 			break;
285 
286 		case L_NO_VALID_PATH:
287 			(void) sprintf(err_msg,
288 				MSGSTR(10022,
289 				" Error: Could not find valid path to"
290 				" the device."));
291 			break;
292 
293 		case L_NO_WWN_FOUND_IN_PATH:
294 			(void) sprintf(err_msg,
295 				MSGSTR(10023,
296 				" Error in the device physical path:"
297 				" No WWN found."));
298 
299 			break;
300 
301 		case L_NO_NODE_WWN_IN_WWNLIST:
302 			(void) sprintf(err_msg,
303 				MSGSTR(10024,
304 				" Error: Device's Node WWN is not"
305 				" found in the WWN list.\n"));
306 			break;
307 
308 		case L_NO_NODE_WWN_IN_BOXLIST:
309 			(void) sprintf(err_msg,
310 				MSGSTR(10025,
311 				" Error: Device's Node WWN is not"
312 				" found in the Box list.\n"));
313 			break;
314 
315 		case L_NULL_WWN_LIST:
316 			(void) sprintf(err_msg,
317 				MSGSTR(10026,
318 				" Error: Null WWN list found."));
319 			break;
320 
321 		case L_NO_LOOP_ADDRS_FOUND:
322 			(void) sprintf(err_msg,
323 				MSGSTR(10027,
324 				" Error: Could not find the loop address for "
325 				" the device at physical path."));
326 
327 			break;
328 
329 		case L_INVLD_PORT_IN_PATH:
330 			(void) sprintf(err_msg,
331 				MSGSTR(10028,
332 				"Error in the device physical path:"
333 				" Invalid port number found."
334 				" (Should be 0 or 1)."));
335 
336 			break;
337 
338 		case L_INVALID_LOOP_MAP:
339 			(void) sprintf(err_msg,
340 				MSGSTR(10029,
341 				"Error: Invalid loop map found."));
342 			break;
343 
344 		case L_SFIOCGMAP_IOCTL_FAIL:
345 			(void) sprintf(err_msg,
346 				MSGSTR(10030,
347 				" Error: SFIOCGMAP ioctl failed."
348 				" Cannot read loop map."));
349 			break;
350 
351 		case L_FCIO_GETMAP_IOCTL_FAIL:
352 			(void) sprintf(err_msg,
353 				MSGSTR(10031,
354 				" Error: FCIO_GETMAP ioctl failed."
355 				" Cannot read loop map."));
356 			break;
357 
358 		case L_FCIO_LINKSTATUS_FAILED:
359 			(void) sprintf(err_msg,
360 				MSGSTR(10032,
361 				" Error: FCIO_LINKSTATUS ioctl failed."
362 				" Cannot read loop map."));
363 			break;
364 
365 		case L_FCIOGETMAP_INVLD_LEN:
366 			(void) sprintf(err_msg,
367 				MSGSTR(10033,
368 				" Error: FCIO_GETMAP ioctl returned"
369 				" an invalid parameter:"
370 				" # entries to large."));
371 			break;
372 
373 		case L_FCIO_FORCE_LIP_FAIL:
374 			(void) sprintf(err_msg,
375 				MSGSTR(10034,
376 				" Error: FCIO_FORCE_LIP ioctl failed."));
377 			break;
378 
379 		case L_FCIO_FORCE_LIP_PARTIAL_FAIL:
380 			(void) sprintf(err_msg,
381 				MSGSTR(10115,
382 				" Error: FCIO_FORCE_LIP ioctl failed on one"
383 				" or more (but not all) of the paths."));
384 			break;
385 
386 		case L_DWNLD_CHKSUM_FAILED:
387 			(void) sprintf(err_msg,
388 				MSGSTR(10035,
389 				"Error: Download file checksum failed."));
390 
391 			break;
392 
393 		case L_DWNLD_READ_HEADER_FAIL:
394 			(void) sprintf(err_msg,
395 				MSGSTR(10036,
396 				" Error: Reading download file exec"
397 				" header failed."));
398 			break;
399 
400 		case L_DWNLD_READ_INCORRECT_BYTES:
401 			(void) sprintf(err_msg,
402 				MSGSTR(10037,
403 				" Error: Incorrect number of bytes read."));
404 			break;
405 
406 		case L_DWNLD_INVALID_TEXT_SIZE:
407 			(void) sprintf(err_msg,
408 				MSGSTR(10038,
409 				" Error: Reading text segment: "
410 				" Found wrong size."));
411 			break;
412 
413 		case L_DWNLD_READ_ERROR:
414 			(void) sprintf(err_msg,
415 				MSGSTR(10039,
416 				" Error: Failed to read download file."));
417 			break;
418 
419 		case L_DWNLD_BAD_FRMWARE:
420 			(void) sprintf(err_msg,
421 				MSGSTR(10040,
422 				" Error: Bad Firmware MAGIC."));
423 			break;
424 
425 		case L_DWNLD_TIMED_OUT:
426 			(void) sprintf(err_msg,
427 				MSGSTR(10041,
428 				" Error: Timed out in 5 minutes"
429 				" waiting for the"
430 				" IB to become available."));
431 			break;
432 
433 		case L_REC_DIAG_PG1:
434 			(void) sprintf(err_msg,
435 				MSGSTR(10042,
436 				" Error parsing the Receive"
437 				" diagnostic page."));
438 			break;
439 
440 		case L_TRANSFER_LEN:
441 			(void) sprintf(err_msg,
442 				MSGSTR(10043, "  "));
443 			break;
444 
445 		case L_REQUIRE_FILE:
446 			(void) sprintf(err_msg,
447 				MSGSTR(10109,
448 				" Error: No default file.  You must specify"
449 				" the filename path."));
450 			break;
451 
452 		case L_MALLOC_FAILED:
453 			(void) sprintf(err_msg,
454 				MSGSTR(10,
455 				" Error: Unable to allocate memory."));
456 			break;
457 
458 		case L_LOCALTIME_ERROR:
459 			(void) sprintf(err_msg,
460 				MSGSTR(10044,
461 				" Error: Could not convert time"
462 				" to broken-down time: Hrs/Mins/Secs."));
463 			break;
464 
465 		case L_SELECT_ERROR:
466 			(void) sprintf(err_msg,
467 				MSGSTR(10045,
468 				" select() error during retry:"
469 				" Could not wait for"
470 				" specified time."));
471 			break;
472 
473 		case L_NO_DISK_DEV_FOUND:
474 			(void) sprintf(err_msg,
475 				MSGSTR(10046,
476 				" Error: No disk devices found"
477 				" in the /dev/rdsk"
478 				" directory."));
479 			break;
480 
481 		case L_NO_TAPE_DEV_FOUND:
482 			(void) sprintf(err_msg,
483 				MSGSTR(10047,
484 				" Error: No tape devices found"
485 				" in the /dev/rmt"
486 				" directory."));
487 			break;
488 
489 		case L_LSTAT_ERROR:
490 			(void) sprintf(err_msg,
491 				MSGSTR(10048,
492 				" lstat() error: Cannot obtain status"
493 				" for the device."));
494 			break;
495 
496 		case L_SYMLINK_ERROR:
497 			(void) sprintf(err_msg,
498 				MSGSTR(10049,
499 				" Error: Could not read the symbolic link."));
500 			break;
501 
502 		case L_UNAME_FAILED:
503 			(void) sprintf(err_msg,
504 				MSGSTR(10050,
505 				" uname() error: Could not obtain the"
506 				" architeture of the host machine."));
507 			break;
508 
509 		case L_DRVCONFIG_ERROR:
510 			(void) sprintf(err_msg,
511 				MSGSTR(10051,
512 				" Error: Could not run drvconfig."));
513 			break;
514 
515 		case L_DISKS_ERROR:
516 			(void) sprintf(err_msg,
517 				MSGSTR(10052,
518 				" Error: Could not run disks."));
519 			break;
520 
521 		case L_DEVLINKS_ERROR:
522 			(void) sprintf(err_msg,
523 				MSGSTR(10053,
524 				" Error: Could not run devlinks."));
525 			break;
526 
527 		case L_READ_DEV_DIR_ERROR:
528 			(void) sprintf(err_msg,
529 				MSGSTR(10054,
530 				" Error: Could not read /dev/rdsk"
531 				" directory."));
532 			break;
533 
534 		case L_OPEN_ES_DIR_FAILED:
535 			(void) sprintf(err_msg,
536 				MSGSTR(10055,
537 				" Error: Could not open /dev/es"
538 				" directory."));
539 			break;
540 
541 		case L_LSTAT_ES_DIR_ERROR:
542 			(void) sprintf(err_msg,
543 				MSGSTR(10056,
544 				" lstat() error: Could not get status"
545 				" for /dev/es directory."));
546 			break;
547 
548 		case L_DEV_BUSY:
549 			(void) sprintf(err_msg,
550 				MSGSTR(10057,
551 				" Error: Could not offline the device\n"
552 				" May be Busy."));
553 			break;
554 
555 		case L_EXCL_OPEN_FAILED:
556 			(void) sprintf(err_msg,
557 				MSGSTR(10058,
558 				" Error: Could not open device in"
559 				" exclusive mode."
560 				"  May already be open."));
561 			break;
562 
563 		case L_DEVICE_RESERVED:
564 			(void) sprintf(err_msg,
565 				MSGSTR(10059,
566 				" Error: Disk is reserved."));
567 			break;
568 
569 		case L_DISKS_RESERVED:
570 			(void) sprintf(err_msg,
571 				MSGSTR(10060,
572 				" Error: One or more disks in"
573 				" SENA are reserved."));
574 			break;
575 
576 		case L_SLOT_EMPTY:
577 			(void) sprintf(err_msg,
578 				MSGSTR(10061,
579 				" Error: Slot is empty."));
580 			break;
581 
582 		case L_ACQUIRE_FAIL:
583 			(void) sprintf(err_msg,
584 				MSGSTR(10062,
585 				" Error: Could not acquire"
586 				" the device."));
587 			break;
588 
589 		case L_POWER_OFF_FAIL_BUSY:
590 			(void) sprintf(err_msg,
591 				MSGSTR(10063,
592 				" Error: Could not power off the device.\n"
593 				" May be Busy."));
594 			break;
595 
596 		case L_ENCL_NAME_CHANGE_FAIL:
597 			(void) sprintf(err_msg,
598 				MSGSTR(10064,
599 				" Error: The Enclosure name change failed."));
600 			break;
601 
602 		case L_DUPLICATE_ENCLOSURES:
603 			(void) sprintf(err_msg,
604 				MSGSTR(10065,
605 				" Error: There are two or more enclosures"
606 				" with the same name."
607 				" Please use a logical or physical"
608 				" pathname."));
609 			break;
610 
611 		case L_INVALID_NUM_DISKS_ENCL:
612 			(void) sprintf(err_msg,
613 				MSGSTR(10066,
614 				" Error: The number of disks in the"
615 				" front & rear of the enclosure are"
616 				" different."
617 				" This is not a supported configuration."));
618 			break;
619 
620 		case L_ENCL_INVALID_PATH:
621 			(void) sprintf(err_msg,
622 				MSGSTR(10067,
623 				" Error: Invalid path."
624 				" Device is not a SENA subsystem."));
625 			break;
626 
627 		case L_NO_ENCL_LIST_FOUND:
628 			(void) sprintf(err_msg,
629 				MSGSTR(10068,
630 				" Error: Cannot get the Box list."));
631 			break;
632 
633 		case L_IB_NO_ELEM_FOUND:
634 			(void) sprintf(err_msg,
635 				MSGSTR(10069,
636 				" Error: No elements returned from"
637 				" enclosure (IB)."));
638 			break;
639 
640 		case L_GET_STATUS_FAILED:
641 			(void) sprintf(err_msg,
642 				MSGSTR(10070,
643 				" Error: Get status failed."));
644 			break;
645 
646 		case L_RD_PG_MIN_BUFF:
647 			(void) sprintf(err_msg,
648 				MSGSTR(10071,
649 				" Error: Reading page from IB.\n"
650 				" Buffer size too small."));
651 			break;
652 
653 		case L_RD_PG_INVLD_CODE:
654 			(void) sprintf(err_msg,
655 				MSGSTR(10072,
656 				" Error: Reading page from IB\n"
657 				" Invalid page code or page len found."));
658 			break;
659 
660 		case L_BP_BUSY_RESERVED:
661 			(void) sprintf(err_msg,
662 				MSGSTR(10073,
663 				" Error: There is a busy or reserved disk"
664 				" attached to this backplane.\n"
665 				" You must close the disk,\n"
666 				" or release the disk,\n"
667 				" or resubmit the command using"
668 				" the Force option."));
669 			break;
670 
671 		case L_BP_BUSY:
672 			(void) sprintf(err_msg,
673 				MSGSTR(10074,
674 				" Error: There is a busy disk"
675 				" attached to this backplane.\n"
676 				" You must close the disk,\n"
677 				" or resubmit the command using"
678 				" the Force option."));
679 			break;
680 
681 		case L_BP_RESERVED:
682 			(void) sprintf(err_msg,
683 				MSGSTR(10075,
684 				" Error: There is a reserved disk"
685 				" attached to this backplane.\n"
686 				" You must release the disk,\n"
687 				" or resubmit the subcommand using"
688 				" the Force option."));
689 			break;
690 
691 		case L_NO_BP_ELEM_FOUND:
692 			(void) sprintf(err_msg,
693 				MSGSTR(10076,
694 				" Error: No Back plane elements found"
695 				" in the enclosure."));
696 			break;
697 
698 		case L_SSA_CONFLICT:
699 			(void) sprintf(err_msg,
700 				MSGSTR(10077,
701 				" There is a conflict between the "
702 				"enclosure name and an SSA name of "
703 				"same form, cN.\n"
704 				" Please use a logical or physical "
705 				"pathname."));
706 			break;
707 
708 		case L_WARNING:
709 			(void) sprintf(err_msg,
710 				MSGSTR(10078, " Warning:"));
711 
712 			break;
713 
714 		case L_TH_JOIN:
715 			(void) sprintf(err_msg,
716 				MSGSTR(10079,
717 				" Error: Thread join failed."));
718 			break;
719 
720 		case L_FCIO_RESET_LINK_FAIL:
721 			(void) sprintf(err_msg,
722 				MSGSTR(10082,
723 				" Error: FCIO_RESET_LINK ioctl failed.\n"
724 				" Could not reset the loop."));
725 			break;
726 
727 		case L_FCIO_GET_FCODE_REV_FAIL:
728 			(void) sprintf(err_msg,
729 				MSGSTR(10083,
730 				" Error: FCIO_GET_FCODE_REV ioctl failed.\n"
731 				" Could not get the fcode version."));
732 			break;
733 
734 		case L_FCIO_GET_FW_REV_FAIL:
735 			(void) sprintf(err_msg,
736 				MSGSTR(10084,
737 				" Error: FCIO_GET_FW_REV ioctl failed.\n"
738 				" Could not get the firmware revision."));
739 			break;
740 
741 		case L_NO_DEVICES_FOUND:
742 			(void) sprintf(err_msg,
743 				MSGSTR(10085,
744 				" No FC devices found."));
745 			break;
746 
747 		case L_INVALID_DEVICE_COUNT:
748 			(void) sprintf(err_msg,
749 				MSGSTR(10086,
750 				" Error: FCIO_GET_DEV_LIST ioctl returned"
751 				" an invalid device count."));
752 			break;
753 
754 		case L_FCIO_GET_NUM_DEVS_FAIL:
755 			(void) sprintf(err_msg,
756 				MSGSTR(10087,
757 				" Error: FCIO_GET_NUM_DEVS ioctl failed.\n"
758 				" Could not get the number of devices."));
759 			break;
760 
761 		case L_FCIO_GET_DEV_LIST_FAIL:
762 			(void) sprintf(err_msg,
763 				MSGSTR(10088,
764 				" Error: FCIO_GET_DEV_LIST ioctl failed.\n"
765 				" Could not get the device list."));
766 			break;
767 
768 		case L_FCIO_GET_LINK_STATUS_FAIL:
769 			(void) sprintf(err_msg,
770 				MSGSTR(10089,
771 				" Error: FCIO_GET_LINK_STATUS ioctl failed.\n"
772 				" Could not get the link status."));
773 			break;
774 
775 		case L_PORT_OFFLINE_FAIL:
776 			(void) sprintf(err_msg,
777 				MSGSTR(10090,
778 				" Error: ioctl to offline the port failed."));
779 			break;
780 
781 		case L_PORT_OFFLINE_UNSUPPORTED:
782 			(void) sprintf(err_msg,
783 				MSGSTR(10091,
784 				" Error: The driver does not support ioctl to"
785 				" disable the FCA port."));
786 			break;
787 
788 		case L_PORT_ONLINE_FAIL:
789 			(void) sprintf(err_msg,
790 				MSGSTR(10092,
791 				" Error: ioctl to online the port failed."));
792 			break;
793 
794 		case L_PORT_ONLINE_UNSUPPORTED:
795 			(void) sprintf(err_msg,
796 				MSGSTR(10093,
797 				" Error: The driver does not support ioctl to"
798 				" enable the FCA port."));
799 			break;
800 
801 		case L_FCP_TGT_INQUIRY_FAIL:
802 			(void) sprintf(err_msg,
803 				MSGSTR(10094,
804 				" Error: FCP_TGT_INQUIRY ioctl failed.\n"
805 				" Could not get the target inquiry data"
806 				" from FCP."));
807 			break;
808 
809 		case L_FSTAT_ERROR:
810 			(void) sprintf(err_msg,
811 				MSGSTR(10095,
812 				" fstat() error: Cannot obtain status"
813 				" for the device."));
814 			break;
815 
816 		case L_FCIO_GET_HOST_PARAMS_FAIL:
817 			(void) sprintf(err_msg,
818 				MSGSTR(10097,
819 				" Error: FCIO_GET_HOST_PARAMS ioctl failed.\n"
820 				" Could not get the host parameters."));
821 			break;
822 
823 		case L_STAT_ERROR:
824 			(void) sprintf(err_msg,
825 				MSGSTR(10099,
826 				" stat() error: Cannot obtain status"
827 				" for the device."));
828 			break;
829 
830 		case L_DEV_SNAPSHOT_FAILED:
831 			(void) sprintf(err_msg,
832 				MSGSTR(10100,
833 				" Error: Could not retrieve device tree"
834 				" snapshot."));
835 			break;
836 
837 		case L_LOOPBACK_UNSUPPORTED:
838 			(void) sprintf(err_msg,
839 				MSGSTR(10101,
840 				" Error: Loopback mode is unsupported for this"
841 				" device."));
842 			break;
843 
844 		case L_LOOPBACK_FAILED:
845 			(void) sprintf(err_msg,
846 				MSGSTR(10102,
847 				" Error: Error occurred during loopback mode"
848 				" set."));
849 			break;
850 
851 		case L_FCIO_GET_TOPOLOGY_FAIL:
852 			(void) sprintf(err_msg,
853 				MSGSTR(10103,
854 				" Error: FCIO_GET_TOPOLOGY ioctl failed.\n"
855 				" Could not get the fca port topology."));
856 			break;
857 
858 		case L_UNEXPECTED_FC_TOPOLOGY:
859 			(void) sprintf(err_msg,
860 				MSGSTR(10104,
861 				" Error: Unexpected Fibre Channel topology"
862 				" found."));
863 			break;
864 
865 		case L_INVALID_PRIVATE_LOOP_ADDRESS:
866 			(void) sprintf(err_msg,
867 				MSGSTR(10105,
868 				" Error: AL_PA is not a valid private loop"
869 				" address."));
870 			break;
871 
872 		case L_NO_FABRIC_ADDR_FOUND:
873 			(void) sprintf(err_msg,
874 				MSGSTR(10106,
875 				" Error: Could not find the fabric address"
876 				" for the device at physical path."));
877 			break;
878 
879 		case L_INVALID_FABRIC_ADDRESS:
880 			(void) sprintf(err_msg,
881 				MSGSTR(10107,
882 				" Error: Device port address on the Fabric"
883 				" topology is not valid."));
884 			break;
885 
886 		case L_PT_PT_FC_TOP_NOT_SUPPORTED:
887 			(void) sprintf(err_msg,
888 				MSGSTR(10108,
889 				" Error: Point to Point Fibre Channel "
890 				"topology is currently not supported."));
891 			break;
892 
893 		case L_FCIO_DEV_LOGIN_FAIL:
894 			(void) sprintf(err_msg,
895 				MSGSTR(10310,
896 				" Error: FCIO_DEV_LOGIN ioctl failed."));
897 			break;
898 
899 		case L_FCIO_DEV_LOGOUT_FAIL:
900 			(void) sprintf(err_msg,
901 				MSGSTR(10311,
902 				" Error: FCIO_DEV_LOGOUT ioctl failed."));
903 			break;
904 
905 		case L_OPNOSUPP_ON_TOPOLOGY:
906 			(void) sprintf(err_msg,
907 				MSGSTR(10312,
908 				" Error: operation not supported "
909 				"on connected topology."));
910 			break;
911 
912 		case L_INVALID_PATH_TYPE:
913 			(void) sprintf(err_msg,
914 				MSGSTR(10313,
915 				" Error: operation not supported "
916 				"on the path."));
917 			break;
918 
919 		case L_FCIO_GET_STATE_FAIL:
920 			(void) sprintf(err_msg,
921 				MSGSTR(10314,
922 				" Error: FCIO_GET_STATE ioctl failed."));
923 			break;
924 
925 		case L_WWN_NOT_FOUND_IN_DEV_LIST:
926 			(void) sprintf(err_msg,
927 				MSGSTR(10315,
928 				" Error: device WWN not found in "
929 				"device list."));
930 			break;
931 
932 		case L_STAT_RMT_DIR_ERROR:
933 			(void) sprintf(err_msg,
934 				MSGSTR(10110,
935 				" stat() error: Could not get status"
936 				" for /dev/rmt directory."));
937 			break;
938 
939 		case L_STAT_DEV_DIR_ERROR:
940 			(void) sprintf(err_msg,
941 				MSGSTR(10111,
942 				" stat() error: Could not get status"
943 				" for /dev/dsk directory."));
944 			break;
945 
946 		case L_PROM_INIT_FAILED:
947 			(void) sprintf(err_msg,
948 				MSGSTR(10234,
949 				" Error: di_prom_init failure"));
950 			break;
951 
952 		case L_PORT_DRIVER_NOT_FOUND:
953 			(void) sprintf(err_msg,
954 				MSGSTR(10113,
955 				" Error: requested port driver"
956 				" does not exist"));
957 			break;
958 
959 		case L_PHYS_PATH_NOT_FOUND:
960 			(void) sprintf(err_msg,
961 				MSGSTR(10114,
962 				" Error: requested phys path does not exist"));
963 			break;
964 
965 		case L_GET_DEV_LIST_ULP_FAILURE:
966 			(void) sprintf(err_msg,
967 				MSGSTR(10150,
968 				" Error: g_get_dev_list failed on ULP "
969 				"processing of target device(s)"));
970 			break;
971 
972 		case L_SCSI_VHCI_ERROR:
973 			(void) sprintf(err_msg,
974 				MSGSTR(10230,
975 				" Error: Unable to perform failover"));
976 			break;
977 
978 		case L_SCSI_VHCI_ALREADY_ACTIVE:
979 			(void) sprintf(err_msg,
980 				MSGSTR(10231,
981 				" Error: Pathclass already active"));
982 			break;
983 
984 		case L_NO_DEVID:
985 			(void) sprintf(err_msg,
986 				MSGSTR(10232,
987 				" Error: No device identifier found"));
988 			break;
989 
990 		case L_DRIVER_NOTSUPP:
991 			(void) sprintf(err_msg,
992 				MSGSTR(10233,
993 				" Error: Driver not supported"));
994 			break;
995 
996 		case L_PROC_WWN_ARG_ERROR:
997 			(void) sprintf(err_msg,
998 				MSGSTR(10235,
999 				" Error: process WWN argument"));
1000 			break;
1001 
1002 		case L_NO_WWN_PROP_FOUND:
1003 			(void) sprintf(err_msg,
1004 				MSGSTR(10236,
1005 				" Error: WWN prop not found"));
1006 			break;
1007 
1008 		case L_NO_DRIVER_NODES_FOUND:
1009 			(void) sprintf(err_msg,
1010 				MSGSTR(10237,
1011 				" Error: Requested driver nodes not found"));
1012 			break;
1013 
1014 		case L_INVALID_MAP_DEV_ADDR:
1015 			(void) sprintf(err_msg,
1016 				MSGSTR(10330,
1017 				" Error: Invalid map device handle found"));
1018 			break;
1019 
1020 		case L_INVALID_MAP_DEV_PROP_TYPE:
1021 			(void) sprintf(err_msg,
1022 				MSGSTR(10331,
1023 				" Error: Invalid device property type found"));
1024 			break;
1025 
1026 		case L_INVALID_MAP_DEV_PROP_NAME:
1027 			(void) sprintf(err_msg,
1028 				MSGSTR(10332,
1029 				" Error: Invalid device property name found"));
1030 			break;
1031 
1032 		case L_INVALID_MAP_DEV_PROP:
1033 			(void) sprintf(err_msg,
1034 				MSGSTR(10333,
1035 				" Error: Invalid device property handle "
1036 				"found"));
1037 			break;
1038 
1039 		case L_SCSI_VHCI_NO_STANDBY:
1040 			(void) sprintf(err_msg,
1041 				MSGSTR(10334,
1042 				" Error: Unable to perform failover, "
1043 				"standby path unavailable"));
1044 			break;
1045 
1046 		case L_SCSI_VHCI_FAILOVER_NOTSUP:
1047 			(void) sprintf(err_msg,
1048 				MSGSTR(10335,
1049 				" Error: Device does not support failover"));
1050 			break;
1051 
1052 		case L_SCSI_VHCI_FAILOVER_BUSY:
1053 			(void) sprintf(err_msg,
1054 				MSGSTR(10336,
1055 				" Error: Failover currently in progress"));
1056 			break;
1057 
1058 		case L_NO_SUCH_DEV_FOUND:
1059 			(void) sprintf(err_msg,
1060 				MSGSTR(10337,
1061 				" Error: No such device found"));
1062 			break;
1063 
1064 		case L_NO_SUCH_PROP_FOUND:
1065 			(void) sprintf(err_msg,
1066 				MSGSTR(10338,
1067 				" Error: No such property found"));
1068 			break;
1069 
1070 		case L_INVALID_ARG:
1071 			(void) sprintf(err_msg,
1072 				MSGSTR(10339,
1073 				" Error: Invalid argument found"));
1074 			break;
1075 
1076 		default:
1077 
1078 			if (((L_SCSI_ERROR ^ errornum) == STATUS_GOOD) ||
1079 			((L_SCSI_ERROR ^ errornum) == STATUS_BUSY) ||
1080 			((L_SCSI_ERROR ^ errornum) == STATUS_CHECK) ||
1081 			((L_SCSI_ERROR ^ errornum) == STATUS_MET) ||
1082 			((L_SCSI_ERROR ^ errornum) == STATUS_INTERMEDIATE) ||
1083 		((L_SCSI_ERROR ^ errornum) == STATUS_INTERMEDIATE_MET) ||
1084 		((L_SCSI_ERROR ^ errornum) == STATUS_RESERVATION_CONFLICT) ||
1085 			((L_SCSI_ERROR ^ errornum) == STATUS_TERMINATED) ||
1086 			((L_SCSI_ERROR ^ errornum) == STATUS_QFULL)) {
1087 				(void) sprintf(err_msg,
1088 					MSGSTR(10080,
1089 					" SCSI Error - Sense Byte:(0x%x) %s \n"
1090 					" Error: Retry failed."),
1091 				(L_SCSI_ERROR ^ errornum) & STATUS_MASK,
1092 			decode_sense_byte((uchar_t)L_SCSI_ERROR ^ errornum));
1093 			} else {
1094 				(void) sprintf(err_msg,
1095 					MSGSTR(10081,
1096 					" Error: could not decode the"
1097 					" error message.\n"
1098 					" The given error message is not"
1099 					" defined in the library.\n"
1100 					" Message number: %d.\n"), errornum);
1101 			}
1102 
1103 	} /* end of switch */
1104 
1105 	errStrg = alloc_string(err_msg);
1106 
1107 	return (errStrg);
1108 }
1109