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
|
/*
* 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.
*/
#ifndef _CFG_CLUSTER_H
#define _CFG_CLUSTER_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* This file is a combination of interfaces culled from scstat.h,
* scconf.h and the header files that they include.
*
* It exposes a subset of the interfaces defined in PSARC/2001/261
* for use in NWS software.
*/
#include <sys/errno.h>
#include <sys/types.h>
/*
* From sc_syslog_msg.h
*/
typedef enum sc_state_code_enum {
ONLINE = 1, /* resource is running */
OFFLINE, /* resource is stopped due to user action */
FAULTED, /* resource is stopped due to a failure */
DEGRADED, /* resource is running but has a minor problem */
WAIT, /* resource is in transition from a state to another */
/*
* resource is monitored but state of the resource is
* not known because either the monitor went down or
* the monitor cannot report resource state temporarily.
*/
UNKNOWN,
NOT_MONITORED /* There is no monitor to check state of the resource */
} sc_state_code_t;
/*
* End sc_syslog_msg.h
*/
/*
* From scstat.h
*/
#define SCSTAT_MAX_STRING_LEN 1024
/* Error codes returned by scstat functions. */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef enum scstat_errno {
SCSTAT_ENOERR, /* normal return - no error */
SCSTAT_EUSAGE, /* syntax error */
SCSTAT_ENOMEM, /* not enough memory */
SCSTAT_ENOTCLUSTER, /* not a cluster node */
SCSTAT_ENOTCONFIGURED, /* not found in CCR */
SCSTAT_ESERVICENAME, /* dcs: invalid service name */
SCSTAT_EINVAL, /* scconf: invalid argument */
SCSTAT_EPERM, /* not root */
SCSTAT_ECLUSTERRECONFIG, /* cluster is reconfiguring */
SCSTAT_ERGRECONFIG, /* RG is reconfiguring */
SCSTAT_EOBSOLETE, /* Resource/RG has been updated */
SCSTAT_EUNEXPECTED /* internal or unexpected error */
} scstat_errno_t;
/* States a resource can be in */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef enum scstat_state_code {
SCSTAT_ONLINE = ONLINE, /* resource is running */
SCSTAT_OFFLINE = OFFLINE, /* resource stopped due to user action */
SCSTAT_FAULTED = FAULTED, /* resource stopped due to a failure */
SCSTAT_DEGRADED = DEGRADED, /* resource running with a minor problem */
SCSTAT_WAIT = WAIT, /* resource is in transition */
SCSTAT_UNKNOWN = UNKNOWN, /* resource state is unknown */
SCSTAT_NOTMONITORED = NOT_MONITORED /* resource is not monitored */
} scstat_state_code_t;
/* States a replica of a resource can be in */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef enum scstat_node_pref {
SCSTAT_PRIMARY, /* replica is a primary */
SCSTAT_SECONDARY, /* replica is a secondary */
SCSTAT_SPARE, /* replica is a spare */
SCSTAT_INACTIVE, /* replica is inactive */
SCSTAT_TRANSITION, /* replica is changing state */
SCSTAT_INVALID /* replica is in an invalid state */
} scstat_node_pref_t;
/* component name */
typedef char *scstat_name_t;
typedef scstat_name_t scstat_cluster_name_t; /* cluster name */
typedef scstat_name_t scstat_node_name_t; /* node name */
typedef scstat_name_t scstat_adapter_name_t; /* adapter name */
typedef scstat_name_t scstat_path_name_t; /* path name */
typedef scstat_name_t scstat_ds_name_t; /* device service name */
typedef scstat_name_t scstat_quorumdev_name_t; /* quorum device name */
typedef scstat_name_t scstat_rs_name_t; /* resource name */
typedef scstat_name_t scstat_rg_name_t; /* rg name */
/* status string */
typedef char *scstat_statstr_t;
typedef scstat_statstr_t scstat_node_statstr_t; /* node status */
typedef scstat_statstr_t scstat_path_statstr_t; /* path status */
typedef scstat_statstr_t scstat_ds_statstr_t; /* DS status */
typedef scstat_statstr_t scstat_node_quorum_statstr_t; /* node quorum status */
typedef scstat_statstr_t scstat_quorumdev_statstr_t; /* quorum device stat */
/* ha device node status list */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef struct scstat_ds_node_state_struct {
/* node name */
scstat_node_name_t scstat_node_name;
/* node status */
scstat_node_pref_t scstat_node_state;
/* next */
struct scstat_ds_node_state_struct *scstat_node_next;
} scstat_ds_node_state_t;
/* Cluster node status */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef struct scstat_node_struct {
scstat_node_name_t scstat_node_name; /* node name */
scstat_state_code_t scstat_node_status; /* cluster membership */
scstat_node_statstr_t scstat_node_statstr; /* node status string */
void *pad; /* Padding for */
/* PSARC/2001/261. */
struct scstat_node_struct *scstat_node_next; /* next */
} scstat_node_t;
/* Cluster ha device status */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef struct scstat_ds_struct {
/* ha device name */
scstat_ds_name_t scstat_ds_name;
/* ha device status */
scstat_state_code_t scstat_ds_status;
/* ha device statstr */
scstat_ds_statstr_t scstat_ds_statstr;
/* node preference list */
scstat_ds_node_state_t *scstat_node_state_list;
/* next */
struct scstat_ds_struct *scstat_ds_next;
} scstat_ds_t;
/*
* scstat_strerr
*
* Map scstat_errno_t to a string.
*
* The supplied "errbuffer" should be of at least SCSTAT_MAX_STRING_LEN
* in length.
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
void scstat_strerr(scstat_errno_t, char *);
/*
* Upon success, a list of objects of scstat_node_t are returned.
* The caller is responsible for freeing the space.
*
* Possible return values:
*
* SCSTAT_NOERR - success
* SCSTAT_ENOMEM - not enough memory
* SCSTAT_EPERM - not root
* SCSTAT_ENOTCLUSTER - there is no cluster
* SCCONF_EINVAL - invalid argument
* SCSTAT_EUNEXPECTED - internal or unexpected error
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
scstat_errno_t scstat_get_nodes(scstat_node_t **pplnodes);
/*
* Free all memory associated with a scstat_node_t structure.
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
void scstat_free_nodes(scstat_node_t *plnodes);
/*
* If the device service name passed in is NULL, then this function returns
* the status of all device services, otherwise it returns the status of the
* device service specified.
* The caller is responsible for freeing the space.
*
* Possible return values:
*
* SCSTAT_ENOERR - success
* SCSTAT_ENOMEM - not enough memory
* SCSTAT_EPERM - not root
* SCSTAT_ENOTCLUSTER - there is no cluster
* SCCONF_EINVAL - invalid argument
* SCSTAT_ESERVICENAME - invalid device group name
* SCSTAT_EUNEXPECTED - internal or unexpected error
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
scstat_errno_t scstat_get_ds_status(scstat_ds_name_t *dsname,
scstat_ds_t **dsstatus);
/*
* Free memory associated with a scstat_ds_t structure.
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
void scstat_free_ds_status(scstat_ds_t *dsstatus);
/*
* End scstat.h
*/
/*
* From scconf.h
*/
/* Maximum message string length */
#define SCCONF_MAXSTRINGLEN 1024
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef enum scconf_errno {
SCCONF_NOERR = 0, /* normal return - no error */
SCCONF_EPERM = 1, /* permission denied */
SCCONF_EEXIST = 2, /* object already exists */
SCCONF_ENOEXIST = 3, /* object does not exist */
SCCONF_ESTALE = 4, /* object or handle is stale */
SCCONF_EUNKNOWN = 5, /* unkown type */
SCCONF_ENOCLUSTER = 6, /* cluster does not exist */
SCCONF_ENODEID = 7, /* ID used in place of node name */
SCCONF_EINVAL = 8, /* invalid argument */
SCCONF_EUSAGE = 9, /* command usage error */
SCCONF_ETIMEDOUT = 10, /* call timed out */
SCCONF_EINUSE = 11, /* already in use */
SCCONF_EBUSY = 12, /* busy, try again later */
SCCONF_EINSTALLMODE = 13, /* install mode */
SCCONF_ENOMEM = 14, /* not enough memory */
SCCONF_ESETUP = 15, /* setup attempt failed */
SCCONF_EUNEXPECTED = 16, /* internal or unexpected error */
SCCONF_EBADVALUE = 17, /* bad ccr table value */
SCCONF_EOVERFLOW = 18, /* message buffer overflow */
SCCONF_EQUORUM = 19, /* operation would compromise quorum */
SCCONF_TM_EBADOPTS = 20, /* bad transport TM "options" */
SCCONF_TM_EINVAL = 21, /* other transport TM error */
SCCONF_DS_ESUSPENDED = 22, /* Device service in suspended state */
SCCONF_DS_ENODEINVAL = 23, /* Node specified is not in cluster */
SCCONF_EAUTH = 24, /* authentication error */
SCCONF_DS_EINVAL = 25, /* Device service in an invalid state */
SCCONF_EIO = 26 /* IO error */
} scconf_errno_t;
/* IDs */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef uint_t scconf_id_t;
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef scconf_id_t scconf_nodeid_t; /* node ID */
/* Cluster transport handle */
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
typedef void * scconf_cltr_handle_t;
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
extern scconf_errno_t scconf_get_nodeid(char *nodename,
scconf_nodeid_t *nodeidp);
/*
* Get the name of a node from its "nodeid". Upon success,
* a pointer to the nodename is left in "nodenamep".
*
* It is the caller's responsibility to free memory allocated
* for "nodename" using free(3C).
*
* Possible return values:
*
* SCCONF_NOERR - success
* SCCONF_EPERM - not root
* SCCONF_ENOCLUSTER - there is no cluster
* SCCONF_ENOMEM - not enough memory
* SCCONF_EINVAL - invalid argument
* SCCONF_EUNEXPECTED - internal or unexpected error
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
extern scconf_errno_t scconf_get_nodename(scconf_nodeid_t nodeid,
char **nodenamep);
/*
* Map scconf_errno_t to a string.
*
* The supplied "errbuffer" should be of at least SCCONF_MAXSTRINGLEN
* in length.
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
extern void scconf_strerr(char *errbuffer, scconf_errno_t err);
/*
* Given a dev_t value, return the name of device service that contains this
* device.
*
* The caller is responsible for freeing the memory returned in "name".
*
* Possible return values:
*
* SCCONF_NOERR - success
* SCCONF_EPERM - not root
* SCCONF_ENOEXIST - the given device is not configured
* SCCONF_ENOMEM - not enough memory
* SCCONF_ENOCLUSTER - cluster config does not exist
* SCCONF_EUNEXPECTED - internal or unexpected error
*/
/* This definition is covered by PSARC/2001/261. DO NOT change it. */
extern scconf_errno_t scconf_get_ds_by_devt(major_t maj, minor_t min,
char **dsname);
/*
* End scconf.h
*/
#ifdef __cplusplus
}
#endif
#endif /* _CFG_CLUSTER_H */
|