xref: /titanic_41/usr/src/uts/common/sys/cladm.h (revision dd49f125507979bb2ab505a8daf2a46d1be27051)
1 /*
2  * CDDL HEADER START
3  *
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.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1998-2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_CLADM_H
28 #define	_SYS_CLADM_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/types.h>
37 #include <sys/clconf.h>
38 #include <netinet/in.h>
39 
40 
41 /*
42  * This file defines interfaces which are private to Sun Clustering.
43  * Others should not depend on this in any way as it may change or be
44  * removed completely.
45  */
46 
47 /*
48  * cladm() facilities; see below for definitions pertinent to each of these
49  * facilities.
50  */
51 #define	CL_INITIALIZE		0	/* bootstrapping information */
52 #define	CL_CONFIG		1	/* configuration information */
53 
54 
55 /*
56  * Command definitions for each of the facilities.
57  * The type of the data pointer and the direction of the data transfer
58  * is listed for each command.
59  */
60 
61 /*
62  * CL_INITIALIZE facility commands.
63  */
64 #define	CL_GET_BOOTFLAG		0	/* Return cluster config/boot status */
65 
66 /*
67  * Definitions for the flag bits returned by CL_GET_BOOTFLAG.
68  */
69 #define	CLUSTER_CONFIGURED	0x0001	/* system is configured as a cluster */
70 #define	CLUSTER_BOOTED		0x0002	/* system is booted as a cluster */
71 
72 #ifdef _KERNEL
73 #define	CLUSTER_INSTALLING	0x0004	/* cluster is being installed */
74 #define	CLUSTER_DCS_ENABLED	0x0008	/* cluster device framework enabled */
75 #endif	/* _KERNEL */
76 
77 /*
78  * CL_CONFIG facility commands.
79  * The CL_GET_NETADDRS and CL_GET_NUM_NETADDRS are contract private interfaces
80  * per PSARC/2001/579-01.
81  */
82 #define	CL_NODEID		0	/* Return nodeid of this node. */
83 #define	CL_HIGHEST_NODEID	1	/* Return highest configured nodeid. */
84 #define	CL_GDEV_PREFIX		2	/* Return path to global namespace.  */
85 #define	CL_GET_NETADDRS		3	/* Get array of network addresses    */
86 					/* controlled by Sun Cluster. */
87 #define	CL_GET_NUM_NETADDRS	4	/* Get the number of data structure  */
88 					/* entries in the array that will be */
89 					/* returned  using CL_GET_NETADDRS.  */
90 
91 /*
92  * The cladm system call can provide an array of cluster controlled
93  * network addresses and associated netmasks.  The cladm arguments
94  * must be as follows:  the argument fac is specified as CL_CONFIG,
95  * the argument cmd is specified as CL_GET_NETADDRS, and argument arg
96  * is the location of a structure of type cladm_netaddrs_t. The
97  * cladm_num_netaddrs is used as input for the requested number
98  * of array entries, and is used as ouput for the number of valid array
99  * entries available.
100  *
101  * The caller must allocate sufficient memory for the array of
102  * structures of type cladm_netaddr_entry_t and specify the starting
103  * location as cladm_netaddrs_array.  The number of entries included
104  * in the array is determined using cladm with argument fac specified
105  * as CL_CONFIG, argument cmd specified as CL_GET_NUM_NETADDRS, and
106  * argument arg is the location of a structure of type cladm_netaddrs_t.
107  * The determined number of array entries is returned in
108  * cladm_num_netaddrs.
109  *
110  * These commands support the yielding of DR operation control (by the
111  * RCM Framework) to Sun Cluster for cluster controlled adapters.
112  *
113  * These data structures are contract private per PSARC/2001/579-01.
114  */
115 typedef struct {
116 	int32_t		cl_ipversion;	/* IPV4_VERSION or IPV6_VERSION */
117 	union {
118 		struct {
119 			ipaddr_t	ipv4_netaddr;
120 			ipaddr_t	ipv4_netmask;
121 			} cl_ipv4;
122 		struct {
123 			uint32_t	ipv6_netaddr[4];
124 			uint32_t	ipv6_netmask[4];
125 			} cl_ipv6;
126 	} cl_ipv_un;
127 } cladm_netaddr_entry_t;
128 
129 typedef struct {
130 	uint32_t		cladm_num_netaddrs;
131 	cladm_netaddr_entry_t	*cladm_netaddrs_array;
132 } cladm_netaddrs_t;
133 
134 #if defined(_SYSCALL32)
135 typedef struct {
136 	uint32_t	cladm_num_netaddrs;
137 	caddr32_t	cladm_netaddrs_array;
138 } cladm_netaddrs32_t;
139 #endif /* defined(_SYSCALL32) */
140 
141 
142 #ifdef _KERNEL
143 extern int cladmin(int fac, int cmd, void *data);
144 extern int cluster_bootflags;
145 #else
146 #if defined(__STDC__)
147 extern int _cladm(int fac, int cmd, void *data);
148 #else	/* !defined(__STDC__) */
149 extern int _cladm();
150 #endif	/* defined(__STDC__) */
151 #endif	/* _KERNEL */
152 
153 #ifdef	__cplusplus
154 }
155 #endif
156 
157 
158 #endif	/* _SYS_CLADM_H */
159