source: trunk/third/sysinfo/classtype.c @ 12269

Revision 12269, 3.4 KB checked in by ghudson, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r12268, which included commits to RCS files with non-trunk default branches.
Line 
1/*
2 * Copyright (c) 1992-1998 Michael A. Cooper.
3 * This software may be freely used and distributed provided it is not
4 * sold for profit or used in part or in whole for commercial gain
5 * without prior written agreement, and the author is credited
6 * appropriately.
7 */
8
9#ifndef lint
10static char *RCSid = "$Revision: 1.1.1.1 $";
11#endif
12
13/*
14 * ClassType Info
15 */
16#include "defs.h"
17
18/*
19 * ClassType definetions
20 */
21static ClassType_t ClassTypes[] = {
22    { { DT_DISKDRIVE, DT_TAPEDRIVE, DT_CDROM, DT_DISKCTLR, DT_CONTROLLER, 0 },
23      CT_SCSI,          CT_SCSI_S,      NULL },
24    { { DT_DISKDRIVE, DT_TAPEDRIVE, DT_CDROM, DT_DISKCTLR, DT_CONTROLLER, 0 },
25      CT_IPI,           CT_IPI_S,       NULL },
26    { { DT_DISKDRIVE, DT_TAPEDRIVE, DT_CDROM, DT_DISKCTLR, DT_CONTROLLER, 0 },
27      CT_SMD,           CT_SMD_S,       NULL },
28    { { DT_DISKDRIVE, DT_TAPEDRIVE, DT_CDROM, DT_DISKCTLR, DT_CONTROLLER, 0 },
29      CT_ATA,           CT_ATA_S,       "ATA/IDE/EIDE/UIDE" },
30    { { DT_DISKDRIVE, DT_TAPEDRIVE, DT_CDROM, DT_DISKCTLR, DT_CONTROLLER, 0 },
31      CT_ATA,           CT_IDE_S,       "ATA/IDE/EIDE/UIDE" },
32    { { DT_BUS, 0 },    CT_PCI,         CT_PCI_S,       NULL },
33    { { DT_BUS, 0 },    CT_ISA,         CT_ISA_S,       NULL },
34    { { DT_BUS, 0 },    CT_PNPISA,      CT_PNPISA_S,    "Plug-N-Play ISA" },
35    { { DT_BUS, 0 },    CT_EISA,        CT_EISA_S,      NULL },
36    { { DT_BUS, 0 },    CT_MCA,         CT_MCA_S,       NULL },
37    { { DT_BUS, 0 },    CT_SBUS,        CT_SBUS_S,      NULL },
38    { { DT_NETIF, 0 },  CT_ETHER10M,    CT_ETHER10M_S,  "10-Mb Ethernet" },
39    { { DT_NETIF, 0 },  CT_ETHER10M,    "ETHER",        "10-Mb Ethernet" },
40    { { DT_NETIF, 0 },  CT_ETHER100M,   CT_ETHER100M_S,"100-Mb Fast Ethernet"},
41    { { DT_NETIF, 0 },  CT_ETHER1G,     CT_ETHER1G_S, "1-GB Gigabit Ethernet"},
42    { { DT_NETIF, 0 },  CT_FDDI,        CT_FDDI_S,      NULL },
43    { { DT_NETIF, 0 },  CT_ATM,         CT_ATM_S,       NULL },
44    { { DT_NETIF, 0 },  CT_TOKEN,       CT_TOKEN_S,     "Token Ring" },
45    { { DT_NETIF, 0 },  CT_HIPPI,       CT_HIPPI_S,     NULL },
46    { { DT_NETIF, 0 },  CT_ISDN,        CT_ISDN_S,      NULL },
47    { { DT_MONITOR, 0 },CT_RGBCOLOR,    CT_RGBCOLOR_S,  "RGB Color" },
48    { { DT_MONITOR, 0 },CT_NONRGBCOLOR, CT_NONRGBCOLOR_S,"Non-RGB Color" },
49    { { DT_MONITOR, 0 },CT_MONO,        CT_MONO_S,    "Monochrome/grayscale" },
50    { 0 },
51};
52
53/*
54 * Does DevType appear in ClassType->DevTypes list?
55 */
56static int IsDevType(DevType, ClassType)
57     int                        DevType;
58     ClassType_t               *ClassType;
59{
60    register int                i;
61
62    for (i = 0; i < MAX_CLASS_DEVTYPES; ++i)
63        if (ClassType->DevTypes[i] == DevType)
64            return(TRUE);
65
66    return(FALSE);
67}
68
69/*
70 * Lookup by DevType + ClassType.
71 */
72extern ClassType_t *ClassTypeGetByType(DevType, ClassType)
73    int                         DevType;
74    int                         ClassType;
75{
76    register ClassType_t       *Type;
77
78    if (ClassType <= 0 || DevType <= 0)
79        return((ClassType_t *) NULL);
80
81    for (Type = ClassTypes; Type->Name; ++Type)
82        if (IsDevType(DevType, Type) &&
83            Type->Type == ClassType)
84            return(Type);
85
86    SImsg(SIM_DBG, "ClassTypeGetByType: Cannot find DevType=%d ClassType=%d",
87          DevType, ClassType);
88
89    return((ClassType_t *) NULL);
90}
91
92/*
93 * Lookup using DevType and Name of ClassType
94 */
95extern ClassType_t *ClassTypeGetByName(DevType, Name)
96     int                        DevType;
97     char                      *Name;
98{
99    register ClassType_t       *TypePtr;
100
101    if (!Name || DevType <= 0)
102        return((ClassType_t *) NULL);
103
104    for (TypePtr = ClassTypes; TypePtr->Name; ++TypePtr)
105        if (IsDevType(DevType, TypePtr) && EQ(TypePtr->Name, Name))
106            return(TypePtr);
107
108    SImsg(SIM_DBG, "ClassTypeGetByName: Cannot find DevType=%d ClassName=<%s>",
109          DevType, Name);
110
111    return((ClassType_t *) NULL);
112}
Note: See TracBrowser for help on using the repository browser.