197403Sobrien/*	$NetBSD$	*/
297403Sobrien
397403Sobrien/*
497403Sobrien * Copyright (c) 1997-2014 Erez Zadok
597403Sobrien * Copyright (c) 2005 Daniel P. Ottavio
697403Sobrien * Copyright (c) 1990 Jan-Simon Pendry
797403Sobrien * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
897403Sobrien * Copyright (c) 1990 The Regents of the University of California.
997403Sobrien * All rights reserved.
1097403Sobrien *
1197403Sobrien * This code is derived from software contributed to Berkeley by
1297403Sobrien * Jan-Simon Pendry at Imperial College, London.
1397403Sobrien *
1497403Sobrien * Redistribution and use in source and binary forms, with or without
1597403Sobrien * modification, are permitted provided that the following conditions
1697403Sobrien * are met:
1797403Sobrien * 1. Redistributions of source code must retain the above copyright
18169691Skan *    notice, this list of conditions and the following disclaimer.
1997403Sobrien * 2. Redistributions in binary form must reproduce the above copyright
2097403Sobrien *    notice, this list of conditions and the following disclaimer in the
2197403Sobrien *    documentation and/or other materials provided with the distribution.
2297403Sobrien * 3. Neither the name of the University nor the names of its contributors
2397403Sobrien *    may be used to endorse or promote products derived from this software
2497403Sobrien *    without specific prior written permission.
2597403Sobrien *
2697403Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2797403Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2897403Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2997403Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3097403Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3197403Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3297403Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3397403Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3497403Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3597403Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3697403Sobrien * SUCH DAMAGE.
3797403Sobrien *
3897403Sobrien *
3997403Sobrien * File: am-utils/amd/sun_map.h
4097403Sobrien *
4197403Sobrien */
4297403Sobrien
4397403Sobrien#ifndef _SUN_MAP_H
4497403Sobrien#define _SUN_MAP_H
4597403Sobrien
4697403Sobrien/* host */
4797403Sobrienstruct sun_host {
4897403Sobrien  qelem head;     /* link-list header */
4997403Sobrien  char *name;     /* hostname */
5097403Sobrien  int weight;     /* weight given to the host */
5197403Sobrien};
5297403Sobrien
5397403Sobrien/* location */
5497403Sobrienstruct sun_location {
5597403Sobrien  qelem head;                 /* link-list header */
56132720Skan  char *path;                 /* server path */
57132720Skan  struct sun_host *host_list; /* list of hosts */
5897403Sobrien};
5997403Sobrien
6097403Sobrien/* sun mount option */
6197403Sobrienstruct sun_opt {
6297403Sobrien  qelem head;    /* link-list header */
6397403Sobrien  char *str;     /* option string */
6497403Sobrien};
6597403Sobrien
66132720Skan/* mount point */
67struct sun_mountpt {
68  qelem head;                         /* link-list header */
69  char *path;                         /* optional mount point path */
70  char *fstype;                       /* filesystem type */
71  struct sun_opt      *opt_list;      /* list of option strings */
72  struct sun_location *location_list; /* list of 'struct s2a_location' */
73};
74
75/* automount entry */
76struct sun_entry {
77  qelem head;                         /* link-list header */
78  char *key;                          /* auto map key */
79  char *fstype;                       /* filesystem type */
80  struct sun_opt      *opt_list;      /* list of mount options */
81  struct sun_location *location_list; /* list of mount locations */
82  struct sun_mountpt  *mountpt_list;  /* list of mount points */
83};
84
85/*
86 * automount map file
87 *
88 * XXX: Only a place holder structure, not implemented yet.
89 */
90struct sun_map {
91  qelem head;                     /* link-list header */
92  char *path;                     /* directory path of the map file */
93  char *mount_dir;                /* top level mount point for this map */
94  int  lookup;                    /* lookup type i.e file, yp, program, etc. */
95  int  direct_bool;               /* set true if this map is a direct map */
96  struct sun_opt   *opt_list;     /* list of global map options */
97  struct sun_opt   *include_list; /* list of included map files  */
98  struct sun_entry *entry_list;   /* list of 'struct s2a_entry' */
99};
100
101/*
102 * master map file
103 *
104 * XXX: Only a place holder structure, not implemented yet.
105 */
106struct sun_mmap {
107  qelem head;                   /* link-list header */
108  struct sun_opt *include_list; /* list of included master maps */
109  struct sun_map *amap_list;    /* list of 'struct s2a_amap' */
110};
111
112struct sun_list {
113  qelem *first;
114  qelem *last;
115};
116
117
118/*
119 * EXTERNS
120 */
121extern char *sun_entry2amd(const char *, const char *);
122extern struct sun_entry *sun_map_parse_read(const char *);
123extern void sun_list_add(struct sun_list *, qelem *);
124
125#endif /* not _SUN_MAP_H */
126