Annotation of Net2/sys/mount.h, revision 1.1.1.3

1.1       root        1: /*
                      2:  * Copyright (c) 1989 The Regents of the University of California.
                      3:  * 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. All advertising materials mentioning features or use of this software
                     14:  *    must display the following acknowledgement:
                     15:  *     This product includes software developed by the University of
                     16:  *     California, Berkeley and its contributors.
                     17:  * 4. Neither the name of the University nor the names of its contributors
                     18:  *    may be used to endorse or promote products derived from this software
                     19:  *    without specific prior written permission.
                     20:  *
                     21:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     22:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     23:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     24:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     25:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     26:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     27:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     28:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     29:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     30:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     31:  * SUCH DAMAGE.
                     32:  *
1.1.1.3 ! root       33:  *     from: @(#)mount.h       7.22 (Berkeley) 6/3/91
        !            34:  *     mount.h,v 1.11.2.1 1993/08/05 02:37:35 cgd Exp
1.1       root       35:  */
                     36: 
1.1.1.3 ! root       37: #ifndef _SYS_MOUNT_H_
        !            38: #define _SYS_MOUNT_H_
        !            39: 
1.1       root       40: typedef quad fsid_t;                   /* file system id type */
                     41: 
                     42: /*
                     43:  * File identifier.
                     44:  * These are unique per filesystem on a single machine.
                     45:  */
                     46: #define        MAXFIDSZ        16
                     47: 
                     48: struct fid {
                     49:        u_short         fid_len;                /* length of data in bytes */
                     50:        u_short         fid_reserved;           /* force longword alignment */
                     51:        char            fid_data[MAXFIDSZ];     /* data (variable length) */
                     52: };
                     53: 
                     54: /*
                     55:  * file system statistics
                     56:  */
                     57: 
                     58: #define MNAMELEN 90    /* length of buffer for returned name */
                     59: 
                     60: struct statfs {
                     61:        short   f_type;                 /* type of filesystem (see below) */
                     62:        short   f_flags;                /* copy of mount flags */
                     63:        long    f_fsize;                /* fundamental file system block size */
                     64:        long    f_bsize;                /* optimal transfer block size */
                     65:        long    f_blocks;               /* total data blocks in file system */
                     66:        long    f_bfree;                /* free blocks in fs */
                     67:        long    f_bavail;               /* free blocks avail to non-superuser */
                     68:        long    f_files;                /* total file nodes in file system */
                     69:        long    f_ffree;                /* free file nodes in fs */
                     70:        fsid_t  f_fsid;                 /* file system id */
                     71:        long    f_spare[9];             /* spare for later */
                     72:        char    f_mntonname[MNAMELEN];  /* directory on which mounted */
                     73:        char    f_mntfromname[MNAMELEN];/* mounted filesystem */
                     74: };
                     75: 
                     76: /*
                     77:  * File system types.
                     78:  */
                     79: #define        MOUNT_NONE      0
1.1.1.2   root       80: #define        MOUNT_UFS       1               /* UNIX "Fast" Filesystem */
                     81: #define        MOUNT_NFS       2               /* Network Filesystem */
                     82: #define        MOUNT_MFS       3               /* Memory Filesystem */
                     83: #define        MOUNT_MSDOS     4               /* MSDOS Filesystem */
                     84: #define MOUNT_ISOFS    5               /* iso9660 cdrom */
                     85: #define MOUNT_FDESC    6               /* /dev/fd filesystem */
                     86: #define MOUNT_KERNFS   7               /* kernel variable filesystem */
1.1.1.3 ! root       87: #define MOUNT_DEVFS    8               /* device node filesystem */
        !            88: #define MOUNT_AFS      9               /* AFS 3.x */
        !            89: #define        MOUNT_MAXTYPE   MOUNT_AFS
