1 /*
2  * Copyright (c) 1992-1998 Michael A. Cooper.
3  * This software may be freely used and distributed provided it is not
4  * sold for profit or used in part or in whole for commercial gain
5  * without prior written agreement, and the author is credited
6  * appropriately.
7  */
8 
9 /*
10  * $Id: filesys.h,v 6.20 1998/11/10 04:02:47 mcooper Exp $
11  * @(#)filesys.h
12  */
13 
14 #ifndef __filesys_h__
15 #define __filesys_h__
16 
17 /*
18  * File System information
19  */
20 
21 /*
22  * Mount information
23  */
24 #if FSI_TYPE == FSI_GETMNT
25 #	include <sys/types.h>
26 #	include <sys/param.h>
27 #	include <sys/mount.h>
28 #	define MOUNTED_FILE		"<none>"
29 #endif
30 
31 #if FSI_TYPE == FSI_GETFSSTAT
32 #	include <sys/types.h>
33 #	include <sys/mount.h>
34 #	define MOUNTED_FILE		"<none>"
35 #endif
36 
37 #if FSI_TYPE == FSI_MNTCTL
38 #	include <sys/mntctl.h>
39 #	define MOUNTED_FILE		"<none>"
40 #endif
41 
42 #if FSI_TYPE == FSI_GETMNTENT
43 #	include <mntent.h>
44 #	define	MOUNTED_FILE		MOUNTED
45 #endif
46 
47 #if FSI_TYPE == FSI_GETMNTENT2
48 #if     defined(MNTTAB_H)
49 #       include MNTTAB_H
50 #endif	/* MNTTAB_H */
51 #if     defined(MNTENT_H)
52 #       include MNTENT_H
53 #endif	/* MNTENT_H */
54 #	define	MOUNTED_FILE		MNTTAB
55 #endif	/* FSI_GETMNTENT2 */
56 
57 #if	!defined(MOUNTED_FILE) && defined(MNT_MNTTAB)	/* HPUX */
58 #	define MOUNTED_FILE		MNT_MNTTAB
59 #endif	/* MNT_MNTTAB */
60 
61 /*
62  * NCR OS defines bcopy and bzero
63  */
64 #if defined(NCR)
65 #undef bcopy
66 #undef bzero
67 #endif	/* NCR */
68 
69 /*
70  * Stat Filesystem
71  */
72 #if 	defined(STATFS_TYPE)
73 #if defined(ultrix)
74 	typedef struct fs_data		statfs_t;
75 #	define f_bavail			fd_req.bfreen
76 #	define f_bsize			fd_req.bsize
77 #	define f_ffree			fd_req.gfree
78 #else
79 #if defined(_AIX) || STATFS_TYPE == STATFS_SYSV
80 #	include <sys/statfs.h>
81 	typedef struct statfs		statfs_t;
82 #	define f_bavail			f_bfree
83 #else
84 #if defined(SVR4)
85 #	include <sys/statvfs.h>
86 	typedef struct statvfs		statfs_t;
87 #	define statfs(mp,sb)		statvfs(mp,sb)
88 #else
89 #if defined(BSD386) || defined(__bsdi__) || defined(FREEBSD) || STATFS_TYPE == STATFS_OSF1
90 	typedef struct statfs		statfs_t;
91 #else
92 #	include <sys/vfs.h>
93 	typedef struct statfs 		statfs_t;
94 #endif	/* BSD386 */
95 #endif	/* SVR4 */
96 #endif	/* _AIX */
97 #endif	/* ultrix */
98 #endif	/* STATFS_TYPE */
99 
100 /*
101  * Mount Entry definetions
102  */
103 #ifndef METYPE_OTHER
104 #define METYPE_OTHER			"other"
105 #endif
106 #ifndef METYPE_NFS
107 #define METYPE_NFS			"nfs"
108 #endif
109 #ifndef MEFLAG_READONLY
110 #define MEFLAG_READONLY			0x01
111 #endif
112 #ifndef MEFLAG_IGNORE
113 #define MEFLAG_IGNORE			0x02
114 #endif
115 
116 /*
117  * Our internal mount entry type
118  */
119 struct _mntent {
120 	char			       *me_path;	/* Mounted path */
121 	char			       *me_type;	/* Type of mount */
122 	int				me_flags;	/* Mount flags */
123 };
124 typedef struct _mntent mntent_t;
125 
126 /*
127  * Internal mount information type
128  */
129 struct mntinfo {
130 	mntent_t			*mi_mnt;
131 	struct stat			*mi_statb;
132 	struct mntinfo			*mi_nxt;
133 };
134 
135 /*
136  * Declarations
137  */
138 FILE	       *setmountent();
139 mntent_t       *getmountent();
140 mntent_t       *newmountent();
141 void		endmountent();
142 
143 #endif	/* __filesys_h__ */
144