xref: /titanic_41/usr/src/lib/librdc/common/librdc.h (revision bdb9230ac765cb7af3fc1f4119caf2c5720dceb3)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_LIBRDC_H
27 #define	_LIBRDC_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 extern int Is_ipv6present(void);
34 extern int self_check(char *);
35 extern int gethost_netaddrs(char *, char *, char *, char *);
36 extern struct hostent *gethost_byname(const char *);
37 extern struct netbuf *get_addr(char *, ulong_t, ulong_t, struct netconfig **,
38     char *, char *, struct t_info *, int);
39 extern int convert_nconf_to_knconf(struct netconfig *, struct knetconfig *);
40 extern int rdc_check_release(char **);
41 
42 #if !defined(NSC_MAXPATH)
43 #define	NSC_MAXPATH	64
44 #endif
45 
46 #define	RDC_MAX_THREADS	1024
47 /* user interface to sndr */
48 typedef struct rdcconfig_s {
49 	char			phost[NSC_MAXPATH];
50 	char			pfile[NSC_MAXPATH];
51 	char			pbmp[NSC_MAXPATH];
52 	char			shost[NSC_MAXPATH];
53 	char			sfile[NSC_MAXPATH];
54 	char			sbmp[NSC_MAXPATH];
55 	char			direct[NSC_MAXPATH];
56 	char			mode[NSC_MAXPATH];
57 	char			group[NSC_MAXPATH];
58 	char			ctag[NSC_MAXPATH];
59 	char			options[NSC_MAXPATH];
60 	int			persist;	/* 0 no, 1 yes */
61 	struct rdcconfig_s	*next;
62 } rdcconfig_t;
63 
64 #define	RDC_ERR_SIZE	256
65 
66 typedef struct rdc_rc_s {
67 	int			rc;
68 	char			msg[RDC_ERR_SIZE];
69 	struct rdc_rc_s		*next;
70 	rdcconfig_t		set;
71 } rdc_rc_t;
72 
73 #define	RDC_FREEONE	0 /* free one rdcconfig_t* */
74 #define	RDC_FREEALL	1 /* free entire chain of rdcconfig_t* */
75 
76 /* and it's operations */
77 extern rdcconfig_t *rdc_alloc_config(const char *phost, const char *pfile,
78     const char *pbmp, const char *shost, const char *sfile, const char *sbmp,
79     const char *mode, const char *group, const char *ctag, const char *options,
80     int persist);
81 extern void rdc_free_config(rdcconfig_t *rdc, int all);
82 extern void rdc_free_rclist(rdc_rc_t *rc);
83 extern rdc_rc_t *new_rc(void);
84 extern rdc_rc_t *rdc_enable(rdcconfig_t *rdc);
85 extern rdc_rc_t *rdc_enable_clrbmp(rdcconfig_t *rdc);
86 extern rdc_rc_t *rdc_disable(rdcconfig_t *rdc);
87 extern rdc_rc_t *rdc_log(rdcconfig_t *rdc);
88 extern rdc_rc_t *rdc_usync(rdcconfig_t *rdc);
89 extern rdc_rc_t *rdc_fsync(rdcconfig_t *rdc);
90 extern rdc_rc_t *rdc_rsync(rdcconfig_t *rdc);
91 extern rdc_rc_t *rdc_ursync(rdcconfig_t *rdc);
92 extern rdc_rc_t *rdc_wait(rdcconfig_t *rdc);
93 extern rdc_rc_t *rdc_set_autosync(rdcconfig_t *rdc, int autosync);
94 extern rdc_rc_t *rdc_set_maxqfbas(rdcconfig_t *rdc, int maxqfbas);
95 extern rdc_rc_t *rdc_set_maxqitems(rdcconfig_t *rdc, int maxqitems);
96 extern int rdc_get_maxqfbas(rdcconfig_t *rdc);
97 extern int rdc_get_maxqitems(rdcconfig_t *rdc);
98 extern int rdc_get_autosync(rdcconfig_t *rdc);
99 extern rdc_rc_t *rdc_reconfig_pbmp(rdcconfig_t *rdc, char *pbmp);
100 extern rdc_rc_t *rdc_reconfig_sbmp(rdcconfig_t *rdc, char *sbmp);
101 extern rdc_rc_t *rdc_reconfig_group(rdcconfig_t *rdc, char *group);
102 extern rdc_rc_t *rdc_reconfig_ctag(rdcconfig_t *rdc, char *ctag);
103 extern rdc_rc_t *rdc_set_sync(rdcconfig_t *rdc);
104 extern rdc_rc_t *rdc_set_async(rdcconfig_t *rdc);
105 extern rdc_rc_t *rdc_health(rdcconfig_t *rdc);
106 extern rdc_rc_t *rdc_reverse_role(rdcconfig_t *rdc);
107 extern char *rdc_error(int *sev);
108 
109 #ifdef	__cplusplus
110 }
111 #endif
112 
113 #endif	/* _LIBRDC_H */
114