[BACK]Return to mount.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / sys

Annotation of src/sys/sys/mount.h, Revision 1.100

1.100   ! gmcgarry    1: /*     $NetBSD: mount.h,v 1.99 2003/02/01 06:23:50 thorpej Exp $       */
1.33      cgd         2:
1.1       cgd         3: /*
1.31      mycroft     4:  * Copyright (c) 1989, 1991, 1993
                      5:  *     The Regents of the University of California.  All rights reserved.
1.1       cgd         6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
                     15:  * 3. All advertising materials mentioning features or use of this software
                     16:  *    must display the following acknowledgement:
                     17:  *     This product includes software developed by the University of
                     18:  *     California, Berkeley and its contributors.
                     19:  * 4. Neither the name of the University nor the names of its contributors
                     20:  *    may be used to endorse or promote products derived from this software
                     21:  *    without specific prior written permission.
                     22:  *
                     23:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     24:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     25:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     26:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     27:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     28:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     29:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     30:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     31:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     32:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     33:  * SUCH DAMAGE.
                     34:  *
1.64      fvdl       35:  *     @(#)mount.h     8.21 (Berkeley) 5/20/95
1.1       cgd        36:  */
                     37:
1.51      mikel      38: #ifndef _SYS_MOUNT_H_
                     39: #define _SYS_MOUNT_H_
                     40:
1.39      jtc        41: #ifndef _KERNEL
1.31      mycroft    42: #include <sys/ucred.h>
1.76      wrstuden   43: #if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
                     44: #include <sys/stat.h>
                     45: #endif /* !_POSIX_C_SOURCE */
1.31      mycroft    46: #endif
1.27      cgd        47: #include <sys/queue.h>
1.64      fvdl       48: #include <sys/lock.h>
1.7       mycroft    49:
1.35      cgd        50: typedef struct { int32_t val[2]; } fsid_t;     /* file system id type */
1.1       cgd        51:
                     52: /*
                     53:  * File identifier.
                     54:  * These are unique per filesystem on a single machine.
                     55:  */
                     56: #define        MAXFIDSZ        16
                     57:
                     58: struct fid {
                     59:        u_short         fid_len;                /* length of data in bytes */
                     60:        u_short         fid_reserved;           /* force longword alignment */
                     61:        char            fid_data[MAXFIDSZ];     /* data (variable length) */
                     62: };
                     63:
                     64: /*
                     65:  * file system statistics
                     66:  */
                     67:
1.42      cgd        68: #define        MFSNAMELEN      16      /* length of fs type name, including nul */
1.26      cgd        69: #define        MNAMELEN        90      /* length of buffer for returned name */
1.1       cgd        70:
                     71: struct statfs {
1.64      fvdl       72:        short   f_type;                 /* type of file system */
1.78      fvdl       73:        u_short f_oflags;               /* deprecated copy of mount flags */
1.27      cgd        74:        long    f_bsize;                /* fundamental file system block size */
                     75:        long    f_iosize;               /* optimal transfer block size */
1.1       cgd        76:        long    f_blocks;               /* total data blocks in file system */
                     77:        long    f_bfree;                /* free blocks in fs */
                     78:        long    f_bavail;               /* free blocks avail to non-superuser */
                     79:        long    f_files;                /* total file nodes in file system */
                     80:        long    f_ffree;                /* free file nodes in fs */
                     81:        fsid_t  f_fsid;                 /* file system id */
1.42      cgd        82:        uid_t   f_owner;                /* user that mounted the file system */
1.78      fvdl       83:        long    f_flags;                /* copy of mount flags */
                     84:        long    f_syncwrites;           /* count of sync writes since mount */
                     85:        long    f_asyncwrites;          /* count of async writes since mount */
                     86:        long    f_spare[1];             /* spare for later */
1.41      cgd        87:        char    f_fstypename[MFSNAMELEN]; /* fs type name */
1.42      cgd        88:        char    f_mntonname[MNAMELEN];    /* directory on which mounted */
                     89:        char    f_mntfromname[MNAMELEN];  /* mounted file system */
1.1       cgd        90: };
                     91:
                     92: /*
                     93:  * File system types.
                     94:  */
