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 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352
|
/* Copyright (c) 1996-2004, Adaptec Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the Adaptec Corporation nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/****************************************************************************
*
* Created: 7/17/98
*
*****************************************************************************
*
* File Name: Command.cpp
* Module:
* Contributors: Lee Page
* Description: This object provides the common interface to many commands that
the engine is capable of performing. It is expected that all
parameters necessary for the completion of the command will be
gathered by the derived object.
* Version Control:
*
* $Revision$
* $NoKeywords: $
* $Log$
* Revision 1.1.1.1 2004-04-29 10:20:14 bap
* Imported upstream version 0.0.4.
*
*****************************************************************************/
/*** INCLUDES ***/
#ifdef _DPT_NETWARE
#include <nwlocale.h>
#ifdef __cplusplus
extern "C" {
#endif
unsigned long DPT_Bswapl(unsigned long value)
{
return((value >> 24)
+ ((value >> 8) & 0xFF00)
+ ((value << 8) & 0xFF0000)
+ (value << 24));
}
#ifdef __cplusplus
};
#endif
#endif //_DPT_NETWARE
#include "debug.hpp"
#include "command.hpp"
#include "rustring.h"
#include "rdutlosd.h"
#include "ctlr_map.hpp"
#include "eng_std.h"
#include "rscenum.h"
#include <stdio.h>
#include <ctype.h>
/*** CONSTANTS ***/
extern char* EventStrings[];
int FID_RESET_OUTBUFF = 1;
uSHORT PHYS_LIST_SIZE = 675;
uSHORT LOG_LIST_SIZE = 15 * 128;
const DPT_TAG_T INVALID_TAG = (DPT_TAG_T) -1;
/*** TYPES ***/
/*** STATIC DATA ***/
DPT_EngineIO_C *Command::engine = 0;
int Command::num_Instances = 0;
/*** MACROS ***/
/*** PROTOTYPES ***/
/*** FUNCTIONS ***/
Command::Command()
{
ENTER( "Command::Command()" );
// printf( "before num_Instances\n" );
num_Instances++;
EXIT();
}
Command::~Command()
{
ENTER( "Command::~Command()" );
num_Instances--;
if (num_Instances == 0 && engine)
{
engine->Disconnect();
engine->Close();
// if we were going to dynamically load the engine, then we'd use the line
// below.
// Unload_Module( eng_Module_Handle );
delete engine;
engine = 0;
}
EXIT();
}
Command::Dpt_Error::operator char *() const
{
ENTER( "Command::Dpt_Error::operator char *() const" );
char *constant_Str = EventStrings[STR_UNKNOWN];
switch ((uLONG) err)
{
case DPT_CMD_ERR_NO_ERROR:
constant_Str = STR_CMD_ERR_NO_ERROR;
break;
case DPT_CMD_PARSER_ERROR:
constant_Str = EventStrings[STR_CMD_PARSER_ERROR];
break;
case DPT_CMD_ERR_INVALID_LIST_TYPE:
constant_Str = EventStrings[STR_CMD_ERR_INVALID_LIST_TYPE];
break;
case DPT_CMD_ERR_CANT_FIND_COMPONENT:
constant_Str = EventStrings[STR_CMD_ERR_CANT_FIND_COMPONENT];
break;
case DPT_CMD_ERR_CANT_FIND_HBA_INDEX:
constant_Str = EventStrings[STR_CMD_ERR_CANT_FIND_HBA_INDEX];
break;
case DPT_CMD_ERR_CANT_FIND_HBA_INDEX_NVRAM:
constant_Str = EventStrings[STR_CMD_ERR_CANT_FIND_HBA_INDEX_NVRAM];
break;
case DPT_CMD_ERR_COMPONENT_BUSY:
constant_Str = EventStrings[STR_CMD_ERR_COMPONENT_BUSY];
break;
case DPT_CMD_ERR_INVALID_FLASH_IMAGE:
constant_Str = EventStrings[STR_CMD_ERR_INVALID_FLASH_IMAGE];
break;
case DPT_ERR_VALUE_OUT_OF_RANGE:
constant_Str = EventStrings[STR_ERR_VALUE_OUT_OF_RANGE];
break;
case DPT_ERR_INVALID_FILE:
constant_Str = EventStrings[STR_ERR_INVALID_FILE];
break;
case DPT_ERR_INVALID_RAID_TYPE:
constant_Str = EventStrings[STR_ERR_INVALID_RAID_TYPE];
break;
case DPT_ERR_NOT_ENOUGH_MEMORY:
constant_Str = EventStrings[STR_ERR_NOT_ENOUGH_MEMORY];
break;
case DPT_ERR_TWO_TB_RAID:
constant_Str = EventStrings[STR_ERR_TWO_TB_RAID];
break;
case DPT_ERR_INVALID_SEGMENT_OFFSET:
constant_Str = EventStrings[STR_ERR_INVALID_SEGMENT_OFFSET];
break;
case DPT_ERR_INVALID_SEGMENT_SIZE:
constant_Str = EventStrings[STR_ERR_INVALID_SEGMENT_SIZE];
break;
case DPT_ERR_NAME_ALREADY_USED:
constant_Str = EventStrings[STR_ERR_NAME_ALREADY_USED];
break;
case DPT_CMD_ERR_CMD_NOT_POSS_ON_RAID:
constant_Str = EventStrings[STR_CMD_ERR_CMD_NOT_POSS_ON_RAID];
break;
case DPT_CMD_ERR_CMD_NOT_POSS_ON_HBA:
constant_Str = EventStrings[STR_CMD_ERR_CMD_NOT_POSS_ON_HBA];
break;
case DPT_CMD_ERR_CMD_NOT_POSS_ON_THIS_DEVICE:
constant_Str = EventStrings[STR_CMD_ERR_CMD_NOT_POSS_ON_THIS_DEVICE];
break;
case DPT_ERR_POSS_BUFFER_CORRUPTION:
constant_Str = EventStrings[STR_ERR_POSS_BUFFER_CORRUPTION];
break;
case DPT_MSG_RTN_COMPLETED:
constant_Str = EventStrings[STR_MSG_RTN_COMPLETED];
break;
case DPT_MSG_RTN_STARTED:
constant_Str = EventStrings[STR_MSG_RTN_STARTED];
break;
case DPT_MSG_RTN_FAILED:
constant_Str = EventStrings[STR_MSG_RTN_FAILED];
break;
case DPT_MSG_RTN_DATA_OVERFLOW:
constant_Str = EventStrings[STR_MSG_RTN_DATA_OVERFLOW];
break;
case DPT_MSG_RTN_DATA_UNDERFLOW:
constant_Str = EventStrings[STR_MSG_RTN_DATA_UNDERFLOW];
break;
case DPT_MSG_RTN_IGNORED:
constant_Str = EventStrings[STR_MSG_RTN_IGNORED];
break;
case DPT_MSG_RTN_DISCONNECT:
constant_Str = EventStrings[STR_MSG_RTN_DISCONNECT];
break;
case DPT_ERR_CONN_LIST_ALLOC:
constant_Str = EventStrings[STR_ERR_CONN_LIST_ALLOC];
break;
case DPT_ERR_SEMAPHORE_ALLOC:
constant_Str = EventStrings[STR_ERR_SEMAPHORE_ALLOC];
break;
case DPT_ERR_OSD_OPEN_ENGINE:
constant_Str = EventStrings[STR_ERR_OSD_OPEN_ENGINE];
break;
case DPT_ERR_INVALID_IO_METHOD:
constant_Str = EventStrings[STR_ERR_INVALID_IO_METHOD];
break;
case DPT_ERR_NO_SMARTROM:
constant_Str = EventStrings[STR_ERR_NO_SMARTROM];
break;
case DPT_ERR_ENGINE_INIT:
constant_Str = EventStrings[STR_ERR_ENGINE_INIT];
break;
case DPT_ERR_INVALID_CONN_TAG:
constant_Str = EventStrings[STR_ERR_INVALID_CONN_TAG];
break;
case DPT_ERR_SEMAPHORE_TIMEOUT:
constant_Str = EventStrings[STR_ERR_SEMAPHORE_TIMEOUT];
break;
case DPT_ERR_NULL_IO_BUFFER:
constant_Str = EventStrings[STR_ERR_NULL_IO_BUFFER];
break;
case DPT_ERR_INVALID_TGT_TAG:
constant_Str = EventStrings[STR_ERR_INVALID_TGT_TAG];
break;
case DPT_ERR_DESTROY_SEMAPHORE:
constant_Str = EventStrings[STR_ERR_DESTROY_SEMAPHORE];
break;
case DPT_ERR_MEM_ALLOC:
constant_Str = EventStrings[STR_ERR_MEM_ALLOC];
break;
case DPT_ERR_INVALID_DEV_ADDR:
constant_Str = EventStrings[STR_ERR_INVALID_DEV_ADDR];
break;
case DPT_ERR_DUPLICATE_NAME:
constant_Str = EventStrings[STR_ERR_DUPLICATE_NAME];
break;
case DPT_ERR_GET_CCB:
constant_Str = EventStrings[STR_ERR_GET_CCB];
break;
case DPT_ERR_NO_RAID_DEVICES:
constant_Str = EventStrings[STR_ERR_NO_RAID_DEVICES];
break;
case DPT_ERR_RESERVE_BLK_SIG:
constant_Str = EventStrings[STR_ERR_RESERVE_BLK_SIG];
break;
case DPT_ERR_FORMAT_BLK_SIZE:
constant_Str = EventStrings[STR_ERR_FORMAT_BLK_SIZE];
break;
case DPT_ERR_RAID_REFNUM:
constant_Str = EventStrings[STR_ERR_RAID_REFNUM];
break;
case DPT_ERR_RAID_COMP_DUPLICATE:
constant_Str = EventStrings[STR_ERR_RAID_COMP_DUPLICATE];
break;
case DPT_ERR_RAID_COMP_RESTRICT:
constant_Str = EventStrings[STR_ERR_RAID_COMP_RESTRICT];
break;
case DPT_ERR_RAID_COMP_USED:
constant_Str = EventStrings[STR_ERR_RAID_COMP_USED];
break;
case DPT_ERR_RAID_COMP_GHOST:
constant_Str = EventStrings[STR_ERR_RAID_COMP_GHOST];
break;
case DPT_ERR_RAID_COMP_FAILED:
constant_Str = EventStrings[STR_ERR_RAID_COMP_FAILED];
break;
case DPT_ERR_RAID_TOO_FEW:
constant_Str = EventStrings[STR_ERR_RAID_TOO_FEW];
break;
case DPT_ERR_RAID_TOO_MANY:
constant_Str = EventStrings[STR_ERR_RAID_TOO_MANY];
break;
case DPT_ERR_RAID_EVEN:
constant_Str = EventStrings[STR_ERR_RAID_EVEN];
break;
case DPT_ERR_RAID_ODD:
constant_Str = EventStrings[STR_ERR_RAID_ODD];
break;
case DPT_ERR_RAID_POWER_2_PLUS:
constant_Str = EventStrings[STR_ERR_RAID_POWER_2_PLUS];
break;
case DPT_ERR_RAID_CHAN_COUNT:
constant_Str = EventStrings[STR_ERR_RAID_CHAN_COUNT];
break;
case DPT_ERR_RAID_MIN_STRIPE:
constant_Str = EventStrings[STR_ERR_RAID_MIN_STRIPE];
break;
case DPT_ERR_RAID_MAX_STRIPE:
constant_Str = EventStrings[STR_ERR_RAID_MAX_STRIPE];
break;
case DPT_ERR_RAID_ZERO_STRIPES:
constant_Str = EventStrings[STR_ERR_RAID_ZERO_STRIPES];
break;
case DPT_ERR_RAID_TOO_LARGE:
constant_Str = EventStrings[STR_ERR_RAID_TOO_LARGE];
break;
case DPT_ERR_RAID_START_CHAN:
constant_Str = EventStrings[STR_ERR_RAID_START_CHAN];
break;
case DPT_ERR_RAID_SEQ_CHAN:
constant_Str = EventStrings[STR_ERR_RAID_SEQ_CHAN];
break;
case DPT_ERR_RAID_DIFF_STRIPES:
constant_Str = EventStrings[STR_ERR_RAID_DIFF_STRIPES];
break;
case DPT_ERR_RAID_DIFF_NUM_STR:
constant_Str = EventStrings[STR_ERR_RAID_DIFF_NUM_STR];
break;
case DPT_ERR_RAID_OVER_STRIPE:
constant_Str = EventStrings[STR_ERR_RAID_OVER_STRIPE];
break;
case DPT_ERR_RAID_COMP_REMOVE:
constant_Str = EventStrings[STR_ERR_RAID_COMP_REMOVE];
break;
case DPT_ERR_RAID_COMP_EMULATED:
constant_Str = EventStrings[STR_ERR_RAID_COMP_EMULATED];
break;
case DPT_ERR_RAID_COMP_DEVTYPE:
constant_Str = EventStrings[STR_ERR_RAID_COMP_DEVTYPE];
break;
case DPT_ERR_RAID_COMP_NON_512:
constant_Str = EventStrings[STR_ERR_RAID_COMP_NON_512];
break;
case DPT_ERR_RAID_DIFF_BLOCKS:
constant_Str = EventStrings[STR_ERR_RAID_DIFF_BLOCKS];
break;
case DPT_ERR_RAID_DIFF_CAPACITY:
constant_Str = EventStrings[STR_ERR_RAID_DIFF_CAPACITY];
break;
case DPT_ERR_RAID_DIFF_VENDOR:
constant_Str = EventStrings[STR_ERR_RAID_DIFF_VENDOR];
break;
case DPT_ERR_RAID_DIFF_PRODUCT:
constant_Str = EventStrings[STR_ERR_RAID_DIFF_PRODUCT];
break;
case DPT_ERR_RAID_DIFF_REVISION:
constant_Str = EventStrings[STR_ERR_RAID_DIFF_REVISION];
break;
case DPT_ERR_RAID_NOT_SUPPORTED:
constant_Str = EventStrings[STR_ERR_RAID_NOT_SUPPORTED];
break;
case DPT_ERR_RAID_INVALID_HBA:
constant_Str = EventStrings[STR_ERR_RAID_INVALID_HBA];
break;
case DPT_ERR_RAID_TABLE_REQUIRED:
constant_Str = EventStrings[STR_ERR_RAID_TABLE_REQUIRED];
break;
case DPT_ERR_RAID_COMP_TAG:
constant_Str = EventStrings[STR_ERR_RAID_COMP_TAG];
break;
case DPT_ERR_RAID_MAX_ARRAYS:
constant_Str = EventStrings[STR_ERR_RAID_MAX_ARRAYS];
break;
case DPT_ERR_RAID_COMP_SIZE:
constant_Str = EventStrings[STR_ERR_RAID_COMP_SIZE];
break;
case DPT_ERR_RAID_FW_LEVEL:
constant_Str = EventStrings[STR_ERR_RAID_FW_LEVEL];
break;
case DPT_ERR_INVALID_HBA_ADDR:
constant_Str = EventStrings[STR_ERR_INVALID_HBA_ADDR];
break;
case DPT_ERR_ISA_ADDR_ONLY:
constant_Str = EventStrings[STR_ERR_ISA_ADDR_ONLY];
break;
case DPT_ERR_PRIMARY_HBA_EXISTS:
constant_Str = EventStrings[STR_ERR_PRIMARY_HBA_EXISTS];
break;
case DPT_ERR_NO_MORE_SLOTS:
constant_Str = EventStrings[STR_ERR_NO_MORE_SLOTS];
break;
case DPT_ERR_DUP_ISA_ADDR:
constant_Str = EventStrings[STR_ERR_DUP_ISA_ADDR];
break;
case DPT_ERR_DUP_EISA_SLOT:
constant_Str = EventStrings[STR_ERR_DUP_EISA_SLOT];
break;
case DPT_ERR_PRIMARY_ISA_ADDR:
constant_Str = EventStrings[STR_ERR_PRIMARY_ISA_ADDR];
break;
case DPT_ERR_SECONDARY_ISA_ADDR:
constant_Str = EventStrings[STR_ERR_SECONDARY_ISA_ADDR];
break;
case DPT_ERR_ABS_NO_MORE_IDS:
constant_Str = EventStrings[STR_ERR_ABS_NO_MORE_IDS];
break;
case DPT_ERR_ABS_NON_ZERO_LUN:
constant_Str = EventStrings[STR_ERR_ABS_NON_ZERO_LUN];
break;
case DPT_ERR_ABS_ADDR_LIMITS:
constant_Str = EventStrings[STR_ERR_ABS_ADDR_LIMITS];
break;
case DPT_ERR_ABS_ADDR_OCCUPIED:
constant_Str = EventStrings[STR_ERR_ABS_ADDR_OCCUPIED];
break;
case DPT_ERR_ABS_NO_MORE_LUNS:
constant_Str = EventStrings[STR_ERR_ABS_NO_MORE_LUNS];
break;
case DPT_ERR_NEW_ARTIFICIAL:
constant_Str = EventStrings[STR_ERR_NEW_ARTIFICIAL];
break;
case DPT_ERR_IO_NOT_SUPPORTED:
constant_Str = EventStrings[STR_ERR_IO_NOT_SUPPORTED];
break;
case DPT_ERR_RW_EXCEEDS_CAPACITY:
constant_Str = EventStrings[STR_ERR_RW_EXCEEDS_CAPACITY];
break;
case DPT_ERR_DATA_IN_OUT:
constant_Str = EventStrings[STR_ERR_DATA_IN_OUT];
break;
case DPT_ERR_SCSI_CMD_FAILED:
constant_Str = EventStrings[STR_ERR_SCSI_CMD_FAILED];
break;
case DPT_ERR_ARTIFICIAL_IO:
constant_Str = EventStrings[STR_ERR_ARTIFICIAL_IO];
break;
case DPT_ERR_SCSI_IO:
constant_Str = EventStrings[STR_ERR_SCSI_IO];
break;
case DPT_ERR_BLINK_LED_IO:
constant_Str = EventStrings[STR_ERR_BLINK_LED_IO];
break;
case DPT_ERR_OSD_MEM_ALLOC:
constant_Str = EventStrings[STR_ERR_OSD_MEM_ALLOC];
break;
case DPT_ERR_FORMATTING:
constant_Str = EventStrings[STR_ERR_FORMATTING];
break;
case DPT_ERR_HBA_BUSY:
constant_Str = EventStrings[STR_ERR_HBA_BUSY];
break;
case DPT_ERR_HBA_INITIALIZING:
constant_Str = EventStrings[STR_ERR_HBA_INITIALIZING];
break;
case DPT_ERR_DEL_OLD_RAID:
constant_Str = EventStrings[STR_ERR_DEL_OLD_RAID];
break;
case DPT_ERR_ENABLE_NEW_RAID:
constant_Str = EventStrings[STR_ERR_ENABLE_NEW_RAID];
break;
case DPT_ERR_UPDATE_OS_CONFIG:
constant_Str = EventStrings[STR_ERR_UPDATE_OS_CONFIG];
break;
case DPT_ERR_SCSI_ADDR_BOUNDS:
constant_Str = EventStrings[STR_ERR_SCSI_ADDR_BOUNDS];
break;
case DPT_ERR_SCSI_ADDR_CONFLICT:
constant_Str = EventStrings[STR_ERR_SCSI_ADDR_CONFLICT];
break;
case DPT_ERR_CANNOT_DELETE:
constant_Str = EventStrings[STR_ERR_CANNOT_DELETE];
break;
case DPT_ERR_FWD_NO_SPACE:
constant_Str = EventStrings[STR_ERR_FWD_NO_SPACE];
break;
case DPT_ERR_FWD_NOT_RESERVED:
constant_Str = EventStrings[STR_ERR_FWD_NOT_RESERVED];
break;
case DPT_ERR_FWD_NOT_INITIALIZED:
constant_Str = EventStrings[STR_ERR_FWD_NOT_INITIALIZED];
break;
case DPT_ERR_FWD_BLK_MISMATCH:
constant_Str = EventStrings[STR_ERR_FWD_BLK_MISMATCH];
break;
case DPT_ERR_FWD_BLK_OVERFLOW:
constant_Str = EventStrings[STR_ERR_FWD_BLK_OVERFLOW];
break;
case DPT_ERR_RSV_REMOVABLE:
constant_Str = EventStrings[STR_ERR_RSV_REMOVABLE];
break;
case DPT_ERR_RSV_NOT_DASD:
constant_Str = EventStrings[STR_ERR_RSV_NOT_DASD];
break;
case DPT_ERR_RSV_NON_ZERO:
constant_Str = EventStrings[STR_ERR_RSV_NON_ZERO];
break;
case DPT_ERR_RSV_HBA_UNABLE:
constant_Str = EventStrings[STR_ERR_RSV_HBA_UNABLE];
break;
case DPT_ERR_RSV_OTHER:
constant_Str = EventStrings[STR_ERR_RSV_OTHER];
break;
case DPT_ERR_SCAN_PHYSICALS:
constant_Str = EventStrings[STR_ERR_SCAN_PHYSICALS];
break;
case DPT_ERR_INIT_PHYSICALS:
constant_Str = EventStrings[STR_ERR_INIT_PHYSICALS];
break;
case DPT_ERR_SCAN_LOGICALS:
constant_Str = EventStrings[STR_ERR_SCAN_LOGICALS];
break;
case DPT_ERR_INIT_LOGICALS:
constant_Str = EventStrings[STR_ERR_INIT_LOGICALS];
break;
case DPT_ERR_COMM_XMIT_BUFFER:
constant_Str = EventStrings[STR_ERR_COMM_XMIT_BUFFER];
break;
case DPT_ERR_COMM_RCVE_BUFFER:
constant_Str = EventStrings[STR_ERR_COMM_RCVE_BUFFER];
break;
case DPT_ERR_COMM_DISCONNECTED:
constant_Str = EventStrings[STR_ERR_COMM_DISCONNECTED];
break;
case DPT_ERR_COMM_DATA_OVERFLOW:
constant_Str = EventStrings[STR_ERR_COMM_DATA_OVERFLOW];
break;
case DPT_ERRC_T_OPEN:
constant_Str = EventStrings[STR_ERRC_T_OPEN];
break;
case DPT_ERRC_T_BIND:
constant_Str = EventStrings[STR_ERRC_T_BIND];
break;
case DPT_ERRC_T_ALLOC:
constant_Str = EventStrings[STR_ERRC_T_ALLOC];
break;
case DPT_ERRC_T_CONNECT:
constant_Str = EventStrings[STR_ERRC_T_CONNECT];
break;
case DPT_ERRC_T_LISTEN:
constant_Str = EventStrings[STR_ERRC_T_LISTEN];
break;
case DPT_ERRC_T_ACCEPT:
constant_Str = EventStrings[STR_ERRC_T_ACCEPT];
break;
case DPT_ERRC_COMM_NW_INIT:
constant_Str = EventStrings[STR_ERRC_COMM_NW_INIT];
break;
case DPT_ERRC_COMM_WS_INIT:
constant_Str = EventStrings[STR_ERRC_COMM_WS_INIT];
break;
case DPT_ERRC_SEMAPHORE_TIMEOUT:
constant_Str = EventStrings[STR_ERRC_SEMAPHORE_TIMEOUT];
break;
case DPT_ERRC_CONNECTION_TAG:
constant_Str = EventStrings[STR_ERRC_CONNECTION_TAG];
break;
case DPT_ERRC_NOT_NULL_TERMED:
constant_Str = EventStrings[STR_ERRC_NOT_NULL_TERMED];
break;
case DPT_ERRC_MEM_ALLOC:
constant_Str = EventStrings[STR_ERRC_MEM_ALLOC];
break;
case DPT_ERRC_NULL_IO_BUFFER:
constant_Str = EventStrings[STR_ERRC_NULL_IO_BUFFER];
break;
case DPT_ERRC_INVALID_PASSWORD:
constant_Str = EventStrings[STR_ERRC_INVALID_PASSWORD];
break;
case DPT_ERRC_NOT_LOGGED_IN:
constant_Str = EventStrings[STR_ERRC_NOT_LOGGED_IN];
break;
case DPT_ERRC_ENGINE_LOAD:
constant_Str = EventStrings[STR_ERRC_ENGINE_LOAD];
break;
case DPT_ERRC_NOT_SUPPORTED:
constant_Str = EventStrings[STR_ERRC_NOT_SUPPORTED];
break;
case DPT_ERRC_ICRS_ACTIVE:
constant_Str = EventStrings[STR_ERRC_ICRS_ACTIVE];
break;
case DPT_ERRC_ICRS_INACTIVE:
constant_Str = EventStrings[STR_ERRC_ICRS_INACTIVE];
break;
case DPT_ERRC_ICRS_REQ_POSTED:
constant_Str = EventStrings[STR_ERRC_ICRS_REQ_POSTED];
break;
case DPT_ERRC_ICRS_THREAD_START:
constant_Str = EventStrings[STR_ERRC_ICRS_THREAD_START];
break;
case DPT_ERRC_ICRS_START_REQUEST:
constant_Str = EventStrings[STR_ERRC_ICRS_START_REQUEST];
break;
case DPT_ERRC_ICRS_INIT:
constant_Str = EventStrings[STR_ERRC_ICRS_INIT];
break;
case DPT_ERRC_ACCEPTING_ICR:
constant_Str = EventStrings[STR_ERRC_ACCEPTING_ICR];
break;
case DPT_ERRC_TX_MSG_SYNC:
constant_Str = EventStrings[STR_ERRC_TX_MSG_SYNC];
break;
case DPT_ERRC_RX_MSG_ACK:
constant_Str = EventStrings[STR_ERRC_RX_MSG_ACK];
break;
case DPT_ERRC_RX_MSG_HEADER:
constant_Str = EventStrings[STR_ERRC_RX_MSG_HEADER];
break;
case DPT_ERRC_TX_MSG_HEADER:
constant_Str = EventStrings[STR_ERRC_TX_MSG_HEADER];
break;
case DPT_ERRC_TX_TO_ENG_DATA:
constant_Str = EventStrings[STR_ERRC_TX_TO_ENG_DATA];
break;
case DPT_ERRC_RX_TO_ENG_DATA:
constant_Str = EventStrings[STR_ERRC_RX_TO_ENG_DATA];
break;
case DPT_ERRC_RX_STATUS_HEADER:
constant_Str = EventStrings[STR_ERRC_RX_STATUS_HEADER];
break;
case DPT_ERRC_TX_STATUS_HEADER:
constant_Str = EventStrings[STR_ERRC_TX_STATUS_HEADER];
break;
case DPT_ERRC_RX_FROM_ENG_DATA:
constant_Str = EventStrings[STR_ERRC_RX_FROM_ENG_DATA];
break;
case DPT_ERRC_TX_FROM_ENG_DATA:
constant_Str = EventStrings[STR_ERRC_TX_FROM_ENG_DATA];
break;
case DPT_ERRC_FROM_ENG_SIZE:
constant_Str = EventStrings[STR_ERRC_FROM_ENG_SIZE];
break;
case DPT_ERRC_TO_ENG_SIZE:
constant_Str = EventStrings[STR_ERRC_TO_ENG_SIZE];
break;
case DPT_ERRC_SERIAL_INIT:
constant_Str = EventStrings[STR_ERRC_SERIAL_INIT];
break;
case DPT_ERRC_BAUD_RATE:
constant_Str = EventStrings[STR_ERRC_BAUD_RATE];
break;
case DPT_ERRC_COMM_BUSY:
constant_Str = EventStrings[STR_ERRC_COMM_BUSY];
break;
case DPT_ERRC_INVALID_PROTOCOL:
constant_Str = EventStrings[STR_ERRC_INVALID_PROTOCOL];
break;
case DPT_ERRC_PORT_CONFLICT:
constant_Str = EventStrings[STR_ERRC_PORT_CONFLICT];
break;
case DPT_ERRC_MODEM_INIT:
constant_Str = EventStrings[STR_ERRC_MODEM_INIT];
break;
case DPT_ERRC_DIAL_ABORT:
constant_Str = EventStrings[STR_ERRC_DIAL_ABORT];
break;
case DPT_ERRC_DIAL_TIMEOUT:
constant_Str = EventStrings[STR_ERRC_DIAL_TIMEOUT];
break;
case DPT_ERRC_DIAL_BUSY:
constant_Str = EventStrings[STR_ERRC_DIAL_BUSY];
break;
case DPT_ERRC_DIAL_BEEPER_OK:
constant_Str = EventStrings[STR_ERRC_DIAL_BEEPER_OK];
break;
case DPT_ERRC_DIAL_UNEXPECTED_CD:
constant_Str = EventStrings[STR_ERRC_DIAL_UNEXPECTED_CD];
break;
case DPT_ERRC_DIAL_NO_TONE:
constant_Str = EventStrings[STR_ERRC_DIAL_NO_TONE];
break;
case DPT_ERRC_DIAL_NO_ANSWER:
constant_Str = EventStrings[STR_ERRC_DIAL_NO_ANSWER];
break;
case DPT_ERRC_DIAL_ERROR:
constant_Str = EventStrings[STR_ERRC_DIAL_ERROR];
break;
case DPT_ERRC_NEGOTIATION:
constant_Str = EventStrings[STR_ERRC_NEGOTIATION];
break;
case DPT_ERRC_MSG_TIMEOUT:
constant_Str = EventStrings[STR_ERRC_MSG_TIMEOUT];
break;
case DPT_ERRC_USER_ABORT:
constant_Str = EventStrings[STR_ERRC_USER_ABORT];
break;
case DPT_ERRSPX_RD_PROPERTY:
constant_Str = EventStrings[STR_ERRSPX_RD_PROPERTY];
break;
case DPT_ERRSPX_SAP:
constant_Str = EventStrings[STR_ERRSPX_SAP];
break;
case DPT_ERRC_SOCKET_ALLOC:
constant_Str = EventStrings[STR_ERRC_SOCKET_ALLOC];
break;
case DPT_ERRC_SOCKET_BIND:
constant_Str = EventStrings[STR_ERRC_SOCKET_BIND];
break;
case DPT_ERRC_SOCKET_ACCEPT:
constant_Str = EventStrings[STR_ERRC_SOCKET_ACCEPT];
break;
case DPT_ERRC_SOCKET_CONNECT:
constant_Str = EventStrings[STR_ERRC_SOCKET_CONNECT];
break;
case DPT_ERRC_USER_VALIDATION:
constant_Str = EventStrings[STR_ERRC_USER_VALIDATION];
break;
case DPT_ERR_FLASH_ERASE:
constant_Str = EventStrings[STR_ERR_FLASH_ERASE];
break;
case DPT_ERR_FLASH_SWITCH_MODES:
constant_Str = EventStrings[STR_ERR_FLASH_SWITCH_MODES];
break;
case DPT_ERR_FLASH_WRITE_512:
constant_Str = EventStrings[STR_ERR_FLASH_WRITE_512];
break;
case DPT_ERR_FLASH_ENG_VERIFY:
constant_Str = EventStrings[STR_ERR_FLASH_ENG_VERIFY];
break;
case DPT_ERR_FLASH_INIT_REQ:
constant_Str = EventStrings[STR_ERR_FLASH_INIT_REQ];
break;
case DPT_ERR_EXCLUSION_TIME:
constant_Str = EventStrings[STR_ERR_EXCLUSION_TIME];
break;
case DPT_ERR_DIAG_SCHEDULED:
constant_Str = EventStrings[STR_ERR_DIAG_SCHEDULED];
break;
case DPT_ERR_DIAG_NOT_ACTIVE:
constant_Str = EventStrings[STR_ERR_DIAG_NOT_ACTIVE];
break;
case DPT_ERR_ELOG_NOT_LOADED:
constant_Str = EventStrings[STR_ERR_ELOG_NOT_LOADED];
break;
case DPT_ERR_ELOG_LOADED:
constant_Str = EventStrings[STR_ERR_ELOG_LOADED];
break;
case DPT_ERR_ELOG_EVENTS:
constant_Str = EventStrings[STR_ERR_ELOG_EVENTS];
break;
case DPT_ERR_ELOG_PAUSED:
constant_Str = EventStrings[STR_ERR_ELOG_PAUSED];
break;
case DPT_ERR_ELOG_NOT_PAUSED:
constant_Str = EventStrings[STR_ERR_ELOG_NOT_PAUSED];
break;
case DPT_ERR_SLOG_INVALID_TIME:
constant_Str = EventStrings[STR_ERR_SLOG_INVALID_TIME];
break;
case DPT_ERR_SLOG_STAT_GROUP:
constant_Str = EventStrings[STR_ERR_SLOG_STAT_GROUP];
break;
case DPT_ERR_ALMS_ALREADY_LINKED:
constant_Str = EventStrings[STR_ERR_ALMS_ALREADY_LINKED];
break;
case DPT_ERR_ALMS_NOT_LINKED:
constant_Str = EventStrings[STR_ERR_ALMS_NOT_LINKED];
break;
case DPT_ERR_ALMS_INVALID_RESOURCE_TYPE:
constant_Str = EventStrings[STR_ERR_ALMS_INVALID_RESOURCE_TYPE];
break;
default:
constant_Str = EventStrings[STR_ERR_UNKNOWN_ERROR];
break;
}
EXIT();
return( constant_Str );
}
/*
char *Command::Cmd_Error_to_Str( Dpt_Error err )
{
ENTER( "char *Command::Cmd_Error_to_Str( Dpt_Error err )" );
char *constant_Str = "";
switch( err )
{
case CMD_ERR_NO_ERROR:
constant_Str = "CMD_ERR_NO_ERROR";
break;
case CMD_PARSER_ERROR:
constant_Str = "CMD_PARSER_ERROR";
break;
case CMD_ERR_INVALID_LIST_TYPE:
constant_Str = "CMD_ERR_INVALID_LIST_TYPE";
break;
default:
constant_Str = "Unknown";
break;
}
EXIT();
return( constant_Str );
}
*/
/****************************************************************************
*
* Function Name: Get_Log_Component(), Created:7/30/98
*
* Description: This fetches the tags of all components belonging to this raid.
*
* Return: Returns the tag for the indexed component of this raid.
*
* Notes: This doesn't work recursively. i.e. if this raid contains raids,
* you will have to call this function to get the children of the
* raids returned.
*
*****************************************************************************/
DPT_TAG_T Command::Get_Log_Component(
SCSI_Address &obj_Address,
int dev_Index,
bool *obj_Found
)
{
ENTER( "DPT_TAG_T Command::Get_Log_Component(" );
DPT_TAG_T ret_Tag = INVALID_TAG;
DPT_TAG_T parent_Tag;
bool parent_Found;
*obj_Found = false;
engine->Reset();
// get the parent's tag so we can find all logicals that claim this logical as
// their parent.
parent_Tag = Get_Log_Dev_by_Address( obj_Address, (bool)false, &parent_Found );
if (parent_Found)
{
int log_Index;
int log_Component_Index = 0;
bool index_Found = true;
// loop through all logicals and find ones claiming this parent_Tag as their
// parent
for (log_Index = 0; index_Found; log_Index++)
{
DPT_TAG_T log_Dev_Tag;
// get the tag for the nth logical so we can see if it has the parent_Tag
// as its parent.
log_Dev_Tag = Get_Log_Dev_by_Index( log_Index, (bool)false, &index_Found );
if (index_Found && engine->Send( MSG_GET_INFO, log_Dev_Tag ) == MSG_RTN_COMPLETED)
{
if (engine->devInfo_P->raidParent == parent_Tag)
{
if (log_Component_Index == dev_Index)
{
ret_Tag = engine->ids.tag;
index_Found = true;
}
else
{
log_Component_Index++;
}
}
}
}
}
EXIT();
return( ret_Tag );
}
DPT_TAG_T Command::Get_Log_Dev_by_Index(
int dev_Index,
bool retrieve_Hiddens,
bool *index_Found,
int hba_Index // will be negative if unused
// and search all hbas
)
{
ENTER( "DPT_TAG_T Command::Get_Log_Dev_by_Index(" );
DPT_TAG_T ret_Tag = INVALID_TAG;
*index_Found = false;
engine->Reset();
if (engine->GetIDs( ( retrieve_Hiddens )? MSG_ID_ALL_HIDDEN:MSG_ID_ALL_LOGICALS ) == MSG_RTN_COMPLETED
&& engine->ids.GetID())
{
int num_Devs;
int id_Index;
int this_Dev_Type_Index = 0;
num_Devs = engine->ids.numIDs;
for (id_Index = 0;
id_Index < num_Devs && !*index_Found;
id_Index++)
{
engine->ids.SetCurIDnum( id_Index );
// get some info so we can have the raid level and filter out physicals
engine->Send( MSG_GET_INFO, engine->ids.tag );
// filter out physicals
if ((hba_Index != -1) && (engine->devInfo_P->addr.hba != hba_Index))
continue;
if (Convert_Engine_Level( engine->devInfo_P->level ) != 0)
{
if (this_Dev_Type_Index == dev_Index)
{
ret_Tag = engine->ids.tag;
*index_Found= true;
}
else
{
this_Dev_Type_Index++;
}
}
}
}
EXIT();
return( ret_Tag );
}
DPT_TAG_T Command::Get_Log_Dev_by_Address(
SCSI_Address &obj_Address,
bool retrieve_Hiddens,
bool *obj_Found
)
{
ENTER( "DPT_TAG_T Command::Get_Log_Dev_by_Address(" );
DPT_TAG_T ret_Tag = INVALID_TAG;
*obj_Found = false;
engine->Reset();
if (engine->GetIDs( ( retrieve_Hiddens )? MSG_ID_ALL_HIDDEN:MSG_ID_ALL_LOGICALS ) == MSG_RTN_COMPLETED
&& engine->ids.GetID())
{
int num_Devs;
int id_Index;
num_Devs = engine->ids.numIDs;
for (id_Index = 0;
id_Index < num_Devs && !*obj_Found;
id_Index++)
{
engine->ids.SetCurIDnum( id_Index );
// get some info so we can have the raid level and filter out physicals
engine->Send( MSG_GET_INFO, engine->ids.tag );
dptCaddr_S *addr_P = &engine->devInfo_P->addr;
// filter out physicals
if (obj_Address.hba == addr_P->hba
&& obj_Address.bus == addr_P->chan
&& obj_Address.id == addr_P->id
&& obj_Address.lun == addr_P->lun
// && obj_Address.level == Convert_Engine_Level( engine->devInfo_P->level ) )
&& Convert_Engine_Level( engine->devInfo_P->level ) > 0)
{
ret_Tag = engine->ids.tag;
*obj_Found = true;
}
}
}
EXIT();
return( ret_Tag );
}
/****************************************************************************
*
* Function Name: Get_Dev_by_Index(), Created:8/10/98
*
* Description: This searches for a device based on index alone (although it
does ignore RAIDs).
*
* Return: DPT_TAG_T
*
* Notes:
*
*****************************************************************************/
DPT_TAG_T Command::Get_Dev_by_Index(
int hba_Index, // should be negative if unused
// (will index across all HBA's then)
int dev_Index,
bool *index_Found,
get_Devs_Type *dev_Type)
{
ENTER( "DPT_TAG_T Command::Get_Dev_by_Index(" );
unsigned char ignore_Field_Mask;
DPT_TAG_T ret_Tag = INVALID_TAG;
bool param_Error = false;
*index_Found = false;
ignore_Field_Mask = GET_BY_SCSI_ADDR_IGNORE_LUN_FIELD
| GET_BY_SCSI_ADDR_IGNORE_ID_FIELD
| GET_BY_SCSI_ADDR_IGNORE_BUS_FIELD;
if (hba_Index < 0)
{
// for some reason, when I tell this stupid thing NOT to ignore the hba
// field, it still does it. This code here is wasted, but I keep it here
// for good looks. The way I actually got it to regard the HBA field is
// by checking the hba field on each item this thing returns. Otherwise,
// it will return devs from all hba's.
ignore_Field_Mask |= GET_BY_SCSI_ADDR_IGNORE_HBA_FIELD;
}
if (!param_Error)
{
engine->Reset();
// for some blinking reason, when I specify what HBA's devs to search for,
// and that HBA's index is non-zero, it ignores it and fetches NOTHING!?!
// This works now, so I changed it back to be hba specific. kds
dptCaddr_S addr;
addr.hba = hba_Index;
addr.chan = 0;
addr.id = 0;
addr.lun = 0;
// this was changed because SCO wouldn't compile
// dptCaddr_S addr = { hba_Index /* 0 */, 0, 0, 0 };
//insert the address and the masks
engine->Insert(&addr, sizeof( dptCaddr_S ));
engine->Insert((unsigned char) ( /*GET_BY_SCSI_ADDR_DEVS*/GET_BY_SCSI_ADDR_MGR_AND_DEVS_1 | ignore_Field_Mask ));
engine->Insert((unsigned char) DEV_CLASS_ALL_MATCHING);
if (engine->GetIDs( MSG_ID_BY_SCSI_ADDR ) == MSG_RTN_COMPLETED
&& engine->ids.GetID())
{
int num_Devs;
int id_Index;
int this_Dev_Type_Index = 0;
num_Devs = engine->ids.numIDs;
for (id_Index = 0;
id_Index < num_Devs && !*index_Found;
id_Index++)
{
engine->ids.SetCurIDnum( id_Index );
// don't check the error here. If this one fails, just go on
// to the next one...
engine->Send( MSG_GET_INFO, engine->ids.tag );
if (engine->devInfo_P->status.flags & FLG_STAT_REAL)
{
switch (engine->devInfo_P->raidType)
{
// filter out raid types
case RAID_TYPE_0:
case RAID_TYPE_1:
case RAID_TYPE_3:
case RAID_TYPE_5:
case RAID_TYPE_HOT_SPARE:
case RAID_TYPE_REDIRECT:
break;
// only process non-raid types
default:
if (engine->devInfo_P->addr.hba == hba_Index
|| hba_Index < 0)
{
if (this_Dev_Type_Index == dev_Index)
{
*dev_Type = (get_Devs_Type) engine->ids.type;
ret_Tag = engine->ids.tag;
*index_Found= true;
}
else
{
this_Dev_Type_Index++;
}
}
break;
}
}
}
}
}
EXIT();
return( ret_Tag );
}
/****************************************************************************
*
* Function Name: Get_HBA_by_Index(), Created:9/29/98
*
* Description: Fetches an HBA by index.
*
* Return: DPT_TAG_T
*
* Notes:
*
*****************************************************************************/
DPT_TAG_T Command::Get_HBA_by_Index(
int hba_Index,
bool *index_Found
)
{
ENTER( "DPT_TAG_T Command::Get_HBA_by_Index(" );
DPT_TAG_T ret_Tag = INVALID_TAG;
*index_Found = false;
engine->Reset();
engine->Insert( (uSHORT) DPT_ANY_OBJECT );
if (engine->GetIDs( MSG_ID_VISIBLES ) == MSG_RTN_COMPLETED
&& engine->ids.GetID())
{
int num_Devs;
int id_Index;
num_Devs = engine->ids.numIDs;
for (id_Index = 0;
id_Index < num_Devs && !*index_Found;
id_Index++)
{
get_Devs_Type this_Devs_Type;
engine->ids.SetCurIDnum( id_Index );
this_Devs_Type = (get_Devs_Type) engine->ids.type;
if (this_Devs_Type == GET_SCSI_HBA)
{
engine->Send( MSG_GET_INFO, engine->ids.tag );
if (engine->devInfo_P->status.flags & FLG_STAT_REAL)
{
if (engine->devInfo_P->addr.hba == hba_Index)
{
ret_Tag = engine->ids.tag;
*index_Found= true;
}
}
}
}
}
EXIT();
return( ret_Tag );
}
/****************************************************************************
*
* Function Name: Get_Dev_by_Address(), Created:8/10/98
*
* Description: This finds physical (non-hba, non-raid) devices only.
*
* Return: DPT_TAG_T
*
* Notes:
*
*****************************************************************************/
DPT_TAG_T Command::Get_Dev_by_Address(
SCSI_Address &obj_Address,
get_Devs_Type *dev_Type, // Note: this is
// only physical types
bool *obj_Found
)
{
ENTER( "DPT_TAG_T Command::Get_Dev_by_Address(" );
DPT_TAG_T ret_Tag = INVALID_TAG;
bool param_Error = false;
*obj_Found = false;
if (!param_Error)
{
engine->Reset();
engine->Insert( (uSHORT) DPT_ANY_OBJECT );
if (engine->GetIDs( MSG_ID_VISIBLES ) == MSG_RTN_COMPLETED
&& engine->ids.GetID())
{
int num_Devs;
int id_Index;
num_Devs = engine->ids.numIDs;
for (id_Index = 0;
id_Index < num_Devs && !*obj_Found;
id_Index++)
{
get_Devs_Type this_Devs_Type;
engine->ids.SetCurIDnum( id_Index );
this_Devs_Type = (get_Devs_Type) engine->ids.type;
switch (this_Devs_Type)
{
case GET_SCSI_DASD:
case GET_SCSI_SASD:
case GET_SCSI_WORM:
case GET_SCSI_CD_ROM:
case GET_SCSI_OPTICAL:
case GET_SCSI_JUKEBOX:
{
engine->Send( MSG_GET_INFO, engine->ids.tag );
if (engine->devInfo_P->status.flags & FLG_STAT_REAL)
{
dptCaddr_S *addr_P;
addr_P = &engine->devInfo_P->addr;
if (addr_P->id == obj_Address.id
&& addr_P->chan == obj_Address.bus
&& addr_P->hba == obj_Address.hba)
{
ret_Tag = engine->ids.tag;
*obj_Found = true;
*dev_Type = (get_Devs_Type) engine->ids.type;
}
}
}
break;
}
}
}
}
EXIT();
return( ret_Tag );
}
/****************************************************************************
*
* Function Name: Get_Address_by_Index(), Created:10/22/98
*
* Description: This finds all devices.
*
* Return: DPT_TAG_T
*
* Notes:
*
*****************************************************************************/
DPT_TAG_T Command::Get_Address_by_Index(
SCSI_Address &obj_Address,
int dev_Index,
bool *obj_Found,
get_Devs_Type *dev_Type
)
{
ENTER( "DPT_TAG_T Command::Get_Address_by_Index(" );
DPT_TAG_T ret_Tag = INVALID_TAG;
*obj_Found = false;
engine->Reset();
dptCaddr_S addr;
addr.hba = 0;
addr.chan = 0;
addr.id = 0;
addr.lun = 0;
// this was changed because SCO wouldn't compile
// dptCaddr_S addr = { 0, 0, 0, 0 };
//insert the address and the masks
engine->Insert( &addr, sizeof( dptCaddr_S ) );
engine->Insert( (unsigned char) ( GET_BY_SCSI_ADDR_MGR_AND_DEVS_0
| GET_BY_SCSI_ADDR_IGNORE_HBA_FIELD
| GET_BY_SCSI_ADDR_IGNORE_BUS_FIELD
| GET_BY_SCSI_ADDR_IGNORE_ID_FIELD
| GET_BY_SCSI_ADDR_IGNORE_LUN_FIELD ));
engine->Insert( (unsigned char) DEV_CLASS_ALL_MATCHING );
if (engine->GetIDs( MSG_ID_BY_SCSI_ADDR ) == MSG_RTN_COMPLETED
&& engine->ids.GetID())
{
int num_Devs, id_Index, this_Dev_Type_Index = 0;
num_Devs = engine->ids.numIDs;
for (id_Index = 0; id_Index < num_Devs && !*obj_Found; id_Index++)
{
engine->ids.SetCurIDnum( id_Index );
// don't check the error here. If this one fails, just go on
// to the next one...
engine->Send( MSG_GET_INFO, engine->ids.tag );
if (( engine->devInfo_P->status.flags & FLG_STAT_REAL )
&& (( engine->devInfo_P->addr.hba == obj_Address.hba )
|| ( obj_Address.hba < 0 ))
&& (( engine->devInfo_P->addr.chan == obj_Address.bus )
|| ( obj_Address.bus < 0 ))
&& (( engine->devInfo_P->addr.id == obj_Address.id )
|| ( obj_Address.id < 0 ))
&& (( engine->devInfo_P->addr.lun == obj_Address.lun )
|| ( obj_Address.lun < 0 )))
{
if (this_Dev_Type_Index == dev_Index)
{
*dev_Type = (get_Devs_Type) engine->ids.type;
if (*dev_Type == GET_SCSI_DASD)
switch (engine->devInfo_P->raidType)
{
case RAID_TYPE_0:
case RAID_TYPE_1:
case RAID_TYPE_3:
case RAID_TYPE_5:
*dev_Type = GET_RAID;
break;
case RAID_TYPE_HOT_SPARE:
*dev_Type = GET_RAID_HOT_SPARE;
break;
case RAID_TYPE_REDIRECT:
*dev_Type = GET_RAID_REDIRECT;
break;
}
ret_Tag = engine->ids.tag;
*obj_Found= true;
}
else
{
this_Dev_Type_Index++;
}
}
}
}
EXIT();
return( ret_Tag );
}
/****************************************************************************
*
* Function Name: Get_Component(), Created:10/22/98
*
* Description: This finds all devices that are part of an array
*
* Return: DPT_TAG_T
*
* Notes:
*
*****************************************************************************/
DPT_TAG_T Command::Get_Component(
DPT_TAG_T parent_Tag,
int dev_Index,
bool *obj_Found,
get_Devs_Type *dev_Type
)
{
ENTER( "DPT_TAG_T Command::Get_Component(" );
DPT_TAG_T ret_Tag = INVALID_TAG;
SCSI_Address component( -1, -1, -1, -1, -1 );
int Component_Index = 0;
*obj_Found = true;
for (int id_Index = 0; *obj_Found; id_Index++)
{
ret_Tag = Get_Address_by_Index (
component, id_Index, obj_Found, dev_Type );
if (*obj_Found
&& ( engine->Send( MSG_GET_INFO, ret_Tag ) == MSG_RTN_COMPLETED )
&& ( engine->devInfo_P->raidParent == parent_Tag )
&& ( Component_Index++ == dev_Index ))
{
break;
}
}
EXIT();
return( ret_Tag );
}
#ifdef ORIGINAL_SEARCH
DPT_TAG_T Command::Get_Dev_by_Address(
SCSI_Address &obj_Address,
get_Devs_Type *dev_Type, // Note: this is
// only physical
// types
bool *obj_Found
)
{
ENTER( "DPT_TAG_T Command::Get_Dev_by_Address(" );
DPT_TAG_T ret_Tag;
bool param_Error = false;
*obj_Found = false;
if (!param_Error)
{
engine->Reset();
dptCaddr_S addr =
{
obj_Address.hba,
obj_Address.bus,
obj_Address.id,
obj_Address.lun
};
//insert the address and the masks
engine->Insert( &addr, sizeof( dptCaddr_S ) );
engine->Insert( (unsigned char) GET_BY_SCSI_ADDR_DEVS | GET_BY_SCSI_ADDR_IGNORE_LUN_FIELD );
engine->Insert( (unsigned char) DEV_CLASS_ALL_MATCHING );
if (engine->GetIDs( MSG_ID_BY_SCSI_ADDR ) == MSG_RTN_COMPLETED
&& engine->ids.GetID())
{
int num_Devs;
num_Devs = engine->ids.numIDs;
if (num_Devs > 0)
{
engine->ids.SetCurIDnum( 0 );
ret_Tag = engine->ids.tag;
*obj_Found = true;
*dev_Type = (get_Devs_Type) engine->ids.type;
}
}
}
EXIT();
return( ret_Tag );
}
#endif
DPT_TAG_T Command::Get_Dev_by_Address_and_Type(
get_Devs_Type dev_Type,
SCSI_Address &obj_Address,
bool *obj_Found
)
{
ENTER( "DPT_TAG_T Command::Get_Dev_by_Address_and_Type(" );
DPT_TAG_T ret_Tag = INVALID_TAG;
*obj_Found = false;
engine->Reset();
#if !defined _DPT_SCO
dptCaddr_S addr =
{
obj_Address.hba,
obj_Address.bus,
obj_Address.id,
obj_Address.lun
};
#else
dptCaddr_S addr;
addr.hba = obj_Address.hba;
addr.chan = obj_Address.bus;
addr.id = obj_Address.id;
addr.lun = obj_Address.lun;
#endif
engine->Insert( (uSHORT) DPT_ANY_OBJECT );
if (engine->GetIDs( MSG_ID_VISIBLES ) == MSG_RTN_COMPLETED
&& engine->ids.GetID())
{
int num_Devs;
int id_Index;
num_Devs = engine->ids.numIDs;
for (id_Index = 0;
id_Index < num_Devs && !*obj_Found;
id_Index++)
{
dptCaddr_S *addr_P;
engine->ids.SetCurIDnum( id_Index );
if (engine->Send( MSG_GET_INFO, engine->ids.tag ) == MSG_RTN_COMPLETED)
{
if (engine->devInfo_P->status.flags & FLG_STAT_REAL)
{
bool address_Matches = false;
addr_P = &engine->devInfo_P->addr;
switch (dev_Type)
{
case GET_SCSI_HBA:
if (addr_P->hba == obj_Address.hba)
{
address_Matches = true;
}
break;
default:
if (addr_P->id == obj_Address.id
&& addr_P->chan == obj_Address.bus
&& addr_P->hba == obj_Address.hba)
{
address_Matches = true;
}
break;
}
if (address_Matches && engine->ids.type == (unsigned) dev_Type)
{
ret_Tag = engine->ids.tag;
*obj_Found = true;
}
}
}
}
}
EXIT();
return( ret_Tag );
}
#ifdef ORIGINAL_SEARCH
DPT_TAG_T Command::Get_Dev_by_Address_and_Type(
get_Devs_Type dev_Type,
SCSI_Address &obj_Address,
bool *obj_Found
)
{
ENTER( "DPT_TAG_T Command::Get_Dev_by_Address_and_Type(" );
unsigned char ignore_Field_Mask;
DPT_TAG_T ret_Tag;
Dev_Class dev_Class;
bool param_Error = false;
*obj_Found = false;
engine->Reset();
switch (dev_Type)
{
case GET_SCSI_DASD:
case GET_SCSI_SASD:
case GET_SCSI_JUKEBOX:
case GET_SCSI_CD_ROM:
case GET_SCSI_PRINTER:
case GET_SCSI_PROCESSOR:
case GET_SCSI_WORM:
case GET_SCSI_SCANNER:
case GET_SCSI_OPTICAL:
case GET_SCSI_PRO_ROOT:
case GET_SCSI_PRO_CONNECTION:
case GET_SCSI_BCD:
case GET_RAID_BCD:
ignore_Field_Mask = GET_BY_SCSI_ADDR_DEVS;
break;
case GET_SCSI_HBA:
ignore_Field_Mask = GET_BY_SCSI_ADDR_MGR_AND_DEVS_1
| GET_BY_SCSI_ADDR_IGNORE_LUN_FIELD
| GET_BY_SCSI_ADDR_IGNORE_ID_FIELD
| GET_BY_SCSI_ADDR_IGNORE_BUS_FIELD;
break;
// case GET_ANY_MANAGER:
// case GET_RAID_TYPE:
default:
param_Error = true;
break;
}
dev_Class = DEV_CLASS_ALL_MATCHING;
if (!param_Error)
{
engine->Reset();
dptCaddr_S addr =
{
obj_Address.hba,
obj_Address.bus,
obj_Address.id,
obj_Address.lun
};
//insert the address and the masks
engine->Insert( &addr, sizeof( dptCaddr_S ) );
engine->Insert( (unsigned char) ignore_Field_Mask );
engine->Insert( (unsigned char) dev_Class );
if (engine->GetIDs( MSG_ID_BY_SCSI_ADDR ) == MSG_RTN_COMPLETED
&& engine->ids.GetID())
{
int num_Devs;
int id_Index;
num_Devs = engine->ids.numIDs;
for (id_Index = 0;
id_Index < num_Devs && !*obj_Found;
id_Index++)
{
engine->ids.SetCurIDnum( id_Index );
if (engine->ids.type == (unsigned) dev_Type)
{
ret_Tag = engine->ids.tag;
*obj_Found = true;
}
}
}
}
EXIT();
return( ret_Tag );
}
#endif
/****************************************************************************
*
* Function Name: Get_Dev_by_Index_Type_and_Mask(), Created:8/4/98
*
* Description: Allows the fetching of a device's tag, given an index into all
the devices. This lets you specify what type you're looking
for. It also lets you choose which "root" you will index from.
By this, it is meant, that you can find the nth device in the
system, or find the nth device on an HBA, channel, etc.
*
* Return: Tag of the object found.
*
* Notes:
*
*****************************************************************************/
#if DONT_USE_TILL_DEBUGGED
DPT_TAG_T Command::Get_Dev_by_Index_Type_and_Mask(
get_Devs_Type dev_Type,
SCSI_Address &obj_Root, // so as to find all
// devs on a specific
// hba, or bus, etc.
get_Devs_Mask dev_Mask,
int dev_Index,
bool *index_Found
)
{
ENTER( "DPT_TAG_T Command::Get_Dev_by_Index_Type_and_Mask(" );
DPT_TAG_T ret_Tag;
Dev_Class dev_Class;
bool param_Error = false;
*index_Found = false;
dev_Class = DEV_CLASS_ALL_MATCHING;
if (!param_Error)
{
engine->Reset();
engine->Insert( (uSHORT) DPT_ANY_OBJECT );
if (engine->GetIDs( MSG_ID_VISIBLES ) == MSG_RTN_COMPLETED
&& engine->ids.GetID())
{
int num_Devs;
int id_Index;
int this_Dev_Type_Index = 0;
num_Devs = engine->ids.numIDs;
for (id_Index = 0;
id_Index < num_Devs && !*index_Found;
id_Index++)
{
get_Devs_Type this_Devs_Type;
engine->ids.SetCurIDnum( id_Index );
this_Devs_Type = (get_Devs_Type) engine->ids.type;
if (this_Devs_Type == dev_Type)
{
dptCaddr_S *addr_P;
bool doesnt_Match = false;
// don't check the error here. If this one fails, just go on
// to the next one...
engine->Send( MSG_GET_INFO, engine->ids.tag );
if (engine->devInfo_P->status.flags & FLG_STAT_REAL)
{
addr_P = &engine->devInfo_P->addr;
switch (dev_Mask)
{
case GET_DEVS_ON_THIS_HBA_BUS_ID:
if (addr_P->id != obj_Root.id)
{
doesnt_Match = true;
}
case GET_DEVS_ON_THIS_HBA_BUS:
if (addr_P->chan != obj_Root.bus)
{
doesnt_Match = true;
}
case GET_DEVS_ON_THIS_HBA:
if (addr_P->hba != obj_Root.hba)
{
doesnt_Match = true;
}
// case GET_DEVS_ALL_DEVS:
// default:
}
// Limit this to ONLY physicals, no logicals please. I know
// that there are no raid types greater than ten, so I compare
// to ten.
if (!doesnt_Match
&& ( (unsigned) engine->devInfo_P->raidType > 10
|| dev_Type == GET_SCSI_HBA ))
{
if (this_Dev_Type_Index == dev_Index)
{
ret_Tag = engine->ids.tag;
*index_Found= true;
}
else
{
this_Dev_Type_Index++;
}
}
}
}
}
}
}
EXIT();
return( ret_Tag );
}
#endif
#ifdef ORIGINAL_SEARCH
DPT_TAG_T Command::Get_Dev_by_Index_Type_and_Mask(
get_Devs_Type dev_Type,
SCSI_Address &obj_Root, // so as to find all
// devs on a specific
// hba, or bus, etc.
get_Devs_Mask dev_Mask,
int dev_Index,
bool *index_Found
)
{
ENTER( "DPT_TAG_T Command::Get_Dev_by_Index_Type_and_Mask(" );
unsigned char ignore_Field_Mask;
DPT_TAG_T ret_Tag;
Dev_Class dev_Class;
bool param_Error = false;
*index_Found = false;
engine->Reset();
switch (dev_Mask)
{
case GET_DEVS_ALL_DEVS:
ignore_Field_Mask = GET_BY_SCSI_ADDR_IGNORE_LUN_FIELD
| GET_BY_SCSI_ADDR_IGNORE_ID_FIELD
| GET_BY_SCSI_ADDR_IGNORE_BUS_FIELD
| GET_BY_SCSI_ADDR_IGNORE_HBA_FIELD;
break;
case GET_DEVS_ON_THIS_HBA:
ignore_Field_Mask = GET_BY_SCSI_ADDR_IGNORE_LUN_FIELD
| GET_BY_SCSI_ADDR_IGNORE_ID_FIELD
| GET_BY_SCSI_ADDR_IGNORE_BUS_FIELD;
break;
case GET_DEVS_ON_THIS_HBA_BUS:
ignore_Field_Mask = GET_BY_SCSI_ADDR_IGNORE_LUN_FIELD
| GET_BY_SCSI_ADDR_IGNORE_ID_FIELD;
break;
case GET_DEVS_ON_THIS_HBA_BUS_ID:
ignore_Field_Mask = GET_BY_SCSI_ADDR_IGNORE_LUN_FIELD;
break;
default:
param_Error = true;
break;
}
dev_Class = DEV_CLASS_ALL_MATCHING;
if (!param_Error)
{
engine->Reset();
dptCaddr_S addr =
{
obj_Root.hba,
obj_Root.bus,
obj_Root.id,
obj_Root.lun
};
//insert the address and the masks
engine->Insert( &addr, sizeof( dptCaddr_S ) );
engine->Insert( (unsigned char) ( /*GET_BY_SCSI_ADDR_DEVS*/GET_BY_SCSI_ADDR_MGR_AND_DEVS_1 | ignore_Field_Mask ) );
engine->Insert( (unsigned char) dev_Class );
if (engine->GetIDs( MSG_ID_BY_SCSI_ADDR ) == MSG_RTN_COMPLETED
&& engine->ids.GetID())
{
int num_Devs;
int id_Index;
int this_Dev_Type_Index = 0;
num_Devs = engine->ids.numIDs;
for (id_Index = 0;
id_Index < num_Devs && !*index_Found;
id_Index++)
{
get_Devs_Type this_Devs_Type;
engine->ids.SetCurIDnum( id_Index );
this_Devs_Type = (get_Devs_Type) engine->ids.type;
if (this_Devs_Type == dev_Type)
{
// don't check the error here. If this one fails, just go on
// to the next one...
engine->Send( MSG_GET_INFO, engine->ids.tag );
// Limit this to ONLY physicals, no logicals please. I know
// that there are no raid types greater than ten, so I compare
// to ten.
if ((unsigned) engine->devInfo_P->raidType > 10
|| dev_Type == GET_SCSI_HBA)
{
if (this_Dev_Type_Index == dev_Index)
{
ret_Tag = engine->ids.tag;
*index_Found= true;
}
else
{
this_Dev_Type_Index++;
}
}
}
}
}
}
EXIT();
return( ret_Tag );
}
#endif
SCSI_Address Command::DPT_Tag_to_Address( DPT_TAG_T tag, bool *tag_Valid )
{
ENTER( "SCSI_Address Command::DPT_Tag_to_Address( DPT_TAG_T tag, bool *tag_Valid )" );
dptCaddr_S *addr_P = &engine->devInfo_P->addr;
engine->Reset();
if (engine->Send( MSG_GET_INFO, tag ) == MSG_RTN_COMPLETED)
{
*tag_Valid = true;
}
else
{
*tag_Valid = false;
}
EXIT();
return( SCSI_Address( addr_P->hba,
addr_P->chan,
addr_P->id,
addr_P->lun,
Convert_Engine_Level( engine->devInfo_P->level ) ) );
}
void Command::PrintRaidAddress(DPT_TAG_T raid_Tag, String_List *out)
{
bool tag_Valid;
SCSI_Address raid_Address;
raid_Address = DPT_Tag_to_Address(raid_Tag, &tag_Valid);
DPTControllerMap map;
char * String = map.getTargetString(raid_Address.hba,
raid_Address.bus, raid_Address.id, raid_Address.lun);
out->add_Item(String);
delete [] String;
}
char *Command::Strip_Trailing_Whitespace( char *str )
{
ENTER( "char *Show_Inquiry::Strip_Trailing_Whitespace( char *str )" );
int strip_White_Index;
char prev_Char = ' ';
bool done = false;
for (strip_White_Index = strlen( str ) - 1;
strip_White_Index >= 0 && !done;
strip_White_Index--)
{
// find the transition from white to non-white
if (isspace( prev_Char ) && !isspace( str[ strip_White_Index ] ))
{
// null-terminate the string at the transition point.
str[ strip_White_Index + 1 ]= 0;
done = true;
}
prev_Char = str[ strip_White_Index ];
}
EXIT();
return( str );
}
// prints a question and get a one character answer
char Command::PrintAQuestion(char *str)
{
char Buffer[512];
fprintf(stderr, "%s", str);
fgets(Buffer, sizeof(Buffer), stdin);
return(Buffer[0]);
}
void Command::Commit( DPT_TAG_T tag, bool nobuild)
{
ENTER( "void Command::Commit( DPT_TAG_T tag )" );
dptID_S *idlist = new dptID_S[PHYS_LIST_SIZE];
if (engine->Send( MSG_RAID_HW_ENABLE ) == MSG_RTN_COMPLETED)
{
if (tag && (!nobuild))
{
engine->Send( MSG_RAID_BUILD, tag );
}
if (tag && nobuild)
{
int numComps = EngineFindIDs(FID_RESET_OUTBUFF,
MSG_ID_COMPONENTS, tag,
idlist, PHYS_LIST_SIZE);
for (int k = 0; k < numComps; k++)
{
engine->Reset();
engine->Insert((uCHAR) FORCE_OPTIMAL);
engine->Send(MSG_FORCE_STATE, idlist[k].tag);
}
}
if (engine->Send( MSG_IO_SCAN_PHYSICALS ) == MSG_RTN_COMPLETED)
{
engine->Send( MSG_IO_SCAN_LOGICALS );
}
}
EXIT();
}
void Command::MakeArrayOptimal(DPT_TAG_T arrayTag)
{
dptID_S *idlist = new dptID_S[PHYS_LIST_SIZE];
int numComps = EngineFindIDs(FID_RESET_OUTBUFF,
MSG_ID_COMPONENTS, arrayTag,
idlist, PHYS_LIST_SIZE);
// loop through all components
for (int i = 0; i < numComps; i++)
{
// get the info structure for the component
if (MSG_RTN_COMPLETED != engine->Send(MSG_GET_INFO, idlist[i].tag))
return;
// if this is a physical component with failed status, force to optimal
if (engine->devInfo_P->raidType == RAID_NONE)
{
if (engine->devInfo_P->status.main == PAPM_FAILED)
{
engine->Reset();
engine->Insert((uCHAR) FORCE_OPTIMAL);
engine->Send(MSG_FORCE_STATE, idlist[i].tag);
}
}
// this is an array component, so loop through his components
else
{
numComps = EngineFindIDs(FID_RESET_OUTBUFF,
MSG_ID_COMPONENTS, idlist[i].tag,
idlist, PHYS_LIST_SIZE);
for (int j = 0; j < numComps; j++)
{
// get the info structure for the component
if (MSG_RTN_COMPLETED != engine->Send(MSG_GET_INFO, idlist[j].tag))
return;
// if this is a physical component with failed status, force to optimal
if (engine->devInfo_P->status.main == PAPM_FAILED)
{
engine->Reset();
engine->Insert((uCHAR) FORCE_OPTIMAL);
engine->Send(MSG_FORCE_STATE, idlist[i].tag);
}
}
// since we blew away the original array component info for the
// component arrays components, get the original data back for the
// next iteration of the loop
numComps = EngineFindIDs(FID_RESET_OUTBUFF,
MSG_ID_COMPONENTS, arrayTag,
idlist, PHYS_LIST_SIZE);
}
}
}
void Command::Init_Engine(int scanHbasOnly)
{
if (engine == 0)
{
// printf( "before ctor\n" );
engine = new DPT_EngineIO_C(LZSS_BUF_SIZE);
// printf( "before Open\n" );
if (engine->Open())
{
engine->Disconnect();
engine->Close();
printf ("%s", EventStrings[STR_ENG_CONN_FAILED]);
printf ("%s", EventStrings[STR_COLON_OPEN]);
exit (1); // exit with error
}
// if we were going to dynamically load the engine, then we'd use the
// line below.
// eng_Module_Handle = Load_Engine( &engine->EngineProc );
#ifdef _DPT_MSDOS
engine->Connect( DPT_ENGINE_COMPATIBILITY, DPT_IO_EATA_DIRECT );
#else
// printf( "before Connect\n" );
if (engine->Connect( DPT_ENGINE_COMPATIBILITY ))
{
engine->Disconnect();
engine->Close();
printf ("%s", EventStrings[STR_ENG_CONN_FAILED]);
printf ("%s", EventStrings[STR_COLON_COMPAT_NBR]);
exit (1); // exit with error
}
#endif
// printf( "before send\n" );
if (scanHbasOnly == 0) // scan entire system
{
if (engine->Send( MSG_IO_SCAN_SYSTEM ))
{
engine->Disconnect();
engine->Close();
printf ("%s", EventStrings[STR_ENG_CONN_FAILED]);
printf ("%s", EventStrings[STR_COLON_SCAN_FAILED]);
exit (1); // exit with error
}
}
else // only scan the hbas
{
if (engine->Send (MSG_IO_SCAN_HBAS))
{
engine->Disconnect();
engine->Close();
printf ("%s", EventStrings[STR_ENG_CONN_FAILED]);
printf ("%s", EventStrings[STR_COLON_SCAN_FAILED]);
exit (1); // exit with error
}
}
// printf( "after send\n" );
}
}
int Command::EngineFindIDs(int flags, DPT_MSG_T message,
DPT_TAG_T devicetag, void *where,
uSHORT maxIDs)
{
dptBuffer_S *outBuff_P = dptBuffer_S::newBuffer(4*1024);
dptBuffer_S *idBuff_P = dptBuffer_S::newBuffer(4*1024);
outBuff_P->clear();
idBuff_P->clear();
// Handle the flags
if (flags & FID_RESET_OUTBUFF) outBuff_P->reset();
// Find all devices of specified type attached to this device
if (MSG_RTN_COMPLETED != engine->Send(message, devicetag,
idBuff_P, outBuff_P))
{
delete[] outBuff_P;
delete[] idBuff_P;
return 0;
}
// if (MSG_RTN_COMPLETED != CallEngineBuff(message, devicetag, idBuff_P,
// outBuff_P, FALSE)) return 0;
// Figure out how many HBAs were found
#if defined(_SINIX)
int dptID_S_sz = sizeof(uLONG) + sizeof(uSHORT);
int numFound = idBuff_P->writeIndex / dptID_S_sz;
#else
int numFound = idBuff_P->writeIndex / sizeof(dptID_S);
#endif
// Make sure there is enough space in the array to hold all the IDs
// If not, just copy what it can hold and return that number
if (numFound > maxIDs) numFound = maxIDs;
// Copy the tags to our array
#if defined(_SINIX)
dptID_S *list = (dptIS_S *)where;
for (int i=0; i < numFound; i++)
{
memcpy(&(list[i]), &(idBuff_P->data[i*dptID_S_sz]), dptID_S_sz);
}
#else
memcpy(where, idBuff_P->data, numFound * sizeof(dptID_S));
#endif
delete[] outBuff_P;
delete[] idBuff_P;
// Tell them how many we found
return numFound;
}
/*** END OF FILE ***/
|