xref: /onnv-gate/usr/src/lib/libfsmgt/common/libfsmgt.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef _LIBFSMGT_H
28*0Sstevel@tonic-gate #define	_LIBFSMGT_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef __cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #include <stdio.h>
37*0Sstevel@tonic-gate #include <sys/param.h>
38*0Sstevel@tonic-gate #include <nfs/nfs_sec.h>
39*0Sstevel@tonic-gate #include <sys/utsname.h>
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate #define	DFSTYPES	"/etc/dfs/fstypes"		/* dfs list */
42*0Sstevel@tonic-gate #define	DFSTAB		"/etc/dfs/dfstab"		/* dfs list */
43*0Sstevel@tonic-gate #define	BUFSIZE		65536
44*0Sstevel@tonic-gate #define	LINESZ		2048
45*0Sstevel@tonic-gate 
46*0Sstevel@tonic-gate typedef void *fs_dfstab_entry_t;
47*0Sstevel@tonic-gate 
48*0Sstevel@tonic-gate /*
49*0Sstevel@tonic-gate  * Public data type declarations
50*0Sstevel@tonic-gate  */
51*0Sstevel@tonic-gate 
52*0Sstevel@tonic-gate /*
53*0Sstevel@tonic-gate  * Represents a list of the /etc/vfstab entries
54*0Sstevel@tonic-gate  */
55*0Sstevel@tonic-gate typedef struct mount_default_list {
56*0Sstevel@tonic-gate 	struct mount_default_list *next;
57*0Sstevel@tonic-gate 	char *resource;
58*0Sstevel@tonic-gate 	char *fsckdevice;
59*0Sstevel@tonic-gate 	char *mountp;
60*0Sstevel@tonic-gate 	char *fstype;
61*0Sstevel@tonic-gate 	char *fsckpass;
62*0Sstevel@tonic-gate 	char *mountatboot;
63*0Sstevel@tonic-gate 	char *mntopts;
64*0Sstevel@tonic-gate } fs_mntdefaults_t;
65*0Sstevel@tonic-gate 
66*0Sstevel@tonic-gate /*
67*0Sstevel@tonic-gate  * Represents a list of /etc/mnttab entries
68*0Sstevel@tonic-gate  */
69*0Sstevel@tonic-gate typedef struct mount_list {
70*0Sstevel@tonic-gate 	struct mount_list *next;
71*0Sstevel@tonic-gate 	char *resource;
72*0Sstevel@tonic-gate 	char *mountp;
73*0Sstevel@tonic-gate 	char *fstype;
74*0Sstevel@tonic-gate 	char *mntopts;
75*0Sstevel@tonic-gate 	char *time;
76*0Sstevel@tonic-gate 	uint_t major;
77*0Sstevel@tonic-gate 	uint_t minor;
78*0Sstevel@tonic-gate 	boolean_t overlayed;
79*0Sstevel@tonic-gate } fs_mntlist_t;
80*0Sstevel@tonic-gate 
81*0Sstevel@tonic-gate /*
82*0Sstevel@tonic-gate  * Represents a /etc/dfs/sharetab entry
83*0Sstevel@tonic-gate  */
84*0Sstevel@tonic-gate typedef struct share_list {
85*0Sstevel@tonic-gate 	struct share_list *next;
86*0Sstevel@tonic-gate 	char *path;
87*0Sstevel@tonic-gate 	char *resource;
88*0Sstevel@tonic-gate 	char *fstype;
89*0Sstevel@tonic-gate 	char *options;
90*0Sstevel@tonic-gate 	char *description;
91*0Sstevel@tonic-gate } fs_sharelist_t;
92*0Sstevel@tonic-gate 
93*0Sstevel@tonic-gate /*
94*0Sstevel@tonic-gate  * Represents a list of /etc/mnttab entries with associated
95*0Sstevel@tonic-gate  * information from kstat.
96*0Sstevel@tonic-gate  */
97*0Sstevel@tonic-gate typedef struct nfs_mntlist {
98*0Sstevel@tonic-gate 	struct nfs_mntlist *next;
99*0Sstevel@tonic-gate 	char		nml_curpath[MAXPATHLEN];	/* current path on */
100*0Sstevel@tonic-gate 							/* server */
101*0Sstevel@tonic-gate 	char		nml_curserver[SYS_NMLN];	/* current server */
102*0Sstevel@tonic-gate 	char		**nml_failoverlist;	/* The list of servers */
103*0Sstevel@tonic-gate 						/* and corresponding */
104*0Sstevel@tonic-gate 						/* paths for failover. */
105*0Sstevel@tonic-gate 	char		*nml_fstype;		/* filesystem type */
106*0Sstevel@tonic-gate 	char		*nml_mntopts;		/* mount options */
107*0Sstevel@tonic-gate 	char		*nml_mountp;		/* mount point */
108*0Sstevel@tonic-gate 	char		*nml_resource;		/* mnttab.mnt_special */
109*0Sstevel@tonic-gate 	char		nml_proto[KNC_STRSIZE];	/* transfer protocol */
110*0Sstevel@tonic-gate 	char		*nml_securitymode;	/* security mode name */
111*0Sstevel@tonic-gate 	char		*nml_time;		/* time mounted */
112*0Sstevel@tonic-gate 	int		nml_failovercount;	/* number of failover servers */
113*0Sstevel@tonic-gate 	int		nml_retrans;		/* times to retry request */
114*0Sstevel@tonic-gate 	int		nml_timeo;		/* inital timeout in 10th sec */
115*0Sstevel@tonic-gate 	ulong_t		nml_fsid;		/* filesystem ID */
116*0Sstevel@tonic-gate 	uint_t		nml_acdirmax;	/* max time to hold cached dir attr */
117*0Sstevel@tonic-gate 	uint_t		nml_acdirmin;	/* min time to hold cached dir attr */
118*0Sstevel@tonic-gate 	uint_t		nml_acregmax;	/* max time to hold cached file attr */
119*0Sstevel@tonic-gate 	uint_t		nml_acregmin;	/* min time to hold cached file attr */
120*0Sstevel@tonic-gate 	uint32_t	nml_curread;		/* current read size */
121*0Sstevel@tonic-gate 	uint32_t	nml_curwrite;		/* current write size */
122*0Sstevel@tonic-gate 	uint32_t	nml_vers;		/* nfs version */
123*0Sstevel@tonic-gate 	boolean_t	nml_directio;	/* force direct IO */
124*0Sstevel@tonic-gate 	boolean_t	nml_grpid;	/* group id inherited from parent */
125*0Sstevel@tonic-gate 	boolean_t	nml_hard;	/* hard or soft mount */
126*0Sstevel@tonic-gate 	boolean_t	nml_intr;	/* Key board intrupts */
127*0Sstevel@tonic-gate 	boolean_t	nml_noac;	/* no ata and attribute caching */
128*0Sstevel@tonic-gate 	boolean_t	nml_nocto;	/* no close-to-open  consistency */
129*0Sstevel@tonic-gate 	boolean_t	nml_overlayed;	/* Is filesystem overlayed */
130*0Sstevel@tonic-gate 	boolean_t	nml_xattr;	/* allow extended attributes */
131*0Sstevel@tonic-gate } nfs_mntlist_t;
132*0Sstevel@tonic-gate 
133*0Sstevel@tonic-gate /*
134*0Sstevel@tonic-gate  * Command execution interface method declarations
135*0Sstevel@tonic-gate  */
136*0Sstevel@tonic-gate 
137*0Sstevel@tonic-gate /*
138*0Sstevel@tonic-gate  * Method: cmd_execute_command
139*0Sstevel@tonic-gate  *
140*0Sstevel@tonic-gate  * Description: Executes the command passed into the function as if it was
141*0Sstevel@tonic-gate  * the input to a shell and returns the separated stdout and stderr messages
142*0Sstevel@tonic-gate  * which can be accessed by the client via the returned file descriptors using
143*0Sstevel@tonic-gate  * the cmd_retrieve_string method or one of their own methods.
144*0Sstevel@tonic-gate  *
145*0Sstevel@tonic-gate  * Parameters:
146*0Sstevel@tonic-gate  * char * - The command to execute.  Expected in the format of a shell command.
147*0Sstevel@tonic-gate  * int * - Upon return from the function, this is the file descriptor that can
148*0Sstevel@tonic-gate  * 	be used to access the output from the command to stdout.
149*0Sstevel@tonic-gate  * int * - Upon return from the function, this is the file descriptor that can
150*0Sstevel@tonic-gate  *	be used to access the output from the command to stderr.
151*0Sstevel@tonic-gate  *
152*0Sstevel@tonic-gate  * Return:
153*0Sstevel@tonic-gate  * Returns 0 (zero).
154*0Sstevel@tonic-gate  * Supposed to be the integer representing the exit value of the command
155*0Sstevel@tonic-gate  * executed, but due to the way blocking on file descriptors works, it will
156*0Sstevel@tonic-gate  * only return a 0 (zero) value.  The reason: The producer, in this case the
157*0Sstevel@tonic-gate  * command being executed, will block when a certain amount of data is written
158*0Sstevel@tonic-gate  * to the file descriptor and will not be able to write any more data until the
159*0Sstevel@tonic-gate  * consumer reads from the file descriptor so since we are not reading in the
160*0Sstevel@tonic-gate  * data from the file descriptors in this method and we are allowing the client
161*0Sstevel@tonic-gate  * do what they want with the data we can't wait until the command is finished
162*0Sstevel@tonic-gate  * executing to get the return value.
163*0Sstevel@tonic-gate  */
164*0Sstevel@tonic-gate int	cmd_execute_command(char *cmd, int *output_filedes, int *error_filedes);
165*0Sstevel@tonic-gate 
166*0Sstevel@tonic-gate /*
167*0Sstevel@tonic-gate  * Method: cmd_execute_command_and_retrieve_string
168*0Sstevel@tonic-gate  *
169*0Sstevel@tonic-gate  * Description: Executes the command passed into the function as if it was the
170*0Sstevel@tonic-gate  * input to a shell and returns the output to stderr and stdout as a string as
171*0Sstevel@tonic-gate  * it would appear in the shell (stdout and stderr are mixed).
172*0Sstevel@tonic-gate  *
173*0Sstevel@tonic-gate  * Parameters:
174*0Sstevel@tonic-gate  * char * - The command to execute.  Expected in the format of a shell command.
175*0Sstevel@tonic-gate  * int * - Upon return from the function, this should be used to determine if an
176*0Sstevel@tonic-gate  * 	error occurred in the execution of the command and the retrieval of
177*0Sstevel@tonic-gate  *	output data from the command.
178*0Sstevel@tonic-gate  * data from the command.
179*0Sstevel@tonic-gate  *
180*0Sstevel@tonic-gate  * Return:
181*0Sstevel@tonic-gate  * The output to stdout and stderr created by the execution of the passed in
182*0Sstevel@tonic-gate  * command.
183*0Sstevel@tonic-gate  */
184*0Sstevel@tonic-gate char	*cmd_execute_command_and_retrieve_string(char *cmd, int *errp);
185*0Sstevel@tonic-gate 
186*0Sstevel@tonic-gate /*
187*0Sstevel@tonic-gate  * Method: cmd_retrieve_string
188*0Sstevel@tonic-gate  *
189*0Sstevel@tonic-gate  * Description: Retrieves the data from the passed in file descriptor and
190*0Sstevel@tonic-gate  * returns it to the caller in the form of a string.
191*0Sstevel@tonic-gate  *
192*0Sstevel@tonic-gate  * Parameters:
193*0Sstevel@tonic-gate  * int - The file descriptor to be read from.
194*0Sstevel@tonic-gate  * int * - Upon return from the function, this should be the used to determine
195*0Sstevel@tonic-gate  * 	if an error occurred in the retrieval of the data from the file
196*0Sstevel@tonic-gate  *	descriptor.
197*0Sstevel@tonic-gate  *	A non-zero value represents the occurrence of an error.
198*0Sstevel@tonic-gate  *
199*0Sstevel@tonic-gate  * Return:
200*0Sstevel@tonic-gate  * The data from the file descriptor in the form of a string.
201*0Sstevel@tonic-gate  * NOTE: The caller must free the space allocated (with calloc) for the return
202*0Sstevel@tonic-gate  * value using free().
203*0Sstevel@tonic-gate  */
204*0Sstevel@tonic-gate char	*cmd_retrieve_string(int filedes, int *errp);
205*0Sstevel@tonic-gate 
206*0Sstevel@tonic-gate /*
207*0Sstevel@tonic-gate  * File interface method declarations
208*0Sstevel@tonic-gate  */
209*0Sstevel@tonic-gate 
210*0Sstevel@tonic-gate /*
211*0Sstevel@tonic-gate  * NOTE: the caller of this function is responsible for freeing any
212*0Sstevel@tonic-gate  * memory allocated by calling fileutil_free_string_array()
213*0Sstevel@tonic-gate  *
214*0Sstevel@tonic-gate  * Method: fileutil_add_string_to_array
215*0Sstevel@tonic-gate  *
216*0Sstevel@tonic-gate  * Description: Adds one line to the file image string array
217*0Sstevel@tonic-gate  *
218*0Sstevel@tonic-gate  * Parameters:
219*0Sstevel@tonic-gate  * char ***string_array - pointer array of strings holding the lines
220*0Sstevel@tonic-gate  *         for the new file
221*0Sstevel@tonic-gate  * char *line - the line to be added to the new file
222*0Sstevel@tonic-gate  * int *count - the number of elements in the string array
223*0Sstevel@tonic-gate  * int *err - error pointer for returning any errors encountered
224*0Sstevel@tonic-gate  *
225*0Sstevel@tonic-gate  * Return:
226*0Sstevel@tonic-gate  * B_TRUE on success, B_FALSE on failure.
227*0Sstevel@tonic-gate  *
228*0Sstevel@tonic-gate  * Note:
229*0Sstevel@tonic-gate  * On success string_array is set to the new array of strings. On failure
230*0Sstevel@tonic-gate  * string_array is unchanged.
231*0Sstevel@tonic-gate  */
232*0Sstevel@tonic-gate boolean_t fileutil_add_string_to_array(char ***, char *, int *, int *);
233*0Sstevel@tonic-gate 
234*0Sstevel@tonic-gate /*
235*0Sstevel@tonic-gate  * Method: fileutil_free_string_array
236*0Sstevel@tonic-gate  *
237*0Sstevel@tonic-gate  * Description: Frees the space allocated to a string array.
238*0Sstevel@tonic-gate  *
239*0Sstevel@tonic-gate  * Parameters:
240*0Sstevel@tonic-gate  * char ** - is the array to be freed
241*0Sstevel@tonic-gate  * int - the number of elements in the array
242*0Sstevel@tonic-gate  */
243*0Sstevel@tonic-gate void	fileutil_free_string_array(char **, int);
244*0Sstevel@tonic-gate 
245*0Sstevel@tonic-gate /*
246*0Sstevel@tonic-gate  * Method: fileutil_get_cmd_from_string
247*0Sstevel@tonic-gate  *
248*0Sstevel@tonic-gate  * Description: Returns a string containing a line with all comments and
249*0Sstevel@tonic-gate  * trailing white space removed.
250*0Sstevel@tonic-gate  *
251*0Sstevel@tonic-gate  * Parameters:
252*0Sstevel@tonic-gate  * char *input_stringp - the line to remove all coments and trailing white
253*0Sstevel@tonic-gate  *	space.
254*0Sstevel@tonic-gate  *
255*0Sstevel@tonic-gate  * Note: The memory allocated for the returned string must be freed by the
256*0Sstevel@tonic-gate  * caller of fileutil_get_cmd_from_string().
257*0Sstevel@tonic-gate  */
258*0Sstevel@tonic-gate char	*fileutil_get_cmd_from_string(char *input_stringp);
259*0Sstevel@tonic-gate 
260*0Sstevel@tonic-gate /*
261*0Sstevel@tonic-gate  * Method: fileutil_get_first_column_data
262*0Sstevel@tonic-gate  *
263*0Sstevel@tonic-gate  * Description: Returns a string array which is filled with the data in the
264*0Sstevel@tonic-gate  * first column of the lines in a table formatted file.
265*0Sstevel@tonic-gate  * Examples of table formatted files include: /etc/netcofig, /etc/nfssec.conf
266*0Sstevel@tonic-gate  *
267*0Sstevel@tonic-gate  * Parameters:
268*0Sstevel@tonic-gate  * FILE* - The file pointer of the table formatted file to get data from.
269*0Sstevel@tonic-gate  * int* - will be filled with the number of elements in the array that is passed
270*0Sstevel@tonic-gate  *	back.
271*0Sstevel@tonic-gate  * int* - error pointer.  If an error occurs this will be non-zero upon return
272*0Sstevel@tonic-gate  * 	the function.
273*0Sstevel@tonic-gate  *
274*0Sstevel@tonic-gate  * Returns:
275*0Sstevel@tonic-gate  * Two-dimensional array of characters (string array).  Each element in the
276*0Sstevel@tonic-gate  * array is the first column data of each row in the table.
277*0Sstevel@tonic-gate  */
278*0Sstevel@tonic-gate char	**fileutil_get_first_column_data(FILE *, int *, int *);
279*0Sstevel@tonic-gate 
280*0Sstevel@tonic-gate /*
281*0Sstevel@tonic-gate  * Method: fileutil_getfs
282*0Sstevel@tonic-gate  *
283*0Sstevel@tonic-gate  * Description: Convenience function for retrieving the default remote file
284*0Sstevel@tonic-gate  * system type from /etc/dfs/fstypes.
285*0Sstevel@tonic-gate  *
286*0Sstevel@tonic-gate  * Parameters:
287*0Sstevel@tonic-gate  * FILE * - The /etc/dfs/fstypes file pointer.
288*0Sstevel@tonic-gate  *
289*0Sstevel@tonic-gate  * Return:
290*0Sstevel@tonic-gate  * The default remote filesystem type.
291*0Sstevel@tonic-gate  */
292*0Sstevel@tonic-gate char	*fileutil_getfs(FILE *);
293*0Sstevel@tonic-gate 
294*0Sstevel@tonic-gate /*
295*0Sstevel@tonic-gate  * Method: fileutil_getline
296*0Sstevel@tonic-gate  *
297*0Sstevel@tonic-gate  * Description: Convenience function for retrieving the next line from a file.
298*0Sstevel@tonic-gate  *              Commented lines are not returned and comments at the end of
299*0Sstevel@tonic-gate  *              a line are removed.
300*0Sstevel@tonic-gate  *
301*0Sstevel@tonic-gate  * Parameters:
302*0Sstevel@tonic-gate  * FILE * - The file pointer to a file that has been opened for reading.
303*0Sstevel@tonic-gate  * char * - The line retrived from the file will be placed in this string.
304*0Sstevel@tonic-gate  * int * - error pointer - If an error occurs this will be non-zero upon
305*0Sstevel@tonic-gate  *                         return from the function.
306*0Sstevel@tonic-gate  *
307*0Sstevel@tonic-gate  * Return:
308*0Sstevel@tonic-gate  * If successfull the line retrieved from the file will be returned.
309*0Sstevel@tonic-gate  * Otherwise NULL be be returned.
310*0Sstevel@tonic-gate  */
311*0Sstevel@tonic-gate char	*fileutil_getline(FILE *, char *, int);
312*0Sstevel@tonic-gate 
313*0Sstevel@tonic-gate /*
314*0Sstevel@tonic-gate  * Mount defaults (/etc/vfstab) interface method declarations
315*0Sstevel@tonic-gate  */
316*0Sstevel@tonic-gate /*
317*0Sstevel@tonic-gate  * Method: fs_add_mount_default
318*0Sstevel@tonic-gate  *
319*0Sstevel@tonic-gate  * Description: Adds an entry to vfstab based on the fs_mntdefaults_t
320*0Sstevel@tonic-gate  *              structure that is passed in.
321*0Sstevel@tonic-gate  *
322*0Sstevel@tonic-gate  * Parameters:
323*0Sstevel@tonic-gate  * fs_mntdefaults_t *newp - The structure containing the mount information
324*0Sstevel@tonic-gate  *                          to be placed in vfstab.
325*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
326*0Sstevel@tonic-gate  *                             return from the function.
327*0Sstevel@tonic-gate  *
328*0Sstevel@tonic-gate  * Return:
329*0Sstevel@tonic-gate  * If successful a pointer to a list containing all the present vfstab
330*0Sstevel@tonic-gate  * entries is returned. On failure NULL is returned.
331*0Sstevel@tonic-gate  */
332*0Sstevel@tonic-gate fs_mntdefaults_t	*fs_add_mount_default(fs_mntdefaults_t *, int *);
333*0Sstevel@tonic-gate 
334*0Sstevel@tonic-gate /*
335*0Sstevel@tonic-gate  * Method: fs_check_for_duplicate_DFStab_paths
336*0Sstevel@tonic-gate  *
337*0Sstevel@tonic-gate  * Description: Checks dfstab for duplicate paths and returns the number of
338*0Sstevel@tonic-gate  * times the path passed in was encountered. The functon is used to help make
339*0Sstevel@tonic-gate  * sure a path is only listed in dfstab once.
340*0Sstevel@tonic-gate  *
341*0Sstevel@tonic-gate  * Parameters:
342*0Sstevel@tonic-gate  * char *path - the path to check for
343*0Sstevel@tonic-gate  * int *err - error pointer - If an error occurs this will be non-zero upon
344*0Sstevel@tonic-gate  *	return from the function.
345*0Sstevel@tonic-gate  *
346*0Sstevel@tonic-gate  * Return:
347*0Sstevel@tonic-gate  * The number of times the specified path is encountered in dfstab.
348*0Sstevel@tonic-gate  */
349*0Sstevel@tonic-gate int fs_check_for_duplicate_DFStab_paths(char *path, int *err);
350*0Sstevel@tonic-gate 
351*0Sstevel@tonic-gate /*
352*0Sstevel@tonic-gate  * Method: fs_del_mount_default_ent
353*0Sstevel@tonic-gate  *
354*0Sstevel@tonic-gate  * Description: Deletes the specified vfstab entry from the vfstab file.
355*0Sstevel@tonic-gate  *
356*0Sstevel@tonic-gate  * Parameters:
357*0Sstevel@tonic-gate  * fs_mntdefaults_t *old_vfstab_ent - The mount information that corresponds
358*0Sstevel@tonic-gate  *                                    to the vfstab entry to be deleted.
359*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
360*0Sstevel@tonic-gate  *                             return from the function.
361*0Sstevel@tonic-gate  *
362*0Sstevel@tonic-gate  * Return:
363*0Sstevel@tonic-gate  * If successful a pointer to a list containing all the changed vfstab
364*0Sstevel@tonic-gate  * entries is returned. On failure NULL is returned.
365*0Sstevel@tonic-gate  */
366*0Sstevel@tonic-gate fs_mntdefaults_t	*fs_del_mount_default_ent(fs_mntdefaults_t *, int *);
367*0Sstevel@tonic-gate 
368*0Sstevel@tonic-gate /*
369*0Sstevel@tonic-gate  * Method: fs_edit_mount_defaults
370*0Sstevel@tonic-gate  *
371*0Sstevel@tonic-gate  * Description: Edits the specified vfstab entry with the new mount
372*0Sstevel@tonic-gate  * information passed in.
373*0Sstevel@tonic-gate  *
374*0Sstevel@tonic-gate  * Parameters:
375*0Sstevel@tonic-gate  * fs_mntdefaults_t *old_vfstab_ent - The old vfstab entry that is to be edited.
376*0Sstevel@tonic-gate  * fs_mntdefaults_t *new_vfstab_ent - The new vfstab entry information.
377*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
378*0Sstevel@tonic-gate  *                             return from the function
379*0Sstevel@tonic-gate  *
380*0Sstevel@tonic-gate  * Return:
381*0Sstevel@tonic-gate  */
382*0Sstevel@tonic-gate fs_mntdefaults_t	*fs_edit_mount_defaults(fs_mntdefaults_t *,
383*0Sstevel@tonic-gate 				fs_mntdefaults_t *, int *);
384*0Sstevel@tonic-gate 
385*0Sstevel@tonic-gate /*
386*0Sstevel@tonic-gate  * Method: fs_free_mntdefaults_list
387*0Sstevel@tonic-gate  *
388*0Sstevel@tonic-gate  * Description: Frees the memory used when a fs_mntdefaults_t structure
389*0Sstevel@tonic-gate  *              is populated.
390*0Sstevel@tonic-gate  *
391*0Sstevel@tonic-gate  * Parameters:
392*0Sstevel@tonic-gate  * fs_mntdefaults_t *headp - The pointer to the first element in the list
393*0Sstevel@tonic-gate  *                           of mntdefault structures.
394*0Sstevel@tonic-gate  */
395*0Sstevel@tonic-gate void	fs_free_mntdefaults_list(fs_mntdefaults_t *headp);
396*0Sstevel@tonic-gate 
397*0Sstevel@tonic-gate 
398*0Sstevel@tonic-gate /*
399*0Sstevel@tonic-gate  * Method: fs_get_filtered_mount_defaults
400*0Sstevel@tonic-gate  *
401*0Sstevel@tonic-gate  * Description: Retrieves vfstab entries based in the fields in the
402*0Sstevel@tonic-gate  * fs_mntdefaults_t structure passed in. The fields that are not to
403*0Sstevel@tonic-gate  * be used in the filter will be set to NULL.
404*0Sstevel@tonic-gate  *
405*0Sstevel@tonic-gate  * Parameters:
406*0Sstevel@tonic-gate  * fs_mntdefaults_t *filter - The structure containing the fields to be
407*0Sstevel@tonic-gate  *                            used for the filter.
408*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
409*0Sstevel@tonic-gate  *                             return from the function
410*0Sstevel@tonic-gate  *
411*0Sstevel@tonic-gate  * Return:
412*0Sstevel@tonic-gate  * The list of all vfstab entries meeting the filter criteria are returned.
413*0Sstevel@tonic-gate  * On failure NULL is returned.
414*0Sstevel@tonic-gate  */
415*0Sstevel@tonic-gate fs_mntdefaults_t	*fs_get_filtered_mount_defaults(
416*0Sstevel@tonic-gate 				fs_mntdefaults_t *filter, int *errp);
417*0Sstevel@tonic-gate 
418*0Sstevel@tonic-gate /*
419*0Sstevel@tonic-gate  * Method: fs_get_mount_defaults
420*0Sstevel@tonic-gate  *
421*0Sstevel@tonic-gate  * Description: Retrieves vfstab entries and returns a list of
422*0Sstevel@tonic-gate  *              fs_mntdefaults_t structures.
423*0Sstevel@tonic-gate  *
424*0Sstevel@tonic-gate  * Parameters:
425*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
426*0Sstevel@tonic-gate  *                             return from the function
427*0Sstevel@tonic-gate  *
428*0Sstevel@tonic-gate  * Return:
429*0Sstevel@tonic-gate  * fs_mntdefaults_t * - Returns a list of all vfstab entries.
430*0Sstevel@tonic-gate  */
431*0Sstevel@tonic-gate fs_mntdefaults_t	*fs_get_mount_defaults(int *errp);
432*0Sstevel@tonic-gate 
433*0Sstevel@tonic-gate /*
434*0Sstevel@tonic-gate  * Mount (/etc/mnttab) interface method declarations
435*0Sstevel@tonic-gate  */
436*0Sstevel@tonic-gate /*
437*0Sstevel@tonic-gate  * Method: fs_free_mount_list
438*0Sstevel@tonic-gate  *
439*0Sstevel@tonic-gate  * Description: Frees the mount list created when retrieving mnttab entries.
440*0Sstevel@tonic-gate  *
441*0Sstevel@tonic-gate  * Parameters:
442*0Sstevel@tonic-gate  * fs_mntlist_t *headp - The mount list to be freed.
443*0Sstevel@tonic-gate  */
444*0Sstevel@tonic-gate void	fs_free_mount_list(fs_mntlist_t *mnt_list);
445*0Sstevel@tonic-gate 
446*0Sstevel@tonic-gate /*
447*0Sstevel@tonic-gate  * Method: fs_get_availablesize
448*0Sstevel@tonic-gate  *
449*0Sstevel@tonic-gate  * Description: Calculates the total size available on the filesystem.
450*0Sstevel@tonic-gate  *
451*0Sstevel@tonic-gate  * Parameters:
452*0Sstevel@tonic-gate  * char *mntpnt - The mount point to use for gathering the stat information
453*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
454*0Sstevel@tonic-gate  *                             return from the function
455*0Sstevel@tonic-gate  *
456*0Sstevel@tonic-gate  * Return:
457*0Sstevel@tonic-gate  * The total size available on the filesystem.
458*0Sstevel@tonic-gate  */
459*0Sstevel@tonic-gate unsigned long long	fs_get_availablesize(char *mntpnt, int *errp);
460*0Sstevel@tonic-gate 
461*0Sstevel@tonic-gate /*
462*0Sstevel@tonic-gate  * Method: fs_get_avail_for_nonsuperuser_size
463*0Sstevel@tonic-gate  *
464*0Sstevel@tonic-gate  * Description: Calculates the available space on the filesystem for
465*0Sstevel@tonic-gate  *              nonsuperusers.
466*0Sstevel@tonic-gate  *
467*0Sstevel@tonic-gate  * Parameters:
468*0Sstevel@tonic-gate  * char *mntpnt - The mount point for the filesystem.
469*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
470*0Sstevel@tonic-gate  *                             return from the function
471*0Sstevel@tonic-gate  *
472*0Sstevel@tonic-gate  * Return:
473*0Sstevel@tonic-gate  * The available space for nonsuperusers.
474*0Sstevel@tonic-gate  * On failure NULL is returned.
475*0Sstevel@tonic-gate  */
476*0Sstevel@tonic-gate unsigned long long	fs_get_avail_for_nonsuperuser_size(char *mntpnt,
477*0Sstevel@tonic-gate 				int *errp);
478*0Sstevel@tonic-gate 
479*0Sstevel@tonic-gate /*
480*0Sstevel@tonic-gate  * Method: fs_get_blocksize
481*0Sstevel@tonic-gate  *
482*0Sstevel@tonic-gate  * Description: Retrieves the preferred filesystem block size.
483*0Sstevel@tonic-gate  *
484*0Sstevel@tonic-gate  * Parameters:
485*0Sstevel@tonic-gate  * char *mntpnt - The mount point for the filesystem.
486*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
487*0Sstevel@tonic-gate  *                             return from the function
488*0Sstevel@tonic-gate  *
489*0Sstevel@tonic-gate  * Return:
490*0Sstevel@tonic-gate  * Returns the preferred filesystem block size.
491*0Sstevel@tonic-gate  * On failure NULL is returned.
492*0Sstevel@tonic-gate  */
493*0Sstevel@tonic-gate 
494*0Sstevel@tonic-gate unsigned long long	fs_get_blocksize(char *mntpnt, int *errp);
495*0Sstevel@tonic-gate 
496*0Sstevel@tonic-gate /*
497*0Sstevel@tonic-gate  * Method: fs_get_filtered_mount_list
498*0Sstevel@tonic-gate  *
499*0Sstevel@tonic-gate  * Description: Can be used to filter mounts only by the following mount
500*0Sstevel@tonic-gate  * attributes or a mixture of them:
501*0Sstevel@tonic-gate  * 1.) resource
502*0Sstevel@tonic-gate  * 2.) mount point
503*0Sstevel@tonic-gate  * 3.) mount option string
504*0Sstevel@tonic-gate  * 4.) time mounted
505*0Sstevel@tonic-gate  *
506*0Sstevel@tonic-gate  * Parameters:
507*0Sstevel@tonic-gate  * char *resource - The name of the resource to be mounted
508*0Sstevel@tonic-gate  * char *mountp - The pathname of the directory on which the filesystem
509*0Sstevel@tonic-gate  *                is mounted
510*0Sstevel@tonic-gate  * char *mntopts - The mount options
511*0Sstevel@tonic-gate  * char *time - The time at which the filesystem was mounted
512*0Sstevel@tonic-gate  * boolean_t find_overlays - Flag used to turn on overlay checking
513*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
514*0Sstevel@tonic-gate  *                             return from the function
515*0Sstevel@tonic-gate  *
516*0Sstevel@tonic-gate  * Return:
517*0Sstevel@tonic-gate  * The list of all mnttab entries meeting the filter criteria are returned.
518*0Sstevel@tonic-gate  * On failure NULL is returned.
519*0Sstevel@tonic-gate  */
520*0Sstevel@tonic-gate fs_mntlist_t		*fs_get_filtered_mount_list(char *resource,
521*0Sstevel@tonic-gate 				char *mountp, char *fstype, char *mntopts,
522*0Sstevel@tonic-gate 				char *time, boolean_t find_overlays,
523*0Sstevel@tonic-gate 				int *errp);
524*0Sstevel@tonic-gate 
525*0Sstevel@tonic-gate /*
526*0Sstevel@tonic-gate  * Method: fs_get_fragsize
527*0Sstevel@tonic-gate  *
528*0Sstevel@tonic-gate  * Description: Determines the fundamental filesystem block size.
529*0Sstevel@tonic-gate  *
530*0Sstevel@tonic-gate  * Parameters:
531*0Sstevel@tonic-gate  * char *mntpnt - The mount point for the filesystem.
532*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
533*0Sstevel@tonic-gate  *                             return from the function
534*0Sstevel@tonic-gate  *
535*0Sstevel@tonic-gate  * Return:
536*0Sstevel@tonic-gate  * Returns the fundamental filesystem block size.
537*0Sstevel@tonic-gate  * On failure NULL is returned.
538*0Sstevel@tonic-gate  */
539*0Sstevel@tonic-gate unsigned long		fs_get_fragsize(char *mntpnt, int *errp);
540*0Sstevel@tonic-gate 
541*0Sstevel@tonic-gate /*
542*0Sstevel@tonic-gate  * Method: fs_get_maxfilenamelen
543*0Sstevel@tonic-gate  *
544*0Sstevel@tonic-gate  * Description: Determines the maximum file name length for the filesystem.
545*0Sstevel@tonic-gate  *
546*0Sstevel@tonic-gate  * Parameters:
547*0Sstevel@tonic-gate  * char *mntpnt - The mount point for the filesystem.
548*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
549*0Sstevel@tonic-gate  *                             return from the function
550*0Sstevel@tonic-gate  *
551*0Sstevel@tonic-gate  * Return:
552*0Sstevel@tonic-gate  * Returns the  maximum file name length for the specified filesystem.
553*0Sstevel@tonic-gate  * On failure NULL is returned.
554*0Sstevel@tonic-gate  */
555*0Sstevel@tonic-gate unsigned long		fs_get_maxfilenamelen(char *mntpnt, int *errp);
556*0Sstevel@tonic-gate 
557*0Sstevel@tonic-gate /*
558*0Sstevel@tonic-gate  * Method: fs_get_mounts_by_mntopt
559*0Sstevel@tonic-gate  *
560*0Sstevel@tonic-gate  * Description: Returns only mounts with the specified mount option set.
561*0Sstevel@tonic-gate  *
562*0Sstevel@tonic-gate  * Parameters:
563*0Sstevel@tonic-gate  * char *mntopt - The mount option used for filtering mounts
564*0Sstevel@tonic-gate  * boolean_t find_overlays - Flag used to turn on overlay checking
565*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
566*0Sstevel@tonic-gate  *                             return from the function
567*0Sstevel@tonic-gate  *
568*0Sstevel@tonic-gate  * Return:
569*0Sstevel@tonic-gate  * Returns the list of all mnttab entries with the matching mount option.
570*0Sstevel@tonic-gate  * On failure NULL is returned.
571*0Sstevel@tonic-gate  */
572*0Sstevel@tonic-gate fs_mntlist_t		*fs_get_mounts_by_mntopt(char *mntopt,
573*0Sstevel@tonic-gate 				boolean_t find_overlays, int *errp);
574*0Sstevel@tonic-gate 
575*0Sstevel@tonic-gate /*
576*0Sstevel@tonic-gate  * Method: fs_get_mount_list
577*0Sstevel@tonic-gate  *
578*0Sstevel@tonic-gate  * Description: Returns a list of all mounts in mnttab
579*0Sstevel@tonic-gate  *
580*0Sstevel@tonic-gate  * Parameters:
581*0Sstevel@tonic-gate  * char *mntpnt - The mount point for the filesystem
582*0Sstevel@tonic-gate  * boolean_t find_overlays - Flag used to turn on overlay checking
583*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
584*0Sstevel@tonic-gate  *                             return from the function
585*0Sstevel@tonic-gate  *
586*0Sstevel@tonic-gate  * Return:
587*0Sstevel@tonic-gate  * Returns the list of all mounts and associated mount information for mounts
588*0Sstevel@tonic-gate  * listed in mnttab. On failure NULL is returned.
589*0Sstevel@tonic-gate  */
590*0Sstevel@tonic-gate fs_mntlist_t		*fs_get_mount_list(boolean_t find_overlays, int *errp);
591*0Sstevel@tonic-gate 
592*0Sstevel@tonic-gate /*
593*0Sstevel@tonic-gate  * Method: fs_get_totalsize
594*0Sstevel@tonic-gate  *
595*0Sstevel@tonic-gate  * Description: Determines the total size of the filesystem using the
596*0Sstevel@tonic-gate  * total number of blocks and the block size.
597*0Sstevel@tonic-gate  *
598*0Sstevel@tonic-gate  * Parameters:
599*0Sstevel@tonic-gate  * char *mntpnt - The mount point for the filesystem
600*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
601*0Sstevel@tonic-gate  *                             return from the function
602*0Sstevel@tonic-gate  *
603*0Sstevel@tonic-gate  * Return:
604*0Sstevel@tonic-gate  * Returns the total size of the filesystem.
605*0Sstevel@tonic-gate  * On failure NULL is returned.
606*0Sstevel@tonic-gate  */
607*0Sstevel@tonic-gate unsigned long long	fs_get_totalsize(char *mntpnt, int *errp);
608*0Sstevel@tonic-gate 
609*0Sstevel@tonic-gate /*
610*0Sstevel@tonic-gate  * Method: fs_get_usedsize
611*0Sstevel@tonic-gate  *
612*0Sstevel@tonic-gate  * Description: Calculates the size of the used portion of the filesystem.
613*0Sstevel@tonic-gate  *
614*0Sstevel@tonic-gate  * Parameters:
615*0Sstevel@tonic-gate  * char *mntpnt - The mount point for the filesystem
616*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
617*0Sstevel@tonic-gate  *                             return from the function
618*0Sstevel@tonic-gate  *
619*0Sstevel@tonic-gate  * Return:
620*0Sstevel@tonic-gate  * Returns the size of the the used portion of the filesystem.
621*0Sstevel@tonic-gate  * On failure NULL is returned.
622*0Sstevel@tonic-gate  */
623*0Sstevel@tonic-gate unsigned long long	fs_get_usedsize(char *mntpnt, int *errp);
624*0Sstevel@tonic-gate 
625*0Sstevel@tonic-gate /*
626*0Sstevel@tonic-gate  * Method: fs_is_readonly
627*0Sstevel@tonic-gate  *
628*0Sstevel@tonic-gate  * Description: Checks the filesystem flags to see if the filesystem is
629*0Sstevel@tonic-gate  * readonly.
630*0Sstevel@tonic-gate  *
631*0Sstevel@tonic-gate  * Parameters:
632*0Sstevel@tonic-gate  * char *mntpnt - The mount point for the filesystem
633*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
634*0Sstevel@tonic-gate  *                             return from the function
635*0Sstevel@tonic-gate  *
636*0Sstevel@tonic-gate  * Return:
637*0Sstevel@tonic-gate  * Returns B_TRUE if the readonly flag is set and B_FALSE if not.
638*0Sstevel@tonic-gate  * On error the error pointer is set to errno.
639*0Sstevel@tonic-gate  */
640*0Sstevel@tonic-gate boolean_t		fs_is_readonly(char *mntpnt, int *errp);
641*0Sstevel@tonic-gate 
642*0Sstevel@tonic-gate /*
643*0Sstevel@tonic-gate  * Method: fs_parse_optlist_for_option
644*0Sstevel@tonic-gate  *
645*0Sstevel@tonic-gate  * Description:
646*0Sstevel@tonic-gate  * This method will parse the given comma delimited option list (optlist) for
647*0Sstevel@tonic-gate  * the option passed into the function.  If the option (opt) to search for
648*0Sstevel@tonic-gate  * is one that sets a value such as onerror=, the value to the right of the "="
649*0Sstevel@tonic-gate  * character will be returned from the function.  This function expects the
650*0Sstevel@tonic-gate  * opt parameter to have the "=" character appended when searching for options
651*0Sstevel@tonic-gate  * which set a value.
652*0Sstevel@tonic-gate  *
653*0Sstevel@tonic-gate  * Parameters:
654*0Sstevel@tonic-gate  * char *optlist - The option string to be parsed
655*0Sstevel@tonic-gate  * char *opt - The option to search for
656*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
657*0Sstevel@tonic-gate  *                             return from the function
658*0Sstevel@tonic-gate  *
659*0Sstevel@tonic-gate  * Return:
660*0Sstevel@tonic-gate  * Returns the option as found in the option list.
661*0Sstevel@tonic-gate  * If the option is not found NULL is returned.
662*0Sstevel@tonic-gate  * On error NULL is returned and the error pointer is set to errno.
663*0Sstevel@tonic-gate  */
664*0Sstevel@tonic-gate char			*fs_parse_optlist_for_option(char *optlist, char *opt,
665*0Sstevel@tonic-gate 				int *errp);
666*0Sstevel@tonic-gate 
667*0Sstevel@tonic-gate /*
668*0Sstevel@tonic-gate  * Share (/etc/dfs/sharetab) interface method declarations
669*0Sstevel@tonic-gate  */
670*0Sstevel@tonic-gate /*
671*0Sstevel@tonic-gate  * Method: fs_free_share_list
672*0Sstevel@tonic-gate  *
673*0Sstevel@tonic-gate  * Description: Used to free populated fs_sharelist_t structures
674*0Sstevel@tonic-gate  *
675*0Sstevel@tonic-gate  * Parameters:
676*0Sstevel@tonic-gate  * fs_sharelist_t *headp - the pointer to the first element in the list.
677*0Sstevel@tonic-gate  */
678*0Sstevel@tonic-gate void		fs_free_share_list(fs_sharelist_t *share_list);
679*0Sstevel@tonic-gate 
680*0Sstevel@tonic-gate /*
681*0Sstevel@tonic-gate  * Method: fs_get_share_list
682*0Sstevel@tonic-gate  *
683*0Sstevel@tonic-gate  * Description: Gets a list of the shares on the system from /etc/dfs/sharetab
684*0Sstevel@tonic-gate  *
685*0Sstevel@tonic-gate  * Parameters:
686*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
687*0Sstevel@tonic-gate  *                             return from the function
688*0Sstevel@tonic-gate  *
689*0Sstevel@tonic-gate  * Return:
690*0Sstevel@tonic-gate  * Returns a list of fs_sharelist_t structures containing all of the shares
691*0Sstevel@tonic-gate  * from sharetab.
692*0Sstevel@tonic-gate  * On error NULL is returned and errp is set to errno.
693*0Sstevel@tonic-gate  */
694*0Sstevel@tonic-gate fs_sharelist_t	*fs_get_share_list(int *errp);
695*0Sstevel@tonic-gate 
696*0Sstevel@tonic-gate /*
697*0Sstevel@tonic-gate  * Method: fs_parse_opts_for_sec_modes
698*0Sstevel@tonic-gate  *
699*0Sstevel@tonic-gate  * Description: Parses the option string for security modes and returns
700*0Sstevel@tonic-gate  * an array of strings containing all modes.
701*0Sstevel@tonic-gate  *
702*0Sstevel@tonic-gate  * Parameters:
703*0Sstevel@tonic-gate  * 	char * - options string to be parsed.
704*0Sstevel@tonic-gate  * 	int * - count of the number of modes found.
705*0Sstevel@tonic-gate  *	int * - error code.
706*0Sstevel@tonic-gate  *
707*0Sstevel@tonic-gate  * Return:
708*0Sstevel@tonic-gate  * Returns an array of string containing all security opts listed in the
709*0Sstevel@tonic-gate  * passed in option string. On error NULL is returned.
710*0Sstevel@tonic-gate  */
711*0Sstevel@tonic-gate char **fs_parse_opts_for_sec_modes(char *, int *, int *);
712*0Sstevel@tonic-gate 
713*0Sstevel@tonic-gate /*
714*0Sstevel@tonic-gate  * Method: fs_create_array_from_accesslist
715*0Sstevel@tonic-gate  *
716*0Sstevel@tonic-gate  * Description: Takes the colon seperated access list parses the list
717*0Sstevel@tonic-gate  *              into an array containing all the elements of the list.
718*0Sstevel@tonic-gate  *              The array created is returned and count is set to the
719*0Sstevel@tonic-gate  *              number of elements in the array.
720*0Sstevel@tonic-gate  *
721*0Sstevel@tonic-gate  * Parameters:
722*0Sstevel@tonic-gate  * char *access_list - The string containing the colon sperated access list.
723*0Sstevel@tonic-gate  * int *count - Will contain the number of elements in the array.
724*0Sstevel@tonic-gate  * int *err - any errors encountered.
725*0Sstevel@tonic-gate  */
726*0Sstevel@tonic-gate char **fs_create_array_from_accesslist(char *access_list, int *count, int *err);
727*0Sstevel@tonic-gate 
728*0Sstevel@tonic-gate /*
729*0Sstevel@tonic-gate  * FS dfstab (/etc/dfs/dfstab) interface method declarations
730*0Sstevel@tonic-gate  */
731*0Sstevel@tonic-gate 
732*0Sstevel@tonic-gate /*
733*0Sstevel@tonic-gate  * Method: fs_add_DFStab_ent
734*0Sstevel@tonic-gate  *
735*0Sstevel@tonic-gate  * Description: Adds an entry to dfstab and to the list of dfstab
736*0Sstevel@tonic-gate  * entries. Returns a pointer to the head of the dfstab entry list.
737*0Sstevel@tonic-gate  *
738*0Sstevel@tonic-gate  * Parameters:
739*0Sstevel@tonic-gate  * char *cmd - the share command to be added to dfstab
740*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
741*0Sstevel@tonic-gate  *                             return from the function
742*0Sstevel@tonic-gate  *
743*0Sstevel@tonic-gate  * Return:
744*0Sstevel@tonic-gate  * Returns the pointer to the updated dfstab entry list.
745*0Sstevel@tonic-gate  */
746*0Sstevel@tonic-gate fs_dfstab_entry_t fs_add_DFStab_ent(char *, int *);
747*0Sstevel@tonic-gate 
748*0Sstevel@tonic-gate /*
749*0Sstevel@tonic-gate  * Method: fs_del_DFStab_ent
750*0Sstevel@tonic-gate  *
751*0Sstevel@tonic-gate  * Description: Deletes an entry from dfstab and from the list of
752*0Sstevel@tonic-gate  *              dfstab entries.
753*0Sstevel@tonic-gate  *
754*0Sstevel@tonic-gate  * Parameters:
755*0Sstevel@tonic-gate  * char *del_cmd - The share command to be removed
756*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
757*0Sstevel@tonic-gate  *                             return from the function
758*0Sstevel@tonic-gate  *
759*0Sstevel@tonic-gate  * Return:
760*0Sstevel@tonic-gate  * Returns the pointer to the updated dfstab entry list.
761*0Sstevel@tonic-gate  */
762*0Sstevel@tonic-gate fs_dfstab_entry_t fs_del_DFStab_ent(char *, int *);
763*0Sstevel@tonic-gate 
764*0Sstevel@tonic-gate /*
765*0Sstevel@tonic-gate  * NOTE: the caller of this function is responsible for freeing any
766*0Sstevel@tonic-gate  * memory allocated by calling fs_free_DFStab_ents()
767*0Sstevel@tonic-gate  *
768*0Sstevel@tonic-gate  * Method: fs_edit_DFStab_ent
769*0Sstevel@tonic-gate  *
770*0Sstevel@tonic-gate  * Description: Changes the specified line in dfstab to match the second
771*0Sstevel@tonic-gate  *              string passed in.
772*0Sstevel@tonic-gate  *
773*0Sstevel@tonic-gate  * Parameters:
774*0Sstevel@tonic-gate  * char *old_cmd - The share command that will be changed.
775*0Sstevel@tonic-gate  * char *new_cmd - The share command that will replace old_cmd.
776*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
777*0Sstevel@tonic-gate  *                             return from the function
778*0Sstevel@tonic-gate  *
779*0Sstevel@tonic-gate  * Return:
780*0Sstevel@tonic-gate  * Returns the pointer to the updated dfstab entry list.
781*0Sstevel@tonic-gate  */
782*0Sstevel@tonic-gate fs_dfstab_entry_t fs_edit_DFStab_ent(char *, char *, int *);
783*0Sstevel@tonic-gate 
784*0Sstevel@tonic-gate /*
785*0Sstevel@tonic-gate  * Method: fs_free_DFStab_ents
786*0Sstevel@tonic-gate  *
787*0Sstevel@tonic-gate  * Description: Frees the dfstab entry list.
788*0Sstevel@tonic-gate  *
789*0Sstevel@tonic-gate  * Parameters:
790*0Sstevel@tonic-gate  * fs_dfstab_entry_t list - The pointer to the dfstab entry list.
791*0Sstevel@tonic-gate  */
792*0Sstevel@tonic-gate void fs_free_DFStab_ents(fs_dfstab_entry_t);
793*0Sstevel@tonic-gate 
794*0Sstevel@tonic-gate /*
795*0Sstevel@tonic-gate  * NOTE: the caller of this function is responsible for freeing any
796*0Sstevel@tonic-gate  * memory allocated by calling fs_free_DFStab_ents()
797*0Sstevel@tonic-gate  *
798*0Sstevel@tonic-gate  * Method: fs_get_DFStab_ents
799*0Sstevel@tonic-gate  *
800*0Sstevel@tonic-gate  * Description: Retrieves the dfstab entry list.
801*0Sstevel@tonic-gate  *
802*0Sstevel@tonic-gate  * Parameters:
803*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
804*0Sstevel@tonic-gate  *                             return from the function
805*0Sstevel@tonic-gate  *
806*0Sstevel@tonic-gate  * Return:
807*0Sstevel@tonic-gate  * Returns the pointer to the dfstab entry list.
808*0Sstevel@tonic-gate  * If NULL is returned and errp is 0 then dfstab has no entries. If errp is
809*0Sstevel@tonic-gate  * not 0 there was an error and the value of errp is set to the errno
810*0Sstevel@tonic-gate  * value for that error.
811*0Sstevel@tonic-gate  */
812*0Sstevel@tonic-gate fs_dfstab_entry_t fs_get_DFStab_ents(int *err);
813*0Sstevel@tonic-gate 
814*0Sstevel@tonic-gate /*
815*0Sstevel@tonic-gate  * NOTE: the caller of this function is responsible for freeing any
816*0Sstevel@tonic-gate  * memory allocated by calling fs_free_DFStab_ents()
817*0Sstevel@tonic-gate  *
818*0Sstevel@tonic-gate  * Method: fs_get_DFStab_ent_Desc
819*0Sstevel@tonic-gate  *
820*0Sstevel@tonic-gate  * Description: Retrieves the description information for the present
821*0Sstevel@tonic-gate  *              dfstab entry.
822*0Sstevel@tonic-gate  *
823*0Sstevel@tonic-gate  * Parameters:
824*0Sstevel@tonic-gate  * fs_dfstab_entry_t entry - the dfstab entry to retrieve the description from.
825*0Sstevel@tonic-gate  *
826*0Sstevel@tonic-gate  * Return:
827*0Sstevel@tonic-gate  * The string containing the description for the dfstab entry.
828*0Sstevel@tonic-gate  * If the description is not set NULL is returned.
829*0Sstevel@tonic-gate  *
830*0Sstevel@tonic-gate  * Note: the description is an optional share option and a return value of
831*0Sstevel@tonic-gate  *       NULL is not an error but indicates that the description was not set.
832*0Sstevel@tonic-gate  */
833*0Sstevel@tonic-gate char *fs_get_DFStab_ent_Desc(fs_dfstab_entry_t);
834*0Sstevel@tonic-gate 
835*0Sstevel@tonic-gate /*
836*0Sstevel@tonic-gate  * Method: fs_get_DFStab_ent_Fstype
837*0Sstevel@tonic-gate  *
838*0Sstevel@tonic-gate  * Description: Retrieves the filesystem type information from the dfstab
839*0Sstevel@tonic-gate  *              entry passed in.
840*0Sstevel@tonic-gate  *
841*0Sstevel@tonic-gate  * Parameters:
842*0Sstevel@tonic-gate  * fs_dfstab_entry_t entry - the dfstab entry to retrieve the fstype from.
843*0Sstevel@tonic-gate  *
844*0Sstevel@tonic-gate  * Return:
845*0Sstevel@tonic-gate  * The string containing the filesystem type.
846*0Sstevel@tonic-gate  *
847*0Sstevel@tonic-gate  * Note: if fstype is not set in the dfstab entry the default fstype is
848*0Sstevel@tonic-gate  *       returned.
849*0Sstevel@tonic-gate  */
850*0Sstevel@tonic-gate char *fs_get_DFStab_ent_Fstype(fs_dfstab_entry_t);
851*0Sstevel@tonic-gate 
852*0Sstevel@tonic-gate /*
853*0Sstevel@tonic-gate  * Method: fs_get_DFStab_ent_Next
854*0Sstevel@tonic-gate  *
855*0Sstevel@tonic-gate  * Description: Retrieves the next entry in the dfstab entry list.
856*0Sstevel@tonic-gate  *
857*0Sstevel@tonic-gate  * Parameters:
858*0Sstevel@tonic-gate  * fs_dfstab_entry_t entry - The dfstab entry pointer to get the next
859*0Sstevel@tonic-gate  *                           pointer from.
860*0Sstevel@tonic-gate  *
861*0Sstevel@tonic-gate  * Return:
862*0Sstevel@tonic-gate  * Returns the next dfstab entry.
863*0Sstevel@tonic-gate  * A return value of NULL indicates the end of the dfstab entry list.
864*0Sstevel@tonic-gate  */
865*0Sstevel@tonic-gate fs_dfstab_entry_t fs_get_DFStab_ent_Next(fs_dfstab_entry_t);
866*0Sstevel@tonic-gate 
867*0Sstevel@tonic-gate /*
868*0Sstevel@tonic-gate  * Method: fs_get_DFStab_ent_Options
869*0Sstevel@tonic-gate  *
870*0Sstevel@tonic-gate  * Description: Retrieves the share options from the dfstab
871*0Sstevel@tonic-gate  *              entry passed in.
872*0Sstevel@tonic-gate  *
873*0Sstevel@tonic-gate  * Parameters:
874*0Sstevel@tonic-gate  * fs_dfstab_entry_t entry - The dfstab entry to retrieve the share
875*0Sstevel@tonic-gate  *                           options from.
876*0Sstevel@tonic-gate  *
877*0Sstevel@tonic-gate  * Return:
878*0Sstevel@tonic-gate  * Returns the string containing the share options.
879*0Sstevel@tonic-gate  * A NULL value indicates that no options were specified in the dfstab entry.
880*0Sstevel@tonic-gate  */
881*0Sstevel@tonic-gate char *fs_get_DFStab_ent_Options(fs_dfstab_entry_t);
882*0Sstevel@tonic-gate 
883*0Sstevel@tonic-gate /*
884*0Sstevel@tonic-gate  * Method: fs_get_DFStab_ent_Path
885*0Sstevel@tonic-gate  *
886*0Sstevel@tonic-gate  * Description: Retrieves the path information from the dfstab
887*0Sstevel@tonic-gate  *              entry passed in.
888*0Sstevel@tonic-gate  *
889*0Sstevel@tonic-gate  * Parameters:
890*0Sstevel@tonic-gate  * fs_dfstab_entry_t entry - the dfstab entry to retrieve the path from.
891*0Sstevel@tonic-gate  *
892*0Sstevel@tonic-gate  * Return:
893*0Sstevel@tonic-gate  * Returns the string containing the path.
894*0Sstevel@tonic-gate  * A NULL value indecates that no path information is available for the
895*0Sstevel@tonic-gate  * dfstab entry. A NULL value here is an error and indicates an invalid
896*0Sstevel@tonic-gate  * dfstab entry.
897*0Sstevel@tonic-gate  */
898*0Sstevel@tonic-gate char *fs_get_DFStab_ent_Path(fs_dfstab_entry_t);
899*0Sstevel@tonic-gate 
900*0Sstevel@tonic-gate /*
901*0Sstevel@tonic-gate  * Method: fs_get_DFStab_ent_Res
902*0Sstevel@tonic-gate  *
903*0Sstevel@tonic-gate  * Description: Retrieves the resource information from the dfstab entry
904*0Sstevel@tonic-gate  *              passed in.
905*0Sstevel@tonic-gate  *
906*0Sstevel@tonic-gate  * Parameters:
907*0Sstevel@tonic-gate  * fs_dfstab_entry_t entry - the dfstab entry to retrieve the resource
908*0Sstevel@tonic-gate  *                           information from.
909*0Sstevel@tonic-gate  *
910*0Sstevel@tonic-gate  * Return:
911*0Sstevel@tonic-gate  * Returns the string containing the path.
912*0Sstevel@tonic-gate  * A NULL value indecates that no resource information is available for the
913*0Sstevel@tonic-gate  * dfstab entry.
914*0Sstevel@tonic-gate  */
915*0Sstevel@tonic-gate char *fs_get_DFStab_ent_Res(fs_dfstab_entry_t);
916*0Sstevel@tonic-gate 
917*0Sstevel@tonic-gate /*
918*0Sstevel@tonic-gate  * Method: fs_get_Dfstab_share_cmd
919*0Sstevel@tonic-gate  *
920*0Sstevel@tonic-gate  * Description: Retrieves the share command that corresponds to the
921*0Sstevel@tonic-gate  *              dfstab entry passed in.
922*0Sstevel@tonic-gate  *
923*0Sstevel@tonic-gate  * Parameters:
924*0Sstevel@tonic-gate  * fs_dfstab_entry_t entry - The dfstab entry that will be used to create
925*0Sstevel@tonic-gate  *                           a share command.
926*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
927*0Sstevel@tonic-gate  *                             return from the function
928*0Sstevel@tonic-gate  *
929*0Sstevel@tonic-gate  * Return:
930*0Sstevel@tonic-gate  * Returns the string containing the share command.
931*0Sstevel@tonic-gate  * A NULL value indicates an error occured and errp will be non zero.
932*0Sstevel@tonic-gate  */
933*0Sstevel@tonic-gate char *fs_get_Dfstab_share_cmd(fs_dfstab_entry_t, int *);
934*0Sstevel@tonic-gate 
935*0Sstevel@tonic-gate /*
936*0Sstevel@tonic-gate  * NOTE: the caller of this function is responsible for freeing any
937*0Sstevel@tonic-gate  * memory allocated by calling fs_free_DFStab_ents()
938*0Sstevel@tonic-gate  *
939*0Sstevel@tonic-gate  * Method: fs_set_DFStab_ent
940*0Sstevel@tonic-gate  *
941*0Sstevel@tonic-gate  * Description: Used to add entries into dfstab
942*0Sstevel@tonic-gate  *
943*0Sstevel@tonic-gate  * Parameters:
944*0Sstevel@tonic-gate  * char *path - The path for the dfstab entry
945*0Sstevel@tonic-gate  * char *fstype - The filesystem type for the share
946*0Sstevel@tonic-gate  * char *options - The share options to be used for the dfstab entry
947*0Sstevel@tonic-gate  * char *description - The description for the share
948*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
949*0Sstevel@tonic-gate  *                             return from the function
950*0Sstevel@tonic-gate  *
951*0Sstevel@tonic-gate  * Return:
952*0Sstevel@tonic-gate  * Returns a pointer to the begining of the dfstab entry list
953*0Sstevel@tonic-gate  * Failure returns NULL
954*0Sstevel@tonic-gate  */
955*0Sstevel@tonic-gate fs_dfstab_entry_t fs_set_DFStab_ent(char *, char *, char *, char *, int *);
956*0Sstevel@tonic-gate 
957*0Sstevel@tonic-gate /*
958*0Sstevel@tonic-gate  * NOTE: the caller of this function is responsible for freeing any
959*0Sstevel@tonic-gate  * memory allocated by calling fs_free_DFStab_ents()
960*0Sstevel@tonic-gate  *
961*0Sstevel@tonic-gate  * Method: fs_del_All_DFStab_ents_with_Path
962*0Sstevel@tonic-gate  *
963*0Sstevel@tonic-gate  * Description: Removes all dfstab entries with the specified path.
964*0Sstevel@tonic-gate  *
965*0Sstevel@tonic-gate  * Parameters:
966*0Sstevel@tonic-gate  *            char *path - The path to checked for removal from dfstab.
967*0Sstevel@tonic-gate  *            int *err - error pointer.
968*0Sstevel@tonic-gate  *
969*0Sstevel@tonic-gate  * Return: returns a pointer to the nfs list of dfstab entries.
970*0Sstevel@tonic-gate  */
971*0Sstevel@tonic-gate fs_dfstab_entry_t fs_del_All_DFStab_ents_with_Path(char *, int *);
972*0Sstevel@tonic-gate 
973*0Sstevel@tonic-gate /*
974*0Sstevel@tonic-gate  * Debuging functions
975*0Sstevel@tonic-gate  */
976*0Sstevel@tonic-gate void fs_print_dfstab_entries(fs_dfstab_entry_t);
977*0Sstevel@tonic-gate 
978*0Sstevel@tonic-gate /*
979*0Sstevel@tonic-gate  * NFS mount interface method declarations
980*0Sstevel@tonic-gate  */
981*0Sstevel@tonic-gate /*
982*0Sstevel@tonic-gate  * Method: nfs_free_mntinfo_list
983*0Sstevel@tonic-gate  *
984*0Sstevel@tonic-gate  * Description: Used to free the network id list, which is an array of strings.
985*0Sstevel@tonic-gate  *
986*0Sstevel@tonic-gate  * Parameters:
987*0Sstevel@tonic-gate  * nfs_mntlist_t *mountinfo_list - The list of mounts and associated mount
988*0Sstevel@tonic-gate  *                                 information
989*0Sstevel@tonic-gate  *
990*0Sstevel@tonic-gate  */
991*0Sstevel@tonic-gate void nfs_free_mntinfo_list(nfs_mntlist_t *);
992*0Sstevel@tonic-gate 
993*0Sstevel@tonic-gate /*
994*0Sstevel@tonic-gate  * NOTE: the caller of this function is responsible for freeing any
995*0Sstevel@tonic-gate  * memory allocated by calling nfs_free_mntinfo_list()
996*0Sstevel@tonic-gate  *
997*0Sstevel@tonic-gate  * Method: nfs_get_filtered_mount_list
998*0Sstevel@tonic-gate  *
999*0Sstevel@tonic-gate  * Description: Can be used to filter nfs mounts only by the following mount
1000*0Sstevel@tonic-gate  * attributes or a mixture of them:
1001*0Sstevel@tonic-gate  * 1.) resource
1002*0Sstevel@tonic-gate  * 2.) mount point
1003*0Sstevel@tonic-gate  * 3.) mount option string
1004*0Sstevel@tonic-gate  * 4.) time mounted
1005*0Sstevel@tonic-gate  *
1006*0Sstevel@tonic-gate  * NULL must be passed into the options that are not being used in the filter.
1007*0Sstevel@tonic-gate  *
1008*0Sstevel@tonic-gate  * Parameters:
1009*0Sstevel@tonic-gate  * char *resource - The name of the resource to be mounted
1010*0Sstevel@tonic-gate  * char *mountp - The pathname of the directory on which the filesystem
1011*0Sstevel@tonic-gate  *                is mounted
1012*0Sstevel@tonic-gate  * char *mntopts - The mount options
1013*0Sstevel@tonic-gate  * char *time - The time at which the filesystem was mounted
1014*0Sstevel@tonic-gate  * boolean_t find_overlays - Flag used to turn on overlay checking
1015*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
1016*0Sstevel@tonic-gate  *                             return from the function
1017*0Sstevel@tonic-gate  *
1018*0Sstevel@tonic-gate  * Return:
1019*0Sstevel@tonic-gate  * nfs_mntlist_t * - Returns a list of nfs mounts based on the
1020*0Sstevel@tonic-gate  *                   parameters passed in.
1021*0Sstevel@tonic-gate  */
1022*0Sstevel@tonic-gate nfs_mntlist_t *nfs_get_filtered_mount_list(char *resource, char *mountp,
1023*0Sstevel@tonic-gate 	char *mntopts, char *time, boolean_t find_overlays,
1024*0Sstevel@tonic-gate 	int *errp);
1025*0Sstevel@tonic-gate 
1026*0Sstevel@tonic-gate /*
1027*0Sstevel@tonic-gate  * NOTE: the caller of this function is responsible for freeing any
1028*0Sstevel@tonic-gate  * memory allocated by calling nfs_free_mntinfo_list()
1029*0Sstevel@tonic-gate  *
1030*0Sstevel@tonic-gate  * Method: nfs_get_mounts_by_mntopt
1031*0Sstevel@tonic-gate  *
1032*0Sstevel@tonic-gate  * Description: Can be used to filter mounts by the mount options attribute.
1033*0Sstevel@tonic-gate  *
1034*0Sstevel@tonic-gate  * Parameters:
1035*0Sstevel@tonic-gate  * char *mntopts - The mount options
1036*0Sstevel@tonic-gate  * boolean_t find_overlays - Flag used to turn on overlay checking
1037*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
1038*0Sstevel@tonic-gate  *                             return from the function
1039*0Sstevel@tonic-gate  *
1040*0Sstevel@tonic-gate  * Return:
1041*0Sstevel@tonic-gate  * nfs_mntlist_t * - Returns a list of nfs mounts based on the
1042*0Sstevel@tonic-gate  *                   parameters passed in.
1043*0Sstevel@tonic-gate  */
1044*0Sstevel@tonic-gate nfs_mntlist_t *nfs_get_mounts_by_mntopt(char *mntopt, boolean_t find_overlays,
1045*0Sstevel@tonic-gate 	int *errp);
1046*0Sstevel@tonic-gate 
1047*0Sstevel@tonic-gate /*
1048*0Sstevel@tonic-gate  * NOTE: the caller of this function is responsible for freeing any
1049*0Sstevel@tonic-gate  * memory allocated by calling nfs_free_mntinfo_list()
1050*0Sstevel@tonic-gate  *
1051*0Sstevel@tonic-gate  * Method: nfs_get_mount_list
1052*0Sstevel@tonic-gate  *
1053*0Sstevel@tonic-gate  * Description: Used to gather all NFS mounts and there associated
1054*0Sstevel@tonic-gate  *              mount information.
1055*0Sstevel@tonic-gate  *
1056*0Sstevel@tonic-gate  * Parameters:
1057*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
1058*0Sstevel@tonic-gate  *                             return from the function
1059*0Sstevel@tonic-gate  *
1060*0Sstevel@tonic-gate  * Return:
1061*0Sstevel@tonic-gate  * nfs_mntlist_t * - Returns a list of all nfs mounts.
1062*0Sstevel@tonic-gate  */
1063*0Sstevel@tonic-gate nfs_mntlist_t *nfs_get_mount_list(int *);
1064*0Sstevel@tonic-gate 
1065*0Sstevel@tonic-gate /*
1066*0Sstevel@tonic-gate  * Netconfig (/etc/netconfig) interface method declarations
1067*0Sstevel@tonic-gate  */
1068*0Sstevel@tonic-gate /*
1069*0Sstevel@tonic-gate  * Method: netcfg_free_networkid_list
1070*0Sstevel@tonic-gate  *
1071*0Sstevel@tonic-gate  * Description: Used to free the network id list, which is an array of strings.
1072*0Sstevel@tonic-gate  *
1073*0Sstevel@tonic-gate  * Parameters:
1074*0Sstevel@tonic-gate  * char **netlist - The array of strings containing the network id list
1075*0Sstevel@tonic-gate  * int  num_elements - The number of elements in the network id list
1076*0Sstevel@tonic-gate  *
1077*0Sstevel@tonic-gate  */
1078*0Sstevel@tonic-gate void	netcfg_free_networkid_list(char **netlist, int num_elements);
1079*0Sstevel@tonic-gate 
1080*0Sstevel@tonic-gate /*
1081*0Sstevel@tonic-gate  * NOTE: the caller of this function is responsible for freeing any
1082*0Sstevel@tonic-gate  * memory allocated by calling netcfg_free_networkid_list()
1083*0Sstevel@tonic-gate  *
1084*0Sstevel@tonic-gate  * Method: netcfg_get_networkid_list
1085*0Sstevel@tonic-gate  *
1086*0Sstevel@tonic-gate  * Description: Used to create the network id list.
1087*0Sstevel@tonic-gate  *
1088*0Sstevel@tonic-gate  * Parameters:
1089*0Sstevel@tonic-gate  * int *num_elements - The number of elements in the network id list.
1090*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
1091*0Sstevel@tonic-gate  *                             return from the function
1092*0Sstevel@tonic-gate  *
1093*0Sstevel@tonic-gate  * Return:
1094*0Sstevel@tonic-gate  * char    ** - Returns the netowk id list.
1095*0Sstevel@tonic-gate  */
1096*0Sstevel@tonic-gate char	**netcfg_get_networkid_list(int *num_elements, int *errp);
1097*0Sstevel@tonic-gate 
1098*0Sstevel@tonic-gate /*
1099*0Sstevel@tonic-gate  * nfssec (/etc/nfssec.conf) interface method declarations
1100*0Sstevel@tonic-gate  */
1101*0Sstevel@tonic-gate /*
1102*0Sstevel@tonic-gate  * Method: nfssec_free_secmode_list
1103*0Sstevel@tonic-gate  *
1104*0Sstevel@tonic-gate  * Description: Used to free the NFS security mode list.
1105*0Sstevel@tonic-gate  *
1106*0Sstevel@tonic-gate  * Parameters:
1107*0Sstevel@tonic-gate  * char **seclist - The array of strings containing the security mode list
1108*0Sstevel@tonic-gate  * int num_elements - The number of elements in the list
1109*0Sstevel@tonic-gate  *
1110*0Sstevel@tonic-gate  */
1111*0Sstevel@tonic-gate void	nfssec_free_secmode_list(char **seclist, int num_elements);
1112*0Sstevel@tonic-gate 
1113*0Sstevel@tonic-gate /*
1114*0Sstevel@tonic-gate  * Method: nfssec_get_default_secmode
1115*0Sstevel@tonic-gate  *
1116*0Sstevel@tonic-gate  * Description: Used to retrieve the default security mode
1117*0Sstevel@tonic-gate  *
1118*0Sstevel@tonic-gate  * Parameters:
1119*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
1120*0Sstevel@tonic-gate  *                             return from the function
1121*0Sstevel@tonic-gate  *
1122*0Sstevel@tonic-gate  * Return:
1123*0Sstevel@tonic-gate  * char * - Returns the name of the default security mode
1124*0Sstevel@tonic-gate  */
1125*0Sstevel@tonic-gate char	*nfssec_get_default_secmode(int *errp);
1126*0Sstevel@tonic-gate 
1127*0Sstevel@tonic-gate /*
1128*0Sstevel@tonic-gate  * NOTE: the caller of this function is responsible for freeing any
1129*0Sstevel@tonic-gate  * memory allocated by calling nfssec_free_secmode_list()
1130*0Sstevel@tonic-gate  *
1131*0Sstevel@tonic-gate  * Method: nfssec_get_nfs_secmode_list
1132*0Sstevel@tonic-gate  *
1133*0Sstevel@tonic-gate  * Description: Used to create the NFS security mode list.
1134*0Sstevel@tonic-gate  *
1135*0Sstevel@tonic-gate  * Parameters:
1136*0Sstevel@tonic-gate  * int *num_elements - The number of elements in the security mode list
1137*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
1138*0Sstevel@tonic-gate  *                             return from the function
1139*0Sstevel@tonic-gate  *
1140*0Sstevel@tonic-gate  * Return:
1141*0Sstevel@tonic-gate  * char ** - Returns the NFS security mode list
1142*0Sstevel@tonic-gate  *
1143*0Sstevel@tonic-gate  */
1144*0Sstevel@tonic-gate char	**nfssec_get_nfs_secmode_list(int *num_elements, int *errp);
1145*0Sstevel@tonic-gate 
1146*0Sstevel@tonic-gate /*
1147*0Sstevel@tonic-gate  * System information interface method declarations
1148*0Sstevel@tonic-gate  */
1149*0Sstevel@tonic-gate /*
1150*0Sstevel@tonic-gate  * Method: sys_get_hostname
1151*0Sstevel@tonic-gate  *
1152*0Sstevel@tonic-gate  * Description: Used to retrieve the name of the host
1153*0Sstevel@tonic-gate  *
1154*0Sstevel@tonic-gate  * Parameters:
1155*0Sstevel@tonic-gate  * int *errp - error pointer - If an error occurs this will be non-zero upon
1156*0Sstevel@tonic-gate  *                             return from the function
1157*0Sstevel@tonic-gate  *
1158*0Sstevel@tonic-gate  * Return:
1159*0Sstevel@tonic-gate  * char * - Returns the name of the host system
1160*0Sstevel@tonic-gate  */
1161*0Sstevel@tonic-gate char *sys_get_hostname(int *errp);
1162*0Sstevel@tonic-gate 
1163*0Sstevel@tonic-gate 
1164*0Sstevel@tonic-gate #ifdef __cplusplus
1165*0Sstevel@tonic-gate }
1166*0Sstevel@tonic-gate #endif
1167*0Sstevel@tonic-gate 
1168*0Sstevel@tonic-gate #endif /* _LIBFSMGT_H */
1169