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