1.44      mycroft    95: #define        MOUNT_FFS       "ffs"           /* UNIX "Fast" Filesystem */
                     96: #define        MOUNT_UFS       MOUNT_FFS       /* for compatibility */
1.26      cgd        97: #define        MOUNT_NFS       "nfs"           /* Network Filesystem */
                     98: #define        MOUNT_MFS       "mfs"           /* Memory Filesystem */
                     99: #define        MOUNT_MSDOS     "msdos"         /* MSDOS Filesystem */
1.31      mycroft   100: #define        MOUNT_LFS       "lfs"           /* Log-based Filesystem */
                    101: #define        MOUNT_FDESC     "fdesc"         /* File Descriptor Filesystem */
                    102: #define        MOUNT_PORTAL    "portal"        /* Portal Filesystem */
                    103: #define        MOUNT_NULL      "null"          /* Minimal Filesystem Layer */
1.79      wrstuden  104: #define        MOUNT_OVERLAY   "overlay"       /* Minimal Overlay Filesystem Layer */
1.31      mycroft   105: #define        MOUNT_UMAP      "umap"  /* User/Group Identifier Remapping Filesystem */
                    106: #define        MOUNT_KERNFS    "kernfs"        /* Kernel Information Filesystem */
                    107: #define        MOUNT_PROCFS    "procfs"        /* /proc Filesystem */
                    108: #define        MOUNT_AFS       "afs"           /* Andrew Filesystem */
                    109: #define        MOUNT_CD9660    "cd9660"        /* ISO9660 (aka CDROM) Filesystem */
                    110: #define        MOUNT_UNION     "union"         /* Union (translucent) Filesystem */
1.36      mycroft   111: #define        MOUNT_ADOSFS    "adosfs"        /* AmigaDOS Filesystem */
1.66      kleink    112: #define        MOUNT_EXT2FS    "ext2fs"        /* Second Extended Filesystem */
1.69      rvb       113: #define        MOUNT_CFS       "coda"          /* Coda Filesystem */
                    114: #define        MOUNT_CODA      "coda"          /* Coda Filesystem */
1.68      mark      115: #define        MOUNT_FILECORE  "filecore"      /* Acorn Filecore Filesystem */
1.75      christos  116: #define        MOUNT_NTFS      "ntfs"          /* Windows/NT Filesystem */
1.93      deberg    117: #define        MOUNT_SMBFS     "smbfs"         /* CIFS (SMB) */
1.31      mycroft   118:
                    119: /*
                    120:  * Structure per mounted file system.  Each mounted file system has an
                    121:  * array of operations and an instance record.  The file systems are
                    122:  * put on a doubly linked list.
1.1       cgd       123:  */
1.27      cgd       124: LIST_HEAD(vnodelst, vnode);
                    125:
1.1       cgd       126: struct mount {
1.38      mycroft   127:        CIRCLEQ_ENTRY(mount) mnt_list;          /* mount list */
1.1       cgd       128:        struct vfsops   *mnt_op;                /* operations on fs */
                    129:        struct vnode    *mnt_vnodecovered;      /* vnode we mounted on */
1.78      fvdl      130:        struct vnode    *mnt_syncer;            /* syncer vnode */
1.27      cgd       131:        struct vnodelst mnt_vnodelist;          /* list of vnodes this mount */
1.64      fvdl      132:        struct lock     mnt_lock;               /* mount structure lock */
1.1       cgd       133:        int             mnt_flag;               /* flags */
1.31      mycroft   134:        int             mnt_maxsymlinklen;      /* max size of short symlink */
1.87      chs       135:        int             mnt_fs_bshift;          /* offset shift for lblkno */
                    136:        int             mnt_dev_bshift;         /* shift for device sectors */
1.1       cgd       137:        struct statfs   mnt_stat;               /* cache of filesystem stats */
1.97      soren     138:        void            *mnt_data;              /* private data */
1.77      sommerfe  139:        int             mnt_wcnt;               /* count of vfs_busy waiters */
1.78      fvdl      140:        struct proc     *mnt_unmounter;         /* who is unmounting */
1.1       cgd       141: };
                    142:
                    143: /*
1.49      cgd       144:  * Mount flags.  XXX BEWARE: these are not in numerical order!
1.29      cgd       145:  *
                    146:  * Unmount uses MNT_FORCE flag.
1.74      sommerfe  147:  *
                    148:  * Note that all mount flags are listed here.  if you need to add one, take
                    149:  * one of the __MNT_UNUSED flags.
1.1       cgd       150:  */
1.74      sommerfe  151:
                    152: #define __MNT_UNUSED2  0x00400000
                    153: #define __MNT_UNUSED3  0x00800000
                    154:
