Annotation of prex-old/include/sys/mount.h, Revision 1.1
1.1 ! nbrk 1: /*-
! 2: * Copyright (c) 1989, 1991, 1993
! 3: * The Regents of the University of California. All rights reserved.
! 4: *
! 5: * Redistribution and use in source and binary forms, with or without
! 6: * modification, are permitted provided that the following conditions
! 7: * are met:
! 8: * 1. Redistributions of source code must retain the above copyright
! 9: * notice, this list of conditions and the following disclaimer.
! 10: * 2. Redistributions in binary form must reproduce the above copyright
! 11: * notice, this list of conditions and the following disclaimer in the
! 12: * documentation and/or other materials provided with the distribution.
! 13: * 3. Neither the name of the University nor the names of its contributors
! 14: * may be used to endorse or promote products derived from this software
! 15: * without specific prior written permission.
! 16: *
! 17: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 18: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 19: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 20: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 21: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 22: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 23: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 24: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 25: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 26: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 27: * SUCH DAMAGE.
! 28: *
! 29: * @(#)mount.h 8.21 (Berkeley) 5/20/95
! 30: */
! 31:
! 32: #ifndef _SYS_MOUNT_H
! 33: #define _SYS_MOUNT_H
! 34:
! 35: #include <sys/cdefs.h>
! 36: #include <sys/list.h>
! 37: #include <sys/vnode.h>
! 38: #include <sys/syslimits.h>
! 39:
! 40: typedef struct { int32_t val[2]; } fsid_t; /* file system id type */
! 41:
! 42:
! 43: /*
! 44: * file system statistics
! 45: */
! 46: struct statfs {
! 47: short f_type; /* filesystem type number */
! 48: short f_flags; /* copy of mount flags */
! 49: long f_bsize; /* fundamental file system block size */
! 50: long f_blocks; /* total data blocks in file system */
! 51: long f_bfree; /* free blocks in fs */
! 52: long f_bavail; /* free blocks avail to non-superuser */
! 53: long f_files; /* total file nodes in file system */
! 54: long f_ffree; /* free file nodes in fs */
! 55: fsid_t f_fsid; /* file system id */
! 56: long f_namelen; /* maximum filename length */
! 57: };
! 58:
! 59: /*
! 60: * Mount data
! 61: */
! 62: struct mount {
! 63: struct list m_link; /* link to next mount point */
! 64: struct vfsops *m_op; /* pointer to vfs operation */
! 65: int m_flags; /* mount flag */
! 66: int m_count; /* reference count */
! 67: char m_path[PATH_MAX]; /* mounted path */
! 68: dev_t m_dev; /* mounted device */
! 69: struct vnode *m_root; /* root vnode */
! 70: struct vnode *m_covered; /* vnode covered on parent fs */
! 71: void *m_data; /* private data for fs */
! 72: };
! 73: typedef struct mount *mount_t;
! 74:
! 75:
! 76: /*
! 77: * Mount flags.
! 78: *
! 79: * Unmount uses MNT_FORCE flag.
! 80: */
! 81: #define MNT_RDONLY 0x00000001 /* read only filesystem */
! 82: #define MNT_SYNCHRONOUS 0x00000002 /* file system written synchronously */
! 83: #define MNT_NOEXEC 0x00000004 /* can't exec from filesystem */
! 84: #define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */
! 85: #define MNT_NODEV 0x00000010 /* don't interpret special files */
! 86: #define MNT_UNION 0x00000020 /* union with underlying filesystem */
! 87: #define MNT_ASYNC 0x00000040 /* file system written asynchronously */
! 88:
! 89: /*
! 90: * exported mount flags.
! 91: */
! 92: #define MNT_EXRDONLY 0x00000080 /* exported read only */
! 93: #define MNT_EXPORTED 0x00000100 /* file system is exported */
! 94: #define MNT_DEFEXPORTED 0x00000200 /* exported to the world */
! 95: #define MNT_EXPORTANON 0x00000400 /* use anon uid mapping for everyone */
! 96: #define MNT_EXKERB 0x00000800 /* exported with Kerberos uid mapping */
! 97:
! 98: /*
! 99: * Flags set by internal operations.
! 100: */
! 101: #define MNT_LOCAL 0x00001000 /* filesystem is stored locally */
! 102: #define MNT_QUOTA 0x00002000 /* quotas are enabled on filesystem */
! 103: #define MNT_ROOTFS 0x00004000 /* identifies the root filesystem */
! 104:
! 105: /*
! 106: * Mask of flags that are visible to statfs()
! 107: */
! 108: #define MNT_VISFLAGMASK 0x0000ffff
! 109:
! 110: /*
! 111: * External filesystem control flags.
! 112: */
! 113: #define MNT_UPDATE 0x00010000 /* not a real mount, just an update */
! 114: #define MNT_DELEXPORT 0x00020000 /* delete export host lists */
! 115: #define MNT_RELOAD 0x00040000 /* reload filesystem data */
! 116: #define MNT_FORCE 0x00080000 /* force unmount or readonly change */
! 117: /*
! 118: * Internal filesystem control flags.
! 119: *
! 120: * MNT_UNMOUNT locks the mount entry so that name lookup cannot proceed
! 121: * past the mount point. This keeps the subtree stable during mounts
! 122: * and unmounts.
! 123: */
! 124: #define MNT_UNMOUNT 0x01000000 /* unmount in progress */
! 125: #define MNT_MWAIT 0x02000000 /* waiting for unmount to finish */
! 126: #define MNT_WANTRDWR 0x04000000 /* upgrade to read/write requested */
! 127:
! 128: /*
! 129: * Sysctl CTL_VFS definitions.
! 130: *
! 131: * Second level identifier specifies which filesystem. Second level
! 132: * identifier VFS_GENERIC returns information about all filesystems.
! 133: */
! 134: #define VFS_GENERIC 0 /* generic filesystem information */
! 135: /*
! 136: * Third level identifiers for VFS_GENERIC are given below; third
! 137: * level identifiers for specific filesystems are given in their
! 138: * mount specific header files.
! 139: */
! 140: #define VFS_MAXTYPENUM 1 /* int: highest defined filesystem type */
! 141: #define VFS_CONF 2 /* struct: vfsconf for filesystem given
! 142: as next argument */
! 143:
! 144: /*
! 145: * Flags for various system call interfaces.
! 146: *
! 147: * waitfor flags to vfs_sync() and getfsstat()
! 148: */
! 149: #define MNT_WAIT 1
! 150: #define MNT_NOWAIT 2
! 151:
! 152:
! 153: /*
! 154: * Filesystem type switch table.
! 155: */
! 156: struct vfssw {
! 157: char *vs_name; /* name of file system */
! 158: int (*vs_init)(void); /* initialize routine */
! 159: struct vfsops *vs_op; /* pointer to vfs operation */
! 160: };
! 161:
! 162: /*
! 163: * Operations supported on virtual file system.
! 164: */
! 165: struct vfsops {
! 166: int (*mount) (mount_t mp, char *dev, int flags, void *data);
! 167: int (*unmount) (mount_t mp);
! 168: int (*sync) (mount_t mp);
! 169: int (*vget) (mount_t mp, vnode_t vp);
! 170: int (*statfs) (mount_t mp, struct statfs *sfp);
! 171: struct vnops *vnops;
! 172: };
! 173:
! 174: typedef int (*vfsop_mount_t)(mount_t, char *, int, void *);
! 175: typedef int (*vfsop_umount_t)(mount_t);
! 176: typedef int (*vfsop_sync_t)(mount_t);
! 177: typedef int (*vfsop_vget_t)(mount_t, vnode_t);
! 178: typedef int (*vfsop_statfs_t)(mount_t, struct statfs *);
! 179:
! 180: /*
! 181: * VFS interface
! 182: */
! 183: #define VFS_MOUNT(MP, DEV, FL, DAT) ((MP)->m_op->mount)(MP, DEV, FL, DAT)
! 184: #define VFS_UNMOUNT(MP) ((MP)->m_op->unmount)(MP)
! 185: #define VFS_SYNC(MP) ((MP)->m_op->sync)(MP)
! 186: #define VFS_VGET(MP, VP) ((MP)->m_op->vget)(MP, VP)
! 187: #define VFS_STATFS(MP, SFP) ((MP)->m_op->statfs)(MP, SFP)
! 188:
! 189: #define VFS_NULL ((void *)vfs_null)
! 190:
! 191: __BEGIN_DECLS
! 192: int mount(const char *, const char *, const char *, int, void *);
! 193: int umount(const char *);
! 194: int vfs_nullop(void);
! 195: int vfs_einval(void);
! 196: __END_DECLS
! 197:
! 198: #endif /* !_SYS_MOUNT_H */
CVSweb