138494Sobrien/*
2174294Sobrien * Copyright (c) 1997-2006 Erez Zadok
338494Sobrien * Copyright (c) 1989 Jan-Simon Pendry
438494Sobrien * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
538494Sobrien * Copyright (c) 1989 The Regents of the University of California.
638494Sobrien * All rights reserved.
738494Sobrien *
838494Sobrien * This code is derived from software contributed to Berkeley by
938494Sobrien * Jan-Simon Pendry at Imperial College, London.
1038494Sobrien *
1138494Sobrien * Redistribution and use in source and binary forms, with or without
1238494Sobrien * modification, are permitted provided that the following conditions
1338494Sobrien * are met:
1438494Sobrien * 1. Redistributions of source code must retain the above copyright
1538494Sobrien *    notice, this list of conditions and the following disclaimer.
1638494Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1738494Sobrien *    notice, this list of conditions and the following disclaimer in the
1838494Sobrien *    documentation and/or other materials provided with the distribution.
1938494Sobrien * 3. All advertising materials mentioning features or use of this software
2042629Sobrien *    must display the following acknowledgment:
2138494Sobrien *      This product includes software developed by the University of
2238494Sobrien *      California, Berkeley and its contributors.
2338494Sobrien * 4. Neither the name of the University nor the names of its contributors
2438494Sobrien *    may be used to endorse or promote products derived from this software
2538494Sobrien *    without specific prior written permission.
2638494Sobrien *
2738494Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2838494Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2938494Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3038494Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3138494Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3238494Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3338494Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3438494Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3538494Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3638494Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3738494Sobrien * SUCH DAMAGE.
3838494Sobrien *
3938494Sobrien *
40174294Sobrien * File: am-utils/fsinfo/fsinfo.h
4138494Sobrien *
4238494Sobrien */
4338494Sobrien
4438494Sobrienextern FILE *pref_open(char *pref, char *hn, void (*hdr) (FILE *, char *), char *arg);
4538494Sobrienextern auto_tree *new_auto_tree(char *, qelem *);
4638494Sobrienextern automount *new_automount(char *);
4738494Sobrienextern char **g_argv;
4838494Sobrienextern char *autodir;
4938494Sobrienextern char *bootparams_pref;
5038494Sobrienextern char *disk_fs_strings[];
5138494Sobrienextern char *dumpset_pref;
5238494Sobrienextern char *ether_if_strings[];
5338494Sobrienextern char *exportfs_pref;
5438494Sobrienextern char *fsmount_strings[];
5538494Sobrienextern char *fstab_pref;
5638494Sobrienextern char *host_strings[];
5738494Sobrienextern char *mount_pref;
5838494Sobrienextern char *mount_strings[];
5938494Sobrienextern char *progname;
6038494Sobrienextern char *username;
6138494Sobrienextern char *xcalloc(int, int);
6238494Sobrienextern char hostname[];
6338494Sobrienextern char idvbuf[];
6438494Sobrienextern dict *dict_of_hosts;
6538494Sobrienextern dict *dict_of_volnames;
6638494Sobrienextern dict *new_dict(void);
6738494Sobrienextern dict_ent *dict_locate(dict *, char *);
6838494Sobrienextern disk_fs *new_disk_fs(void);
6938494Sobrienextern ether_if *new_ether_if(void);
7038494Sobrienextern fsmount *new_fsmount(void);
7138494Sobrienextern host *new_host(void);
7238494Sobrienextern int dict_iter(dict *, int (*)(qelem *));
7338494Sobrienextern int errors;
7438494Sobrienextern int file_io_errors;
7538494Sobrienextern int parse_errors;
7638494Sobrienextern int pref_close(FILE *fp);
7738494Sobrienextern int verbose;
7838494Sobrienextern ioloc *current_location(void);
7938494Sobrienextern fsi_mount *new_mount(void);
8038494Sobrienextern qelem *new_que(void);
8138494Sobrienextern void analyze_automounts(qelem *);
8238494Sobrienextern void analyze_hosts(qelem *);
83174294Sobrienextern void compute_automount_point(char *, size_t, host *, char *);
8438494Sobrienextern void dict_add(dict *, char *, char *);
8582794Sobrienextern void error(char *fmt, ...)
8682794Sobrien	__attribute__((__format__(__printf__, 1, 2)));
8782794Sobrienextern void fatal(char *fmt, ...)
8882794Sobrien	__attribute__((__format__(__printf__, 1, 2)));
8938494Sobrienextern void gen_hdr(FILE *ef, char *hn);
9038494Sobrienextern void info_hdr(FILE *ef, char *info);
9138494Sobrienextern void init_que(qelem *);
9238494Sobrienextern void ins_que(qelem *, qelem *);
9382794Sobrienextern void lerror(ioloc *l, char *fmt, ...)
9482794Sobrien	__attribute__((__format__(__printf__, 2, 3)));
95119679Smbrextern void fsi_log(char *fmt, ...)
9682794Sobrien	__attribute__((__format__(__printf__, 1, 2)));
9782794Sobrienextern void lwarning(ioloc *l, char *fmt, ...)
9882794Sobrien	__attribute__((__format__(__printf__, 2, 3)));
9938494Sobrienextern void rem_que(qelem *);
10038494Sobrienextern void set_disk_fs(disk_fs *, int, char *);
10138494Sobrienextern void set_fsmount(fsmount *, int, char *);
10238494Sobrienextern void set_mount(fsi_mount *, int, char *);
10338494Sobrienextern void show_area_being_processed(char *area, int n);
10438494Sobrienextern void show_new(char *msg);
10538494Sobrienextern void warning(void);
10638494Sobrien
10782794Sobrienextern int yyerror(char *fmt, ...)
10882794Sobrien	__attribute__((__format__(__printf__, 1, 2)));
10938494Sobrienextern void domain_strip(char *otherdom, char *localdom);
11038494Sobrien/*
11138494Sobrien * some systems such as DU-4.x have a different GNU flex in /usr/bin
11238494Sobrien * which automatically generates yywrap macros and symbols.  So I must
11338494Sobrien * distinguish between them and when yywrap is actually needed.
11438494Sobrien */
11538494Sobrien#ifndef yywrap
11638494Sobrienextern int yywrap(void);
11738494Sobrien#endif /* not yywrap */
11838494Sobrienextern int yyparse(void);
11938494Sobrienextern int write_atab(qelem *q);
12038494Sobrienextern int write_bootparams(qelem *q);
12138494Sobrienextern int write_dumpset(qelem *q);
12238494Sobrienextern int write_exportfs(qelem *q);
12338494Sobrienextern int write_fstab(qelem *q);
12438494Sobrienextern void col_cleanup(int eoj);
12538494Sobrienextern void set_host(host *hp, int k, char *v);
12638494Sobrienextern void set_ether_if(ether_if *ep, int k, char *v);
12738494Sobrienextern int yylex(void);
12838494Sobrien
12938494Sobrien
13038494Sobrien#define	BITSET(m,b)	((m) |= (1<<(b)))
13138494Sobrien#define	AM_FIRST(ty, q)	((ty *) ((q)->q_forw))
13238494Sobrien#define	HEAD(ty, q)	((ty *) q)
13338494Sobrien#define	ISSET(m,b)	((m) & (1<<(b)))
13438494Sobrien#define	ITER(v, ty, q) 	for ((v) = AM_FIRST(ty,(q)); (v) != HEAD(ty,(q)); (v) = NEXT(ty,(v)))
13538494Sobrien#define	AM_LAST(ty, q)	((ty *) ((q)->q_back))
13638494Sobrien#define	NEXT(ty, q)	((ty *) (((qelem *) q)->q_forw))
137