]> git.ipfire.org Git - thirdparty/util-linux.git/blob - mount/sundries.h
Imported from util-linux-2.7.1 tarball.
[thirdparty/util-linux.git] / mount / sundries.h
1 /*
2 * Support function prototypes. Functions are in sundries.c.
3 * sundries.h,v 1.1.1.1 1993/11/18 08:40:51 jrs Exp
4 */
5
6 #include <sys/types.h>
7 #include <fcntl.h>
8 #include <limits.h>
9 #include <signal.h>
10 #include <stdarg.h>
11 #include <stdlib.h>
12 #ifndef bool_t
13 #include <rpc/types.h>
14 #endif
15
16 extern int mount_quiet;
17 extern int verbose;
18
19 #define streq(s, t) (strcmp ((s), (t)) == 0)
20
21
22 /* String list data structure. */
23 typedef struct string_list
24 {
25 char *hd;
26 struct string_list *tl;
27 } *string_list;
28
29 #define car(p) ((p) -> hd)
30 #define cdr(p) ((p) -> tl)
31
32 string_list cons (char *a, const string_list);
33
34 /* Quiet compilation with -Wmissing-prototypes. */
35 int main (int argc, char *argv[]);
36
37 /* Functions in sundries.c that are used in mount.c and umount.c */
38 void block_signals (int how);
39 char *canonicalize (const char *path);
40 char *realpath (const char *path, char *resolved_path);
41 void error (const char *fmt, ...);
42 int matching_type (const char *type, string_list types);
43 string_list parse_list (char *strings);
44 void *xmalloc (size_t size);
45 char *xstrdup (const char *s);
46 char *xstrndup (const char *s, int n);
47 char *xstrconcat2 (const char *, const char *);
48 char *xstrconcat3 (const char *, const char *, const char *);
49 char *xstrconcat4 (const char *, const char *, const char *, const char *);
50
51 /* Here is some serious cruft. */
52 #ifdef __GNUC__
53 #if defined(__GNUC_MINOR__) && __GNUC__ == 2 && __GNUC_MINOR__ >= 5
54 void die (int errcode, const char *fmt, ...) __attribute__ ((noreturn));
55 #else /* GNUC < 2.5 */
56 void volatile die (int errcode, const char *fmt, ...);
57 #endif /* GNUC < 2.5 */
58 #else /* !__GNUC__ */
59 void die (int errcode, const char *fmt, ...);
60 #endif /* !__GNUC__ */
61
62 #ifdef HAVE_NFS
63 int nfsmount (const char *spec, const char *node, int *flags,
64 char **orig_opts, char **opt_args);
65 #endif
66
67 /* exit status - bits below are ORed */
68 #define EX_USAGE 1 /* incorrect invocation or permission */
69 #define EX_SYSERR 2 /* out of memory, cannot fork, ... */
70 #define EX_SOFTWARE 4 /* internal mount bug or wrong version */
71 #define EX_USER 8 /* user interrupt */
72 #define EX_FILEIO 16 /* problems writing, locking, ... mtab/fstab */
73 #define EX_FAIL 32 /* mount failure */
74 #define EX_SOMEOK 64 /* some mount succeeded */