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-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: mount.h,v 1.151 2006/11/17 17:05:18 hannken 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 #ifndef _KERNEL
   38 #include <sys/featuretest.h>
   39 #include <sys/ucred.h>
   40 #if defined(_NETBSD_SOURCE)
   41 #include <sys/stat.h>
   42 #endif /* _NETBSD_SOURCE */
   43 #endif
   44 #include <sys/fstypes.h>
   45 #include <sys/queue.h>
   46 #include <sys/lock.h>
   47 #include <sys/statvfs.h>
   48 #include <sys/specificdata.h>
   49 
   50 /*
   51  * file system statistics
   52  */
   53 
   54 #define MFSNAMELEN      16      /* length of fs type name, including nul */
   55 #define MNAMELEN        90      /* length of buffer for returned name */
   56 
   57 /*
   58  * File system types.
   59  */
   60 #define MOUNT_FFS       "ffs"           /* UNIX "Fast" Filesystem */
   61 #define MOUNT_UFS       MOUNT_FFS       /* for compatibility */
   62 #define MOUNT_NFS       "nfs"           /* Network Filesystem */
   63 #define MOUNT_MFS       "mfs"           /* Memory Filesystem */
   64 #define MOUNT_MSDOS     "msdos"         /* MSDOS Filesystem */
   65 #define MOUNT_LFS       "lfs"           /* Log-based Filesystem */
   66 #define MOUNT_FDESC     "fdesc"         /* File Descriptor Filesystem */
   67 #define MOUNT_PORTAL    "portal"        /* Portal Filesystem */
   68 #define MOUNT_NULL      "null"          /* Minimal Filesystem Layer */
   69 #define MOUNT_OVERLAY   "overlay"       /* Minimal Overlay Filesystem Layer */
   70 #define MOUNT_UMAP      "umap"  /* User/Group Identifier Remapping Filesystem */
   71 #define MOUNT_KERNFS    "kernfs"        /* Kernel Information Filesystem */
   72 #define MOUNT_PROCFS    "procfs"        /* /proc Filesystem */
   73 #define MOUNT_AFS       "afs"           /* Andrew Filesystem */
   74 #define MOUNT_CD9660    "cd9660"        /* ISO9660 (aka CDROM) Filesystem */
   75 #define MOUNT_UNION     "union"         /* Union (translucent) Filesystem */
   76 #define MOUNT_ADOSFS    "adosfs"        /* AmigaDOS Filesystem */
   77 #define MOUNT_EXT2FS    "ext2fs"        /* Second Extended Filesystem */
   78 #define MOUNT_CFS       "coda"          /* Coda Filesystem */
   79 #define MOUNT_CODA      MOUNT_CFS       /* Coda Filesystem */
   80 #define MOUNT_FILECORE  "filecore"      /* Acorn Filecore Filesystem */
   81 #define MOUNT_NTFS      "ntfs"          /* Windows/NT Filesystem */
   82 #define MOUNT_SMBFS     "smbfs"         /* CIFS (SMB) */
   83 #define MOUNT_PTYFS     "ptyfs"         /* Pseudo tty filesystem */
   84 #define MOUNT_TMPFS     "tmpfs"         /* Efficient memory file-system */
   85 #define MOUNT_UDF       "udf"           /* UDF CD/DVD filesystem */
   86 #define MOUNT_SYSVBFS   "sysvbfs"       /* System V Boot Filesystem */
   87 #define MOUNT_PUFFS     "puffs"         /* Pass-to-Userspace filesystem */
   88 
   89 /*
   90  * Structure per mounted file system.  Each mounted file system has an
   91  * array of operations and an instance record.  The file systems are
   92  * put on a doubly linked list.
   93  */
   94 TAILQ_HEAD(vnodelst, vnode);
   95 
   96 struct mount {
   97         CIRCLEQ_ENTRY(mount) mnt_list;          /* mount list */
   98         struct vfsops   *mnt_op;                /* operations on fs */
   99         struct vnode    *mnt_vnodecovered;      /* vnode we mounted on */
  100         struct vnode    *mnt_syncer;            /* syncer vnode */
  101         struct vnodelst mnt_vnodelist;          /* list of vnodes this mount */
  102         struct lock     mnt_lock;               /* mount structure lock */
  103         int             mnt_flag;               /* flags */
  104         int             mnt_iflag;              /* internal flags */
  105         int             mnt_fs_bshift;          /* offset shift for lblkno */
  106         int             mnt_dev_bshift;         /* shift for device sectors */
  107         struct statvfs  mnt_stat;               /* cache of filesystem stats */
  108         void            *mnt_data;              /* private data */
  109         int             mnt_wcnt;               /* count of vfs_busy waiters */
  110         struct lwp      *mnt_unmounter;         /* who is unmounting */
  111         int             mnt_writeopcountupper;  /* upper writeops in progress */
  112         int             mnt_writeopcountlower;  /* lower writeops in progress */
  113         struct simplelock mnt_slock;            /* mutex for wcnt and
  114                                                    writeops counters */
  115         struct mount    *mnt_leaf;              /* leaf fs we mounted on */
  116         specificdata_reference
  117                         mnt_specdataref;        /* subsystem specific data */
  118 };
  119 
  120 /*
  121  * Sysctl CTL_VFS definitions.
  122  *
  123  * Second level identifier specifies which filesystem. Second level
  124  * identifier VFS_GENERIC returns information about all filesystems.
  125  *
  126  * Note the slightly non-flat nature of these sysctl numbers.  Oh for
  127  * a better sysctl interface.
  128  */
  129 #define VFS_GENERIC     0               /* generic filesystem information */
  130 #define VFS_MAXTYPENUM  1               /* int: highest defined fs type */
  131 #define VFS_CONF        2               /* struct: vfsconf for filesystem given
  132                                            as next argument */
  133 #define VFS_USERMOUNT   3               /* enable/disable fs mnt by non-root */
  134 #define VFS_MAGICLINKS  4               /* expand 'magic' symlinks */
  135 #define VFSGEN_MAXID    5               /* number of valid vfs.generic ids */
  136 
  137 #ifndef _STANDALONE
  138 /*
  139  * USE THE SAME NAMES AS MOUNT_*!
  140  *
  141  * Only need to add new entry here if the filesystem actually supports
  142  * sysctl(2).
  143  */
  144 #define CTL_VFS_NAMES { \
  145         { "generic", CTLTYPE_NODE }, \
  146         { MOUNT_FFS, CTLTYPE_NODE }, \
  147         { MOUNT_NFS, CTLTYPE_NODE }, \
  148         { MOUNT_MFS, CTLTYPE_NODE }, \
  149         { MOUNT_MSDOS, CTLTYPE_NODE }, \
  150         { MOUNT_LFS, CTLTYPE_NODE }, \
  151         { 0, 0 },                       /* MOUNT_LOFS */ \
  152         { MOUNT_FDESC, CTLTYPE_NODE }, \
  153         { MOUNT_PORTAL, CTLTYPE_NODE }, \
  154         { MOUNT_NULL, CTLTYPE_NODE }, \
  155         { MOUNT_UMAP, CTLTYPE_NODE }, \
  156         { MOUNT_KERNFS, CTLTYPE_NODE }, \
  157         { MOUNT_PROCFS, CTLTYPE_NODE }, \
  158         { MOUNT_AFS, CTLTYPE_NODE }, \
  159         { MOUNT_CD9660, CTLTYPE_NODE }, \
  160         { MOUNT_UNION, CTLTYPE_NODE }, \
  161         { MOUNT_ADOSFS, CTLTYPE_NODE }, \
  162         { MOUNT_EXT2FS, CTLTYPE_NODE }, \
  163         { MOUNT_CODA, CTLTYPE_NODE }, \
  164         { MOUNT_FILECORE, CTLTYPE_NODE }, \
  165         { MOUNT_NTFS, CTLTYPE_NODE }, \
  166 }
  167 
  168 #define VFS_MAXID       20              /* number of valid vfs ids */
  169 
  170 #define CTL_VFSGENCTL_NAMES { \
  171         { 0, 0 }, \
  172         { "maxtypenum", CTLTYPE_INT }, \
  173         { "conf", CTLTYPE_NODE },       /* Special */ \
  174         { "usermount", CTLTYPE_INT }, \
  175         { "magiclinks", CTLTYPE_INT }, \
  176 }
  177 
  178 /*
  179  * Operations supported on mounted file system.
  180  */
  181 #ifdef _KERNEL
  182 
  183 #if __STDC__
  184 struct nameidata;
  185 struct mbuf;
  186 struct vnodeopv_desc;
  187 struct kauth_cred;
  188 #endif
  189 
  190 #define VFS_PROTOS(fsname)                                              \
  191 int     fsname##_mount(struct mount *, const char *, void *,            \
  192                 struct nameidata *, struct lwp *);                      \
  193 int     fsname##_start(struct mount *, int, struct lwp *);              \
  194 int     fsname##_unmount(struct mount *, int, struct lwp *);            \
  195 int     fsname##_root(struct mount *, struct vnode **);                 \
  196 int     fsname##_quotactl(struct mount *, int, uid_t, void *,           \
  197                 struct lwp *);                                          \
  198 int     fsname##_statvfs(struct mount *, struct statvfs *,              \
  199                 struct lwp *);                                          \
  200 int     fsname##_sync(struct mount *, int, struct kauth_cred *,         \
  201                 struct lwp *);                                          \
  202 int     fsname##_vget(struct mount *, ino_t, struct vnode **);          \
  203 int     fsname##_fhtovp(struct mount *, struct fid *, struct vnode **); \
  204 int     fsname##_vptofh(struct vnode *, struct fid *);                  \
  205 void    fsname##_init(void);                                            \
  206 void    fsname##_reinit(void);                                          \
  207 void    fsname##_done(void);                                            \
  208 int     fsname##_mountroot(void);                                       \
  209 int     fsname##_snapshot(struct mount *, struct vnode *,               \
  210                 struct timespec *);                                     \
  211 int     fsname##_extattrctl(struct mount *, int, struct vnode *, int,   \
  212                 const char *, struct lwp *);
  213 
  214 struct vfsops {
  215         const char *vfs_name;
  216         int     (*vfs_mount)    (struct mount *, const char *, void *,
  217                                     struct nameidata *, struct lwp *);
  218         int     (*vfs_start)    (struct mount *, int, struct lwp *);
  219         int     (*vfs_unmount)  (struct mount *, int, struct lwp *);
  220         int     (*vfs_root)     (struct mount *, struct vnode **);
  221         int     (*vfs_quotactl) (struct mount *, int, uid_t, void *,
  222                                     struct lwp *);
  223         int     (*vfs_statvfs)  (struct mount *, struct statvfs *,
  224                                     struct lwp *);
  225         int     (*vfs_sync)     (struct mount *, int, struct kauth_cred *,
  226                                     struct lwp *);
  227         int     (*vfs_vget)     (struct mount *, ino_t, struct vnode **);
  228         int     (*vfs_fhtovp)   (struct mount *, struct fid *,
  229                                     struct vnode **);
  230         int     (*vfs_vptofh)   (struct vnode *, struct fid *, size_t *);
  231         void    (*vfs_init)     (void);
  232         void    (*vfs_reinit)   (void);
  233         void    (*vfs_done)     (void);
  234         int     (*vfs_mountroot)(void);
  235         int     (*vfs_snapshot) (struct mount *, struct vnode *,
  236                                     struct timespec *);
  237         int     (*vfs_extattrctl) (struct mount *, int,
  238                                     struct vnode *, int, const char *,
  239                                     struct lwp *);
  240         const struct vnodeopv_desc * const *vfs_opv_descs;
  241         int     vfs_refcount;
  242         LIST_ENTRY(vfsops) vfs_list;
  243 };
  244 
  245 #define VFS_ATTACH(vfs)         __link_set_add_data(vfsops, vfs)
  246 
  247 #define VFS_MOUNT(MP, PATH, DATA, NDP, L) \
  248         (*(MP)->mnt_op->vfs_mount)(MP, PATH, DATA, NDP, L)
  249 #define VFS_START(MP, FLAGS, L)   (*(MP)->mnt_op->vfs_start)(MP, FLAGS, L)
  250 #define VFS_UNMOUNT(MP, FORCE, L) (*(MP)->mnt_op->vfs_unmount)(MP, FORCE, L)
  251 #define VFS_ROOT(MP, VPP)         (*(MP)->mnt_op->vfs_root)(MP, VPP)
  252 #define VFS_QUOTACTL(MP,C,U,A,L)  (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, L)
  253 #define VFS_STATVFS(MP, SBP, L)   (*(MP)->mnt_op->vfs_statvfs)(MP, SBP, L)
  254 #define VFS_SYNC(MP, WAIT, C, L)  (*(MP)->mnt_op->vfs_sync)(MP, WAIT, C, L)
  255 #define VFS_VGET(MP, INO, VPP)    (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP)
  256 #define VFS_FHTOVP(MP, FIDP, VPP) (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP)
  257 #define VFS_VPTOFH(VP, FIDP, FIDSZP)  (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP, FIDSZP)
  258 #define VFS_SNAPSHOT(MP, VP, TS)  (*(MP)->mnt_op->vfs_snapshot)(MP, VP, TS)
  259 #define VFS_EXTATTRCTL(MP, C, VP, AS, AN, L) \
  260         (*(MP)->mnt_op->vfs_extattrctl)(MP, C, VP, AS, AN, L)
  261 
  262 struct vfs_hooks {
  263         void    (*vh_unmount)(struct mount *);
  264 };
  265 #define VFS_HOOKS_ATTACH(hooks) __link_set_add_data(vfs_hooks, hooks)
  266 
  267 void    vfs_hooks_unmount(struct mount *);
  268 
  269 #endif /* _KERNEL */
  270 
  271 /*
  272  * Export arguments for local filesystem mount calls.
  273  *
  274  * This structure is deprecated and is only provided for compatibility
  275  * reasons with old binary utilities; several file systems expose an
  276  * instance of this structure in their mount arguments structure, thus
  277  * needing a padding in place of the old values.  This definition cannot
  278  * change in the future due to this reason.
  279  * XXX: This should be moved to the compat subtree but cannot be done
  280  * until we can move the mount args structures themselves.
  281  *
  282  * The current export_args structure can be found in nfs/nfs.h.
  283  */
  284 struct export_args30 {
  285         int     ex_flags;               /* export related flags */
  286         uid_t   ex_root;                /* mapping for root uid */
  287         struct  uucred ex_anon;         /* mapping for anonymous user */
  288         struct  sockaddr *ex_addr;      /* net address to which exported */
  289         int     ex_addrlen;             /* and the net address length */
  290         struct  sockaddr *ex_mask;      /* mask of valid bits in saddr */
  291         int     ex_masklen;             /* and the smask length */
  292         char    *ex_indexfile;          /* index file for WebNFS URLs */
  293 };
  294 
  295 #ifdef _KERNEL
  296 #include <sys/mallocvar.h>
  297 MALLOC_DECLARE(M_MOUNT);
  298 
  299 /*
  300  * exported VFS interface (see vfssubr(9))
  301  */
  302 struct  mount *vfs_getvfs(fsid_t *);    /* return vfs given fsid */
  303 int     vfs_composefh(struct vnode *, fhandle_t *, size_t *);
  304 int     vfs_composefh_alloc(struct vnode *, fhandle_t **);
  305 void    vfs_composefh_free(fhandle_t *);
  306 int     vfs_fhtovp(fhandle_t *, struct vnode **);
  307 int     vfs_mountedon(struct vnode *);/* is a vfs mounted on vp */
  308 int     vfs_mountroot(void);
  309 void    vfs_shutdown(void);         /* unmount and sync file systems */
  310 void    vfs_unmountall(struct lwp *);       /* unmount file systems */
  311 int     vfs_busy(struct mount *, int, struct simplelock *);
  312 int     vfs_rootmountalloc(const char *, const char *, struct mount **);
  313 void    vfs_unbusy(struct mount *);
  314 int     vfs_attach(struct vfsops *);
  315 int     vfs_detach(struct vfsops *);
  316 void    vfs_reinit(void);
  317 struct vfsops *vfs_getopsbyname(const char *);
  318 
  319 int     vfs_stdextattrctl(struct mount *, int, struct vnode *,
  320             int, const char *, struct lwp *);
  321 
  322 extern  CIRCLEQ_HEAD(mntlist, mount) mountlist; /* mounted filesystem list */
  323 extern  struct vfsops *vfssw[];                 /* filesystem type table */
  324 extern  int nvfssw;
  325 extern  struct simplelock mountlist_slock;
  326 extern  struct simplelock spechash_slock;
  327 long    makefstype(const char *);
  328 int     dounmount(struct mount *, int, struct lwp *);
  329 void    vfsinit(void);
  330 void    vfs_opv_init(const struct vnodeopv_desc * const *);
  331 void    vfs_opv_free(const struct vnodeopv_desc * const *);
  332 #ifdef DEBUG
  333 void    vfs_bufstats(void);
  334 #endif
  335 
  336 int     mount_specific_key_create(specificdata_key_t *, specificdata_dtor_t);
  337 void    mount_specific_key_delete(specificdata_key_t);
  338 void    mount_initspecific(struct mount *);
  339 void    mount_finispecific(struct mount *);
  340 void *  mount_getspecific(struct mount *, specificdata_key_t);
  341 void    mount_setspecific(struct mount *, specificdata_key_t, void *);
  342 
  343 /*
  344  * syscall helpers
  345  */
  346 
  347 int     vfs_copyinfh_alloc(const void *, size_t, fhandle_t **);
  348 void    vfs_copyinfh_free(fhandle_t *);
  349 
  350 struct stat;
  351 int dofhopen(struct lwp *, const void *, size_t, int, register_t *);
  352 int dofhstat(struct lwp *, const void *, size_t, struct stat *, register_t *);
  353 int dofhstatvfs(struct lwp *, const void *, size_t, struct statvfs *, int,
  354     register_t *);
  355 
  356 LIST_HEAD(vfs_list_head, vfsops);
  357 extern struct vfs_list_head vfs_list;
  358 
  359 #else /* _KERNEL */
  360 
  361 #include <sys/cdefs.h>
  362 
  363 __BEGIN_DECLS
  364 #if !defined(__LIBC12_SOURCE__) && !defined(_STANDALONE)
  365 int     getfh(const char *, void *, size_t *)
  366         __RENAME(__getfh30);
  367 #endif
  368 
  369 int     mount(const char *, const char *, int, void *);
  370 int     unmount(const char *, int);
  371 #if defined(_NETBSD_SOURCE)
  372 #ifndef __LIBC12_SOURCE__
  373 int     fhopen(const void *, size_t, int) __RENAME(__fhopen40);
  374 int     fhstat(const void *, size_t, struct stat *) __RENAME(__fhstat40);
  375 #endif
  376 #endif /* _NETBSD_SOURCE */
  377 __END_DECLS
  378 
  379 #endif /* _KERNEL */
  380 #endif /* !_STANDALONE */
  381 
  382 #endif /* !_SYS_MOUNT_H_ */

Cache object: 07e0c2af1e706acb4d153f1213b50f51


[ 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.