1.1       cgd       155: #define        MNT_RDONLY      0x00000001      /* read only filesystem */
                    156: #define        MNT_SYNCHRONOUS 0x00000002      /* file system written synchronously */
                    157: #define        MNT_NOEXEC      0x00000004      /* can't exec from filesystem */
                    158: #define        MNT_NOSUID      0x00000008      /* don't honor setuid bits on fs */
                    159: #define        MNT_NODEV       0x00000010      /* don't interpret special files */
1.18      cgd       160: #define        MNT_UNION       0x00000020      /* union with underlying filesystem */
1.31      mycroft   161: #define        MNT_ASYNC       0x00000040      /* file system written asynchronously */
1.49      cgd       162: #define        MNT_NOCOREDUMP  0x00008000      /* don't write core dumps to this FS */
1.86      christos  163: #define MNT_IGNORE     0x00100000      /* don't show entry in df */
1.52      tls       164: #define MNT_NOATIME    0x04000000      /* Never update access times in fs */
1.61      enami     165: #define MNT_SYMPERM    0x20000000      /* recognize symlink permission */
1.74      sommerfe  166: #define MNT_NODEVMTIME 0x40000000      /* Never update mod times for devs */
1.78      fvdl      167: #define MNT_SOFTDEP    0x80000000      /* Use soft dependencies */
1.15      deraadt   168:
1.94      christos  169: #define __MNT_BASIC_FLAGS \
                    170:        { MNT_RDONLY,           0,      "read-only" }, \
                    171:        { MNT_SYNCHRONOUS,      0,      "synchronous" }, \
                    172:        { MNT_NOEXEC,           0,      "noexec" }, \
                    173:        { MNT_NOSUID,           0,      "nosuid" }, \
                    174:        { MNT_NODEV,            0,      "nodev" }, \
                    175:        { MNT_UNION,            0,      "union" }, \
                    176:        { MNT_ASYNC,            0,      "asynchronous" }, \
                    177:        { MNT_NOCOREDUMP,       0,      "nocoredump" }, \
1.95      chuck     178:        { MNT_IGNORE,           0,      "hidden" }, \
1.94      christos  179:        { MNT_NOATIME,          0,      "noatime" }, \
                    180:        { MNT_SYMPERM,          0,      "symperm" }, \
                    181:        { MNT_NODEVMTIME,       0,      "nodevmtime" }, \
                    182:        { MNT_SOFTDEP,          0,      "soft dependencies" },
                    183:
1.1       cgd       184: /*
                    185:  * exported mount flags.
                    186:  */
1.31      mycroft   187: #define        MNT_EXRDONLY    0x00000080      /* exported read only */
1.1       cgd       188: #define        MNT_EXPORTED    0x00000100      /* file system is exported */
1.31      mycroft   189: #define        MNT_DEFEXPORTED 0x00000200      /* exported to the world */
                    190: #define        MNT_EXPORTANON  0x00000400      /* use anon uid mapping for everyone */
                    191: #define        MNT_EXKERB      0x00000800      /* exported with Kerberos uid mapping */
