summaryrefslogtreecommitdiff
path: root/Utility/libmounts.h
blob: 0bd52e323069a3fb2bf74a8929d3e3934bd20983 (plain)
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
/* Include appropriate headers for the OS, and define what will be used. */
#if defined(__APPLE__)
# include <sys/param.h>
# include <sys/ucred.h>
# include <sys/mount.h>
/* In newer OSX versions, statfs64 is deprecated, in favor of statfs,
 * which is 64 bit only with a build option -- but statfs64 still works,
 * and this keeps older OSX also supported. */
# define GETMNTINFOCALL getmntinfo64
# define MNTINFOSTRUCT statfs64
#else
#if defined (__FreeBSD__)
# include <sys/param.h>
# include <sys/ucred.h>
# include <sys/mount.h>
# define GETMNTINFOCALL getmntinfo64
# define MNTINFOSTRUCT statfs64
#else
#if defined (__linux__) || defined (__FreeBSD_kernel__)
/* Linux or Debian kFreeBSD */
#include <mntent.h>
# define GETMNTENT
#else
# warning mounts listing code not available for this OS
# define UNKNOWN
#endif
#endif
#endif

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#ifndef GETMNTENT
#warning "boo"
struct mntent {
	char *mnt_fsname;
	char *mnt_dir;
	char *mnt_type;
	char *mnt_opts; /* not filled in */
	int mnt_freq; /* not filled in */
	int mnt_passno; /* not filled in */
};
#endif

FILE *mounts_start (void);
int mounts_end (FILE *fp);
struct mntent *mounts_next (FILE *fp);