1.1       root       90: 
                     91: /*
                     92:  * Structure per mounted file system.
                     93:  * Each mounted file system has an array of
                     94:  * operations and an instance record.
                     95:  * The file systems are put on a doubly linked list.
                     96:  */
                     97: struct mount {
                     98:        struct mount    *mnt_next;              /* next in mount list */
                     99:        struct mount    *mnt_prev;              /* prev in mount list */
                    100:        struct vfsops   *mnt_op;                /* operations on fs */
                    101:        struct vnode    *mnt_vnodecovered;      /* vnode we mounted on */
                    102:        struct vnode    *mnt_mounth;            /* list of vnodes this mount */
                    103:        int             mnt_flag;               /* flags */
                    104:        uid_t           mnt_exroot;             /* exported mapping for uid 0 */
                    105:        struct statfs   mnt_stat;               /* cache of filesystem stats */
                    106:        qaddr_t         mnt_data;               /* private data */
                    107: };
                    108: 
                    109: /*
                    110:  * Mount flags.
                    111:  */
                    112: #define        MNT_RDONLY      0x00000001      /* read only filesystem */
                    113: #define        MNT_SYNCHRONOUS 0x00000002      /* file system written synchronously */
                    114: #define        MNT_NOEXEC      0x00000004      /* can't exec from filesystem */
                    115: #define        MNT_NOSUID      0x00000008      /* don't honor setuid bits on fs */
                    116: #define        MNT_NODEV       0x00000010      /* don't interpret special files */
1.1.1.2   root      117: #define        MNT_UNION       0x00000020      /* union with underlying filesysem */
1.1.1.3 ! root      118: #ifdef ISOFS
        !           119: #define ISOFSMNT_NORRIP        0x00000040      /* disable Rock Ridge Ext.*/
        !           120: #endif