1.56      fvdl      192: #define MNT_EXNORESPORT        0x08000000      /* don't enforce reserved ports (NFS) */
1.58      fvdl      193: #define MNT_EXPUBLIC   0x10000000      /* public export (WebNFS) */
1.1       cgd       194:
1.94      christos  195: #define __MNT_EXPORTED_FLAGS \
                    196:        { MNT_EXRDONLY,         1,      "exported read-only" }, \
                    197:        { MNT_EXPORTED,         0,      "NFS exported" }, \
                    198:        { MNT_DEFEXPORTED,      1,      "exported to the world" }, \
                    199:        { MNT_EXPORTANON,       1,      "anon uid mapping" }, \
                    200:        { MNT_EXKERB,           1,      "kerberos uid mapping" }, \
                    201:        { MNT_EXNORESPORT,      0,      "non-reserved ports" }, \
                    202:        { MNT_EXPUBLIC,         0,      "WebNFS exports" },
1.1       cgd       203: /*
                    204:  * Flags set by internal operations.
                    205:  */
                    206: #define        MNT_LOCAL       0x00001000      /* filesystem is stored locally */
                    207: #define        MNT_QUOTA       0x00002000      /* quotas are enabled on filesystem */
1.31      mycroft   208: #define        MNT_ROOTFS      0x00004000      /* identifies the root filesystem */
1.1       cgd       209:
1.94      christos  210:
                    211: #define __MNT_INTERNAL_FLAGS \
                    212:        { MNT_LOCAL,            0,      "local" }, \
                    213:        { MNT_QUOTA,            0,      "with quotas" }, \
                    214:        { MNT_ROOTFS,           1,      "root file system" },
1.1       cgd       215: /*
                    216:  * Mask of flags that are visible to statfs()
                    217:  */
1.86      christos  218: #define        MNT_VISFLAGMASK 0xfc10ffff
1.1       cgd       219:
                    220: /*
1.64      fvdl      221:  * External filesystem control flags.
1.1       cgd       222:  *
                    223:  * MNT_MLOCK lock the mount entry so that name lookup cannot proceed
                    224:  * past the mount point.  This keeps the subtree stable during mounts
                    225:  * and unmounts.
                    226:  */
                    227: #define        MNT_UPDATE      0x00010000      /* not a real mount, just an update */
1.31      mycroft   228: #define        MNT_DELEXPORT   0x00020000      /* delete export host lists */
                    229: #define        MNT_RELOAD      0x00040000      /* reload filesystem data */
                    230: #define        MNT_FORCE       0x00080000      /* force unmount or readonly change */
1.98      christos  231: #define        MNT_GETARGS     0x00400000      /* retrieve file system specific args */
1.64      fvdl      232:
1.94      christos  233: #define __MNT_EXTERNAL_FLAGS \
                    234:        { MNT_UPDATE,           1,      "being updated" }, \
                    235:        { MNT_DELEXPORT,        1,      "delete export list" }, \
                    236:        { MNT_RELOAD,           1,      "reload filesystem data" }, \
                    237:        { MNT_FORCE,            1,      "force unmount or readonly change" },
1.64      fvdl      238: /*
                    239:  * Internal filesystem control flags.
                    240:  *
                    241:  * MNT_UNMOUNT locks the mount entry so that name lookup cannot proceed
                    242:  * past the mount point.  This keeps the subtree stable during mounts
                    243:  * and unmounts.
                    244:  */
1.77      sommerfe  245: #define        MNT_GONE        0x00200000      /* filesystem is gone.. */
1.1       cgd       246: #define MNT_UNMOUNT    0x01000000      /* unmount in progress */
1.64      fvdl      247: #define MNT_WANTRDWR   0x02000000      /* upgrade to read/write requested */
                    248:
1.94      christos  249: #define __MNT_CONTROL_FLAGS \
                    250:        { MNT_GONE,             0,      "gone" }, \
                    251:        { MNT_UNMOUNT,          0,      "unmount in progress" }, \
                    252:        { MNT_WANTRDWR,         0,      "upgrade to read/write requested" },
                    253:
                    254: #define __MNT_FLAGS \
                    255:        __MNT_BASIC_FLAGS \
                    256:        __MNT_EXPORTED_FLAGS \
                    257:        __MNT_INTERNAL_FLAGS \
1.96      christos  258:        __MNT_EXTERNAL_FLAGS \
                    259:        __MNT_CONTROL_FLAGS
