xref: /titanic_41/usr/src/cmd/lvm/rpc.metamedd/med_local.h (revision 60405de4d8688d96dd05157c28db3ade5c9bc234)
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 /*
24  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 #ifndef	_MED_LOCAL_H
29 #define	_MED_LOCAL_H
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <fcntl.h>
36 #include <errno.h>
37 #include <string.h>
38 #include <unistd.h>
39 #include <assert.h>
40 #include <stdarg.h>
41 #include <ctype.h>
42 #include <sys/types.h>
43 #include <sys/stat.h>
44 #include <sys/sysmacros.h>
45 #include <sys/mkdev.h>
46 #include <sys/time.h>
47 #include <sys/dkio.h>
48 #include <sys/vtoc.h>
49 
50 #include <metamed.h>
51 
52 #ifdef	__cplusplus
53 extern "C" {
54 #endif
55 
56 #ifdef	_REENTRANT
57 /*
58  * millisecond time
59  */
60 typedef	u_longlong_t	med_msec_t;
61 #endif	/* _REENTRANT */
62 
63 /*
64  * extern functions
65  */
66 /* med_error.c */
67 extern	int		med_error(med_err_t *medep, int errnum, char *name);
68 /*PRINTFLIKE2*/
69 extern	void		medde_perror(med_err_t *medep, const char *fmt, ...);
70 /*PRINTFLIKE1*/
71 extern	void		med_perror(const char *fmt, ...);
72 /*PRINTFLIKE1*/
73 extern	void		med_eprintf(const char *fmt, ...);
74 
75 /* med_init.c */
76 extern	void		med_exit(int eval);
77 extern	int		med_init(struct svc_req *rqstp, int amode,
78 			    med_err_t *medep);
79 extern	char		*mynode(void);
80 
81 /* med_mem.c */
82 extern	void		*Malloc(size_t s);
83 extern	void		*Zalloc(size_t s);
84 extern	void		*Realloc(void *p, size_t s);
85 extern	void		*Calloc(size_t n, size_t s);
86 extern	char		*Strdup(char *p);
87 extern	void		Free(void *p);
88 
89 /* meta_metad.c */
90 #ifdef	_REENTRANT
91 /* med_synch.c */
92 extern	void		med_cv_init(cond_t *cvp);
93 extern	void		med_cv_destroy(cond_t *cvp);
94 extern	void		med_cv_wait(cond_t *cvp, mutex_t *mp);
95 extern	void		med_cv_timedwait(cond_t *cvp, mutex_t *mp,
96 			    med_msec_t to);
97 extern	void		med_cv_broadcast(cond_t *cvp);
98 extern	void		med_mx_init(mutex_t *mp);
99 extern	void		med_mx_destroy(mutex_t *mp);
100 extern	void		med_mx_lock(mutex_t *mp);
101 extern	void		med_mx_unlock(mutex_t *mp);
102 extern	void		med_rw_rdlock(rwlock_t *rwlp);
103 extern	void		med_rw_wrlock(rwlock_t *rwlp);
104 extern	void		med_rw_unlock(rwlock_t *rwlp);
105 #endif	/* _REENTRANT */
106 
107 /* med_db.c */
108 extern int		med_db_init(med_err_t *medep);
109 extern med_rec_t	*med_db_get_rec(med_med_t *medp, med_err_t *medep);
110 extern med_data_t	*med_db_get_data(med_med_t *medp, med_err_t *medep);
111 extern int		med_db_put_rec(med_med_t *medp, med_rec_t *nmedrp,
112 			    med_err_t *medep);
113 extern int		med_db_put_data(med_med_t *medp, med_data_t *meddp,
114 			    med_err_t *medep);
115 extern int		med_db_finit(med_err_t *medep);
116 
117 #ifdef	__cplusplus
118 }
119 #endif
120 
121 #endif	/* _MED_LOCAL_H */
122