1.1       root      121: 
                    122: /*
                    123:  * exported mount flags.
                    124:  */
                    125: #define        MNT_EXPORTED    0x00000100      /* file system is exported */
                    126: #define        MNT_EXRDONLY    0x00000200      /* exported read only */
                    127: 
                    128: /*
                    129:  * Flags set by internal operations.
                    130:  */
                    131: #define        MNT_LOCAL       0x00001000      /* filesystem is stored locally */
                    132: #define        MNT_QUOTA       0x00002000      /* quotas are enabled on filesystem */
                    133: 
                    134: /*
                    135:  * Mask of flags that are visible to statfs()
                    136:  */
                    137: #define        MNT_VISFLAGMASK 0x0000ffff
                    138: 
                    139: /*
                    140:  * filesystem control flags.
                    141:  *
                    142:  * MNT_MLOCK lock the mount entry so that name lookup cannot proceed
                    143:  * past the mount point.  This keeps the subtree stable during mounts
                    144:  * and unmounts.
                    145:  */
                    146: #define        MNT_UPDATE      0x00010000      /* not a real mount, just an update */
                    147: #define        MNT_MLOCK       0x00100000      /* lock so that subtree is stable */
                    148: #define        MNT_MWAIT       0x00200000      /* someone is waiting for lock */
                    149: #define MNT_MPBUSY     0x00400000      /* scan of mount point in progress */
                    150: #define MNT_MPWANT     0x00800000      /* waiting for mount point */
                    151: #define MNT_UNMOUNT    0x01000000      /* unmount in progress */
                    152: 
                    153: /*
                    154:  * Operations supported on mounted file system.
                    155:  */
                    156: #ifdef KERNEL
                    157: #ifdef __STDC__
                    158: struct nameidata;
                    159: #endif
                    160: 
                    161: struct vfsops {
                    162:        int     (*vfs_mount)    __P((struct mount *mp, char *path, caddr_t data,
                    163:                                    struct nameidata *ndp, struct proc *p));
                    164:        int     (*vfs_start)    __P((struct mount *mp, int flags,
                    165:                                    struct proc *p));
                    166:        int     (*vfs_unmount)  __P((struct mount *mp, int mntflags,
                    167:                                    struct proc *p));
                    168:        int     (*vfs_root)     __P((struct mount *mp, struct vnode **vpp));
                    169:                        /* int uid,             should be uid_t */
                    170:        int     (*vfs_quotactl) __P((struct mount *mp, int cmds, int uid,
                    171:                                    caddr_t arg, struct proc *p));
                    172:        int     (*vfs_statfs)   __P((struct mount *mp, struct statfs *sbp,
                    173:                                    struct proc *p));
                    174:        int     (*vfs_sync)     __P((struct mount *mp, int waitfor));
                    175:        int     (*vfs_fhtovp)   __P((struct mount *mp, struct fid *fhp,
                    176:                                    struct vnode **vpp));
                    177:        int     (*vfs_vptofh)   __P((struct vnode *vp, struct fid *fhp));
                    178:        int     (*vfs_init)     __P(());
                    179: };
                    180: 
                    181: #define VFS_MOUNT(MP, PATH, DATA, NDP, P) \
                    182:        (*(MP)->mnt_op->vfs_mount)(MP, PATH, DATA, NDP, P)
                    183: #define VFS_START(MP, FLAGS, P)          (*(MP)->mnt_op->vfs_start)(MP, FLAGS, P)
                    184: #define VFS_UNMOUNT(MP, FORCE, P) (*(MP)->mnt_op->vfs_unmount)(MP, FORCE, P)
                    185: #define VFS_ROOT(MP, VPP)        (*(MP)->mnt_op->vfs_root)(MP, VPP)
                    186: #define VFS_QUOTACTL(MP,C,U,A,P)  (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, P)
                    187: #define VFS_STATFS(MP, SBP, P)   (*(MP)->mnt_op->vfs_statfs)(MP, SBP, P)
                    188: #define VFS_SYNC(MP, WAITFOR)    (*(MP)->mnt_op->vfs_sync)(MP, WAITFOR)
                    189: #define VFS_FHTOVP(MP, FIDP, VPP) (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP)
                    190: #define        VFS_VPTOFH(VP, FIDP)      (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP)
                    191: #endif /* KERNEL */
                    192: 
                    193: /*
                    194:  * Flags for various system call interfaces.
                    195:  *
                    196:  * forcibly flags for vfs_umount().
                    197:  * waitfor flags to vfs_sync() and getfsstat()
                    198:  */
                    199: #define MNT_FORCE      1
                    200: #define MNT_NOFORCE    2
                    201: #define MNT_WAIT       1
                    202: #define MNT_NOWAIT     2
                    203: 
                    204: /*
                    205:  * Generic file handle
                    206:  */
                    207: struct fhandle {
                    208:        fsid_t  fh_fsid;        /* File system id of mount point */
                    209:        struct  fid fh_fid;     /* Id of file */
                    210: };
                    211: typedef struct fhandle fhandle_t;
                    212: 
                    213: /*
                    214:  * Arguments to mount UFS
                    215:  */
                    216: struct ufs_args {
                    217:        char    *fspec;         /* block special device to mount */
                    218:        int     exflags;        /* export related flags */
                    219:        uid_t   exroot;         /* mapping for root uid */
                    220: };
                    221: 
                    222: #ifdef MFS
                    223: /*
                    224:  * Arguments to mount MFS
                    225:  */
                    226: struct mfs_args {
                    227:        char    *name;          /* name to export for statfs */
                    228:        caddr_t base;           /* base address of file system in memory */
                    229:        u_long size;            /* size of file system */
                    230: };
                    231: #endif MFS
                    232: 
