8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / sun_fc / common / HBA.h
blob47cd0fadad6e3161341df3e9284c8f080a82cb76
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _HBA_H
27 #define _HBA_H
31 // Forward declarations
32 class HBA;
33 class HBAPort;
35 #include "Lockable.h"
36 #include "HBAPort.h"
37 #include <map>
38 #include <string>
39 #include <vector>
40 #include <map>
41 #include <hbaapi.h>
42 #include <hbaapi-sun.h>
46 * @memo Used to track an individual HBA
47 * @see HBAList
49 * @doc During discovery, as HBAs are found on the system,
50 * instances of this class will be created, and stored
51 * in the HBAList class.
53 class HBA : public Lockable {
54 public:
55 HBA() {}
56 virtual ~HBA();
57 bool operator == (HBA &comp);
58 static const uint8_t HBA_PORT_MAX;
59 void addPort(HBAPort* port);
60 HBAPort* getPort(uint64_t wwn);
61 bool containsWWN(uint64_t wwn);
63 virtual HBA_ADAPTERATTRIBUTES getHBAAttributes() = 0;
64 virtual int doForceLip() = 0;
65 virtual HBA_ADAPTERATTRIBUTES npivGetHBAAttributes() = 0;
66 void setRNID(HBA_MGMTINFO info);
68 * Fetch the name, excluding the trailing "-" and index number
70 virtual std::string getName() = 0;
72 void validatePresent();
74 HBAPort* getPortByIndex(int index);
75 uint8_t getNumberOfPorts();
77 // Utility routines: Could be moved elsewhere
78 // Each routine throws exceptions on error (and logs)
79 static int _open(std::string path, int flag);
80 static void _ioctl(int fd, int type, uchar_t *arg);
82 private:
83 std::map<uint64_t, HBAPort *> portsByWWN;
84 std::vector<HBAPort*> portsByIndex;
88 #endif /* _HBA_H */