xref: /netbsd-src/external/bsd/am-utils/dist/fsinfo/fsinfo.h (revision fdd524d4ccd2bb0c6f67401e938dabf773eb0372)
1 /*	$NetBSD: fsinfo.h,v 1.1.1.3 2015/01/17 16:34:17 christos Exp $	*/
2 
3 /*
4  * Copyright (c) 1997-2014 Erez Zadok
5  * Copyright (c) 1989 Jan-Simon Pendry
6  * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
7  * Copyright (c) 1989 The Regents of the University of California.
8  * All rights reserved.
9  *
10  * This code is derived from software contributed to Berkeley by
11  * Jan-Simon Pendry at Imperial College, London.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  *    notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  *    notice, this list of conditions and the following disclaimer in the
20  *    documentation and/or other materials provided with the distribution.
21  * 3. Neither the name of the University nor the names of its contributors
22  *    may be used to endorse or promote products derived from this software
23  *    without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35  * SUCH DAMAGE.
36  *
37  *
38  * File: am-utils/fsinfo/fsinfo.h
39  *
40  */
41 
42 extern FILE *pref_open(char *pref, char *hn, void (*hdr) (FILE *, char *), char *arg);
43 extern auto_tree *new_auto_tree(char *, qelem *);
44 extern automount *new_automount(char *);
45 extern char **g_argv;
46 extern char *autodir;
47 extern char *bootparams_pref;
48 extern char *disk_fs_strings[];
49 extern char *dumpset_pref;
50 extern char *ether_if_strings[];
51 extern char *exportfs_pref;
52 extern char *fsmount_strings[];
53 extern char *fstab_pref;
54 extern char *host_strings[];
55 extern char *mount_pref;
56 extern char *mount_strings[];
57 extern char *progname;
58 extern char *username;
59 extern char *xcalloc(int, int);
60 extern char hostname[];
61 extern char idvbuf[];
62 extern dict *dict_of_hosts;
63 extern dict *dict_of_volnames;
64 extern dict *new_dict(void);
65 extern dict_ent *dict_locate(dict *, char *);
66 extern disk_fs *new_disk_fs(void);
67 extern ether_if *new_ether_if(void);
68 extern fsmount *new_fsmount(void);
69 extern host *new_host(void);
70 extern int dict_iter(dict *, int (*)(qelem *));
71 extern int errors;
72 extern int file_io_errors;
73 extern int parse_errors;
74 extern int pref_close(FILE *fp);
75 extern int verbose;
76 extern ioloc *current_location(void);
77 extern fsi_mount *new_mount(void);
78 extern qelem *new_que(void);
79 extern void analyze_automounts(qelem *);
80 extern void analyze_hosts(qelem *);
81 extern void compute_automount_point(char *, size_t, host *, char *);
82 extern void dict_add(dict *, char *, char *);
83 extern void error(char *fmt, ...)
84 	__attribute__((__format__(__printf__, 1, 2)));
85 extern void fatal(char *fmt, ...)
86 	__attribute__((__format__(__printf__, 1, 2)));
87 extern void gen_hdr(FILE *ef, char *hn);
88 extern void info_hdr(FILE *ef, char *info);
89 extern void init_que(qelem *);
90 extern void ins_que(qelem *, qelem *);
91 extern void lerror(ioloc *l, char *fmt, ...)
92 	__attribute__((__format__(__printf__, 2, 3)));
93 extern void fsi_log(char *fmt, ...)
94 	__attribute__((__format__(__printf__, 1, 2)));
95 extern void lwarning(ioloc *l, char *fmt, ...)
96 	__attribute__((__format__(__printf__, 2, 3)));
97 extern void rem_que(qelem *);
98 extern void set_disk_fs(disk_fs *, int, char *);
99 extern void set_fsmount(fsmount *, int, char *);
100 extern void set_mount(fsi_mount *, int, char *);
101 extern void show_area_being_processed(char *area, int n);
102 extern void show_new(char *msg);
103 extern void warning(void);
104 
105 extern int fsi_error(const char *fmt, ...)
106 	__attribute__((__format__(__printf__, 1, 2)));
107 extern void domain_strip(char *otherdom, char *localdom);
108 /*
109  * some systems such as DU-4.x have a different GNU flex in /usr/bin
110  * which automatically generates yywrap macros and symbols.  So I must
111  * distinguish between them and when yywrap is actually needed.
112  */
113 #ifndef yywrap
114 extern int yywrap(void);
115 #endif /* not yywrap */
116 extern int fsi_parse(void);
117 extern int write_atab(qelem *q);
118 extern int write_bootparams(qelem *q);
119 extern int write_dumpset(qelem *q);
120 extern int write_exportfs(qelem *q);
121 extern int write_fstab(qelem *q);
122 extern void col_cleanup(int eoj);
123 extern void set_host(host *hp, int k, char *v);
124 extern void set_ether_if(ether_if *ep, int k, char *v);
125 extern int fsi_lex(void);
126 
127 
128 #define	BITSET(m,b)	((m) |= (1<<(b)))
129 #define	AM_FIRST(ty, q)	((ty *) ((q)->q_forw))
130 #define	HEAD(ty, q)	((ty *) q)
131 #define	ISSET(m,b)	((m) & (1<<(b)))
132 #define	ITER(v, ty, q) 	for ((v) = AM_FIRST(ty,(q)); (v) != HEAD(ty,(q)); (v) = NEXT(ty,(v)))
133 #define	AM_LAST(ty, q)	((ty *) ((q)->q_back))
134 #define	NEXT(ty, q)	((ty *) (((qelem *) q)->q_forw))
135