|
root / base / usr / src / cmd / luxadm / errormsgs.c
errormsgs.c C 1109 lines 24.5 KB
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */




/*
 * I18N message number ranges
 *  This file: 10000 - 10499
 *  Shared common messages: 1 - 1999
 */

/* #define	_POSIX_SOURCE 1 */


/*	Includes	*/
#include	<stdlib.h>
#include	<stdio.h>
#include	<fcntl.h>
#include	<nl_types.h>
#include	<sys/scsi/scsi.h>
#include	<string.h>
#include	<errno.h>
#include	"common.h"
#include	"errorcodes.h"



/*	Defines		*/
#define	MAXLEN	1000

/*
 * Allocate space for and return a pointer to a string
 * on the stack.  If the string is null, create
 * an empty string.
 */
char *
alloc_string(char *s)
{
	char	*ns;

	if (s == (char *)NULL) {
		ns = (char *)calloc(1, 1);
	} else {
		ns = (char *)calloc(1, strlen(s) + 1);
		if (ns != NULL) {
			(void) strncpy(ns, s, (strlen(s) + 1));
		}
	}
	return (ns);
}


/*
 * Decodes the SCSI sense byte to a string.
 *
 * RETURNS:
 *	character string
 */
static char *
decode_sense_byte(uchar_t status)
{
	switch (status & STATUS_MASK) {
		case STATUS_GOOD:
			return (MSGSTR(10000, "Good status"));

		case STATUS_CHECK:
			return (MSGSTR(128, "Check condition"));

		case STATUS_MET:
			return (MSGSTR(124, "Condition met"));

		case STATUS_BUSY:
			return (MSGSTR(37, "Busy"));

		case STATUS_INTERMEDIATE:
			return (MSGSTR(10001, "Intermediate"));

		case STATUS_INTERMEDIATE_MET:
			return (MSGSTR(10002, "Intermediate - condition met"));

		case STATUS_RESERVATION_CONFLICT:
			return (MSGSTR(10003, "Reservation_conflict"));

		case STATUS_TERMINATED:
			return (MSGSTR(126, "Command terminated"));

		case STATUS_QFULL:
			return (MSGSTR(83, "Queue full"));

		default:
			return (MSGSTR(4, "Unknown status"));
	}
}


/*
 * This function finds a predefined error string to a given
 * error number (errornum), allocates memory for the string
 * and returns the corresponding error message to the caller.
 *
 * RETURNS
 *	error string	if O.K.
 *	NULL		otherwise
 */
