7712 mandoc -Tlint does always exit with error code 0
[unleashed.git] / usr / src / head / sdssc.h
blobd26fb263caf87675c119ca0976461c67041e44be
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _SDSSC_H
28 #define _SDSSC_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
33 * This header supports DiskSuite cluster operations and describes the
34 * functions that isolate it from cluster implementation.
37 #include <meta.h>
38 #include <metacl.h>
39 #include <sys/types.h>
40 #ifdef CLUSTER_LIBRARY_SOURCE
41 #include <sys/mhd.h>
42 #include <scadmin/scconf.h>
43 #include <scadmin/scswitch.h>
44 #include <scadmin/scstat.h>
45 #endif
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
51 #define SDSSC_PROXY_PRIMARY ((char *)1)
52 #define SDSSC_CLASS "sds" /* Service class name */
53 #define SDSSC_MO_CLASS "multi-owner-svm"
54 #define SDSSC_SERVICE_CMD "sds_ownership"
55 #define SDSSC_DEFAULT_PREFERENCE 0
59 * IMPORTANT: Any change to the metaset "-C" option interface shall
60 * be reflected in this number. Changes which do not affect shell
61 * parsing such as elimination of spaces or substitution of spaces
62 * for \n or addition of new non-interfering features may be indicated
63 * by incrementing the minor number in the version. Changes in content
64 * require the major portion of the version be incremented. All changes
65 * shall be discussed with and approved by our current contract partner(s).
67 #define METASETIFVERSION "1.0"
70 * XXX - This should be in some general purpose header but I can't
71 * find it anywhere. - JST
73 #define SDSSC_MD_DIR "/dev/md"
74 #define SDSSC_SET_PATH SDSSC_MD_DIR "/shared"
75 #define SDSSC_SETNO_LINK "shared"
77 /* This is a cluster-specific directory. */
78 #define SDSSC_CL_GLOBAL "/global/.devices/node@"
81 * Cluster specific directory which contains libdid.so
83 #define SDSSC_CL_LIBDIR "/usr/cluster/lib"
84 #define SDSSC_DID_LIB SDSSC_CL_LIBDIR "/libdid.so"
87 * This information can't change unless a corresponding change to SC3.0
88 * upgrade process is made. When a HA1.3 or SC2.2 system is upgraded
89 * to SC3.0, the upgrade process will create our services with the following
90 * properties:
91 * SDSSC_PROP_INDEX: the current set number on the old HA pair
92 * SDSSC_PROP_STATE: SDSSC_STATE_COMMIT
94 #define SDSSC_PROP_COUNT 4 /* Number of store props */
95 #define SDSSC_PROP_INDEX "index" /* One of the properties */
96 #define SDSSC_PROP_NODE "node" /* ditto */
97 #define SDSSC_PROP_INCAR "incarnation" /* ditto */
98 #define SDSSC_PROP_STATE "state" /* ditto */
100 #define SDSSC_STATE_COMMIT "commit" /* state values */
101 #define SDSSC_STATE_CREATE "create" /* ditto */
102 #define SDSSC_STATE_DEL "delete" /* ditto */
105 * When creating services in the DCS the index used is either set
106 * by the calling routine or sdssc_create_begin will pick the next
107 * available one. To have the next available one picked the following
108 * define should be used as the forth argument.
110 #define SDSSC_PICK_SETNO 0
113 * The following number was lifted from the Cluster Project source
114 * code. Apparently they don't believe in using #define for constants.
115 * For now we'll create one.
117 #define SDSSC_NODE_NAME_LEN 64
120 * We need to malloc a small amount of space for property values.
121 * The two values are integer strings with a value of 1 to 64.
123 #define SDSSC_NODE_INDEX_LEN 20
126 * The maximum number of metadevices in a set is currently limited
127 * to 8192.
129 #define SDSSC_METADDEV_MAX 8192
132 * To avoid the need for two separate files with definitions for the libraries
133 * entry points the following macro is being used. CLUSTER_LIBRARY_SOURCE
134 * is only defined in the libsdssc source just as the name implies. The
135 * reference below becomes a function prototype. Otherwise a pointer to a
136 * function is defined which can be used elsewhere in the commands.
138 #ifdef CLUSTER_LIBRARY_SOURCE
139 #define REF(method, args) _##method args
140 #else
141 #define REF(method, args) (* method) args
142 #endif
144 struct sdssc_version {
145 int major;
146 int minor;
147 int library_level;
150 typedef struct {
151 char *fname; /* function name found in library */
152 void **fptr; /* pointer to storage for global pointer */
153 } func_table_t, *func_table_p;
155 enum rval1 {
157 * Function executed without errors. Duh
159 SDSSC_OKAY,
162 * Some generic error condition occurred
164 SDSSC_ERROR,
167 * sdssc_cmd_proxy was able to execute the command
168 * remotely.
170 SDSSC_PROXY_DONE,
173 * When the libsds_sc.so is not found or the system isn't
174 * part of a cluster the interface routines will return this
175 * as indication
177 SDSSC_NOT_BOUND,
180 * If the service isn't found in the CCR sdssc_get_primary
181 * will this enumeration.
183 SDSSC_NO_SERVICE,
186 * When the libsds_sc.so is found, but this specific routine failed
187 * to bind, then this interface routine will return this error.
188 * This error indicates that an older version of the libsds_sc.so
189 * library which does not support this routine.
191 SDSSC_NOT_BOUND_ERROR
194 enum dcs_state { SDSSC_COMMIT, SDSSC_CLEANUP };
195 enum sds_boolean { SDSSC_True, SDSSC_False };
196 enum sdssc_dcs_notify { Make_Primary, Release_Primary, Shutdown_Services };
198 typedef enum rval1 rval_e;
199 typedef enum dcs_state dcs_set_state_e;
200 typedef struct sdssc_version sdssc_version_t;
201 typedef enum sds_boolean sdssc_boolean_e;
202 typedef enum sdssc_dcs_notify sdssc_dcs_notify_e;
204 rval_e sdssc_bind_library(void);
205 rval_e REF(sdssc_version, (sdssc_version_t *));
206 rval_e REF(sdssc_create_begin, (char *, int, char **, int));
207 rval_e REF(sdssc_mo_create_begin, (char *, int, char **, int));
208 rval_e REF(sdssc_create_end, (char *, dcs_set_state_e));
209 rval_e REF(sdssc_delete_begin, (char *));
210 rval_e REF(sdssc_delete_end, (char *, dcs_set_state_e));
211 rval_e REF(sdssc_get_index, (char *, set_t *));
212 rval_e REF(sdssc_add_hosts, (char *, int, char **));
213 rval_e REF(sdssc_delete_hosts, (char *, int, char **));
214 rval_e REF(sdssc_get_primary_host, (char *, char *, int));
215 rval_e REF(sdssc_cmd_proxy, (int, char **, char *host, int *));
216 rval_e REF(sdssc_getnodelist, (int **));
217 void REF(sdssc_freenodelist, (int *));
218 mdc_errno_t REF(sdssc_binddevs, (void));
219 rval_e REF(sdssc_gettransportbynode, (int, char **));
220 rval_e REF(sdssc_bindclusterdevs, (mdc_err_t ***));
221 void REF(sdssc_free_mdcerr_list, (mdc_err_t **));
222 rval_e REF(sdssc_clnt_bind_devs, (char *, mdc_err_t *));
223 rval_e REF(sdssc_property_get, (char *, char *, char **));
224 rval_e REF(sdssc_property_set, (char *, char *, char *));
225 rval_e REF(sdssc_get_services, (char ***));
226 rval_e REF(sdssc_get_services_free, (char **));
227 rval_e REF(sdssc_suspend, (const char *));
228 rval_e REF(sdssc_convert_cluster_path, (const char *, char **));
229 rval_e REF(sdssc_convert_ctd_path, (const char *, char **));
230 void REF(sdssc_convert_path_free, (char *));
231 rval_e REF(sdssc_notify_service, (const char *, sdssc_dcs_notify_e));
232 void REF(sdssc_cm_nm2nid, (char *));
233 void REF(sdssc_cm_sr_nm2nid, (md_set_record *));
234 void REF(sdssc_cm_nid2nm, (char *));
235 void REF(sdssc_cm_sr_nid2nm, (md_set_record *));
236 rval_e REF(sdssc_get_priv_ipaddr, (char *, struct in_addr *));
237 rval_e REF(sdssc_clnt_proxy_cmd, (uint_t, char **, uint_t, char **,
238 char *, mdc_err_t *));
240 #ifdef CLUSTER_LIBRARY_SOURCE
242 * Support routines used with libsds_sc.so and not for public
243 * consumption (see mapfile-vers for scoping).
245 rval_e l_get_property(scconf_cfg_ds_t *, char *, char **);
246 void *l_get_incarnation(int);
247 char *l_incarnation_to_prop(int);
248 void *l_prop_to_incarnation(char *);
249 sdssc_boolean_e l_compare_incarnation(void *, void *);
250 rval_e l_build_hostlist(scconf_nodeid_t *, char ***);
251 #endif
252 #ifdef __cplusplus
254 #endif
256 #endif /* _SDSSC_H */