1.1.1.2   root      233: #if defined(NFSSERVER) || defined(NFSCLIENT)
1.1       root      234: /*
                    235:  * File Handle (32 bytes for version 2), variable up to 1024 for version 3
                    236:  */
                    237: union nfsv2fh {
                    238:        fhandle_t       fh_generic;
                    239:        u_char          fh_bytes[32];
                    240: };
                    241: typedef union nfsv2fh nfsv2fh_t;
                    242: 
                    243: /*
                    244:  * Arguments to mount NFS
                    245:  */
                    246: struct nfs_args {
                    247:        struct sockaddr *addr;          /* file server address */
                    248:        int             sotype;         /* Socket type */
                    249:        int             proto;          /* and Protocol */
                    250:        nfsv2fh_t       *fh;            /* File handle to be mounted */
                    251:        int             flags;          /* flags */
                    252:        int             wsize;          /* write size in bytes */
                    253:        int             rsize;          /* read size in bytes */
                    254:        int             timeo;          /* initial timeout in .1 secs */
                    255:        int             retrans;        /* times to retry send */
                    256:        char            *hostname;      /* server's name */
                    257: };
                    258: /*
                    259:  * NFS mount option flags
                    260:  */
                    261: #define        NFSMNT_SOFT     0x0001  /* soft mount (hard is default) */
                    262: #define        NFSMNT_WSIZE    0x0002  /* set write size */
                    263: #define        NFSMNT_RSIZE    0x0004  /* set read size */
                    264: #define        NFSMNT_TIMEO    0x0008  /* set initial timeout */
                    265: #define        NFSMNT_RETRANS  0x0010  /* set number of request retrys */
                    266: #define        NFSMNT_HOSTNAME 0x0020  /* set hostname for error printf */
                    267: #define        NFSMNT_INT      0x0040  /* allow interrupts on hard mount */
                    268: #define        NFSMNT_NOCONN   0x0080  /* Don't Connect the socket */
                    269: #define        NFSMNT_SCKLOCK  0x0100  /* Lock socket against others */
                    270: #define        NFSMNT_WANTSCK  0x0200  /* Want a socket lock */
                    271: #define        NFSMNT_SPONGY   0x0400  /* spongy mount (soft for stat and lookup) */
                    272: #define        NFSMNT_COMPRESS 0x0800  /* Compress nfs rpc xdr */
                    273: #define        NFSMNT_LOCKBITS (NFSMNT_SCKLOCK | NFSMNT_WANTSCK)
1.1.1.2   root      274: #endif /* defined(NFSSERVER || defined(NFSCLIENT) */
                    275: 
1.1.1.3 ! root      276: #ifdef MSDOSFS
1.1.1.2   root      277: /*
                    278:  *  Arguments to mount MSDOS filesystems.
                    279:  */
                    280: struct pcfs_args {
                    281:        char *fspec;            /* blocks special holding the fs to mount */
                    282:        int exflags;            /* mount flags                          */
                    283:        uid_t exroot;           /* mapping for root uid                 */
                    284: };
1.1.1.3 ! root      285: #endif /* MSDOSFS */
1.1       root      286: 
                    287: #ifdef KERNEL
                    288: /*
                    289:  * exported vnode operations
                    290:  */
                    291: void   vfs_remove __P((struct mount *mp)); /* remove a vfs from mount list */
                    292: int    vfs_lock __P((struct mount *mp));   /* lock a vfs */
                    293: void   vfs_unlock __P((struct mount *mp)); /* unlock a vfs */
                    294: struct mount *getvfs __P((fsid_t *fsid));  /* return vfs given fsid */
                    295: struct mount *rootfs;                      /* ptr to root mount structure */
                    296: struct vfsops *vfssw[];                    /* mount filesystem type table */
                    297: 
                    298: #else /* KERNEL */
                    299: 
                    300: #include <sys/cdefs.h>
                    301: 
                    302: __BEGIN_DECLS
                    303: int    fstatfs __P((int, struct statfs *));
                    304: int    getfh __P((const char *, fhandle_t *));
                    305: int    getfsstat __P((struct statfs *, long, int));
                    306: int    getmntinfo __P((struct statfs **, int));
                    307: int    mount __P((int, const char *, int, void *));
                    308: int    statfs __P((const char *, struct statfs *));
                    309: int    unmount __P((const char *, int));
                    310: __END_DECLS
                    311: 
                    312: #endif /* KERNEL */
1.1.1.3 ! root      313: 
        !           314: #endif /* !_SYS_MOUNT_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.