1.64      fvdl      260: /*
                    261:  * Sysctl CTL_VFS definitions.
                    262:  *
                    263:  * Second level identifier specifies which filesystem. Second level
                    264:  * identifier VFS_GENERIC returns information about all filesystems.
1.70      thorpej   265:  *
                    266:  * Note the slightly non-flat nature of these sysctl numbers.  Oh for
                    267:  * a better sysctl interface.
1.64      fvdl      268:  */
                    269: #define VFS_GENERIC    0               /* generic filesystem information */
                    270: #define VFS_MAXTYPENUM 1               /* int: highest defined fs type */
                    271: #define VFS_CONF       2               /* struct: vfsconf for filesystem given
                    272:                                           as next argument */
1.80      fvdl      273: #define VFS_USERMOUNT  3               /* enable/disable fs mnt by non-root */
                    274: #define        VFSGEN_MAXID    4               /* number of valid vfs.generic ids */
1.70      thorpej   275:
                    276: /*
1.90      jdolecek  277:  * USE THE SAME NAMES AS MOUNT_*!
1.70      thorpej   278:  *
1.90      jdolecek  279:  * Only need to add new entry here if the filesystem actually supports
                    280:  * sysctl(2).
1.70      thorpej   281:  */
                    282: #define        CTL_VFS_NAMES { \
                    283:        { "generic", CTLTYPE_NODE }, \
                    284:        { MOUNT_FFS, CTLTYPE_NODE }, \
                    285:        { MOUNT_NFS, CTLTYPE_NODE }, \
                    286:        { MOUNT_MFS, CTLTYPE_NODE }, \
                    287:        { MOUNT_MSDOS, CTLTYPE_NODE }, \
                    288:        { MOUNT_LFS, CTLTYPE_NODE }, \
                    289:        { 0, 0 },                       /* MOUNT_LOFS */ \
                    290:        { MOUNT_FDESC, CTLTYPE_NODE }, \
                    291:        { MOUNT_PORTAL, CTLTYPE_NODE }, \
                    292:        { MOUNT_NULL, CTLTYPE_NODE }, \
                    293:        { MOUNT_UMAP, CTLTYPE_NODE }, \
                    294:        { MOUNT_KERNFS, CTLTYPE_NODE }, \
                    295:        { MOUNT_PROCFS, CTLTYPE_NODE }, \
                    296:        { MOUNT_AFS, CTLTYPE_NODE }, \
                    297:        { MOUNT_CD9660, CTLTYPE_NODE }, \
                    298:        { MOUNT_UNION, CTLTYPE_NODE }, \
                    299:        { MOUNT_ADOSFS, CTLTYPE_NODE }, \
                    300:        { MOUNT_EXT2FS, CTLTYPE_NODE }, \
                    301:        { MOUNT_CODA, CTLTYPE_NODE }, \
                    302:        { MOUNT_FILECORE, CTLTYPE_NODE }, \
1.81      jdolecek  303:        { MOUNT_NTFS, CTLTYPE_NODE }, \
1.70      thorpej   304: }
                    305:
                    306: #define        VFS_MAXID       20              /* number of valid vfs ids */
                    307:
                    308: #define        CTL_VFSGENCTL_NAMES { \
                    309:        { 0, 0 }, \
                    310:        { "maxtypenum", CTLTYPE_INT }, \
                    311:        { "conf", CTLTYPE_NODE },       /* Special */ \
1.80      fvdl      312:        { "usermount", CTLTYPE_INT }, \
1.70      thorpej   313: }
1.1       cgd       314:
                    315: /*
                    316:  * Operations supported on mounted file system.
                    317:  */
