The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/mount.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

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

Cache object: 57753b8af5a9aa3e6d76d91c9d3f3bb8


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.