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