xref: /onnv-gate/usr/src/lib/libfsmgt/common/fs_dfstab.c (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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*0Sstevel@tonic-gate 
29*0Sstevel@tonic-gate #include <stdio.h>
30*0Sstevel@tonic-gate #include <stdlib.h>
31*0Sstevel@tonic-gate #include <errno.h>
32*0Sstevel@tonic-gate #include <sys/types.h>
33*0Sstevel@tonic-gate #include <ctype.h>
34*0Sstevel@tonic-gate #include <string.h>
35*0Sstevel@tonic-gate #include <strings.h>
36*0Sstevel@tonic-gate #include <thread.h>
37*0Sstevel@tonic-gate #include <synch.h>
38*0Sstevel@tonic-gate #include "libfsmgt.h"
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate /*
41*0Sstevel@tonic-gate  * Private datastructures.
42*0Sstevel@tonic-gate  */
43*0Sstevel@tonic-gate typedef struct dfstab_entry {
44*0Sstevel@tonic-gate 	struct dfstab_entry *next;
45*0Sstevel@tonic-gate 	char    *path;
46*0Sstevel@tonic-gate 	char    *resource;
47*0Sstevel@tonic-gate 	char    *fstype;
48*0Sstevel@tonic-gate 	char    *options;
49*0Sstevel@tonic-gate 	char    *description;
50*0Sstevel@tonic-gate } dfstab_entry_t;
51*0Sstevel@tonic-gate 
52*0Sstevel@tonic-gate static const char *whitespace = " \t";
53*0Sstevel@tonic-gate static mutex_t dfstab_lock = DEFAULTMUTEX;
54*0Sstevel@tonic-gate 
55*0Sstevel@tonic-gate /*
56*0Sstevel@tonic-gate  * Private functions
57*0Sstevel@tonic-gate  */
58*0Sstevel@tonic-gate static dfstab_entry_t *get_dfstab_ents(int *);
59*0Sstevel@tonic-gate static void free_dfstab_list(dfstab_entry_t *);
60*0Sstevel@tonic-gate static dfstab_entry_t *dfstab_line_to_dfstab_entry(char *, int *);
61*0Sstevel@tonic-gate static char *create_share_cmd(dfstab_entry_t *, char *, int *);
62*0Sstevel@tonic-gate static dfstab_entry_t *change_dfstab_ent(dfstab_entry_t *,
63*0Sstevel@tonic-gate 	dfstab_entry_t *, int *);
64*0Sstevel@tonic-gate static void add_entry_to_dfstab(dfstab_entry_t *, int *);
65*0Sstevel@tonic-gate 
66*0Sstevel@tonic-gate 
67*0Sstevel@tonic-gate static dfstab_entry_t *
get_dfstab_ents(int * err)68*0Sstevel@tonic-gate get_dfstab_ents(int *err)
69*0Sstevel@tonic-gate {
70*0Sstevel@tonic-gate 	dfstab_entry_t *dfstablist, *headptr, *tailptr = NULL;
71*0Sstevel@tonic-gate 	FILE *dfp;		/* fp for dfs list */
72*0Sstevel@tonic-gate 	static char cmd[BUFSIZE];
73*0Sstevel@tonic-gate 	*err = 0;
74*0Sstevel@tonic-gate 
75*0Sstevel@tonic-gate 	if ((dfp = fopen(DFSTAB, "r")) != NULL) {
76*0Sstevel@tonic-gate 		char *share_cmd;
77*0Sstevel@tonic-gate 		(void) mutex_lock(&dfstab_lock);
78*0Sstevel@tonic-gate 		while ((share_cmd =
79*0Sstevel@tonic-gate 		    fileutil_getline(dfp, cmd, BUFSIZE)) != NULL) {
80*0Sstevel@tonic-gate 			if ((dfstablist =
81*0Sstevel@tonic-gate 			    dfstab_line_to_dfstab_entry(share_cmd, err)) !=
82*0Sstevel@tonic-gate 			    NULL) {
83*0Sstevel@tonic-gate 				if (tailptr == NULL) {
84*0Sstevel@tonic-gate 					headptr = dfstablist;
85*0Sstevel@tonic-gate 					tailptr = dfstablist;
86*0Sstevel@tonic-gate 				} else {
87*0Sstevel@tonic-gate 					tailptr->next = dfstablist;
88*0Sstevel@tonic-gate 					tailptr = dfstablist;
89*0Sstevel@tonic-gate 				}
90*0Sstevel@tonic-gate 				dfstablist = dfstablist->next;
91*0Sstevel@tonic-gate 			} else {
92*0Sstevel@tonic-gate 				free(share_cmd);
93*0Sstevel@tonic-gate 				break;
94*0Sstevel@tonic-gate 			}
95*0Sstevel@tonic-gate 			free(share_cmd);
96*0Sstevel@tonic-gate 		}
97*0Sstevel@tonic-gate 		if (tailptr == NULL) {
98*0Sstevel@tonic-gate 			headptr = tailptr;
99*0Sstevel@tonic-gate 		}
100*0Sstevel@tonic-gate 		(void) mutex_unlock(&dfstab_lock);
101*0Sstevel@tonic-gate 		fclose(dfp);
102*0Sstevel@tonic-gate 	} else {
103*0Sstevel@tonic-gate 		*err = errno;
104*0Sstevel@tonic-gate 		(void) fprintf(stderr, "%s: cannot open %s\n", cmd, DFSTAB);
105*0Sstevel@tonic-gate 		headptr = NULL;
106*0Sstevel@tonic-gate 	}
107*0Sstevel@tonic-gate 	return (headptr);
108*0Sstevel@tonic-gate } /* get_dfstab_ents */
109*0Sstevel@tonic-gate 
110*0Sstevel@tonic-gate static void
add_entry_to_dfstab(dfstab_entry_t * list,int * err)111*0Sstevel@tonic-gate add_entry_to_dfstab(dfstab_entry_t *list, int *err)
112*0Sstevel@tonic-gate {
113*0Sstevel@tonic-gate 	FILE *dfp;		/* fp for dfs list */
114*0Sstevel@tonic-gate 
115*0Sstevel@tonic-gate 	if ((dfp = fopen(DFSTAB, "a")) != NULL) {
116*0Sstevel@tonic-gate 		char *share_cmd;
117*0Sstevel@tonic-gate 		if ((share_cmd = create_share_cmd(list, NULL, err)) != NULL) {
118*0Sstevel@tonic-gate 			(void) mutex_lock(&dfstab_lock);
119*0Sstevel@tonic-gate 			fprintf(dfp, "%s", share_cmd);
120*0Sstevel@tonic-gate 			fclose(dfp);
121*0Sstevel@tonic-gate 			(void) mutex_unlock(&dfstab_lock);
122*0Sstevel@tonic-gate 			free(share_cmd);
123*0Sstevel@tonic-gate 		} else {
124*0Sstevel@tonic-gate 			*err = errno;
125*0Sstevel@tonic-gate 		}
126*0Sstevel@tonic-gate 	} else {
127*0Sstevel@tonic-gate 		*err = errno;
128*0Sstevel@tonic-gate 	}
129*0Sstevel@tonic-gate 
130*0Sstevel@tonic-gate } /* add_entry_to_dfstab */
131*0Sstevel@tonic-gate 
132*0Sstevel@tonic-gate static void
free_dfstab_list(dfstab_entry_t * headp)133*0Sstevel@tonic-gate free_dfstab_list(dfstab_entry_t *headp)
134*0Sstevel@tonic-gate {
135*0Sstevel@tonic-gate 	dfstab_entry_t *tmp = headp;
136*0Sstevel@tonic-gate 
137*0Sstevel@tonic-gate 	while (headp != NULL) {
138*0Sstevel@tonic-gate 		tmp = headp->next;
139*0Sstevel@tonic-gate 		if (headp->path != NULL) {
140*0Sstevel@tonic-gate 			free(headp->path);
141*0Sstevel@tonic-gate 		}
142*0Sstevel@tonic-gate 		if (headp->resource != NULL) {
143*0Sstevel@tonic-gate 			free(headp->resource);
144*0Sstevel@tonic-gate 		}
145*0Sstevel@tonic-gate 		if (headp->fstype != NULL) {
146*0Sstevel@tonic-gate 			free(headp->fstype);
147*0Sstevel@tonic-gate 		}
148*0Sstevel@tonic-gate 		if (headp->options != NULL) {
149*0Sstevel@tonic-gate 			free(headp->options);
150*0Sstevel@tonic-gate 		}
151*0Sstevel@tonic-gate 		if (headp->description != NULL) {
152*0Sstevel@tonic-gate 			free(headp->description);
153*0Sstevel@tonic-gate 		}
154*0Sstevel@tonic-gate 		headp->next = NULL;
155*0Sstevel@tonic-gate 		free(headp);
156*0Sstevel@tonic-gate 		headp = tmp;
157*0Sstevel@tonic-gate 	}
158*0Sstevel@tonic-gate } /* free_dfstab_list */
159*0Sstevel@tonic-gate 
160*0Sstevel@tonic-gate static char *
create_share_cmd(dfstab_entry_t * new_entry,char * temp_line,int * err)161*0Sstevel@tonic-gate create_share_cmd(dfstab_entry_t *new_entry, char *temp_line, int *err)
162*0Sstevel@tonic-gate {
163*0Sstevel@tonic-gate 	char tempstr[BUFSIZE];
164*0Sstevel@tonic-gate 	char *cmd, *ret_val;
165*0Sstevel@tonic-gate 
166*0Sstevel@tonic-gate 	cmd = (char *)calloc((size_t)1, BUFSIZE);
167*0Sstevel@tonic-gate 	if (cmd == NULL) {
168*0Sstevel@tonic-gate 		*err = errno;
169*0Sstevel@tonic-gate 		return (NULL);
170*0Sstevel@tonic-gate 	}
171*0Sstevel@tonic-gate 	sprintf(cmd, "share ");
172*0Sstevel@tonic-gate 	if (new_entry->fstype) {
173*0Sstevel@tonic-gate 		sprintf(tempstr, "-F %s ", new_entry->fstype);
174*0Sstevel@tonic-gate 		strlcat(cmd, tempstr, BUFSIZE);
175*0Sstevel@tonic-gate 	}
176*0Sstevel@tonic-gate 	if (new_entry->options) {
177*0Sstevel@tonic-gate 		sprintf(tempstr, "-o %s ", new_entry->options);
178*0Sstevel@tonic-gate 		strlcat(cmd, tempstr, BUFSIZE);
179*0Sstevel@tonic-gate 	}
180*0Sstevel@tonic-gate 	if (new_entry->description) {
181*0Sstevel@tonic-gate 		sprintf(tempstr, "-d %s ",
182*0Sstevel@tonic-gate 		    new_entry->description);
183*0Sstevel@tonic-gate 		strlcat(cmd, tempstr, BUFSIZE);
184*0Sstevel@tonic-gate 	}
185*0Sstevel@tonic-gate 	sprintf(tempstr, "%s\n", new_entry->path);
186*0Sstevel@tonic-gate 	strlcat(cmd, tempstr, BUFSIZE);
187*0Sstevel@tonic-gate 	if (temp_line != NULL && strchr(temp_line, '#')) {
188*0Sstevel@tonic-gate 		sprintf(tempstr, " %s", strchr(temp_line, '#'));
189*0Sstevel@tonic-gate 		strlcat(cmd, tempstr, BUFSIZE);
190*0Sstevel@tonic-gate 	}
191*0Sstevel@tonic-gate 	ret_val = strdup(cmd);
192*0Sstevel@tonic-gate 	free(cmd);
193*0Sstevel@tonic-gate 	return (ret_val);
194*0Sstevel@tonic-gate } /* create_share_cmd */
195*0Sstevel@tonic-gate 
196*0Sstevel@tonic-gate /*
197*0Sstevel@tonic-gate  * dfstab_line_to_dfstab_entry - parses a line from dfstab and fills in
198*0Sstevel@tonic-gate  * the fields of a dfstab_entry_t structure
199*0Sstevel@tonic-gate  * Parameters:
200*0Sstevel@tonic-gate  * char *cmd - the share command or dfstab line to be parsed
201*0Sstevel@tonic-gate  * int *err - a pointer for returning any error codes encountered
202*0Sstevel@tonic-gate  */
203*0Sstevel@tonic-gate static dfstab_entry_t *
dfstab_line_to_dfstab_entry(char * cmd,int * err)204*0Sstevel@tonic-gate dfstab_line_to_dfstab_entry(char *cmd, int *err)
205*0Sstevel@tonic-gate {
206*0Sstevel@tonic-gate 
207*0Sstevel@tonic-gate 	dfstab_entry_t *dfstablist;
208*0Sstevel@tonic-gate 	extern char *optarg;
209*0Sstevel@tonic-gate 	extern int optind;
210*0Sstevel@tonic-gate 	int c, argcount = 0;
211*0Sstevel@tonic-gate 	char *temp_str;
212*0Sstevel@tonic-gate 	char *arglist[LINESZ];
213*0Sstevel@tonic-gate 
214*0Sstevel@tonic-gate 	c = 0;
215*0Sstevel@tonic-gate 	optind = 1;
216*0Sstevel@tonic-gate 
217*0Sstevel@tonic-gate 	temp_str = strdup(cmd);
218*0Sstevel@tonic-gate 	if (temp_str == NULL) {
219*0Sstevel@tonic-gate 		*err = ENOMEM;
220*0Sstevel@tonic-gate 		return (NULL);
221*0Sstevel@tonic-gate 	}
222*0Sstevel@tonic-gate 
223*0Sstevel@tonic-gate 	for (arglist[argcount] = strtok(temp_str, whitespace);
224*0Sstevel@tonic-gate 	    arglist[argcount] != NULL; /* CSTYLED */) {
225*0Sstevel@tonic-gate 		arglist[++argcount] = strtok(NULL, whitespace);
226*0Sstevel@tonic-gate 	}
227*0Sstevel@tonic-gate 	argcount--;
228*0Sstevel@tonic-gate 	dfstablist =
229*0Sstevel@tonic-gate 	    (dfstab_entry_t *)calloc((size_t)1,
230*0Sstevel@tonic-gate 	    sizeof (dfstab_entry_t));
231*0Sstevel@tonic-gate 	if (dfstablist == NULL) {
232*0Sstevel@tonic-gate 		*err = ENOMEM;
233*0Sstevel@tonic-gate 		free(temp_str);
234*0Sstevel@tonic-gate 		return (NULL);
235*0Sstevel@tonic-gate 	}
236*0Sstevel@tonic-gate 	while ((c = getopt(argcount, arglist, "F:d:o:")) != -1) {
237*0Sstevel@tonic-gate 		switch (c) {
238*0Sstevel@tonic-gate 		case 'F':
239*0Sstevel@tonic-gate 					/* file system type */
240*0Sstevel@tonic-gate 					/* at most one -F */
241*0Sstevel@tonic-gate 			*err |= (dfstablist->fstype != NULL);
242*0Sstevel@tonic-gate 			dfstablist->fstype = strdup(optarg);
243*0Sstevel@tonic-gate 			if (dfstablist->fstype == NULL) {
244*0Sstevel@tonic-gate 				*err = ENOMEM;
245*0Sstevel@tonic-gate 				free_dfstab_list(dfstablist);
246*0Sstevel@tonic-gate 				free(temp_str);
247*0Sstevel@tonic-gate 				return (NULL);
248*0Sstevel@tonic-gate 			}
249*0Sstevel@tonic-gate 			break;
250*0Sstevel@tonic-gate 		case 'd':		/* description */
251*0Sstevel@tonic-gate 					/* at most one -d */
252*0Sstevel@tonic-gate 			*err |= (dfstablist->description != NULL);
253*0Sstevel@tonic-gate 			dfstablist->description = strdup(optarg);
254*0Sstevel@tonic-gate 			if (dfstablist->description == NULL) {
255*0Sstevel@tonic-gate 				*err = ENOMEM;
256*0Sstevel@tonic-gate 				free_dfstab_list(dfstablist);
257*0Sstevel@tonic-gate 				free(temp_str);
258*0Sstevel@tonic-gate 				return (NULL);
259*0Sstevel@tonic-gate 			}
260*0Sstevel@tonic-gate 			break;
261*0Sstevel@tonic-gate 		case 'o':		/* fs specific options */
262*0Sstevel@tonic-gate 					/* at most one - o */
263*0Sstevel@tonic-gate 			*err |= (dfstablist->options != NULL);
264*0Sstevel@tonic-gate 			dfstablist->options = strdup(optarg);
265*0Sstevel@tonic-gate 			if (dfstablist->options == NULL) {
266*0Sstevel@tonic-gate 				*err = ENOMEM;
267*0Sstevel@tonic-gate 				free_dfstab_list(dfstablist);
268*0Sstevel@tonic-gate 				free(temp_str);
269*0Sstevel@tonic-gate 				return (NULL);
270*0Sstevel@tonic-gate 			}
271*0Sstevel@tonic-gate 			break;
272*0Sstevel@tonic-gate 		case '?':
273*0Sstevel@tonic-gate 			*err = 1;
274*0Sstevel@tonic-gate 			break;
275*0Sstevel@tonic-gate 		}
276*0Sstevel@tonic-gate 	}
277*0Sstevel@tonic-gate 	if (dfstablist->fstype == NULL) {
278*0Sstevel@tonic-gate 		FILE *fp;
279*0Sstevel@tonic-gate 
280*0Sstevel@tonic-gate 		if ((fp = fopen(DFSTYPES, "r")) == NULL) {
281*0Sstevel@tonic-gate 			(void) fprintf(stderr, "%s: cannot open %s\n",
282*0Sstevel@tonic-gate 			    cmd, DFSTYPES);
283*0Sstevel@tonic-gate 			free_dfstab_list(dfstablist);
284*0Sstevel@tonic-gate 			free(temp_str);
285*0Sstevel@tonic-gate 			return (NULL);
286*0Sstevel@tonic-gate 		}
287*0Sstevel@tonic-gate 		(void) mutex_lock(&dfstab_lock);
288*0Sstevel@tonic-gate 		dfstablist->fstype = strdup(fileutil_getfs(fp));
289*0Sstevel@tonic-gate 		(void) mutex_unlock(&dfstab_lock);
290*0Sstevel@tonic-gate 		fclose(fp);
291*0Sstevel@tonic-gate 	}
292*0Sstevel@tonic-gate 	dfstablist->path = strdup(arglist[argcount]);
293*0Sstevel@tonic-gate 	if (dfstablist->path == NULL) {
294*0Sstevel@tonic-gate 		*err = ENOMEM;
295*0Sstevel@tonic-gate 		free_dfstab_list(dfstablist);
296*0Sstevel@tonic-gate 		free(temp_str);
297*0Sstevel@tonic-gate 		return (NULL);
298*0Sstevel@tonic-gate 	}
299*0Sstevel@tonic-gate 	free(temp_str);
300*0Sstevel@tonic-gate 	return (dfstablist);
301*0Sstevel@tonic-gate } /* dfstab_line_to_dfstab_entry */
302*0Sstevel@tonic-gate 
303*0Sstevel@tonic-gate static dfstab_entry_t *
change_dfstab_ent(dfstab_entry_t * old_entry,dfstab_entry_t * new_entry,int * err)304*0Sstevel@tonic-gate change_dfstab_ent(
305*0Sstevel@tonic-gate 	dfstab_entry_t *old_entry,
306*0Sstevel@tonic-gate 	dfstab_entry_t *new_entry,
307*0Sstevel@tonic-gate 	int *err)
308*0Sstevel@tonic-gate {
309*0Sstevel@tonic-gate 
310*0Sstevel@tonic-gate 	FILE *fp;
311*0Sstevel@tonic-gate 	dfstab_entry_t *temp_list, *ret_val;
312*0Sstevel@tonic-gate 	char cmd[BUFSIZE];
313*0Sstevel@tonic-gate 	char **temp_dfstab = NULL;
314*0Sstevel@tonic-gate 	int line_found = 0;
315*0Sstevel@tonic-gate 
316*0Sstevel@tonic-gate 	if ((fp = fopen(DFSTAB, "r")) != NULL) {
317*0Sstevel@tonic-gate 		char *share_cmd;
318*0Sstevel@tonic-gate 		int count = 0;
319*0Sstevel@tonic-gate 		(void) mutex_lock(&dfstab_lock);
320*0Sstevel@tonic-gate 		while (fgets(cmd, BUFSIZE, fp) != NULL) {
321*0Sstevel@tonic-gate 			if ((share_cmd =
322*0Sstevel@tonic-gate 			    fileutil_get_cmd_from_string(cmd)) == NULL) {
323*0Sstevel@tonic-gate 				if (!fileutil_add_string_to_array(
324*0Sstevel@tonic-gate 				    &temp_dfstab, cmd, &count, err)) {
325*0Sstevel@tonic-gate 					ret_val = NULL;
326*0Sstevel@tonic-gate 					line_found = 0;
327*0Sstevel@tonic-gate 					break;
328*0Sstevel@tonic-gate 				}
329*0Sstevel@tonic-gate 				continue;
330*0Sstevel@tonic-gate 			}
331*0Sstevel@tonic-gate 			if ((temp_list =
332*0Sstevel@tonic-gate 			    dfstab_line_to_dfstab_entry(share_cmd, err)) ==
333*0Sstevel@tonic-gate 			    NULL) {
334*0Sstevel@tonic-gate 				free(share_cmd);
335*0Sstevel@tonic-gate 				ret_val = NULL;
336*0Sstevel@tonic-gate 				break;
337*0Sstevel@tonic-gate 			}
338*0Sstevel@tonic-gate 			if (strcmp(old_entry->path,
339*0Sstevel@tonic-gate 			    temp_list->path) == 0) {
340*0Sstevel@tonic-gate 				char *new_cmd = NULL;
341*0Sstevel@tonic-gate 				line_found = 1;
342*0Sstevel@tonic-gate 				if (new_entry != NULL && (new_cmd =
343*0Sstevel@tonic-gate 				    create_share_cmd(new_entry, cmd,
344*0Sstevel@tonic-gate 				    err)) != NULL) {
345*0Sstevel@tonic-gate 					if (!fileutil_add_string_to_array(
346*0Sstevel@tonic-gate 					    &temp_dfstab, new_cmd, &count,
347*0Sstevel@tonic-gate 					    err)) {
348*0Sstevel@tonic-gate 						ret_val = NULL;
349*0Sstevel@tonic-gate 						line_found = 0;
350*0Sstevel@tonic-gate 						free(share_cmd);
351*0Sstevel@tonic-gate 						free(new_cmd);
352*0Sstevel@tonic-gate 						break;
353*0Sstevel@tonic-gate 					}
354*0Sstevel@tonic-gate 					free(new_cmd);
355*0Sstevel@tonic-gate 				}
356*0Sstevel@tonic-gate 			} else {
357*0Sstevel@tonic-gate 				if (!fileutil_add_string_to_array(
358*0Sstevel@tonic-gate 				    &temp_dfstab, cmd, &count, err)) {
359*0Sstevel@tonic-gate 					free(share_cmd);
360*0Sstevel@tonic-gate 					ret_val = NULL;
361*0Sstevel@tonic-gate 					line_found = 0;
362*0Sstevel@tonic-gate 					break;
363*0Sstevel@tonic-gate 				}
364*0Sstevel@tonic-gate 			}
365*0Sstevel@tonic-gate 			free_dfstab_list(temp_list);
366*0Sstevel@tonic-gate 			free(share_cmd);
367*0Sstevel@tonic-gate 		}
368*0Sstevel@tonic-gate 		fclose(fp);
369*0Sstevel@tonic-gate 
370*0Sstevel@tonic-gate 		if (line_found && temp_dfstab != NULL) {
371*0Sstevel@tonic-gate 			if ((fp = fopen(DFSTAB, "w")) != NULL) {
372*0Sstevel@tonic-gate 				int i;
373*0Sstevel@tonic-gate 				for (i = 0; i < count; i++) {
374*0Sstevel@tonic-gate 					fprintf(fp, "%s", temp_dfstab[i]);
375*0Sstevel@tonic-gate 				}
376*0Sstevel@tonic-gate 				fclose(fp);
377*0Sstevel@tonic-gate 				(void) mutex_unlock(&dfstab_lock);
378*0Sstevel@tonic-gate 				ret_val = get_dfstab_ents(err);
379*0Sstevel@tonic-gate 				fileutil_free_string_array(temp_dfstab, count);
380*0Sstevel@tonic-gate 			} else {
381*0Sstevel@tonic-gate 				*err = errno;
382*0Sstevel@tonic-gate 				(void) mutex_unlock(&dfstab_lock);
383*0Sstevel@tonic-gate 				fileutil_free_string_array(temp_dfstab, count);
384*0Sstevel@tonic-gate 				ret_val = NULL;
385*0Sstevel@tonic-gate 			}
386*0Sstevel@tonic-gate 		} else {
387*0Sstevel@tonic-gate 			(void) mutex_unlock(&dfstab_lock);
388*0Sstevel@tonic-gate 			if (temp_dfstab != NULL) {
389*0Sstevel@tonic-gate 				fileutil_free_string_array(temp_dfstab, count);
390*0Sstevel@tonic-gate 			}
391*0Sstevel@tonic-gate 			ret_val = NULL;
392*0Sstevel@tonic-gate 		}
393*0Sstevel@tonic-gate 	} else {
394*0Sstevel@tonic-gate 		*err = errno;
395*0Sstevel@tonic-gate 		ret_val = NULL;
396*0Sstevel@tonic-gate 	}
397*0Sstevel@tonic-gate 	return (ret_val);
398*0Sstevel@tonic-gate } /* change_dfstab_ent */
399*0Sstevel@tonic-gate 
400*0Sstevel@tonic-gate /*
401*0Sstevel@tonic-gate  * Public accessor functions.
402*0Sstevel@tonic-gate  */
403*0Sstevel@tonic-gate 
404*0Sstevel@tonic-gate /*
405*0Sstevel@tonic-gate  * fs_add_DFStab_ent - adds an entry to dfstab and to the list of dfstab
406*0Sstevel@tonic-gate  * entries. Returns a pointer to the head of the dfstab entry list.
407*0Sstevel@tonic-gate  * Parameters:
408*0Sstevel@tonic-gate  * char *cmd - the same command to be added to dstab
409*0Sstevel@tonic-gate  * int *err - an error pointer for retruning any errors
410*0Sstevel@tonic-gate  */
411*0Sstevel@tonic-gate fs_dfstab_entry_t
fs_add_DFStab_ent(char * cmd,int * err)412*0Sstevel@tonic-gate fs_add_DFStab_ent(char *cmd, int *err)
413*0Sstevel@tonic-gate {
414*0Sstevel@tonic-gate 	dfstab_entry_t *dfstab_ent;
415*0Sstevel@tonic-gate 
416*0Sstevel@tonic-gate 	dfstab_ent = dfstab_line_to_dfstab_entry(cmd, err);
417*0Sstevel@tonic-gate 	if (dfstab_ent == NULL) {
418*0Sstevel@tonic-gate 		*err = errno;
419*0Sstevel@tonic-gate 		return (NULL);
420*0Sstevel@tonic-gate 	}
421*0Sstevel@tonic-gate 	add_entry_to_dfstab(dfstab_ent, err);
422*0Sstevel@tonic-gate 	if (*err != 0) {
423*0Sstevel@tonic-gate 		free_dfstab_list(dfstab_ent);
424*0Sstevel@tonic-gate 		return (NULL);
425*0Sstevel@tonic-gate 	}
426*0Sstevel@tonic-gate 	free_dfstab_list(dfstab_ent);
427*0Sstevel@tonic-gate 	return (get_dfstab_ents(err));
428*0Sstevel@tonic-gate }
429*0Sstevel@tonic-gate 
430*0Sstevel@tonic-gate /*
431*0Sstevel@tonic-gate  * set_DFStab_ent - adds an entry to dfstab and to the list of dfstab entries.
432*0Sstevel@tonic-gate  * returns a pointer to the head of the dfstab entry list.
433*0Sstevel@tonic-gate  */
434*0Sstevel@tonic-gate fs_dfstab_entry_t
fs_set_DFStab_ent(char * path,char * fstype,char * options,char * description,int * err)435*0Sstevel@tonic-gate fs_set_DFStab_ent(
436*0Sstevel@tonic-gate 	char *path,
437*0Sstevel@tonic-gate 	char *fstype,
438*0Sstevel@tonic-gate 	char *options,
439*0Sstevel@tonic-gate 	char *description,
440*0Sstevel@tonic-gate 	int *err)
441*0Sstevel@tonic-gate {
442*0Sstevel@tonic-gate 
443*0Sstevel@tonic-gate 	dfstab_entry_t *new_entry;
444*0Sstevel@tonic-gate 	new_entry = (dfstab_entry_t *)calloc((size_t)1,
445*0Sstevel@tonic-gate 	    sizeof (dfstab_entry_t));
446*0Sstevel@tonic-gate 	if (new_entry == NULL) {
447*0Sstevel@tonic-gate 		*err = ENOMEM;
448*0Sstevel@tonic-gate 		return (NULL);
449*0Sstevel@tonic-gate 	}
450*0Sstevel@tonic-gate 	if (path != NULL) {
451*0Sstevel@tonic-gate 		new_entry->path = strdup(path);
452*0Sstevel@tonic-gate 	} else {
453*0Sstevel@tonic-gate 		*err = EINVAL;
454*0Sstevel@tonic-gate 		free_dfstab_list(new_entry);
455*0Sstevel@tonic-gate 		return (NULL);
456*0Sstevel@tonic-gate 	}
457*0Sstevel@tonic-gate 	if (fstype != NULL) {
458*0Sstevel@tonic-gate 		new_entry->fstype = strdup(fstype);
459*0Sstevel@tonic-gate 	} else {
460*0Sstevel@tonic-gate 		FILE *fp;
461*0Sstevel@tonic-gate 
462*0Sstevel@tonic-gate 		if ((fp = fopen(DFSTYPES, "r")) == NULL) {
463*0Sstevel@tonic-gate 			/* change this to error handler */
464*0Sstevel@tonic-gate 			(void) fprintf(stderr, "cannot open %s\n",
465*0Sstevel@tonic-gate 			    DFSTYPES);
466*0Sstevel@tonic-gate 			free_dfstab_list(new_entry);
467*0Sstevel@tonic-gate 			return (NULL);
468*0Sstevel@tonic-gate 		}
469*0Sstevel@tonic-gate 		(void) mutex_lock(&dfstab_lock);
470*0Sstevel@tonic-gate 		new_entry->fstype = strdup(fileutil_getfs(fp));
471*0Sstevel@tonic-gate 		(void) mutex_unlock(&dfstab_lock);
472*0Sstevel@tonic-gate 		fclose(fp);
473*0Sstevel@tonic-gate 	}
474*0Sstevel@tonic-gate 	if (options != NULL) {
475*0Sstevel@tonic-gate 		new_entry->options = strdup(options);
476*0Sstevel@tonic-gate 	}
477*0Sstevel@tonic-gate 	if (description != NULL) {
478*0Sstevel@tonic-gate 		new_entry->description = strdup(description);
479*0Sstevel@tonic-gate 	}
480*0Sstevel@tonic-gate 	add_entry_to_dfstab(new_entry, err);
481*0Sstevel@tonic-gate 	if (*err != 0) {
482*0Sstevel@tonic-gate 		free_dfstab_list(new_entry);
483*0Sstevel@tonic-gate 		return (NULL);
484*0Sstevel@tonic-gate 	}
485*0Sstevel@tonic-gate 	free_dfstab_list(new_entry);
486*0Sstevel@tonic-gate 	return (get_dfstab_ents(err));
487*0Sstevel@tonic-gate } /* set_DFStab_ent */
488*0Sstevel@tonic-gate 
489*0Sstevel@tonic-gate /*
490*0Sstevel@tonic-gate  * Accessor function for path element of dfstab entry.
491*0Sstevel@tonic-gate  */
492*0Sstevel@tonic-gate char *
fs_get_DFStab_ent_Path(void * entry)493*0Sstevel@tonic-gate fs_get_DFStab_ent_Path(void *entry)
494*0Sstevel@tonic-gate {
495*0Sstevel@tonic-gate 	dfstab_entry_t *entryptr = (dfstab_entry_t *)entry;
496*0Sstevel@tonic-gate 	if (entryptr == NULL) {
497*0Sstevel@tonic-gate 		return (NULL);
498*0Sstevel@tonic-gate 	}
499*0Sstevel@tonic-gate 	return (entryptr->path);
500*0Sstevel@tonic-gate } /* get_DFStab_ent_Path */
501*0Sstevel@tonic-gate 
502*0Sstevel@tonic-gate /*
503*0Sstevel@tonic-gate  * Accessor function for fstype element of dfstab entry.
504*0Sstevel@tonic-gate  */
505*0Sstevel@tonic-gate char *
fs_get_DFStab_ent_Fstype(void * entry)506*0Sstevel@tonic-gate fs_get_DFStab_ent_Fstype(void *entry)
507*0Sstevel@tonic-gate {
508*0Sstevel@tonic-gate 	dfstab_entry_t *entryptr = (dfstab_entry_t *)entry;
509*0Sstevel@tonic-gate 	if (entryptr == NULL) {
510*0Sstevel@tonic-gate 		return (NULL);
511*0Sstevel@tonic-gate 	}
512*0Sstevel@tonic-gate 	return (entryptr->fstype);
513*0Sstevel@tonic-gate }
514*0Sstevel@tonic-gate 
515*0Sstevel@tonic-gate /*
516*0Sstevel@tonic-gate  * Accessor function for options element of dfstab entry.
517*0Sstevel@tonic-gate  */
518*0Sstevel@tonic-gate char *
fs_get_DFStab_ent_Options(void * entry)519*0Sstevel@tonic-gate fs_get_DFStab_ent_Options(void *entry)
520*0Sstevel@tonic-gate {
521*0Sstevel@tonic-gate 	dfstab_entry_t *entryptr = (dfstab_entry_t *)entry;
522*0Sstevel@tonic-gate 	if (entryptr == NULL) {
523*0Sstevel@tonic-gate 		return (NULL);
524*0Sstevel@tonic-gate 	}
525*0Sstevel@tonic-gate 	return (entryptr->options);
526*0Sstevel@tonic-gate }
527*0Sstevel@tonic-gate 
528*0Sstevel@tonic-gate /*
529*0Sstevel@tonic-gate  * Accessor function for description element of dfstab entry.
530*0Sstevel@tonic-gate  */
531*0Sstevel@tonic-gate char *
fs_get_DFStab_ent_Desc(void * entry)532*0Sstevel@tonic-gate fs_get_DFStab_ent_Desc(void *entry)
533*0Sstevel@tonic-gate {
534*0Sstevel@tonic-gate 	dfstab_entry_t *entryptr = (dfstab_entry_t *)entry;
535*0Sstevel@tonic-gate 	if (entryptr == NULL) {
536*0Sstevel@tonic-gate 		return (NULL);
537*0Sstevel@tonic-gate 	}
538*0Sstevel@tonic-gate 	return (entryptr->description);
539*0Sstevel@tonic-gate }
540*0Sstevel@tonic-gate 
541*0Sstevel@tonic-gate /*
542*0Sstevel@tonic-gate  * Accessor function for resource element of dfstab entry.
543*0Sstevel@tonic-gate  */
544*0Sstevel@tonic-gate char *
fs_get_DFStab_ent_Res(void * entry)545*0Sstevel@tonic-gate fs_get_DFStab_ent_Res(void *entry)
546*0Sstevel@tonic-gate {
547*0Sstevel@tonic-gate 	dfstab_entry_t *entryptr = (dfstab_entry_t *)entry;
548*0Sstevel@tonic-gate 	if (entryptr == NULL) {
549*0Sstevel@tonic-gate 		return (NULL);
550*0Sstevel@tonic-gate 	}
551*0Sstevel@tonic-gate 	return (entryptr->resource);
552*0Sstevel@tonic-gate }
553*0Sstevel@tonic-gate 
554*0Sstevel@tonic-gate 
555*0Sstevel@tonic-gate /*
556*0Sstevel@tonic-gate  * Calls get_dfstab_ents to create the list of dfstab
557*0Sstevel@tonic-gate  * entries and returns that list.
558*0Sstevel@tonic-gate  */
559*0Sstevel@tonic-gate fs_dfstab_entry_t
fs_get_DFStab_ents(int * err)560*0Sstevel@tonic-gate fs_get_DFStab_ents(int *err)
561*0Sstevel@tonic-gate {
562*0Sstevel@tonic-gate 	dfstab_entry_t *list;
563*0Sstevel@tonic-gate 	list = get_dfstab_ents(err);
564*0Sstevel@tonic-gate 	return (list);
565*0Sstevel@tonic-gate }
566*0Sstevel@tonic-gate 
567*0Sstevel@tonic-gate /*
568*0Sstevel@tonic-gate  * Retrives and returns the next entry in the list.
569*0Sstevel@tonic-gate  */
570*0Sstevel@tonic-gate fs_dfstab_entry_t
fs_get_DFStab_ent_Next(void * list)571*0Sstevel@tonic-gate fs_get_DFStab_ent_Next(void *list)
572*0Sstevel@tonic-gate {
573*0Sstevel@tonic-gate 	dfstab_entry_t *listptr = (dfstab_entry_t *)list;
574*0Sstevel@tonic-gate 	if (listptr == NULL) {
575*0Sstevel@tonic-gate 		return (NULL);
576*0Sstevel@tonic-gate 	}
577*0Sstevel@tonic-gate 	return (listptr->next);
578*0Sstevel@tonic-gate }
579*0Sstevel@tonic-gate 
580*0Sstevel@tonic-gate /*
581*0Sstevel@tonic-gate  * Retrives and returns a share command based on the dfstab entry passed in.
582*0Sstevel@tonic-gate  */
583*0Sstevel@tonic-gate char *
fs_get_Dfstab_share_cmd(fs_dfstab_entry_t dfstab_ent,int * err)584*0Sstevel@tonic-gate fs_get_Dfstab_share_cmd(fs_dfstab_entry_t dfstab_ent, int *err)
585*0Sstevel@tonic-gate {
586*0Sstevel@tonic-gate 	char *share_cmd;
587*0Sstevel@tonic-gate 	if (dfstab_ent == NULL) {
588*0Sstevel@tonic-gate 		return (NULL);
589*0Sstevel@tonic-gate 	}
590*0Sstevel@tonic-gate 	share_cmd = create_share_cmd((dfstab_entry_t *)dfstab_ent, NULL, err);
591*0Sstevel@tonic-gate 	return (share_cmd);
592*0Sstevel@tonic-gate } /* fs_get_Dfstab_share_cmd */
593*0Sstevel@tonic-gate 
594*0Sstevel@tonic-gate /*
595*0Sstevel@tonic-gate  * edit_DFStab_ent - changes an entry in dfstab.
596*0Sstevel@tonic-gate  */
597*0Sstevel@tonic-gate fs_dfstab_entry_t
fs_edit_DFStab_ent(char * old_cmd,char * new_cmd,int * err)598*0Sstevel@tonic-gate fs_edit_DFStab_ent(char *old_cmd, char *new_cmd, int *err)
599*0Sstevel@tonic-gate {
600*0Sstevel@tonic-gate 	dfstab_entry_t *old_dfstabent, *new_dfstabent, *ret_val;
601*0Sstevel@tonic-gate 
602*0Sstevel@tonic-gate 	if ((old_dfstabent =
603*0Sstevel@tonic-gate 	    dfstab_line_to_dfstab_entry(old_cmd, err)) == NULL) {
604*0Sstevel@tonic-gate 		return (NULL);
605*0Sstevel@tonic-gate 	}
606*0Sstevel@tonic-gate 	if ((new_dfstabent =
607*0Sstevel@tonic-gate 	    dfstab_line_to_dfstab_entry(new_cmd, err)) == NULL) {
608*0Sstevel@tonic-gate 		return (NULL);
609*0Sstevel@tonic-gate 	}
610*0Sstevel@tonic-gate 	if ((ret_val =
611*0Sstevel@tonic-gate 	    change_dfstab_ent(old_dfstabent, new_dfstabent, err)) == NULL) {
612*0Sstevel@tonic-gate 		return (NULL);
613*0Sstevel@tonic-gate 	}
614*0Sstevel@tonic-gate 	free_dfstab_list(old_dfstabent);
615*0Sstevel@tonic-gate 	free_dfstab_list(new_dfstabent);
616*0Sstevel@tonic-gate 	return (ret_val);
617*0Sstevel@tonic-gate }
618*0Sstevel@tonic-gate 
619*0Sstevel@tonic-gate /*
620*0Sstevel@tonic-gate  * del_DFStab_ent - deletes an entry in dfstab.
621*0Sstevel@tonic-gate  */
622*0Sstevel@tonic-gate fs_dfstab_entry_t
fs_del_DFStab_ent(char * del_cmd,int * err)623*0Sstevel@tonic-gate fs_del_DFStab_ent(char *del_cmd, int *err)
624*0Sstevel@tonic-gate {
625*0Sstevel@tonic-gate 	dfstab_entry_t *del_dfstabent, *ret_val;
626*0Sstevel@tonic-gate 
627*0Sstevel@tonic-gate 	if ((del_dfstabent =
628*0Sstevel@tonic-gate 	    dfstab_line_to_dfstab_entry(del_cmd, err)) == NULL) {
629*0Sstevel@tonic-gate 		return (NULL);
630*0Sstevel@tonic-gate 	}
631*0Sstevel@tonic-gate 	if ((ret_val =
632*0Sstevel@tonic-gate 	    change_dfstab_ent(del_dfstabent, NULL, err)) == NULL) {
633*0Sstevel@tonic-gate 		return (NULL);
634*0Sstevel@tonic-gate 	}
635*0Sstevel@tonic-gate 	free_dfstab_list(del_dfstabent);
636*0Sstevel@tonic-gate 	return (ret_val);
637*0Sstevel@tonic-gate }
638*0Sstevel@tonic-gate 
639*0Sstevel@tonic-gate /*
640*0Sstevel@tonic-gate  * del_All_DFStab_ents_with_Path - deletes all duplicate entries with
641*0Sstevel@tonic-gate  * the specified path.
642*0Sstevel@tonic-gate  */
643*0Sstevel@tonic-gate fs_dfstab_entry_t
fs_del_All_DFStab_ents_with_Path(char * path,int * err)644*0Sstevel@tonic-gate fs_del_All_DFStab_ents_with_Path(char *path, int *err)
645*0Sstevel@tonic-gate {
646*0Sstevel@tonic-gate 	dfstab_entry_t del_dfstabent, *ret_val;
647*0Sstevel@tonic-gate 
648*0Sstevel@tonic-gate 	if (path != NULL) {
649*0Sstevel@tonic-gate 		if ((del_dfstabent.path = strdup(path)) != NULL) {
650*0Sstevel@tonic-gate 			if ((ret_val = change_dfstab_ent(&del_dfstabent,
651*0Sstevel@tonic-gate 			    NULL, err)) == NULL) {
652*0Sstevel@tonic-gate 				ret_val = NULL;
653*0Sstevel@tonic-gate 			}
654*0Sstevel@tonic-gate 			free(del_dfstabent.path);
655*0Sstevel@tonic-gate 		} else {
656*0Sstevel@tonic-gate 			*err = ENOMEM;
657*0Sstevel@tonic-gate 			ret_val = NULL;
658*0Sstevel@tonic-gate 		}
659*0Sstevel@tonic-gate 	} else {
660*0Sstevel@tonic-gate 		*err = EINVAL;
661*0Sstevel@tonic-gate 		ret_val = NULL;
662*0Sstevel@tonic-gate 	}
663*0Sstevel@tonic-gate 	return (ret_val);
664*0Sstevel@tonic-gate }
665*0Sstevel@tonic-gate 
666*0Sstevel@tonic-gate 
667*0Sstevel@tonic-gate int
fs_check_for_duplicate_DFStab_paths(char * path,int * err)668*0Sstevel@tonic-gate fs_check_for_duplicate_DFStab_paths(char *path, int *err)
669*0Sstevel@tonic-gate {
670*0Sstevel@tonic-gate 	dfstab_entry_t *dfstablist;
671*0Sstevel@tonic-gate 	int count = 0;
672*0Sstevel@tonic-gate 
673*0Sstevel@tonic-gate 	*err = 0;
674*0Sstevel@tonic-gate 	if (path == NULL) {
675*0Sstevel@tonic-gate 		count = -1;
676*0Sstevel@tonic-gate 	}
677*0Sstevel@tonic-gate 	dfstablist = get_dfstab_ents(err);
678*0Sstevel@tonic-gate 	if (dfstablist != NULL) {
679*0Sstevel@tonic-gate 		while (dfstablist != NULL) {
680*0Sstevel@tonic-gate 			if (strcmp(dfstablist->path, path) == 0) {
681*0Sstevel@tonic-gate 				count++;
682*0Sstevel@tonic-gate 			}
683*0Sstevel@tonic-gate 			dfstablist = dfstablist->next;
684*0Sstevel@tonic-gate 		}
685*0Sstevel@tonic-gate 
686*0Sstevel@tonic-gate 		free_dfstab_list(dfstablist);
687*0Sstevel@tonic-gate 	} else {
688*0Sstevel@tonic-gate 		if (err != 0)
689*0Sstevel@tonic-gate 			count = *err;
690*0Sstevel@tonic-gate 		else
691*0Sstevel@tonic-gate 			count = 0;
692*0Sstevel@tonic-gate 	}
693*0Sstevel@tonic-gate 	return (count);
694*0Sstevel@tonic-gate }
695*0Sstevel@tonic-gate 
696*0Sstevel@tonic-gate void
fs_free_DFStab_ents(void * list)697*0Sstevel@tonic-gate fs_free_DFStab_ents(void *list)
698*0Sstevel@tonic-gate {
699*0Sstevel@tonic-gate 	dfstab_entry_t *headp = (dfstab_entry_t *)list;
700*0Sstevel@tonic-gate 	free_dfstab_list(headp);
701*0Sstevel@tonic-gate }
702*0Sstevel@tonic-gate 
703*0Sstevel@tonic-gate /*
704*0Sstevel@tonic-gate  * used for debugging only
705*0Sstevel@tonic-gate  */
706*0Sstevel@tonic-gate void
fs_print_dfstab_entries(void * list)707*0Sstevel@tonic-gate fs_print_dfstab_entries(void *list)
708*0Sstevel@tonic-gate {
709*0Sstevel@tonic-gate 	while (list != NULL) {
710*0Sstevel@tonic-gate 
711*0Sstevel@tonic-gate 		if (fs_get_DFStab_ent_Fstype(list) != NULL)
712*0Sstevel@tonic-gate 			printf("fstype: %s", fs_get_DFStab_ent_Fstype(list));
713*0Sstevel@tonic-gate 		if (fs_get_DFStab_ent_Desc(list) != NULL)
714*0Sstevel@tonic-gate 			printf(" description: %s",
715*0Sstevel@tonic-gate 			    fs_get_DFStab_ent_Desc(list));
716*0Sstevel@tonic-gate 		if (fs_get_DFStab_ent_Options(list) != NULL)
717*0Sstevel@tonic-gate 			printf(" options: %s",
718*0Sstevel@tonic-gate 			    fs_get_DFStab_ent_Options(list));
719*0Sstevel@tonic-gate 		if (fs_get_DFStab_ent_Path(list) != NULL)
720*0Sstevel@tonic-gate 			printf(" shared path is: %s\n",
721*0Sstevel@tonic-gate 			    fs_get_DFStab_ent_Path(list));
722*0Sstevel@tonic-gate 		list = (void *)fs_get_DFStab_ent_Next(list);
723*0Sstevel@tonic-gate 	}
724*0Sstevel@tonic-gate 
725*0Sstevel@tonic-gate }
726