char
*get_errString(int errornum)
{
char	err_msg[MAXLEN], *errStrg;

	err_msg[0] = '\0'; /* Just in case */
	if (errornum < L_BASE) {
			/* Some sort of random system error most likely */
			errStrg = strerror(errno);
			if (errStrg != NULL) {
				(void) strcpy(err_msg, errStrg);
			} else { /* Something's _really_ messed up */
				(void) sprintf(err_msg,
					MSGSTR(10081,
					" Error: could not decode the"
					" error message.\n"
					" The given error message is not"
					" defined in the library.\n"
					" Message number: %d.\n"), errornum);
			}

	/* Make sure ALL CASES set err_msg to something */
	} else switch (errornum) {
		case L_SCSI_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10096,
				" Error: SCSI failure."));
			break;

		case L_PR_INVLD_TRNSFR_LEN:
			(void) sprintf(err_msg,
				MSGSTR(10005,
				" Error: Persistant Reserve command"
				" transfer length not word aligned."));
			break;

		case L_RD_NO_DISK_ELEM:
			(void) sprintf(err_msg,
				MSGSTR(10006,
				" Error: Could not find the disk elements"
				" in the Receive Diagnostic pages."));
			break;

		case L_RD_INVLD_TRNSFR_LEN:
			(void) sprintf(err_msg,
				MSGSTR(10007,
				" Error: Receive Diagnostic command"
				" transfer length not word aligned."));
			break;

		case L_ILLEGAL_MODE_SENSE_PAGE:
			(void) sprintf(err_msg,
				MSGSTR(10008,
				" Error: Programming error - "
				"illegal Mode Sense parameter."));
			break;

		case L_INVALID_NO_OF_ENVSEN_PAGES:
			(void) sprintf(err_msg,
				MSGSTR(10009,
				" Error: Invalid no. of sense pages.\n"
				" Could not get valid sense page"
				" information from the device."));
			break;

		case L_INVALID_BUF_LEN:
			(void) sprintf(err_msg,
				MSGSTR(10010,
				" Error: Invalid buffer length.\n"
				" Could not get diagnostic "
				" information from the device."));
			break;

		case L_INVALID_PATH:
			(void) sprintf(err_msg,
				MSGSTR(113,
				" Error: Invalid pathname"));
			break;

		case L_NO_PHYS_PATH:
			(void) sprintf(err_msg,
				MSGSTR(10011,
				" Error: Could not get"
				" physical path to the device."));
			break;

		case L_NO_SES_PATH:
			(void) sprintf(err_msg,
				MSGSTR(10098,
				" Error: No SES found"
				" for the device path."));
			break;

		case L_INVLD_PATH_NO_SLASH_FND:
			(void) sprintf(err_msg,
				MSGSTR(10012,
				"Error in the device physical path."));
			break;

		case L_INVLD_PATH_NO_ATSIGN_FND:
			(void) sprintf(err_msg,
				MSGSTR(10013,
				" Error in the device physical path:"
				" no @ found."));
			break;

		case L_INVALID_SLOT:
			(void) sprintf(err_msg,
				MSGSTR(10014,
				" Error: Invalid path format."
				" Invalid slot."));
			break;

		case L_INVALID_LED_RQST:
			(void) sprintf(err_msg,
				MSGSTR(10015,
				" Error: Invalid LED request."));
			break;

		case L_INVALID_PATH_FORMAT:
			(void) sprintf(err_msg,
				MSGSTR(10016,
				" Error: Invalid path format."));
			break;

		case L_OPEN_PATH_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10017,
				" Error opening the path."));
			break;

		case L_INVALID_PASSWORD_LEN:
			(void) sprintf(err_msg,
				MSGSTR(10018,
				"Error: Invalid password length."));
			break;

		case L_INVLD_PHYS_PATH_TO_DISK:
			(void) sprintf(err_msg,
				MSGSTR(10019,
				" Error: Physical path not of a disk."));
			break;

		case L_INVLD_ID_FOUND:
			(void) sprintf(err_msg,
				MSGSTR(10020,
				" Error in the device physical path:"
				" Invalid ID found in the path."));
			break;

		case L_INVLD_WWN_FORMAT:
			(void) sprintf(err_msg,
				MSGSTR(10021,
				" Error in the device physical path:"
				" Invalid wwn format."));

			break;

		case L_NO_VALID_PATH:
			(void) sprintf(err_msg,
				MSGSTR(10022,
				" Error: Could not find valid path to"
				" the device."));
			break;

		case L_NO_WWN_FOUND_IN_PATH:
			(void) sprintf(err_msg,
				MSGSTR(10023,
				" Error in the device physical path:"
				" No WWN found."));

			break;

		case L_NO_NODE_WWN_IN_WWNLIST:
			(void) sprintf(err_msg,
				MSGSTR(10024,
				" Error: Device's Node WWN is not"
				" found in the WWN list.\n"));
			break;

		case L_NO_NODE_WWN_IN_BOXLIST:
			(void) sprintf(err_msg,
				MSGSTR(10025,
				" Error: Device's Node WWN is not"
				" found in the Box list.\n"));
			break;

		case L_NULL_WWN_LIST:
			(void) sprintf(err_msg,
				MSGSTR(10026,
				" Error: Null WWN list found."));
			break;

		case L_NO_LOOP_ADDRS_FOUND:
			(void) sprintf(err_msg,
				MSGSTR(10027,
				" Error: Could not find the loop address for "
				" the device at physical path."));

			break;

		case L_INVLD_PORT_IN_PATH:
			(void) sprintf(err_msg,
				MSGSTR(10028,
				"Error in the device physical path:"
				" Invalid port number found."
				" (Should be 0 or 1)."));

			break;

		case L_INVALID_LOOP_MAP:
			(void) sprintf(err_msg,
				MSGSTR(10029,
				"Error: Invalid loop map found."));
			break;

		case L_SFIOCGMAP_IOCTL_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10030,
				" Error: SFIOCGMAP ioctl failed."
				" Cannot read loop map."));
			break;

		case L_FCIO_GETMAP_IOCTL_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10031,
				" Error: FCIO_GETMAP ioctl failed."
				" Cannot read loop map."));
			break;

		case L_FCIO_LINKSTATUS_FAILED:
			(void) sprintf(err_msg,
				MSGSTR(10032,
				" Error: FCIO_LINKSTATUS ioctl failed."
				" Cannot read loop map."));
			break;

		case L_FCIOGETMAP_INVLD_LEN:
			(void) sprintf(err_msg,
				MSGSTR(10033,
				" Error: FCIO_GETMAP ioctl returned"
				" an invalid parameter:"
				" # entries to large."));
			break;

		case L_FCIO_FORCE_LIP_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10034,
				" Error: FCIO_FORCE_LIP ioctl failed."));
			break;

		case L_FCIO_FORCE_LIP_PARTIAL_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10115,
				" Error: FCIO_FORCE_LIP ioctl failed on one"
				" or more (but not all) of the paths."));
			break;

		case L_DWNLD_CHKSUM_FAILED:
			(void) sprintf(err_msg,
				MSGSTR(10035,
				"Error: Download file checksum failed."));

			break;

		case L_DWNLD_READ_HEADER_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10036,
				" Error: Reading download file exec"
				" header failed."));
			break;

		case L_DWNLD_READ_INCORRECT_BYTES:
			(void) sprintf(err_msg,
				MSGSTR(10037,
				" Error: Incorrect number of bytes read."));
			break;

		case L_DWNLD_INVALID_TEXT_SIZE:
			(void) sprintf(err_msg,
				MSGSTR(10038,
				" Error: Reading text segment: "
				" Found wrong size."));
			break;

		case L_DWNLD_READ_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10039,
				" Error: Failed to read download file."));
			break;

		case L_DWNLD_BAD_FRMWARE:
			(void) sprintf(err_msg,
				MSGSTR(10040,
				" Error: Bad Firmware MAGIC."));
			break;

		case L_DWNLD_TIMED_OUT:
			(void) sprintf(err_msg,
				MSGSTR(10041,
				" Error: Timed out in 5 minutes"
				" waiting for the"
				" IB to become available."));
			break;

		case L_REC_DIAG_PG1:
			(void) sprintf(err_msg,
				MSGSTR(10042,
				" Error parsing the Receive"
				" diagnostic page."));
			break;

		case L_TRANSFER_LEN:
			(void) sprintf(err_msg,
				MSGSTR(10043, "  "));
			break;

		case L_REQUIRE_FILE:
			(void) sprintf(err_msg,
				MSGSTR(10109,
				" Error: No default file.  You must specify"
				" the filename path."));
			break;

		case L_MALLOC_FAILED:
			(void) sprintf(err_msg,
				MSGSTR(10,
				" Error: Unable to allocate memory."));
			break;

		case L_LOCALTIME_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10044,
				" Error: Could not convert time"
				" to broken-down time: Hrs/Mins/Secs."));
			break;

		case L_SELECT_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10045,
				" select() error during retry:"
				" Could not wait for"
				" specified time."));
			break;

		case L_NO_DISK_DEV_FOUND:
			(void) sprintf(err_msg,
				MSGSTR(10046,
				" Error: No disk devices found"
				" in the /dev/rdsk"
				" directory."));
			break;

		case L_NO_TAPE_DEV_FOUND:
			(void) sprintf(err_msg,
				MSGSTR(10047,
				" Error: No tape devices found"
				" in the /dev/rmt"
				" directory."));
			break;

		case L_LSTAT_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10048,
				" lstat() error: Cannot obtain status"
				" for the device."));
			break;

		case L_SYMLINK_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10049,
				" Error: Could not read the symbolic link."));
			break;

		case L_UNAME_FAILED:
			(void) sprintf(err_msg,
				MSGSTR(10050,
				" uname() error: Could not obtain the"
				" architeture of the host machine."));
			break;

		case L_DRVCONFIG_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10051,
				" Error: Could not run drvconfig."));
			break;

		case L_DISKS_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10052,
				" Error: Could not run disks."));
			break;

		case L_DEVLINKS_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10053,
				" Error: Could not run devlinks."));
			break;

		case L_READ_DEV_DIR_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10054,
				" Error: Could not read /dev/rdsk"
				" directory."));
			break;

		case L_OPEN_ES_DIR_FAILED:
			(void) sprintf(err_msg,
				MSGSTR(10055,
				" Error: Could not open /dev/es"
				" directory."));
			break;

		case L_LSTAT_ES_DIR_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10056,
				" lstat() error: Could not get status"
				" for /dev/es directory."));
			break;

		case L_DEV_BUSY:
			(void) sprintf(err_msg,
				MSGSTR(10057,
				" Error: Could not offline the device\n"
				" May be Busy."));
			break;

		case L_EXCL_OPEN_FAILED:
			(void) sprintf(err_msg,
				MSGSTR(10058,
				" Error: Could not open device in"
				" exclusive mode."
				"  May already be open."));
			break;

		case L_DEVICE_RESERVED:
			(void) sprintf(err_msg,
				MSGSTR(10059,
				" Error: Disk is reserved."));
			break;

		case L_DISKS_RESERVED:
			(void) sprintf(err_msg,
				MSGSTR(10060,
				" Error: One or more disks in"
				" SENA are reserved."));
			break;

		case L_SLOT_EMPTY:
			(void) sprintf(err_msg,
				MSGSTR(10061,
				" Error: Slot is empty."));
			break;

		case L_ACQUIRE_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10062,
				" Error: Could not acquire"
				" the device."));
			break;

		case L_POWER_OFF_FAIL_BUSY:
			(void) sprintf(err_msg,
				MSGSTR(10063,
				" Error: Could not power off the device.\n"
				" May be Busy."));
			break;

		case L_ENCL_NAME_CHANGE_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10064,
				" Error: The Enclosure name change failed."));
			break;

		case L_DUPLICATE_ENCLOSURES:
			(void) sprintf(err_msg,
				MSGSTR(10065,
				" Error: There are two or more enclosures"
				" with the same name."
				" Please use a logical or physical"
				" pathname."));
			break;

		case L_INVALID_NUM_DISKS_ENCL:
			(void) sprintf(err_msg,
				MSGSTR(10066,
				" Error: The number of disks in the"
				" front & rear of the enclosure are"
				" different."
				" This is not a supported configuration."));
			break;

		case L_ENCL_INVALID_PATH:
			(void) sprintf(err_msg,
				MSGSTR(10067,
				" Error: Invalid path."
				" Device is not a SENA subsystem."));
			break;

		case L_NO_ENCL_LIST_FOUND:
			(void) sprintf(err_msg,
				MSGSTR(10068,
				" Error: Cannot get the Box list."));
			break;

		case L_IB_NO_ELEM_FOUND:
			(void) sprintf(err_msg,
				MSGSTR(10069,
				" Error: No elements returned from"
				" enclosure (IB)."));
			break;

		case L_GET_STATUS_FAILED:
			(void) sprintf(err_msg,
				MSGSTR(10070,
				" Error: Get status failed."));
			break;

		case L_RD_PG_MIN_BUFF:
			(void) sprintf(err_msg,
				MSGSTR(10071,
				" Error: Reading page from IB.\n"
				" Buffer size too small."));
			break;

		case L_RD_PG_INVLD_CODE:
			(void) sprintf(err_msg,
				MSGSTR(10072,
				" Error: Reading page from IB\n"
				" Invalid page code or page len found."));
			break;

		case L_BP_BUSY_RESERVED:
			(void) sprintf(err_msg,
				MSGSTR(10073,
				" Error: There is a busy or reserved disk"
				" attached to this backplane.\n"
				" You must close the disk,\n"
				" or release the disk,\n"
				" or resubmit the command using"
				" the Force option."));
			break;

		case L_BP_BUSY:
			(void) sprintf(err_msg,
				MSGSTR(10074,
				" Error: There is a busy disk"
				" attached to this backplane.\n"
				" You must close the disk,\n"
				" or resubmit the command using"
				" the Force option."));
			break;

		case L_BP_RESERVED:
			(void) sprintf(err_msg,
				MSGSTR(10075,
				" Error: There is a reserved disk"
				" attached to this backplane.\n"
				" You must release the disk,\n"
				" or resubmit the subcommand using"
				" the Force option."));
			break;

		case L_NO_BP_ELEM_FOUND:
			(void) sprintf(err_msg,
				MSGSTR(10076,
				" Error: No Back plane elements found"
				" in the enclosure."));
			break;

		case L_SSA_CONFLICT:
			(void) sprintf(err_msg,
				MSGSTR(10077,
				" There is a conflict between the "
				"enclosure name and an SSA name of "
				"same form, cN.\n"
				" Please use a logical or physical "
				"pathname."));
			break;

		case L_WARNING:
			(void) sprintf(err_msg,
				MSGSTR(10078, " Warning:"));

			break;

		case L_TH_JOIN:
			(void) sprintf(err_msg,
				MSGSTR(10079,
				" Error: Thread join failed."));
			break;

		case L_FCIO_RESET_LINK_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10082,
				" Error: FCIO_RESET_LINK ioctl failed.\n"
				" Could not reset the loop."));
			break;

		case L_FCIO_GET_FCODE_REV_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10083,
				" Error: FCIO_GET_FCODE_REV ioctl failed.\n"
				" Could not get the fcode version."));
			break;

		case L_FCIO_GET_FW_REV_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10084,
				" Error: FCIO_GET_FW_REV ioctl failed.\n"
				" Could not get the firmware revision."));
			break;

		case L_NO_DEVICES_FOUND:
			(void) sprintf(err_msg,
				MSGSTR(10085,
				" No FC devices found."));
			break;

		case L_INVALID_DEVICE_COUNT:
			(void) sprintf(err_msg,
				MSGSTR(10086,
				" Error: FCIO_GET_DEV_LIST ioctl returned"
				" an invalid device count."));
			break;

		case L_FCIO_GET_NUM_DEVS_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10087,
				" Error: FCIO_GET_NUM_DEVS ioctl failed.\n"
				" Could not get the number of devices."));
			break;

		case L_FCIO_GET_DEV_LIST_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10088,
				" Error: FCIO_GET_DEV_LIST ioctl failed.\n"
				" Could not get the device list."));
			break;

		case L_FCIO_GET_LINK_STATUS_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10089,
				" Error: FCIO_GET_LINK_STATUS ioctl failed.\n"
				" Could not get the link status."));
			break;

		case L_PORT_OFFLINE_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10090,
				" Error: ioctl to offline the port failed."));
			break;

		case L_PORT_OFFLINE_UNSUPPORTED:
			(void) sprintf(err_msg,
				MSGSTR(10091,
				" Error: The driver does not support ioctl to"
				" disable the FCA port."));
			break;

		case L_PORT_ONLINE_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10092,
				" Error: ioctl to online the port failed."));
			break;

		case L_PORT_ONLINE_UNSUPPORTED:
			(void) sprintf(err_msg,
				MSGSTR(10093,
				" Error: The driver does not support ioctl to"
				" enable the FCA port."));
			break;

		case L_FCP_TGT_INQUIRY_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10094,
				" Error: FCP_TGT_INQUIRY ioctl failed.\n"
				" Could not get the target inquiry data"
				" from FCP."));
			break;

		case L_FSTAT_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10095,
				" fstat() error: Cannot obtain status"
				" for the device."));
			break;

		case L_FCIO_GET_HOST_PARAMS_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10097,
				" Error: FCIO_GET_HOST_PARAMS ioctl failed.\n"
				" Could not get the host parameters."));
			break;

		case L_STAT_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10099,
				" stat() error: Cannot obtain status"
				" for the device."));
			break;

		case L_DEV_SNAPSHOT_FAILED:
			(void) sprintf(err_msg,
				MSGSTR(10100,
				" Error: Could not retrieve device tree"
				" snapshot."));
			break;

		case L_LOOPBACK_UNSUPPORTED:
			(void) sprintf(err_msg,
				MSGSTR(10101,
				" Error: Loopback mode is unsupported for this"
				" device."));
			break;

		case L_LOOPBACK_FAILED:
			(void) sprintf(err_msg,
				MSGSTR(10102,
				" Error: Error occurred during loopback mode"
				" set."));
			break;

		case L_FCIO_GET_TOPOLOGY_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10103,
				" Error: FCIO_GET_TOPOLOGY ioctl failed.\n"
				" Could not get the fca port topology."));
			break;

		case L_UNEXPECTED_FC_TOPOLOGY:
			(void) sprintf(err_msg,
				MSGSTR(10104,
				" Error: Unexpected Fibre Channel topology"
				" found."));
			break;

		case L_INVALID_PRIVATE_LOOP_ADDRESS:
			(void) sprintf(err_msg,
				MSGSTR(10105,
				" Error: AL_PA is not a valid private loop"
				" address."));
			break;

		case L_NO_FABRIC_ADDR_FOUND:
			(void) sprintf(err_msg,
				MSGSTR(10106,
				" Error: Could not find the fabric address"
				" for the device at physical path."));
			break;

		case L_INVALID_FABRIC_ADDRESS:
			(void) sprintf(err_msg,
				MSGSTR(10107,
				" Error: Device port address on the Fabric"
				" topology is not valid."));
			break;

		case L_PT_PT_FC_TOP_NOT_SUPPORTED:
			(void) sprintf(err_msg,
				MSGSTR(10108,
				" Error: Point to Point Fibre Channel "
				"topology is currently not supported."));
			break;

		case L_FCIO_DEV_LOGIN_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10310,
				" Error: FCIO_DEV_LOGIN ioctl failed."));
			break;

		case L_FCIO_DEV_LOGOUT_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10311,
				" Error: FCIO_DEV_LOGOUT ioctl failed."));
			break;

		case L_OPNOSUPP_ON_TOPOLOGY:
			(void) sprintf(err_msg,
				MSGSTR(10312,
				" Error: operation not supported "
				"on connected topology."));
			break;

		case L_INVALID_PATH_TYPE:
			(void) sprintf(err_msg,
				MSGSTR(10313,
				" Error: operation not supported "
				"on the path."));
			break;

		case L_FCIO_GET_STATE_FAIL:
			(void) sprintf(err_msg,
				MSGSTR(10314,
				" Error: FCIO_GET_STATE ioctl failed."));
			break;

		case L_WWN_NOT_FOUND_IN_DEV_LIST:
			(void) sprintf(err_msg,
				MSGSTR(10315,
				" Error: device WWN not found in "
				"device list."));
			break;

		case L_STAT_RMT_DIR_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10110,
				" stat() error: Could not get status"
				" for /dev/rmt directory."));
			break;

		case L_STAT_DEV_DIR_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10111,
				" stat() error: Could not get status"
				" for /dev/dsk directory."));
			break;

		case L_PROM_INIT_FAILED:
			(void) sprintf(err_msg,
				MSGSTR(10234,
				" Error: di_prom_init failure"));
			break;

		case L_PORT_DRIVER_NOT_FOUND:
			(void) sprintf(err_msg,
				MSGSTR(10113,
				" Error: requested port driver"
				" does not exist"));
			break;

		case L_PHYS_PATH_NOT_FOUND:
			(void) sprintf(err_msg,
				MSGSTR(10114,
				" Error: requested phys path does not exist"));
			break;

		case L_GET_DEV_LIST_ULP_FAILURE:
			(void) sprintf(err_msg,
				MSGSTR(10150,
				" Error: g_get_dev_list failed on ULP "
				"processing of target device(s)"));
			break;

		case L_SCSI_VHCI_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10230,
				" Error: Unable to perform failover"));
			break;

		case L_SCSI_VHCI_ALREADY_ACTIVE:
			(void) sprintf(err_msg,
				MSGSTR(10231,
				" Error: Pathclass already active"));
			break;

		case L_NO_DEVID:
			(void) sprintf(err_msg,
				MSGSTR(10232,
				" Error: No device identifier found"));
			break;

		case L_DRIVER_NOTSUPP:
			(void) sprintf(err_msg,
				MSGSTR(10233,
				" Error: Driver not supported"));
			break;

		case L_PROC_WWN_ARG_ERROR:
			(void) sprintf(err_msg,
				MSGSTR(10235,
				" Error: process WWN argument"));
			break;

		case L_NO_WWN_PROP_FOUND:
			(void) sprintf(err_msg,
				MSGSTR(10236,
				" Error: WWN prop not found"));
			break;

		case L_NO_DRIVER_NODES_FOUND:
			(void) sprintf(err_msg,
				MSGSTR(10237,
				" Error: Requested driver nodes not found"));
			break;

		case L_INVALID_MAP_DEV_ADDR:
			(void) sprintf(err_msg,
				MSGSTR(10330,
				" Error: Invalid map device handle found"));
			break;

		case L_INVALID_MAP_DEV_PROP_TYPE:
			(void) sprintf(err_msg,
				MSGSTR(10331,
				" Error: Invalid device property type found"));
			break;

		case L_INVALID_MAP_DEV_PROP_NAME:
			(void) sprintf(err_msg,
				MSGSTR(10332,
				" Error: Invalid device property name found"));
			break;

		case L_INVALID_MAP_DEV_PROP:
			(void) sprintf(err_msg,
				MSGSTR(10333,
				" Error: Invalid device property handle "
				"found"));
			break;

		case L_SCSI_VHCI_NO_STANDBY:
			(void) sprintf(err_msg,
				MSGSTR(10334,
				" Error: Unable to perform failover, "
				"standby path unavailable"));
			break;

		case L_SCSI_VHCI_FAILOVER_NOTSUP:
			(void) sprintf(err_msg,
				MSGSTR(10335,
				" Error: Device does not support failover"));
			break;

		case L_SCSI_VHCI_FAILOVER_BUSY:
			(void) sprintf(err_msg,
				MSGSTR(10336,
				" Error: Failover currently in progress"));
			break;

		case L_NO_SUCH_DEV_FOUND:
			(void) sprintf(err_msg,
				MSGSTR(10337,
				" Error: No such device found"));
			break;

		case L_NO_SUCH_PROP_FOUND:
			(void) sprintf(err_msg,
				MSGSTR(10338,
				" Error: No such property found"));
			break;

		case L_INVALID_ARG:
			(void) sprintf(err_msg,
				MSGSTR(10339,
				" Error: Invalid argument found"));
			break;

		default:

			if (((L_SCSI_ERROR ^ errornum) == STATUS_GOOD) ||
			((L_SCSI_ERROR ^ errornum) == STATUS_BUSY) ||
			((L_SCSI_ERROR ^ errornum) == STATUS_CHECK) ||
			((L_SCSI_ERROR ^ errornum) == STATUS_MET) ||
			((L_SCSI_ERROR ^ errornum) == STATUS_INTERMEDIATE) ||
		((L_SCSI_ERROR ^ errornum) == STATUS_INTERMEDIATE_MET) ||
		((L_SCSI_ERROR ^ errornum) == STATUS_RESERVATION_CONFLICT) ||
			((L_SCSI_ERROR ^ errornum) == STATUS_TERMINATED) ||
			((L_SCSI_ERROR ^ errornum) == STATUS_QFULL)) {
				(void) sprintf(err_msg,
					MSGSTR(10080,
					" SCSI Error - Sense Byte:(0x%x) %s \n"
					" Error: Retry failed."),
				(L_SCSI_ERROR ^ errornum) & STATUS_MASK,
			decode_sense_byte((uchar_t)L_SCSI_ERROR ^ errornum));
			} else {
				(void) sprintf(err_msg,
					MSGSTR(10081,
					" Error: could not decode the"
					" error message.\n"
					" The given error message is not"
					" defined in the library.\n"
					" Message number: %d.\n"), errornum);
			}

	} /* end of switch */

	errStrg = alloc_string(err_msg);

	return (errStrg);
}