1.39      jtc       318: #ifdef _KERNEL
1.64      fvdl      319:
                    320: #if defined(COMPAT_09) || defined(COMPAT_43) || defined(COMPAT_44)
                    321:
                    322: /*
                    323:  * Filesystem configuration information. Not used by NetBSD, but
                    324:  * defined here to provide a compatible sysctl interface to Lite2.
                    325:  */
                    326: struct vfsconf {
                    327:        struct  vfsops *vfc_vfsops;     /* filesystem operations vector */
                    328:        char    vfc_name[MFSNAMELEN];   /* filesystem type name */
                    329:        int     vfc_typenum;            /* historic filesystem type number */
                    330:        int     vfc_refcount;           /* number mounted of this type */
                    331:        int     vfc_flags;              /* permanent flags */
                    332:        int     (*vfc_mountroot)(void); /* if != NULL, routine to mount root */
                    333:        struct  vfsconf *vfc_next;      /* next in list */
                    334: };
                    335:
                    336: #endif
                    337:
1.89      kleink    338: #if __STDC__
1.1       cgd       339: struct nameidata;
1.31      mycroft   340: struct mbuf;
1.63      thorpej   341: struct vnodeopv_desc;
1.1       cgd       342: #endif
                    343:
                    344: struct vfsops {
1.82      jdolecek  345:        const char *vfs_name;
1.50      cgd       346:        int     (*vfs_mount)    __P((struct mount *mp, const char *path,
                    347:                                    void *data, struct nameidata *ndp,
                    348:                                    struct proc *p));
1.1       cgd       349:        int     (*vfs_start)    __P((struct mount *mp, int flags,
                    350:                                    struct proc *p));
                    351:        int     (*vfs_unmount)  __P((struct mount *mp, int mntflags,
                    352:                                    struct proc *p));
                    353:        int     (*vfs_root)     __P((struct mount *mp, struct vnode **vpp));
1.20      cgd       354:        int     (*vfs_quotactl) __P((struct mount *mp, int cmds, uid_t uid,
1.1       cgd       355:                                    caddr_t arg, struct proc *p));
                    356:        int     (*vfs_statfs)   __P((struct mount *mp, struct statfs *sbp,
                    357:                                    struct proc *p));
1.31      mycroft   358:        int     (*vfs_sync)     __P((struct mount *mp, int waitfor,
                    359:                                    struct ucred *cred, struct proc *p));
                    360:        int     (*vfs_vget)     __P((struct mount *mp, ino_t ino,
                    361:                                    struct vnode **vpp));
1.1       cgd       362:        int     (*vfs_fhtovp)   __P((struct mount *mp, struct fid *fhp,
1.72      wrstuden  363:                                    struct vnode **vpp));
1.1       cgd       364:        int     (*vfs_vptofh)   __P((struct vnode *vp, struct fid *fhp));
1.47      christos  365:        void    (*vfs_init)     __P((void));
1.91      chs       366:        void    (*vfs_reinit)   __P((void));
1.82      jdolecek  367:        void    (*vfs_done)     __P((void));
1.64      fvdl      368:        int     (*vfs_sysctl)   __P((int *, u_int, void *, size_t *, void *,
                    369:                                    size_t, struct proc *));
1.53      thorpej   370:        int     (*vfs_mountroot) __P((void));
1.72      wrstuden  371:        int     (*vfs_checkexp) __P((struct mount *mp, struct mbuf *nam,
                    372:                                    int *extflagsp, struct ucred **credanonp));
1.88      jdolecek  373:        const struct vnodeopv_desc * const *vfs_opv_descs;
1.34      mycroft   374:        int     vfs_refcount;
1.63      thorpej   375:        LIST_ENTRY(vfsops) vfs_list;
1.1       cgd       376: };
                    377:
                    378: #define VFS_MOUNT(MP, PATH, DATA, NDP, P) \
                    379:        (*(MP)->mnt_op->vfs_mount)(MP, PATH, DATA, NDP, P)
                    380: #define VFS_START(MP, FLAGS, P)          (*(MP)->mnt_op->vfs_start)(MP, FLAGS, P)
                    381: #define VFS_UNMOUNT(MP, FORCE, P) (*(MP)->mnt_op->vfs_unmount)(MP, FORCE, P)
                    382: #define VFS_ROOT(MP, VPP)        (*(MP)->mnt_op->vfs_root)(MP, VPP)
                    383: #define VFS_QUOTACTL(MP,C,U,A,P)  (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, P)
                    384: #define VFS_STATFS(MP, SBP, P)   (*(MP)->mnt_op->vfs_statfs)(MP, SBP, P)
