xref: /titanic_51/usr/src/uts/common/sys/cladm.h (revision ba3594ba9b5dd4c846c472a8d657edcb7c8109ac)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
23*ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24*ba3594baSGarrett D'Amore  *
257c478bd9Sstevel@tonic-gate  * Copyright 1998-2002 Sun Microsystems, Inc.  All rights reserved.
267c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifndef _SYS_CLADM_H
307c478bd9Sstevel@tonic-gate #define	_SYS_CLADM_H
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
337c478bd9Sstevel@tonic-gate extern "C" {
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #include <sys/types.h>
377c478bd9Sstevel@tonic-gate #include <sys/clconf.h>
387c478bd9Sstevel@tonic-gate #include <netinet/in.h>
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate /*
427c478bd9Sstevel@tonic-gate  * This file defines interfaces which are private to Sun Clustering.
437c478bd9Sstevel@tonic-gate  * Others should not depend on this in any way as it may change or be
447c478bd9Sstevel@tonic-gate  * removed completely.
457c478bd9Sstevel@tonic-gate  */
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate /*
487c478bd9Sstevel@tonic-gate  * cladm() facilities; see below for definitions pertinent to each of these
497c478bd9Sstevel@tonic-gate  * facilities.
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate #define	CL_INITIALIZE		0	/* bootstrapping information */
527c478bd9Sstevel@tonic-gate #define	CL_CONFIG		1	/* configuration information */
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate /*
567c478bd9Sstevel@tonic-gate  * Command definitions for each of the facilities.
577c478bd9Sstevel@tonic-gate  * The type of the data pointer and the direction of the data transfer
587c478bd9Sstevel@tonic-gate  * is listed for each command.
597c478bd9Sstevel@tonic-gate  */
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate /*
627c478bd9Sstevel@tonic-gate  * CL_INITIALIZE facility commands.
637c478bd9Sstevel@tonic-gate  */
647c478bd9Sstevel@tonic-gate #define	CL_GET_BOOTFLAG		0	/* Return cluster config/boot status */
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate /*
677c478bd9Sstevel@tonic-gate  * Definitions for the flag bits returned by CL_GET_BOOTFLAG.
687c478bd9Sstevel@tonic-gate  */
697c478bd9Sstevel@tonic-gate #define	CLUSTER_CONFIGURED	0x0001	/* system is configured as a cluster */
707c478bd9Sstevel@tonic-gate #define	CLUSTER_BOOTED		0x0002	/* system is booted as a cluster */
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate #ifdef _KERNEL
737c478bd9Sstevel@tonic-gate #define	CLUSTER_INSTALLING	0x0004	/* cluster is being installed */
747c478bd9Sstevel@tonic-gate #define	CLUSTER_DCS_ENABLED	0x0008	/* cluster device framework enabled */
757c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate /*
787c478bd9Sstevel@tonic-gate  * CL_CONFIG facility commands.
797c478bd9Sstevel@tonic-gate  * The CL_GET_NETADDRS and CL_GET_NUM_NETADDRS are contract private interfaces
807c478bd9Sstevel@tonic-gate  * per PSARC/2001/579-01.
817c478bd9Sstevel@tonic-gate  */
827c478bd9Sstevel@tonic-gate #define	CL_NODEID		0	/* Return nodeid of this node. */
837c478bd9Sstevel@tonic-gate #define	CL_HIGHEST_NODEID	1	/* Return highest configured nodeid. */
847c478bd9Sstevel@tonic-gate #define	CL_GDEV_PREFIX		2	/* Return path to global namespace.  */
857c478bd9Sstevel@tonic-gate #define	CL_GET_NETADDRS		3	/* Get array of network addresses    */
867c478bd9Sstevel@tonic-gate 					/* controlled by Sun Cluster. */
877c478bd9Sstevel@tonic-gate #define	CL_GET_NUM_NETADDRS	4	/* Get the number of data structure  */
887c478bd9Sstevel@tonic-gate 					/* entries in the array that will be */
897c478bd9Sstevel@tonic-gate 					/* returned  using CL_GET_NETADDRS.  */
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate /*
927c478bd9Sstevel@tonic-gate  * The cladm system call can provide an array of cluster controlled
937c478bd9Sstevel@tonic-gate  * network addresses and associated netmasks.  The cladm arguments
947c478bd9Sstevel@tonic-gate  * must be as follows:  the argument fac is specified as CL_CONFIG,
957c478bd9Sstevel@tonic-gate  * the argument cmd is specified as CL_GET_NETADDRS, and argument arg
967c478bd9Sstevel@tonic-gate  * is the location of a structure of type cladm_netaddrs_t. The
977c478bd9Sstevel@tonic-gate  * cladm_num_netaddrs is used as input for the requested number
987c478bd9Sstevel@tonic-gate  * of array entries, and is used as ouput for the number of valid array
997c478bd9Sstevel@tonic-gate  * entries available.
1007c478bd9Sstevel@tonic-gate  *
1017c478bd9Sstevel@tonic-gate  * The caller must allocate sufficient memory for the array of
1027c478bd9Sstevel@tonic-gate  * structures of type cladm_netaddr_entry_t and specify the starting
1037c478bd9Sstevel@tonic-gate  * location as cladm_netaddrs_array.  The number of entries included
1047c478bd9Sstevel@tonic-gate  * in the array is determined using cladm with argument fac specified
1057c478bd9Sstevel@tonic-gate  * as CL_CONFIG, argument cmd specified as CL_GET_NUM_NETADDRS, and
1067c478bd9Sstevel@tonic-gate  * argument arg is the location of a structure of type cladm_netaddrs_t.
1077c478bd9Sstevel@tonic-gate  * The determined number of array entries is returned in
1087c478bd9Sstevel@tonic-gate  * cladm_num_netaddrs.
1097c478bd9Sstevel@tonic-gate  *
1107c478bd9Sstevel@tonic-gate  * These commands support the yielding of DR operation control (by the
1117c478bd9Sstevel@tonic-gate  * RCM Framework) to Sun Cluster for cluster controlled adapters.
1127c478bd9Sstevel@tonic-gate  *
1137c478bd9Sstevel@tonic-gate  * These data structures are contract private per PSARC/2001/579-01.
1147c478bd9Sstevel@tonic-gate  */
1157c478bd9Sstevel@tonic-gate typedef struct {
1167c478bd9Sstevel@tonic-gate 	int32_t		cl_ipversion;	/* IPV4_VERSION or IPV6_VERSION */
1177c478bd9Sstevel@tonic-gate 	union {
1187c478bd9Sstevel@tonic-gate 		struct {
1197c478bd9Sstevel@tonic-gate 			ipaddr_t	ipv4_netaddr;
1207c478bd9Sstevel@tonic-gate 			ipaddr_t	ipv4_netmask;
1217c478bd9Sstevel@tonic-gate 			} cl_ipv4;
1227c478bd9Sstevel@tonic-gate 		struct {
1237c478bd9Sstevel@tonic-gate 			uint32_t	ipv6_netaddr[4];
1247c478bd9Sstevel@tonic-gate 			uint32_t	ipv6_netmask[4];
1257c478bd9Sstevel@tonic-gate 			} cl_ipv6;
1267c478bd9Sstevel@tonic-gate 	} cl_ipv_un;
1277c478bd9Sstevel@tonic-gate } cladm_netaddr_entry_t;
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate typedef struct {
1307c478bd9Sstevel@tonic-gate 	uint32_t		cladm_num_netaddrs;
1317c478bd9Sstevel@tonic-gate 	cladm_netaddr_entry_t	*cladm_netaddrs_array;
1327c478bd9Sstevel@tonic-gate } cladm_netaddrs_t;
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32)
1357c478bd9Sstevel@tonic-gate typedef struct {
1367c478bd9Sstevel@tonic-gate 	uint32_t	cladm_num_netaddrs;
1377c478bd9Sstevel@tonic-gate 	caddr32_t	cladm_netaddrs_array;
1387c478bd9Sstevel@tonic-gate } cladm_netaddrs32_t;
1397c478bd9Sstevel@tonic-gate #endif /* defined(_SYSCALL32) */
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate #ifdef _KERNEL
1437c478bd9Sstevel@tonic-gate extern int cladmin(int fac, int cmd, void *data);
1447c478bd9Sstevel@tonic-gate extern int cluster_bootflags;
1457c478bd9Sstevel@tonic-gate #else
1467c478bd9Sstevel@tonic-gate extern int _cladm(int fac, int cmd, void *data);
1477c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
1487c478bd9Sstevel@tonic-gate 
1497c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1507c478bd9Sstevel@tonic-gate }
1517c478bd9Sstevel@tonic-gate #endif
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate #endif	/* _SYS_CLADM_H */
155