8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libsrpt / common / libsrpt.h
blob8b5d1fe26e5db1a08c7e7fd578db33cd0812477e
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 (c) 2010, Oracle and/or its affiliates. All rights reserved.
25 #ifndef _LIBSRPT_H
26 #define _LIBSRPT_H
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 #include <sys/types.h>
33 #include <libnvpair.h>
36 * Function: srpt_GetConfig()
38 * Parameters:
39 * cfg Current SRPT configuration in nvlist form
40 * token Configuration generation number. Use this token
41 * if updating the configuration with srpt_SetConfig.
43 * Return Values:
44 * 0 Success
45 * ENOMEM Could not allocate resources
46 * EINVAL Invalid parameter
48 int
49 srpt_GetConfig(nvlist_t **cfg, uint64_t *token);
52 * Function: srpt_SetConfig()
54 * Parameters:
55 * cfg SRPT configuration in nvlist form
56 * token Configuration generation number from srpt_GetConfig.
57 * Use this token to ensure the configuration hasn't been
58 * updated by another user since the time it was fetched.
60 * Return Values:
61 * 0 Success
62 * ENOMEM Could not allocate resources
63 * EINVAL Invalid parameter
64 * ECANCELED Configuration updated by another user
66 int
67 srpt_SetConfig(nvlist_t *cfg, uint64_t token);
70 * Function: srpt_GetDefaultState()
72 * Parameters:
73 * enabled If B_TRUE, indicates that targets will be created for all
74 * discovered HCAs that have not been specifically disabled.
75 * If B_FALSE, targets will not be created unless the HCA has
76 * been specifically enabled. See also srpt_SetDefaultState().
78 * Return Values:
79 * 0 Success
80 * ENOMEM Could not allocate resources
81 * EINVAL Invalid parameter
83 int
84 srpt_GetDefaultState(boolean_t *enabled);
87 * Function: srpt_SetDefaultState()
89 * Parameters:
90 * enabled If B_TRUE, indicates that targets will be created for all
91 * discovered HCAs that have not been specifically disabled.
92 * If B_FALSE, targets will not be created unless the HCA has
93 * been specifically enabled. See also srpt_SetDefaultState().
95 * Return Values:
96 * 0 Success
97 * ENOMEM Could not allocate resources
98 * EINVAL Invalid parameter
101 srpt_SetDefaultState(boolean_t enabled);
104 * Function: srpt_SetTargetState()
106 * Parameters:
107 * hca_guid HCA GUID. See description of srpt_NormalizeGuid
108 * enabled If B_TRUE, indicates that a target will be created for
109 * this HCA when the SRPT SMF service is enabled. If B_FALSE,
110 * a target will not be created
112 * Return Values:
113 * 0 Success
114 * ENOMEM Could not allocate resources
115 * EINVAL Invalid parameter
118 srpt_SetTargetState(char *hca_guid, boolean_t enabled);
121 * Function: srpt_GetTargetState()
123 * Parameters:
124 * hca_guid HCA GUID. See description of srpt_NormalizeGuid
125 * enabled If B_TRUE, indicates that a target will be created for
126 * this HCA when the SRPT SMF service is enabled. If B_FALSE,
127 * a target will not be created
129 * Return Values:
130 * 0 Success
131 * ENOMEM Could not allocate resources
132 * EINVAL Invalid parameter
135 srpt_GetTargetState(char *hca_guid, boolean_t *enabled);
138 * Function: srpt_ResetTarget()
140 * Clears the HCA-specific configuration. Target creation will revert to
141 * the default.
143 * Parameters:
144 * hca_guid HCA GUID. See description of srpt_NormalizeGuid
146 * Return Values:
147 * 0 Success
148 * ENOMEM Could not allocate resources
149 * EINVAL Invalid parameter
152 srpt_ResetTarget(char *hca_guid);
155 * srpt_NormalizeGuid()
157 * Parameters:
158 * in HCA GUID. Must be in one of the following forms:
159 * 3BA000100CD18 - base hex form
160 * 0003BA000100CD18 - base hex form with leading zeroes
161 * hca:3BA000100CD18 - form from cfgadm and/or /dev/cfg
162 * eui.0003BA000100CD18 - EUI form
164 * buf Buffer to hold normalized guid string. Must be at least
165 * 17 chars long.
166 * buflen Length of provided buffer
167 * int_guid Optional. If not NULL, the integer form of the GUID will also
168 * be returned.
169 * Return Values:
170 * 0 Success
171 * EINVAL Invalid HCA GUID or invalid parameter.
174 srpt_NormalizeGuid(char *in, char *buf, size_t buflen, uint64_t *int_guid);
176 #ifdef __cplusplus
178 #endif
180 #endif /* _LIBSRPT_H */