1305100Scy/*
2305100Scy * Copyright (c) 1997-2014 Erez Zadok
3305100Scy * Copyright (c) 2005 Daniel P. Ottavio
4305100Scy * Copyright (c) 1990 Jan-Simon Pendry
5305100Scy * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
6305100Scy * Copyright (c) 1990 The Regents of the University of California.
7305100Scy * All rights reserved.
8305100Scy *
9305100Scy * This code is derived from software contributed to Berkeley by
10305100Scy * Jan-Simon Pendry at Imperial College, London.
11305100Scy *
12305100Scy * Redistribution and use in source and binary forms, with or without
13305100Scy * modification, are permitted provided that the following conditions
14305100Scy * are met:
15305100Scy * 1. Redistributions of source code must retain the above copyright
16305100Scy *    notice, this list of conditions and the following disclaimer.
17305100Scy * 2. Redistributions in binary form must reproduce the above copyright
18305100Scy *    notice, this list of conditions and the following disclaimer in the
19305100Scy *    documentation and/or other materials provided with the distribution.
20305100Scy * 3. Neither the name of the University nor the names of its contributors
21305100Scy *    may be used to endorse or promote products derived from this software
22305100Scy *    without specific prior written permission.
23305100Scy *
24305100Scy * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25305100Scy * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26305100Scy * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27305100Scy * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28305100Scy * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29305100Scy * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30305100Scy * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31305100Scy * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32305100Scy * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33305100Scy * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34305100Scy * SUCH DAMAGE.
35305100Scy *
36305100Scy *
37305100Scy * File: am-utils/amd/sun_map.h
38305100Scy *
39305100Scy */
40305100Scy
41305100Scy#ifndef _SUN_MAP_H
42305100Scy#define _SUN_MAP_H
43305100Scy
44305100Scy/* host */
45305100Scystruct sun_host {
46305100Scy  qelem head;     /* link-list header */
47305100Scy  char *name;     /* hostname */
48305100Scy  int weight;     /* weight given to the host */
49305100Scy};
50305100Scy
51305100Scy/* location */
52305100Scystruct sun_location {
53305100Scy  qelem head;                 /* link-list header */
54305100Scy  char *path;                 /* server path */
55305100Scy  struct sun_host *host_list; /* list of hosts */
56305100Scy};
57305100Scy
58305100Scy/* sun mount option */
59305100Scystruct sun_opt {
60305100Scy  qelem head;    /* link-list header */
61305100Scy  char *str;     /* option string */
62305100Scy};
63305100Scy
64305100Scy/* mount point */
65305100Scystruct sun_mountpt {
66305100Scy  qelem head;                         /* link-list header */
67305100Scy  char *path;                         /* optional mount point path */
68305100Scy  char *fstype;                       /* filesystem type */
69305100Scy  struct sun_opt      *opt_list;      /* list of option strings */
70305100Scy  struct sun_location *location_list; /* list of 'struct s2a_location' */
71305100Scy};
72305100Scy
73305100Scy/* automount entry */
74305100Scystruct sun_entry {
75305100Scy  qelem head;                         /* link-list header */
76305100Scy  char *key;                          /* auto map key */
77305100Scy  char *fstype;                       /* filesystem type */
78305100Scy  struct sun_opt      *opt_list;      /* list of mount options */
79305100Scy  struct sun_location *location_list; /* list of mount locations */
80305100Scy  struct sun_mountpt  *mountpt_list;  /* list of mount points */
81305100Scy};
82305100Scy
83305100Scy/*
84305100Scy * automount map file
85305100Scy *
86305100Scy * XXX: Only a place holder structure, not implemented yet.
87305100Scy */
88305100Scystruct sun_map {
89305100Scy  qelem head;                     /* link-list header */
90305100Scy  char *path;                     /* directory path of the map file */
91305100Scy  char *mount_dir;                /* top level mount point for this map */
92305100Scy  int  lookup;                    /* lookup type i.e file, yp, program, etc. */
93305100Scy  int  direct_bool;               /* set true if this map is a direct map */
94305100Scy  struct sun_opt   *opt_list;     /* list of global map options */
95305100Scy  struct sun_opt   *include_list; /* list of included map files  */
96305100Scy  struct sun_entry *entry_list;   /* list of 'struct s2a_entry' */
97305100Scy};
98305100Scy
99305100Scy/*
100305100Scy * master map file
101305100Scy *
102305100Scy * XXX: Only a place holder structure, not implemented yet.
103305100Scy */
104305100Scystruct sun_mmap {
105305100Scy  qelem head;                   /* link-list header */
106305100Scy  struct sun_opt *include_list; /* list of included master maps */
107305100Scy  struct sun_map *amap_list;    /* list of 'struct s2a_amap' */
108305100Scy};
109305100Scy
110305100Scystruct sun_list {
111305100Scy  qelem *first;
112305100Scy  qelem *last;
113305100Scy};
114305100Scy
115305100Scy
116305100Scy/*
117305100Scy * EXTERNS
118305100Scy */
119305100Scyextern char *sun_entry2amd(const char *, const char *);
120305100Scyextern struct sun_entry *sun_map_parse_read(const char *);
121305100Scyextern void sun_list_add(struct sun_list *, qelem *);
122305100Scy
123305100Scy#endif /* not _SUN_MAP_H */
124