xref: /netbsd-src/external/bsd/am-utils/dist/amd/sun_map.h (revision 8bae5d409deb915cf7c8f0539fae22ff2cb8a313)
1*8bae5d40Schristos /*	$NetBSD: sun_map.h,v 1.1.1.3 2015/01/17 16:34:15 christos Exp $	*/
2a53f50b9Schristos 
3a53f50b9Schristos /*
4*8bae5d40Schristos  * Copyright (c) 1997-2014 Erez Zadok
5a53f50b9Schristos  * Copyright (c) 2005 Daniel P. Ottavio
6a53f50b9Schristos  * Copyright (c) 1990 Jan-Simon Pendry
7a53f50b9Schristos  * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
8a53f50b9Schristos  * Copyright (c) 1990 The Regents of the University of California.
9a53f50b9Schristos  * All rights reserved.
10a53f50b9Schristos  *
11a53f50b9Schristos  * This code is derived from software contributed to Berkeley by
12a53f50b9Schristos  * Jan-Simon Pendry at Imperial College, London.
13a53f50b9Schristos  *
14a53f50b9Schristos  * Redistribution and use in source and binary forms, with or without
15a53f50b9Schristos  * modification, are permitted provided that the following conditions
16a53f50b9Schristos  * are met:
17a53f50b9Schristos  * 1. Redistributions of source code must retain the above copyright
18a53f50b9Schristos  *    notice, this list of conditions and the following disclaimer.
19a53f50b9Schristos  * 2. Redistributions in binary form must reproduce the above copyright
20a53f50b9Schristos  *    notice, this list of conditions and the following disclaimer in the
21a53f50b9Schristos  *    documentation and/or other materials provided with the distribution.
22*8bae5d40Schristos  * 3. Neither the name of the University nor the names of its contributors
23a53f50b9Schristos  *    may be used to endorse or promote products derived from this software
24a53f50b9Schristos  *    without specific prior written permission.
25a53f50b9Schristos  *
26a53f50b9Schristos  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27a53f50b9Schristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28a53f50b9Schristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29a53f50b9Schristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30a53f50b9Schristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31a53f50b9Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32a53f50b9Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33a53f50b9Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34a53f50b9Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35a53f50b9Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36a53f50b9Schristos  * SUCH DAMAGE.
37a53f50b9Schristos  *
38a53f50b9Schristos  *
39a53f50b9Schristos  * File: am-utils/amd/sun_map.h
40a53f50b9Schristos  *
41a53f50b9Schristos  */
42a53f50b9Schristos 
43a53f50b9Schristos #ifndef _SUN_MAP_H
44a53f50b9Schristos #define _SUN_MAP_H
45a53f50b9Schristos 
46a53f50b9Schristos /* host */
47a53f50b9Schristos struct sun_host {
48a53f50b9Schristos   qelem head;     /* link-list header */
49a53f50b9Schristos   char *name;     /* hostname */
50a53f50b9Schristos   int weight;     /* weight given to the host */
51a53f50b9Schristos };
52a53f50b9Schristos 
53a53f50b9Schristos /* location */
54a53f50b9Schristos struct sun_location {
55a53f50b9Schristos   qelem head;                 /* link-list header */
56a53f50b9Schristos   char *path;                 /* server path */
57a53f50b9Schristos   struct sun_host *host_list; /* list of hosts */
58a53f50b9Schristos };
59a53f50b9Schristos 
60a53f50b9Schristos /* sun mount option */
61a53f50b9Schristos struct sun_opt {
62a53f50b9Schristos   qelem head;    /* link-list header */
63a53f50b9Schristos   char *str;     /* option string */
64a53f50b9Schristos };
65a53f50b9Schristos 
66a53f50b9Schristos /* mount point */
67a53f50b9Schristos struct sun_mountpt {
68a53f50b9Schristos   qelem head;                         /* link-list header */
69a53f50b9Schristos   char *path;                         /* optional mount point path */
70a53f50b9Schristos   char *fstype;                       /* filesystem type */
71a53f50b9Schristos   struct sun_opt      *opt_list;      /* list of option strings */
72a53f50b9Schristos   struct sun_location *location_list; /* list of 'struct s2a_location' */
73a53f50b9Schristos };
74a53f50b9Schristos 
75a53f50b9Schristos /* automount entry */
76a53f50b9Schristos struct sun_entry {
77a53f50b9Schristos   qelem head;                         /* link-list header */
78a53f50b9Schristos   char *key;                          /* auto map key */
79a53f50b9Schristos   char *fstype;                       /* filesystem type */
80a53f50b9Schristos   struct sun_opt      *opt_list;      /* list of mount options */
81a53f50b9Schristos   struct sun_location *location_list; /* list of mount locations */
82a53f50b9Schristos   struct sun_mountpt  *mountpt_list;  /* list of mount points */
83a53f50b9Schristos };
84a53f50b9Schristos 
85a53f50b9Schristos /*
86a53f50b9Schristos  * automount map file
87a53f50b9Schristos  *
88a53f50b9Schristos  * XXX: Only a place holder structure, not implemented yet.
89a53f50b9Schristos  */
90a53f50b9Schristos struct sun_map {
91a53f50b9Schristos   qelem head;                     /* link-list header */
92a53f50b9Schristos   char *path;                     /* directory path of the map file */
93a53f50b9Schristos   char *mount_dir;                /* top level mount point for this map */
94a53f50b9Schristos   int  lookup;                    /* lookup type i.e file, yp, program, etc. */
95a53f50b9Schristos   int  direct_bool;               /* set true if this map is a direct map */
96a53f50b9Schristos   struct sun_opt   *opt_list;     /* list of global map options */
97a53f50b9Schristos   struct sun_opt   *include_list; /* list of included map files  */
98a53f50b9Schristos   struct sun_entry *entry_list;   /* list of 'struct s2a_entry' */
99a53f50b9Schristos };
100a53f50b9Schristos 
101a53f50b9Schristos /*
102a53f50b9Schristos  * master map file
103a53f50b9Schristos  *
104a53f50b9Schristos  * XXX: Only a place holder structure, not implemented yet.
105a53f50b9Schristos  */
106a53f50b9Schristos struct sun_mmap {
107a53f50b9Schristos   qelem head;                   /* link-list header */
108a53f50b9Schristos   struct sun_opt *include_list; /* list of included master maps */
109a53f50b9Schristos   struct sun_map *amap_list;    /* list of 'struct s2a_amap' */
110a53f50b9Schristos };
111a53f50b9Schristos 
112a53f50b9Schristos struct sun_list {
113a53f50b9Schristos   qelem *first;
114a53f50b9Schristos   qelem *last;
115a53f50b9Schristos };
116a53f50b9Schristos 
117a53f50b9Schristos 
118a53f50b9Schristos /*
119a53f50b9Schristos  * EXTERNS
120a53f50b9Schristos  */
121a53f50b9Schristos extern char *sun_entry2amd(const char *, const char *);
122a53f50b9Schristos extern struct sun_entry *sun_map_parse_read(const char *);
123a53f50b9Schristos extern void sun_list_add(struct sun_list *, qelem *);
124a53f50b9Schristos 
125a53f50b9Schristos #endif /* not _SUN_MAP_H */
126