1.31      mycroft   385: #define VFS_SYNC(MP, WAIT, C, P)  (*(MP)->mnt_op->vfs_sync)(MP, WAIT, C, P)
                    386: #define VFS_VGET(MP, INO, VPP)   (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP)
1.72      wrstuden  387: #define VFS_FHTOVP(MP, FIDP, VPP) (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP)
1.73      wrstuden  388: #define VFS_CHECKEXP(MP, NAM, EXFLG, CRED) \
1.72      wrstuden  389:        (*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED)
1.1       cgd       390: #define        VFS_VPTOFH(VP, FIDP)      (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP)
1.39      jtc       391: #endif /* _KERNEL */
1.1       cgd       392:
                    393: /*
                    394:  * Flags for various system call interfaces.
                    395:  *
                    396:  * waitfor flags to vfs_sync() and getfsstat()
                    397:  */
1.78      fvdl      398: #define MNT_WAIT       1       /* synchronously wait for I/O to complete */
                    399: #define MNT_NOWAIT     2       /* start all I/O, but do not wait for it */
                    400: #define MNT_LAZY       3       /* push data not written by filesystem syncer */
1.1       cgd       401:
                    402: /*
                    403:  * Generic file handle
                    404:  */
                    405: struct fhandle {
                    406:        fsid_t  fh_fsid;        /* File system id of mount point */
1.31      mycroft   407:        struct  fid fh_fid;     /* File sys specific id */
1.1       cgd       408: };
                    409: typedef struct fhandle fhandle_t;
                    410:
1.39      jtc       411: #ifdef _KERNEL
1.31      mycroft   412: #include <net/radix.h>
                    413: #include <sys/socket.h>                /* XXX for AF_MAX */
                    414:
                    415: /*
                    416:  * Network address lookup element
                    417:  */
                    418: struct netcred {
                    419:        struct  radix_node netc_rnodes[2];
                    420:        int     netc_exflags;
                    421:        struct  ucred netc_anon;
                    422: };
                    423:
                    424: /*
                    425:  * Network export information
                    426:  */
                    427: struct netexport {
                    428:        struct  netcred ne_defexported;               /* Default export */
                    429:        struct  radix_node_head *ne_rtable[AF_MAX+1]; /* Individual exports */
                    430: };
1.39      jtc       431: #endif /* _KERNEL */
1.31      mycroft   432:
1.1       cgd       433: /*
1.31      mycroft   434:  * Export arguments for local filesystem mount calls.
1.17      ws        435:  */
                    436: struct export_args {
1.31      mycroft   437:        int     ex_flags;               /* export related flags */
                    438:        uid_t   ex_root;                /* mapping for root uid */
1.92      christos  439:        struct  uucred ex_anon;         /* mapping for anonymous user */
1.31      mycroft   440:        struct  sockaddr *ex_addr;      /* net address to which exported */
                    441:        int     ex_addrlen;             /* and the net address length */
                    442:        struct  sockaddr *ex_mask;      /* mask of valid bits in saddr */
                    443:        int     ex_masklen;             /* and the smask length */
1.58      fvdl      444:        char    *ex_indexfile;          /* index file for WebNFS URLs */
1.17      ws        445: };
                    446:
                    447: /*
1.58      fvdl      448:  * Structure holding information for a publicly exported filesystem
                    449:  * (WebNFS). Currently the specs allow just for one such filesystem.
                    450:  */
                    451: struct nfs_public {
                    452:        int             np_valid;       /* Do we hold valid information */
                    453:        fhandle_t       np_handle;      /* Filehandle for pub fs (internal) */
                    454:        struct mount    *np_mount;      /* Mountpoint of exported fs */
                    455:        char            *np_index;      /* Index file */
                    456: };
                    457:
1.39      jtc       458: #ifdef _KERNEL
1.99      thorpej   459: #include <sys/mallocvar.h>
                    460: MALLOC_DECLARE(M_MOUNT);
                    461:
