File: mntinfo.h

package info (click to toggle)
fdclone 3.01b-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 4,772 kB
  • ctags: 8,674
  • sloc: ansic: 100,552; makefile: 4,497; sh: 1,480; sed: 224
file content (113 lines) | stat: -rw-r--r-- 2,718 bytes parent folder | download
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
 *	mntinfo.h
 *
 *	definitions & function prototype declarations for "mntinfo.c"
 */

#ifndef	__MNTINFO_H_
#define	__MNTINFO_H_

#ifdef	USEMNTENTH
#include <mntent.h>
#endif
#ifdef	USEMNTTABH
#include <sys/mnttab.h>
#endif
#ifdef	USEMNTCTL
#include <fshelp.h>
#include <sys/vfs.h>
#include <sys/mntctl.h>
#include <sys/vmount.h>
#endif

#define	ETCMTAB			"/etc/mtab"
#define	PROCMOUNTS		"/proc/mounts"
#define	DEVROOT			"/dev/root"
#define	ROOTFS			"rootfs"

#ifdef	USEMNTENTH
typedef struct mntent		mnt_t;
#define	Xmnt_fsname		mnt_fsname
#define	Xmnt_dir		mnt_dir
#define	Xmnt_type		mnt_type
#define	Xmnt_opts		mnt_opts
#define	Xsetmntent		setmntent
#define	Xgetmntent(f, m)	getmntent(f)
#define	Xendmntent		endmntent
#endif

#ifdef	USEMNTTABH
#define	MOUNTED			MNTTAB
typedef struct mnttab		mnt_t;
#define	Xmnt_fsname		mnt_special
#define	Xmnt_dir		mnt_mountp
#define	Xmnt_type		mnt_fstype
#define	Xmnt_opts		mnt_mntopts
#define	Xsetmntent		fopen
#define	Xgetmntent(f, m)	(getmntent(f, m) ? NULL : m)
#define	Xendmntent		fclose
#endif

#if	defined (USEGETFSSTAT) || defined (USEGETVFSTAT) \
|| defined (USEMNTCTL) || defined (USEMNTINFOR) || defined (USEMNTINFO) \
|| defined (USEGETMNT) || defined (USEREADMTAB)
typedef struct _mnt_t {
	CONST char *Xmnt_fsname;
	CONST char *Xmnt_dir;
	CONST char *Xmnt_type;
	CONST char *Xmnt_opts;
} mnt_t;
# ifdef	USEREADMTAB
# define	Xendmntent	fclose
# else	/* !USEREADMTAB */
#  if	defined (USEMNTINFO) || defined (USEGETMNT)
#  define	Xendmntent(f)
#  else
#  define	Xendmntent	Xfree
#  endif
# endif	/* !USEREADMTAB */
#endif	/* USEGETFSSTAT || USEGETVFSTAT || USEMNTCTL \
|| USEMNTINFOR || USEMNTINFO || USEGETMNT || USEREADMTAB */

#ifdef	USEGETFSENT
typedef struct fstab		mnt_t;
#define	Xmnt_fsname		fs_spec
#define	Xmnt_dir		fs_file
#define	Xmnt_type		fs_vfstype
#define	Xmnt_opts		fs_mntops
#define	Xsetmntent(f, m)	(FILE *)setfsent()
#define	Xgetmntent(f, m)	getfsent()
#define	Xendmntent(fp)		endfsent()
#endif

#if	MSDOS
# ifdef	DOUBLESLASH
# define	MNTDIRSIZ	MAXPATHLEN
# else
# define	MNTDIRSIZ	(3 + 1)
# endif
typedef struct _mnt_t {
	CONST char *Xmnt_fsname;
	char Xmnt_dir[MNTDIRSIZ];
	CONST char *Xmnt_type;
	CONST char *Xmnt_opts;
} mnt_t;
#endif	/* MSDOS */

#ifdef	USEPROCMNT
#undef	MOUNTED
#define	MOUNTED			PROCMOUNTS
#endif
#ifndef	MOUNTED
#define	MOUNTED			ETCMTAB
#endif

#if	defined (USEGETFSSTAT) || defined (USEGETVFSTAT) \
|| defined (USEMNTCTL) || defined (USEMNTINFOR) || defined (USEMNTINFO) \
|| defined (USEGETMNT) || defined (USEREADMTAB)
extern FILE *Xsetmntent __P_((CONST char *, CONST char *));
extern mnt_t *Xgetmntent __P_((FILE *, mnt_t *));
#endif
extern char *Xhasmntopt __P_((mnt_t *, CONST char *));

#endif	/* !__MNTINFO_H_ */