xref: /illumos-gate/usr/src/cmd/fs.d/fslib.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_FSLIB_H
28 #define	_FSLIB_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include	<sys/mnttab.h>
37 
38 /*
39  * This structure is used to build a list of
40  * mnttab structures from /etc/mnttab.
41  */
42 typedef struct mntlist {
43 	int		mntl_flags;
44 	uint_t		mntl_dev;
45 	struct extmnttab *mntl_mnt;
46 	struct mntlist	*mntl_next;
47 } mntlist_t;
48 
49 /*
50  * Bits for mntl_flags.
51  */
52 #define	MNTL_UNMOUNT	0x01	/* unmount this entry */
53 #define	MNTL_DIRECT	0x02	/* direct mount entry */
54 
55 /*
56  * Routines available in fslib.c:
57  */
58 void			fsfreemnttab(struct extmnttab *);
59 struct extmnttab 	*fsdupmnttab(struct extmnttab *);
60 void			fsfreemntlist(mntlist_t *);
61 
62 mntlist_t	*fsmkmntlist(FILE *);
63 mntlist_t	*fsgetmntlist(void);
64 mntlist_t	*fsgetmlast(mntlist_t *, struct mnttab *);
65 void	cmp_requested_to_actual_options(char *, char *, char *, char *);
66 
67 int	fsgetmlevel(char *);
68 int	fsstrinlist(const char *, const char **);
69 int	fsgetmaxphys(int *, int *);
70 
71 boolean_t 	fsisstdopt(const char *);
72 
73 /*
74  * Routines for determining which zone a mount resides in.
75  */
76 struct zone_summary;
77 
78 struct		zone_summary *fs_get_zone_summaries(void);
79 boolean_t	fs_mount_in_other_zone(const struct zone_summary *,
80     const char *);
81 
82 #undef MIN
83 #undef MAX
84 #define	MIN(a, b)	((a) < (b) ? (a) : (b))
85 #define	MAX(a, b)	((a) > (b) ? (a) : (b))
86 
87 #define	MAXLINE		2048
88 
89 #ifdef	__cplusplus
90 }
91 #endif
92 
93 #endif	/* _FSLIB_H */
94