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