Annotation of src/usr.bin/rdistd/filesys.h, Revision 1.3
1.3 ! deraadt 1: /* * $OpenBSD: filesys.h,v 1.2 1996/03/05 03:16:18 dm Exp $*/
1.1 dm 2: /*
3: * Copyright (c) 1983 Regents of the University of California.
4: * All rights reserved.
5: *
6: * Redistribution and use in source and binary forms, with or without
7: * modification, are permitted provided that the following conditions
8: * are met:
9: * 1. Redistributions of source code must retain the above copyright
10: * notice, this list of conditions and the following disclaimer.
11: * 2. Redistributions in binary form must reproduce the above copyright
12: * notice, this list of conditions and the following disclaimer in the
13: * documentation and/or other materials provided with the distribution.
14: * 3. All advertising materials mentioning features or use of this software
15: * must display the following acknowledgement:
16: * This product includes software developed by the University of
17: * California, Berkeley and its contributors.
18: * 4. Neither the name of the University nor the names of its contributors
19: * may be used to endorse or promote products derived from this software
20: * without specific prior written permission.
21: *
22: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: * SUCH DAMAGE.
33: */
34:
35: /*
36: * @(#)filesys.h
37: */
38:
39: #ifndef __filesys_h__
40: #define __filesys_h__
41:
42: /*
43: * File System information
44: */
45:
46: /*
47: * Mount information
48: */
49: #if FSI_TYPE == FSI_GETMNT
50: # include <sys/types.h>
51: # include <sys/param.h>
52: # include <sys/mount.h>
53: # define MOUNTED_FILE "<none>"
54: #endif
55:
56: #if FSI_TYPE == FSI_GETFSSTAT
57: # include <sys/types.h>
58: # include <sys/mount.h>
59: # define MOUNTED_FILE "<none>"
60: #endif
61:
62: #if FSI_TYPE == FSI_MNTCTL
63: # include <sys/mntctl.h>
64: # define MOUNTED_FILE "<none>"
65: #endif
66:
67: #if FSI_TYPE == FSI_GETMNTENT
68: # include <mntent.h>
69: # define MOUNTED_FILE MOUNTED
70: #endif
71:
72: #if FSI_TYPE == FSI_GETMNTENT2
73: #if defined(MNTTAB_H)
74: # include MNTTAB_H
75: #endif /* MNTTAB_H */
76: #if defined(MNTENT_H)
77: # include MNTENT_H
78: #endif /* MNTENT_H */
79: # define MOUNTED_FILE MNTTAB
80: #endif /* FSI_GETMNTENT2 */
81:
82: #if !defined(MOUNTED_FILE) && defined(MNT_MNTTAB) /* HPUX */
83: # define MOUNTED_FILE MNT_MNTTAB
84: #endif /* MNT_MNTTAB */
85:
86: /*
87: * NCR OS defines bcopy and bzero
88: */
89: #if defined(NCR)
90: #undef bcopy
91: #undef bzero
92: #endif /* NCR */
93:
94: /*
95: * Stat Filesystem
96: */
97: #if defined(STATFS_TYPE)
98: #if defined(ultrix)
99: typedef struct fs_data statfs_t;
100: # define f_bavail fd_req.bfreen
101: # define f_bsize fd_req.bsize
102: # define f_ffree fd_req.gfree
103: #else
104: #if defined(_AIX) || STATFS_TYPE == STATFS_SYSV
105: # include <sys/statfs.h>
106: typedef struct statfs statfs_t;
107: # define f_bavail f_bfree
108: #else
109: #if defined(SVR4)
110: # include <sys/statvfs.h>
111: typedef struct statvfs statfs_t;
112: # define statfs(mp,sb) statvfs(mp,sb)
113: #else
114: #if defined(BSD386) || defined(__bsdi__) || defined(FREEBSD) || STATFS_TYPE == STATFS_OSF1
115: typedef struct statfs statfs_t;
116: #else
117: # include <sys/vfs.h>
118: typedef struct statfs statfs_t;
119: #endif /* BSD386 */
120: #endif /* SVR4 */
121: #endif /* _AIX */
122: #endif /* ultrix */
123: #endif /* STATFS_TYPE */
124:
125: /*
126: * Mount Entry definetions
127: */
128: #ifndef METYPE_OTHER
129: #define METYPE_OTHER "other"
130: #endif
131: #ifndef METYPE_NFS
132: #define METYPE_NFS "nfs"
133: #endif
134: #ifndef MEFLAG_READONLY
135: #define MEFLAG_READONLY 0x01
136: #endif
137: #ifndef MEFLAG_IGNORE
138: #define MEFLAG_IGNORE 0x02
139: #endif
140:
141: /*
142: * Our internal mount entry type
143: */
144: struct _mntent {
145: char *me_path; /* Mounted path */
146: char *me_type; /* Type of mount */
147: int me_flags; /* Mount flags */
148: };
149: typedef struct _mntent mntent_t;
150:
151: /*
152: * Internal mount information type
153: */
154: struct mntinfo {
155: mntent_t *mi_mnt;
156: struct stat *mi_statb;
157: struct mntinfo *mi_nxt;
158: };
159:
160: /*
161: * Declarations
162: */
163: FILE *setmountent();
164: mntent_t *getmountent();
165: mntent_t *newmountent();
166: void endmountent();
167:
168: #endif /* __filesys_h__ */