summaryrefslogtreecommitdiffstats
path: root/mount/sundries.h
blob: f64d15dbdaa3f7e779b624e5917b24f569eaa449 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * sundries.h
 * Support function prototypes.  Functions are in sundries.c.
 */
#ifndef SUNDRIES_H
#define SUNDRIES_H

#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdlib.h>

/* global mount, umount, and losetup variables */
extern int mount_quiet;
extern int verbose;
extern char *progname;

#define streq(s, t)	(strcmp ((s), (t)) == 0)

void block_signals (int how);

void error (const char *fmt, ...)
	__attribute__ ((__format__ (__printf__, 1, 2)));
void die(int err, const char *fmt, ...)
	__attribute__ ((__format__ (__printf__, 2, 3)));

int matching_type (const char *type, const char *types);
int matching_opts (const char *options, const char *test_opts);
void *xmalloc (size_t size);
char *xstrdup (const char *s);
char *xstrndup (const char *s, int n);
char *xstrconcat3 (char *, const char *, const char *);
char *xstrconcat4 (char *, const char *, const char *, const char *);

int parse_spec(const char *spec, char **name, char **value);

/* exit status - bits below are ORed */
#define EX_USAGE	1	/* incorrect invocation or permission */
#define EX_SYSERR	2	/* out of memory, cannot fork, ... */
#define EX_SOFTWARE	4	/* internal mount bug or wrong version */
#define EX_USER		8	/* user interrupt */
#define EX_FILEIO      16	/* problems writing, locking, ... mtab/fstab */
#define EX_FAIL	       32	/* mount failure */
#define EX_SOMEOK      64	/* some mount succeeded */

#endif /* SUNDRIES_H */