1*23de60b7Schristos /*	$NetBSD: sun_map_parse.y,v 1.4 2015/01/17 17:46:31 christos Exp $	*/
2a53f50b9Schristos 
3a53f50b9Schristos %{
4a53f50b9Schristos /*
5*23de60b7Schristos  * Copyright (c) 1997-2014 Erez Zadok
6a53f50b9Schristos  * Copyright (c) 2005 Daniel P. Ottavio
7a53f50b9Schristos  * Copyright (c) 1990 Jan-Simon Pendry
8a53f50b9Schristos  * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
9a53f50b9Schristos  * Copyright (c) 1990 The Regents of the University of California.
10a53f50b9Schristos  * All rights reserved.
11a53f50b9Schristos  *
12a53f50b9Schristos  * This code is derived from software contributed to Berkeley by
13a53f50b9Schristos  * Jan-Simon Pendry at Imperial College, London.
14a53f50b9Schristos  *
15a53f50b9Schristos  * Redistribution and use in source and binary forms, with or without
16a53f50b9Schristos  * modification, are permitted provided that the following conditions
17a53f50b9Schristos  * are met:
18a53f50b9Schristos  * 1. Redistributions of source code must retain the above copyright
19a53f50b9Schristos  *    notice, this list of conditions and the following disclaimer.
20a53f50b9Schristos  * 2. Redistributions in binary form must reproduce the above copyright
21a53f50b9Schristos  *    notice, this list of conditions and the following disclaimer in the
22a53f50b9Schristos  *    documentation and/or other materials provided with the distribution.
23*23de60b7Schristos  * 3. Neither the name of the University nor the names of its contributors
24a53f50b9Schristos  *    may be used to endorse or promote products derived from this software
25a53f50b9Schristos  *    without specific prior written permission.
26a53f50b9Schristos  *
27a53f50b9Schristos  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28a53f50b9Schristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29a53f50b9Schristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30a53f50b9Schristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31a53f50b9Schristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32a53f50b9Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33a53f50b9Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34a53f50b9Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35a53f50b9Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36a53f50b9Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37a53f50b9Schristos  * SUCH DAMAGE.
38a53f50b9Schristos  *
39a53f50b9Schristos  *
40a53f50b9Schristos  * File: am-utils/amd/sun_map_parse.y
41a53f50b9Schristos  *
42a53f50b9Schristos  */
43a53f50b9Schristos 
44a53f50b9Schristos #ifdef HAVE_CONFIG_H
45a53f50b9Schristos # include <config.h>
46a53f50b9Schristos #endif /* HAVE_CONFIG_H */
47a53f50b9Schristos #include <am_defs.h>
48a53f50b9Schristos #include <amd.h>
49a53f50b9Schristos #include <sun_map.h>
50a53f50b9Schristos 
51a53f50b9Schristos 
52a53f50b9Schristos #define SUN_FSTYPE_STR  "fstype="
53a53f50b9Schristos 
54a53f50b9Schristos 
55a53f50b9Schristos extern int sun_map_lex(void);
56a53f50b9Schristos extern int sun_map_error(const char *);
57a53f50b9Schristos extern void sun_map_tok_setbuff(const char *);
58a53f50b9Schristos extern int sun_map_parse(void);
59a53f50b9Schristos 
60a53f50b9Schristos struct sun_entry *sun_map_parse_read(const char *);
61a53f50b9Schristos 
62a53f50b9Schristos static struct sun_list *sun_entry_list = NULL;
63a53f50b9Schristos static struct sun_list *sun_opt_list = NULL;
64a53f50b9Schristos static struct sun_list *sun_host_list = NULL;
65a53f50b9Schristos static struct sun_list *sun_location_list = NULL;
66a53f50b9Schristos static struct sun_list *mountpt_list = NULL;
67a53f50b9Schristos static char *tmpFsType = NULL;
68a53f50b9Schristos 
69a53f50b9Schristos 
70a53f50b9Schristos /*
71a53f50b9Schristos  * Each get* function returns a pointer to the corresponding global
72a53f50b9Schristos  * list structure.  If the structure is NULL than a new instance is
73a53f50b9Schristos  * returned.
74a53f50b9Schristos  */
75b7899253Schristos static struct sun_list *get_sun_opt_list(void);
76b7899253Schristos static struct sun_list *get_sun_host_list(void);
77b7899253Schristos static struct sun_list *get_sun_location_list(void);
78b7899253Schristos static struct sun_list *get_mountpt_list(void);
79b7899253Schristos static struct sun_list *get_sun_entry_list(void);
80a53f50b9Schristos 
81a53f50b9Schristos %}
82a53f50b9Schristos 
83a53f50b9Schristos %union {
84a53f50b9Schristos   char strval[2048];
85a53f50b9Schristos }
86a53f50b9Schristos 
87a53f50b9Schristos %token NEWLINE COMMENT WSPACE
88a53f50b9Schristos %token <strval> WORD
89a53f50b9Schristos 
90a53f50b9Schristos %%
91a53f50b9Schristos 
92a53f50b9Schristos amap : file
93a53f50b9Schristos      ;
94a53f50b9Schristos 
95a53f50b9Schristos file : new_lines entries
96a53f50b9Schristos      | entries
97a53f50b9Schristos      ;
98a53f50b9Schristos 
99a53f50b9Schristos entries : entry
100a53f50b9Schristos         | entry new_lines
101a53f50b9Schristos         | entry new_lines entries
102a53f50b9Schristos         ;
103a53f50b9Schristos 
104a53f50b9Schristos new_lines : NEWLINE
105a53f50b9Schristos           | NEWLINE new_lines
106a53f50b9Schristos           ;
107a53f50b9Schristos 
108a53f50b9Schristos entry : locations {
109a53f50b9Schristos 
110a53f50b9Schristos   struct sun_list *list;
111a53f50b9Schristos   struct sun_entry *entry;
112a53f50b9Schristos 
113a53f50b9Schristos   /* allocate an entry */
114a53f50b9Schristos   entry = CALLOC(struct sun_entry);
115a53f50b9Schristos 
116a53f50b9Schristos   /*
117a53f50b9Schristos    * Assign the global location list to this entry and reset the
118a53f50b9Schristos    * global pointer.  Reseting the global pointer will create a new
119a53f50b9Schristos    * list instance next time get_sun_location_list() is called.
120a53f50b9Schristos    */
121a53f50b9Schristos   list = get_sun_location_list();
122a53f50b9Schristos   entry->location_list = (struct sun_location *)list->first;
123a53f50b9Schristos   sun_location_list = NULL;
124a53f50b9Schristos 
125a53f50b9Schristos    /* Add this entry to the entry list. */
126a53f50b9Schristos   sun_list_add(get_sun_entry_list(), (qelem *)entry);
127a53f50b9Schristos }
128a53f50b9Schristos 
129a53f50b9Schristos | '-' options WSPACE locations {
130a53f50b9Schristos 
131a53f50b9Schristos   struct sun_list *list;
132a53f50b9Schristos   struct sun_entry *entry;
133a53f50b9Schristos 
134a53f50b9Schristos   entry = CALLOC(struct sun_entry);
135a53f50b9Schristos 
136a53f50b9Schristos   /* An fstype may have been defined in the 'options'. */
137a53f50b9Schristos   if (tmpFsType != NULL) {
138a53f50b9Schristos     entry->fstype = tmpFsType;
139a53f50b9Schristos     tmpFsType = NULL;
140a53f50b9Schristos   }
141a53f50b9Schristos 
142a53f50b9Schristos   /*
143a53f50b9Schristos    * Assign the global location list to this entry and reset the
144a53f50b9Schristos    * global pointer.  Reseting the global pointer will create a new
145a53f50b9Schristos    * list instance next time get_sun_location_list() is called.
146a53f50b9Schristos    */
147a53f50b9Schristos   list = get_sun_location_list();
148a53f50b9Schristos   entry->location_list = (struct sun_location *)list->first;
149a53f50b9Schristos   sun_location_list = NULL;
150a53f50b9Schristos 
151a53f50b9Schristos   /*
152a53f50b9Schristos    * Assign the global opt list to this entry and reset the global
153a53f50b9Schristos    * pointer.  Reseting the global pointer will create a new list
154a53f50b9Schristos    * instance next time get_sun_opt_list() is called.
155a53f50b9Schristos    */
156a53f50b9Schristos   list = get_sun_opt_list();
157a53f50b9Schristos   entry->opt_list = (struct sun_opt *)list->first;
158a53f50b9Schristos   sun_opt_list = NULL;
159a53f50b9Schristos 
160a53f50b9Schristos   /* Add this entry to the entry list. */
161a53f50b9Schristos   sun_list_add(get_sun_entry_list(), (qelem *)entry);
162a53f50b9Schristos }
163a53f50b9Schristos 
164a53f50b9Schristos | mountpoints {
165a53f50b9Schristos 
166a53f50b9Schristos   struct sun_list *list;
167a53f50b9Schristos   struct sun_entry *entry;
168a53f50b9Schristos 
169a53f50b9Schristos   /* allocate an entry */
170a53f50b9Schristos   entry = CALLOC(struct sun_entry);
171a53f50b9Schristos 
172a53f50b9Schristos   /*
173a53f50b9Schristos    * Assign the global mountpt list to this entry and reset the global
174a53f50b9Schristos    * pointer.  Reseting the global pointer will create a new list
175a53f50b9Schristos    * instance next time get_mountpt_list() is called.
176a53f50b9Schristos    */
177a53f50b9Schristos   list = get_mountpt_list();
178a53f50b9Schristos   entry->mountpt_list = (struct sun_mountpt *)list->first;
179a53f50b9Schristos   mountpt_list = NULL;
180a53f50b9Schristos 
181a53f50b9Schristos   /* Add this entry to the entry list. */
182a53f50b9Schristos   sun_list_add(get_sun_entry_list(), (qelem *)entry);
183a53f50b9Schristos }
184a53f50b9Schristos 
185a53f50b9Schristos | '-' options WSPACE mountpoints {
186a53f50b9Schristos 
187a53f50b9Schristos   struct sun_list *list;
188a53f50b9Schristos   struct sun_entry *entry;
189a53f50b9Schristos 
190a53f50b9Schristos   /* allocate an entry */
191a53f50b9Schristos   entry = CALLOC(struct sun_entry);
192a53f50b9Schristos 
193a53f50b9Schristos   /* An fstype may have been defined in the 'options'. */
194a53f50b9Schristos   if (tmpFsType != NULL) {
195a53f50b9Schristos     entry->fstype = tmpFsType;
196a53f50b9Schristos     tmpFsType = NULL;
197a53f50b9Schristos   }
198a53f50b9Schristos 
199a53f50b9Schristos   /*
200a53f50b9Schristos    * Assign the global mountpt list to this entry and reset the global
201a53f50b9Schristos    * pointer.  Reseting the global pointer will create a new list
202a53f50b9Schristos    * instance next time get_mountpt_list() is called.
203a53f50b9Schristos    */
204a53f50b9Schristos   list = get_mountpt_list();
205a53f50b9Schristos   entry->mountpt_list = (struct sun_mountpt *)list->first;
206a53f50b9Schristos   mountpt_list = NULL;
207a53f50b9Schristos 
208a53f50b9Schristos   /*
209a53f50b9Schristos    * Assign the global opt list to this entry and reset the global
210a53f50b9Schristos    * pointer.  Reseting the global pointer will create a new list
211a53f50b9Schristos    * instance next time get_sun_opt_list() is called.
212a53f50b9Schristos    */
213a53f50b9Schristos   list = get_sun_opt_list();
214a53f50b9Schristos   entry->opt_list = (struct sun_opt *)list->first;
215a53f50b9Schristos   sun_opt_list = NULL;
216a53f50b9Schristos 
217a53f50b9Schristos   /* Add this entry to the entry list. */
218a53f50b9Schristos   sun_list_add(get_sun_entry_list(), (qelem *)entry);
219a53f50b9Schristos }
220a53f50b9Schristos ;
221a53f50b9Schristos 
222a53f50b9Schristos mountpoints : mountpoint
223a53f50b9Schristos             | mountpoint WSPACE mountpoints
224a53f50b9Schristos             ;
225a53f50b9Schristos 
226a53f50b9Schristos mountpoint : WORD WSPACE location {
227a53f50b9Schristos 
228a53f50b9Schristos   struct sun_list *list;
229a53f50b9Schristos   struct sun_mountpt *mountpt;
230a53f50b9Schristos 
231a53f50b9Schristos   /* allocate a mountpt */
232a53f50b9Schristos   mountpt = CALLOC(struct sun_mountpt);
233a53f50b9Schristos 
234a53f50b9Schristos   /*
235a53f50b9Schristos    * Assign the global loaction list to this entry and reset the
236a53f50b9Schristos    * global pointer.  Reseting the global pointer will create a new
237a53f50b9Schristos    * list instance next time get_sun_location_list() is called.
238a53f50b9Schristos    */
239a53f50b9Schristos   list = get_sun_location_list();
240a53f50b9Schristos   mountpt->location_list = (struct sun_location *)list->first;
241a53f50b9Schristos   sun_location_list = NULL;
242a53f50b9Schristos 
243*23de60b7Schristos   mountpt->path = xstrdup($1);
244a53f50b9Schristos 
245a53f50b9Schristos   /* Add this mountpt to the mountpt list. */
246a53f50b9Schristos   sun_list_add(get_mountpt_list(), (qelem *)mountpt);
247a53f50b9Schristos }
248a53f50b9Schristos 
249a53f50b9Schristos | WORD WSPACE '-' options WSPACE location {
250a53f50b9Schristos 
251a53f50b9Schristos   struct sun_list *list;
252a53f50b9Schristos   struct sun_mountpt *mountpt;
253a53f50b9Schristos 
254a53f50b9Schristos   /* allocate a mountpt */
255a53f50b9Schristos   mountpt = CALLOC(struct sun_mountpt);
256a53f50b9Schristos 
257a53f50b9Schristos   /* An fstype may have been defined in the 'options'. */
258a53f50b9Schristos   if (tmpFsType != NULL) {
259a53f50b9Schristos     mountpt->fstype = tmpFsType;
260a53f50b9Schristos     tmpFsType = NULL;
261a53f50b9Schristos   }
262a53f50b9Schristos 
263a53f50b9Schristos   /*
264a53f50b9Schristos    * Assign the global location list to this entry and reset the
265a53f50b9Schristos    * global pointer.  Reseting the global pointer will create a new
266a53f50b9Schristos    * list instance next time get_sun_location_list() is called.
267a53f50b9Schristos    */
268a53f50b9Schristos   list = get_sun_location_list();
269a53f50b9Schristos   mountpt->location_list = (struct sun_location *)list->first;
270a53f50b9Schristos   sun_location_list = NULL;
271a53f50b9Schristos 
272a53f50b9Schristos   /*
273a53f50b9Schristos    * Assign the global opt list to this entry and reset the global
274a53f50b9Schristos    * pointer.  Reseting the global pointer will create a new list
275a53f50b9Schristos    * instance next time get_sun_opt_list() is called.
276a53f50b9Schristos    */
277a53f50b9Schristos   list = get_sun_opt_list();
278a53f50b9Schristos   mountpt->opt_list = (struct sun_opt *)list->first;
279a53f50b9Schristos   sun_opt_list = NULL;
280a53f50b9Schristos 
281*23de60b7Schristos   mountpt->path = xstrdup($1);
282a53f50b9Schristos 
283a53f50b9Schristos   /* Add this mountpt to the mountpt list. */
284a53f50b9Schristos   sun_list_add(get_mountpt_list(), (qelem *)mountpt);
285a53f50b9Schristos }
286a53f50b9Schristos ;
287a53f50b9Schristos 
288a53f50b9Schristos locations : location
289a53f50b9Schristos           | location WSPACE locations
290a53f50b9Schristos           ;
291a53f50b9Schristos 
292a53f50b9Schristos location : hosts ':' WORD {
293a53f50b9Schristos 
294a53f50b9Schristos   struct sun_list *list;
295a53f50b9Schristos   struct sun_location *location;
296a53f50b9Schristos 
297a53f50b9Schristos   /* allocate a new location */
298a53f50b9Schristos   location = CALLOC(struct sun_location);
299a53f50b9Schristos 
300a53f50b9Schristos   /*
301a53f50b9Schristos    * Assign the global opt list to this entry and reset the global
302a53f50b9Schristos    * pointer.  Reseting the global pointer will create a new list
303a53f50b9Schristos    * instance next time get_sun_opt_list() is called.
304a53f50b9Schristos    */
305a53f50b9Schristos   list = get_sun_host_list();
306a53f50b9Schristos   location->host_list = (struct sun_host *)list->first;
307a53f50b9Schristos   sun_host_list = NULL;
308a53f50b9Schristos 
309*23de60b7Schristos   location->path = xstrdup($3);
310a53f50b9Schristos 
311a53f50b9Schristos   /* Add this location to the location list. */
312a53f50b9Schristos   sun_list_add(get_sun_location_list(), (qelem *)location);
313a53f50b9Schristos }
314a53f50b9Schristos 
315a53f50b9Schristos | ':' WORD {
316a53f50b9Schristos 
317a53f50b9Schristos   struct sun_location *location;
318a53f50b9Schristos 
319a53f50b9Schristos   /* allocate a new location */
320a53f50b9Schristos   location = CALLOC(struct sun_location);
321a53f50b9Schristos 
322*23de60b7Schristos   location->path = xstrdup($2);
323a53f50b9Schristos 
324a53f50b9Schristos   /* Add this location to the location list. */
325a53f50b9Schristos   sun_list_add(get_sun_location_list(), (qelem *)location);
326a53f50b9Schristos }
327a53f50b9Schristos ;
328a53f50b9Schristos 
329a53f50b9Schristos hosts : host
330a53f50b9Schristos       | host ',' hosts
331a53f50b9Schristos       ;
332a53f50b9Schristos 
333a53f50b9Schristos host : WORD {
334a53f50b9Schristos 
335a53f50b9Schristos   /* allocate a new host */
336a53f50b9Schristos   struct sun_host *host = CALLOC(struct sun_host);
337a53f50b9Schristos 
338*23de60b7Schristos   host->name = xstrdup($1);
339a53f50b9Schristos 
340a53f50b9Schristos   /* Add this host to the host list. */
341a53f50b9Schristos   sun_list_add(get_sun_host_list(),(qelem *)host);
342a53f50b9Schristos }
343a53f50b9Schristos 
344a53f50b9Schristos | WORD weight {
345a53f50b9Schristos 
346a53f50b9Schristos   /*
347a53f50b9Schristos    * It is assumed that the host for this rule was allocated by the
348a53f50b9Schristos    * 'weight' rule and assigned to be the last host item on the host
349a53f50b9Schristos    * list.
350a53f50b9Schristos    */
351a53f50b9Schristos   struct sun_host *host = (struct sun_host *)sun_host_list->last;
352a53f50b9Schristos 
353*23de60b7Schristos   host->name = xstrdup($1);
354a53f50b9Schristos }
355a53f50b9Schristos ;
356a53f50b9Schristos 
357a53f50b9Schristos weight : '(' WORD ')' {
358a53f50b9Schristos 
359a53f50b9Schristos   int val;
360a53f50b9Schristos   /* allocate a new host */
361a53f50b9Schristos   struct sun_host *host = CALLOC(struct sun_host);
362a53f50b9Schristos 
363a53f50b9Schristos   val = atoi($2);
364a53f50b9Schristos 
365a53f50b9Schristos   host->weight = val;
366a53f50b9Schristos 
367a53f50b9Schristos   /* Add this host to the host list. */
368a53f50b9Schristos   sun_list_add(get_sun_host_list(), (qelem *)host);
369a53f50b9Schristos }
370a53f50b9Schristos ;
371a53f50b9Schristos 
372a53f50b9Schristos options : option
373a53f50b9Schristos         | option ',' options
374a53f50b9Schristos         ;
375a53f50b9Schristos 
376a53f50b9Schristos option : WORD {
377a53f50b9Schristos 
378a53f50b9Schristos   char *type;
379a53f50b9Schristos 
380a53f50b9Schristos   /* check if this is an fstype option */
381a53f50b9Schristos   if ((type = strstr($1,SUN_FSTYPE_STR)) != NULL) {
382a53f50b9Schristos     /* parse out the fs type from the Sun fstype keyword  */
383a53f50b9Schristos     if ((type = type + strlen(SUN_FSTYPE_STR)) != NULL) {
384a53f50b9Schristos       /*
385a53f50b9Schristos        * This global fstype str will be assigned to the current being
386a53f50b9Schristos        * parsed later in the parsing.
387a53f50b9Schristos        */
388*23de60b7Schristos       tmpFsType = xstrdup(type);
389a53f50b9Schristos     }
390a53f50b9Schristos   }
391a53f50b9Schristos   else {
392a53f50b9Schristos     /*
393a53f50b9Schristos      * If it is not an fstype option allocate an opt struct and assign
394a53f50b9Schristos      * the value.
395a53f50b9Schristos      */
396a53f50b9Schristos     struct sun_opt *opt = CALLOC(struct sun_opt);
397*23de60b7Schristos     opt->str = xstrdup($1);
398a53f50b9Schristos     /* Add this opt to the opt list. */
399a53f50b9Schristos     sun_list_add(get_sun_opt_list(), (qelem *)opt);
400a53f50b9Schristos   }
401a53f50b9Schristos }
402a53f50b9Schristos 
403a53f50b9Schristos ;
404a53f50b9Schristos 
405a53f50b9Schristos %%
406a53f50b9Schristos 
407a53f50b9Schristos /*
408a53f50b9Schristos  * Parse 'map_data' which is assumed to be a Sun-syle map.  If
409a53f50b9Schristos  * successful a sun_entry is returned.
410a53f50b9Schristos  *
411a53f50b9Schristos  * The parser is designed to parse map entries with out the keys.  For
412a53f50b9Schristos  * example the entry:
413a53f50b9Schristos  *
414a53f50b9Schristos  * usr -ro pluto:/usr/local
415a53f50b9Schristos  *
416a53f50b9Schristos  * should be passed to the parser as:
417a53f50b9Schristos  *
418a53f50b9Schristos  * -ro pluto:/usr/local
419a53f50b9Schristos  *
420a53f50b9Schristos  * The reason for this is that the Amd info services already strip off
421a53f50b9Schristos  * the key when they read map info.
422a53f50b9Schristos  */
423a53f50b9Schristos struct sun_entry *
424a53f50b9Schristos sun_map_parse_read(const char *map_data)
425a53f50b9Schristos {
426a53f50b9Schristos   struct sun_entry *retval = NULL;
427a53f50b9Schristos 
428a53f50b9Schristos   /* pass map_data to lex */
429a53f50b9Schristos   sun_map_tok_setbuff(map_data);
430a53f50b9Schristos 
431a53f50b9Schristos   /* call yacc */
432a53f50b9Schristos   sun_map_parse();
433a53f50b9Schristos 
434a53f50b9Schristos   if (sun_entry_list != NULL) {
435a53f50b9Schristos     /* return the first Sun entry in the list */
436a53f50b9Schristos     retval = (struct sun_entry*)sun_entry_list->first;
437a53f50b9Schristos     sun_entry_list = NULL;
438a53f50b9Schristos   }
439a53f50b9Schristos   else {
440a53f50b9Schristos     plog(XLOG_ERROR, "Sun map parser did not produce data structs.");
441a53f50b9Schristos   }
442a53f50b9Schristos 
443a53f50b9Schristos   return retval;
444a53f50b9Schristos }
445a53f50b9Schristos 
446a53f50b9Schristos 
447a53f50b9Schristos static struct sun_list *
get_sun_entry_list(void)448a53f50b9Schristos get_sun_entry_list(void)
449a53f50b9Schristos {
450a53f50b9Schristos   if (sun_entry_list == NULL) {
451a53f50b9Schristos     sun_entry_list = CALLOC(struct sun_list);
452a53f50b9Schristos   }
453a53f50b9Schristos   return sun_entry_list;
454a53f50b9Schristos }
455a53f50b9Schristos 
456a53f50b9Schristos 
457a53f50b9Schristos static struct sun_list *
get_mountpt_list(void)458a53f50b9Schristos get_mountpt_list(void)
459a53f50b9Schristos {
460a53f50b9Schristos   if (mountpt_list == NULL) {
461a53f50b9Schristos     mountpt_list = CALLOC(struct sun_list);
462a53f50b9Schristos   }
463a53f50b9Schristos   return mountpt_list;
464a53f50b9Schristos }
465a53f50b9Schristos 
466a53f50b9Schristos 
467a53f50b9Schristos static struct sun_list *
get_sun_location_list(void)468a53f50b9Schristos get_sun_location_list(void)
469a53f50b9Schristos {
470a53f50b9Schristos   if (sun_location_list == NULL) {
471a53f50b9Schristos     sun_location_list = CALLOC(struct sun_list);
472a53f50b9Schristos   }
473a53f50b9Schristos   return sun_location_list;
474a53f50b9Schristos }
475a53f50b9Schristos 
476a53f50b9Schristos 
477a53f50b9Schristos static struct sun_list *
get_sun_host_list(void)478a53f50b9Schristos get_sun_host_list(void)
479a53f50b9Schristos {
480a53f50b9Schristos   if (sun_host_list == NULL) {
481a53f50b9Schristos     sun_host_list = CALLOC(struct sun_list);
482a53f50b9Schristos   }
483a53f50b9Schristos   return sun_host_list;
484a53f50b9Schristos }
485a53f50b9Schristos 
486a53f50b9Schristos 
487a53f50b9Schristos static struct sun_list *
get_sun_opt_list(void)488a53f50b9Schristos get_sun_opt_list(void)
489a53f50b9Schristos {
490a53f50b9Schristos   if (sun_opt_list == NULL) {
491a53f50b9Schristos     sun_opt_list = CALLOC(struct sun_list);
492a53f50b9Schristos   }
493a53f50b9Schristos   return sun_opt_list;
494a53f50b9Schristos }
495