1.1       cgd       462: /*
1.100   ! gmcgarry  463:  * exported VFS interface (see vfssubr(9))
1.1       cgd       464:  */
1.64      fvdl      465: struct mount *vfs_getvfs __P((fsid_t *));    /* return vfs given fsid */
1.31      mycroft   466: int    vfs_export                          /* process mount export info */
                    467:          __P((struct mount *, struct netexport *, struct export_args *));
1.98      christos  468: #define        vfs_showexport(a, b, c) (void)memset((b), 0, sizeof(*(b)))
1.31      mycroft   469: struct netcred *vfs_export_lookup          /* lookup host in fs export list */
                    470:          __P((struct mount *, struct netexport *, struct mbuf *));
1.58      fvdl      471: int    vfs_setpublicfs                     /* set publicly exported fs */
                    472:          __P((struct mount *, struct netexport *, struct export_args *));
1.31      mycroft   473: int    vfs_mountedon __P((struct vnode *));/* is a vfs mounted on vp */
1.53      thorpej   474: int    vfs_mountroot __P((void));
1.40      mycroft   475: void   vfs_shutdown __P((void));           /* unmount and sync file systems */
1.85      sommerfe  476: void   vfs_unmountall __P((struct proc *));        /* unmount file systems */
1.64      fvdl      477: int    vfs_busy __P((struct mount *, int, struct simplelock *));
                    478: int    vfs_rootmountalloc __P((char *, char *, struct mount **));
1.47      christos  479: void   vfs_unbusy __P((struct mount *));
1.63      thorpej   480: int    vfs_attach __P((struct vfsops *));
                    481: int    vfs_detach __P((struct vfsops *));
1.91      chs       482: void   vfs_reinit __P((void));
1.53      thorpej   483: struct vfsops *vfs_getopsbyname __P((const char *));
1.64      fvdl      484: int    vfs_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
                    485:                        struct proc *));
1.63      thorpej   486:
1.64      fvdl      487: extern CIRCLEQ_HEAD(mntlist, mount) mountlist; /* mounted filesystem list */
                    488: extern struct vfsops *vfssw[];                 /* filesystem type table */
                    489: extern int nvfssw;
                    490: extern struct nfs_public nfs_pub;
                    491: extern struct simplelock mountlist_slock;
1.65      thorpej   492: extern struct simplelock spechash_slock;
1.84      assar     493: long   makefstype __P((const char *));
1.47      christos  494: int    dounmount __P((struct mount *, int, struct proc *));
                    495: void   vfsinit __P((void));
1.88      jdolecek  496: void   vfs_opv_init __P((const struct vnodeopv_desc * const *));
                    497: void   vfs_opv_free __P((const struct vnodeopv_desc * const *));
1.47      christos  498: #ifdef DEBUG
                    499: void   vfs_bufstats __P((void));
                    500: #endif
1.63      thorpej   501:
                    502: LIST_HEAD(vfs_list_head, vfsops);
                    503: extern struct vfs_list_head vfs_list;
                    504:
1.39      jtc       505: #else /* _KERNEL */
1.1       cgd       506:
                    507: #include <sys/cdefs.h>
                    508:
                    509: __BEGIN_DECLS
                    510: int    fstatfs __P((int, struct statfs *));
                    511: int    getfh __P((const char *, fhandle_t *));
                    512: int    getfsstat __P((struct statfs *, long, int));
                    513: int    getmntinfo __P((struct statfs **, int));
1.46      mycroft   514: int    mount __P((const char *, const char *, int, void *));
1.1       cgd       515: int    statfs __P((const char *, struct statfs *));
                    516: int    unmount __P((const char *, int));
1.76      wrstuden  517: #if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
                    518: int    fhopen __P((const fhandle_t *, int));
                    519: int    fhstat __P((const fhandle_t *, struct stat *));
                    520: int    fhstatfs __P((const fhandle_t *, struct statfs *));
                    521: #endif /* !_POSIX_C_SOURCE */
1.1       cgd       522: __END_DECLS
                    523:
1.39      jtc       524: #endif /* _KERNEL */
1.51      mikel     525:
                    526: #endif /* !_SYS_MOUNT_H_ */

CVSweb <webmaster@jp.NetBSD.org>