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 /*      $OpenBSD: mount.h,v 1.91 2008/07/22 08:05:02 thib Exp $ */
    2 /*      $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $  */
    3 
    4 /*
    5  * Copyright (c) 1989, 1991, 1993
    6  *      The Regents of the University of California.  All rights reserved.
    7  *
    8  * Redistribution and use in source and binary forms, with or without
    9  * modification, are permitted provided that the following conditions
   10  * are met:
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in the
   15  *    documentation and/or other materials provided with the distribution.
   16  * 3. Neither the name of the University nor the names of its contributors
   17  *    may be used to endorse or promote products derived from this software
   18  *    without specific prior written permission.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   30  * SUCH DAMAGE.
   31  *
   32  *      @(#)mount.h     8.15 (Berkeley) 7/14/94
   33  */
   34 
   35 #ifndef _SYS_MOUNT_H_
   36 #define _SYS_MOUNT_H_
   37 
   38 #include <sys/cdefs.h>
   39 #ifndef _KERNEL
   40 #include <sys/ucred.h>
   41 #endif
   42 #include <sys/queue.h>
   43 #include <sys/rwlock.h>
   44 
   45 typedef struct { int32_t val[2]; } fsid_t;      /* file system id type */
   46 
   47 /*
   48  * File identifier.
   49  * These are unique per filesystem on a single machine.
   50  */
   51 #define MAXFIDSZ        16
   52 
   53 struct fid {
   54         u_short         fid_len;                /* length of data in bytes */
   55         u_short         fid_reserved;           /* force longword alignment */
   56         char            fid_data[MAXFIDSZ];     /* data (variable length) */
   57 };
   58 
   59 /*
   60  * Export arguments for local filesystem mount calls.
   61  */
   62 struct export_args {
   63         int     ex_flags;               /* export related flags */
   64         uid_t   ex_root;                /* mapping for root uid */
   65         struct  ucred ex_anon;          /* mapping for anonymous user */
   66         struct  sockaddr *ex_addr;      /* net address to which exported */
   67         int     ex_addrlen;             /* and the net address length */
   68         struct  sockaddr *ex_mask;      /* mask of valid bits in saddr */
   69         int     ex_masklen;             /* and the smask length */
   70 };
   71 
   72 /*
   73  * Arguments to mount UFS-based filesystems
   74  */
   75 struct ufs_args {
   76         char    *fspec;                 /* block special device to mount */
   77         struct  export_args export_info;/* network export information */
   78 };
   79 
   80 /*
   81  * Arguments to mount MFS
   82  */
   83 struct mfs_args {
   84         char    *fspec;                 /* name to export for statfs */
   85         struct  export_args export_info;/* if exported MFSes are supported */
   86         caddr_t base;                   /* base of file system in memory */
   87         u_long  size;                   /* size of file system */
   88 };
   89 
   90 /*
   91  * Arguments to mount ISO 9660 filesystems.
   92  */
   93 struct iso_args {
   94         char    *fspec;                 /* block special device to mount */
   95         struct  export_args export_info;/* network export info */
   96         int     flags;                  /* mounting flags, see below */
   97         int     sess;                   /* start sector of session */
   98 };
   99 
  100 #define ISOFSMNT_NORRIP         0x00000001      /* disable Rock Ridge Ext.*/
  101 #define ISOFSMNT_GENS           0x00000002      /* enable generation numbers */
  102 #define ISOFSMNT_EXTATT         0x00000004      /* enable extended attr. */
  103 #define ISOFSMNT_NOJOLIET       0x00000008      /* disable Joliet Ext.*/
  104 #define ISOFSMNT_SESS           0x00000010      /* use iso_args.sess */
  105 
  106 /*
  107  * Arguments to mount NFS
  108  */
  109 #define NFS_ARGSVERSION 4               /* change when nfs_args changes */
  110 struct nfs_args {
  111         int             version;        /* args structure version number */
  112         struct sockaddr *addr;          /* file server address */
  113         int             addrlen;        /* length of address */
  114         int             sotype;         /* Socket type */
  115         int             proto;          /* and Protocol */
  116         u_char          *fh;            /* File handle to be mounted */
  117         int             fhsize;         /* Size, in bytes, of fh */
  118         int             flags;          /* flags */
  119         int             wsize;          /* write size in bytes */
  120         int             rsize;          /* read size in bytes */
  121         int             readdirsize;    /* readdir size in bytes */
  122         int             timeo;          /* initial timeout in .1 secs */
  123         int             retrans;        /* times to retry send */
  124         int             maxgrouplist;   /* Max. size of group list */
  125         int             readahead;      /* # of blocks to readahead */
  126         int             leaseterm;      /* Term (sec) of lease */
  127         int             deadthresh;     /* Retrans threshold */
  128         char            *hostname;      /* server's name */
  129         int             acregmin;       /* Attr cache file recently modified */
  130         int             acregmax;       /* ac file not recently modified */
  131         int             acdirmin;       /* ac for dir recently modified */
  132         int             acdirmax;       /* ac for dir not recently modified */
  133 };
  134 /* NFS args version 3 (for backwards compatibility) */
  135 struct nfs_args3 {
  136         int             version;        /* args structure version number */
  137         struct sockaddr *addr;          /* file server address */
  138         int             addrlen;        /* length of address */
  139         int             sotype;         /* Socket type */
  140         int             proto;          /* and Protocol */
  141         u_char          *fh;            /* File handle to be mounted */
  142         int             fhsize;         /* Size, in bytes, of fh */
  143         int             flags;          /* flags */
  144         int             wsize;          /* write size in bytes */
  145         int             rsize;          /* read size in bytes */
  146         int             readdirsize;    /* readdir size in bytes */
  147         int             timeo;          /* initial timeout in .1 secs */
  148         int             retrans;        /* times to retry send */
  149         int             maxgrouplist;   /* Max. size of group list */
  150         int             readahead;      /* # of blocks to readahead */
  151         int             leaseterm;      /* Term (sec) of lease */
  152         int             deadthresh;     /* Retrans threshold */
  153         char            *hostname;      /* server's name */
  154 };
  155 
  156 /*
  157  * NFS mount option flags
  158  */
  159 #ifndef _KERNEL
  160 #define NFSMNT_RESVPORT         0x00000000  /* always use reserved ports */
  161 #endif /* ! _KERNEL */
  162 #define NFSMNT_SOFT             0x00000001  /* soft mount (hard is default) */
  163 #define NFSMNT_WSIZE            0x00000002  /* set write size */
  164 #define NFSMNT_RSIZE            0x00000004  /* set read size */
  165 #define NFSMNT_TIMEO            0x00000008  /* set initial timeout */
  166 #define NFSMNT_RETRANS          0x00000010  /* set number of request retries */
  167 #define NFSMNT_MAXGRPS          0x00000020  /* set maximum grouplist size */
  168 #define NFSMNT_INT              0x00000040  /* allow interrupts on hard mount */
  169 #define NFSMNT_NOCONN           0x00000080  /* Don't Connect the socket */
  170 #define NFSMNT_NQNFS            0x00000100  /* Use Nqnfs protocol */
  171 #define NFSMNT_NFSV3            0x00000200  /* Use NFS Version 3 protocol */
  172 #define NFSMNT_KERB             0x00000400  /* Use Kerberos authentication */
  173 #define NFSMNT_DUMBTIMR         0x00000800  /* Don't estimate rtt dynamically */
  174 #define NFSMNT_LEASETERM        0x00001000  /* set lease term (nqnfs) */
  175 #define NFSMNT_READAHEAD        0x00002000  /* set read ahead */
  176 #define NFSMNT_DEADTHRESH       0x00004000  /* set dead server retry thresh */
  177 #ifdef _KERNEL /* Coming soon to a system call near you! */
  178 #define NFSMNT_NOAC             0x00008000  /* disable attribute cache */
  179 #endif /* _KERNEL */
  180 #define NFSMNT_RDIRPLUS         0x00010000  /* Use Readdirplus for V3 */
  181 #define NFSMNT_READDIRSIZE      0x00020000  /* Set readdir size */
  182 
  183 /* Flags valid only in mount syscall arguments */
  184 #define NFSMNT_ACREGMIN         0x00040000  /* acregmin field valid */
  185 #define NFSMNT_ACREGMAX         0x00080000  /* acregmax field valid */
  186 #define NFSMNT_ACDIRMIN         0x00100000  /* acdirmin field valid */
  187 #define NFSMNT_ACDIRMAX         0x00200000  /* acdirmax field valid */
  188 
  189 /* Flags valid only in kernel */
  190 #define NFSMNT_INTERNAL         0xfffc0000  /* Bits set internally */
  191 #define NFSMNT_HASWRITEVERF     0x00040000  /* Has write verifier for V3 */
  192 #define NFSMNT_GOTPATHCONF      0x00080000  /* Got the V3 pathconf info */
  193 #define NFSMNT_GOTFSINFO        0x00100000  /* Got the V3 fsinfo */
  194 #define NFSMNT_MNTD             0x00200000  /* Mnt server for mnt point */
  195 #define NFSMNT_DISMINPROG       0x00400000  /* Dismount in progress */
  196 #define NFSMNT_DISMNT           0x00800000  /* Dismounted */
  197 #define NFSMNT_SNDLOCK          0x01000000  /* Send socket lock */
  198 #define NFSMNT_WANTSND          0x02000000  /* Want above */
  199 #define NFSMNT_RCVLOCK          0x04000000  /* Rcv socket lock */
  200 #define NFSMNT_WANTRCV          0x08000000  /* Want above */
  201 #define NFSMNT_WAITAUTH         0x10000000  /* Wait for authentication */
  202 #define NFSMNT_HASAUTH          0x20000000  /* Has authenticator */
  203 #define NFSMNT_WANTAUTH         0x40000000  /* Wants an authenticator */
  204 #define NFSMNT_AUTHERR          0x80000000  /* Authentication error */
  205 
  206 /*
  207  *  Arguments to mount MSDOS filesystems.
  208  */
  209 struct msdosfs_args {
  210         char    *fspec;         /* blocks special holding the fs to mount */
  211         struct  export_args export_info;
  212                                 /* network export information */
  213         uid_t   uid;            /* uid that owns msdosfs files */
  214         gid_t   gid;            /* gid that owns msdosfs files */
  215         mode_t  mask;           /* mask to be applied for msdosfs perms */
  216         int     flags;          /* see below */
  217 };
  218 
  219 /*
  220  * Msdosfs mount options:
  221  */
  222 #define MSDOSFSMNT_SHORTNAME    0x01    /* Force old DOS short names only */
  223 #define MSDOSFSMNT_LONGNAME     0x02    /* Force Win'95 long names */
  224 #define MSDOSFSMNT_NOWIN95      0x04    /* Completely ignore Win95 entries */
  225 #define MSDOSFSMNT_ALLOWDIRX    0x10    /* dir is mode +x if r */
  226 
  227 /*
  228  * Arguments to mount ntfs filesystems
  229  */
  230 struct ntfs_args {
  231         char    *fspec;                 /* block special device to mount */
  232         struct  export_args export_info;/* network export information */
  233         uid_t   uid;                    /* uid that owns ntfs files */
  234         gid_t   gid;                    /* gid that owns ntfs files */
  235         mode_t  mode;                   /* mask to be applied for ntfs perms */
  236         u_long  flag;                   /* additional flags */
  237 };
  238 
  239 /*
  240  * ntfs mount options:
  241  */
  242 #define NTFS_MFLAG_CASEINS      0x00000001
  243 #define NTFS_MFLAG_ALLNAMES     0x00000002
  244 
  245 /* Arguments to mount UDF file systems */
  246 struct udf_args {
  247         char *fspec; /* Block special device to mount */
  248         u_int32_t lastblock; /* Special device last block */
  249 };
  250 
  251 /*
  252  * Arguments to mount procfs filesystems
  253  */
  254 struct procfs_args {
  255         int version;
  256         int flags;
  257 };
  258 
  259 /*
  260  * procfs mount options:
  261  */
  262 #define PROCFS_ARGSVERSION      1
  263 #define PROCFSMNT_LINUXCOMPAT   0x01
  264 
  265 
  266 /*
  267  * file system statistics
  268  */
  269 
  270 #define MFSNAMELEN      16      /* length of fs type name, including nul */
  271 #define MNAMELEN        90      /* length of buffer for returned name */
  272 
  273 /* per-filesystem mount options */
  274 union mount_info {
  275         struct ufs_args ufs_args;
  276         struct mfs_args mfs_args;
  277         struct nfs_args nfs_args;
  278         struct iso_args iso_args;
  279         struct procfs_args procfs_args;
  280         struct msdosfs_args msdosfs_args;
  281         struct ntfs_args ntfs_args;
  282         char __align[160];      /* 64-bit alignment and room to grow */
  283 };
  284 
  285 /* new statfs structure with mount options and statvfs fields */
  286 struct statfs {
  287         u_int32_t       f_flags;        /* copy of mount flags */
  288         u_int32_t       f_bsize;        /* file system block size */
  289         u_int32_t       f_iosize;       /* optimal transfer block size */
  290 
  291                                         /* unit is f_bsize */
  292         u_int64_t       f_blocks;       /* total data blocks in file system */
  293         u_int64_t       f_bfree;        /* free blocks in fs */
  294         int64_t         f_bavail;       /* free blocks avail to non-superuser */
  295 
  296         u_int64_t       f_files;        /* total file nodes in file system */
  297         u_int64_t       f_ffree;        /* free file nodes in fs */
  298         int64_t         f_favail;       /* free file nodes avail to non-root */
  299 
  300         u_int64_t       f_syncwrites;   /* count of sync writes since mount */
  301         u_int64_t       f_syncreads;    /* count of sync reads since mount */
  302         u_int64_t       f_asyncwrites;  /* count of async writes since mount */
  303         u_int64_t       f_asyncreads;   /* count of async reads since mount */
  304 
  305         fsid_t          f_fsid;         /* file system id */
  306         u_int32_t       f_namemax;      /* maximum filename length */
  307         uid_t           f_owner;        /* user that mounted the file system */
  308         u_int32_t       f_ctime;        /* last mount [-u] time */
  309         u_int32_t       f_spare[3];     /* spare for later */
  310 
  311         char f_fstypename[MFSNAMELEN];  /* fs type name */
  312         char f_mntonname[MNAMELEN];     /* directory on which mounted */
  313         char f_mntfromname[MNAMELEN];   /* mounted file system */
  314         union mount_info mount_info;    /* per-filesystem mount options */
  315 };
  316 
  317 /* old (pre-4.3) statfs structure with mount options */
  318 struct o43statfs {
  319         u_int32_t  f_flags;             /* copy of mount flags */
  320         int32_t    f_bsize;             /* fundamental file system block size */
  321         u_int32_t  f_iosize;            /* optimal transfer block size */
  322         u_int32_t  f_blocks;            /* total data blocks in file system */
  323         u_int32_t  f_bfree;             /* free blocks in fs */
  324         int32_t    f_bavail;            /* free blocks avail to non-superuser */
  325         u_int32_t  f_files;             /* total file nodes in file system */
  326         u_int32_t  f_ffree;             /* free file nodes in fs */
  327         fsid_t     f_fsid;              /* file system id */
  328         uid_t      f_owner;             /* user that mounted the file system */
  329         u_int32_t  f_syncwrites;        /* count of sync writes since mount */
  330         u_int32_t  f_asyncwrites;       /* count of async writes since mount */
  331         u_int32_t  f_ctime;             /* last mount [-u] time */
  332         u_int32_t  f_spare[3];          /* spare for later */
  333         char       f_fstypename[MFSNAMELEN]; /* fs type name */
  334         char       f_mntonname[MNAMELEN];    /* directory on which mounted */
  335         char       f_mntfromname[MNAMELEN];  /* mounted file system */
  336         union mount_info mount_info;        /* per-filesystem mount options */
  337 };
  338 
  339 /* old (pre-2.6) statfs structure */
  340 struct ostatfs {
  341         short   f_type;                 /* type of file system (unused; zero) */
  342         short   f_flags;                /* copy of mount flags */
  343         long    f_bsize;                /* fundamental file system block size */
  344         long    f_iosize;               /* optimal transfer block size */
  345         long    f_blocks;               /* total data blocks in file system */
  346         long    f_bfree;                /* free blocks in fs */
  347         long    f_bavail;               /* free blocks avail to non-superuser */
  348         long    f_files;                /* total file nodes in file system */
  349         long    f_ffree;                /* free file nodes in fs */
  350         fsid_t  f_fsid;                 /* file system id */
  351         uid_t   f_owner;                /* user that mounted the file system */
  352         long    f_syncwrites;           /* count of sync writes since mount */
  353         long    f_asyncwrites;          /* count of async writes since mount */
  354         long    f_spare[2];             /* spare for later */
  355         char    f_fstypename[MFSNAMELEN]; /* fs type name */
  356         char    f_mntonname[MNAMELEN];    /* directory on which mounted */
  357         char    f_mntfromname[MNAMELEN];  /* mounted file system */
  358 };
  359 
  360 /*
  361  * File system types.
  362  */
  363 #define MOUNT_FFS       "ffs"           /* UNIX "Fast" Filesystem */
  364 #define MOUNT_UFS       MOUNT_FFS       /* for compatibility */
  365 #define MOUNT_NFS       "nfs"           /* Network Filesystem */
  366 #define MOUNT_MFS       "mfs"           /* Memory Filesystem */
  367 #define MOUNT_MSDOS     "msdos"         /* MSDOS Filesystem */
  368 #define MOUNT_PORTAL    "portal"        /* Portal Filesystem */
  369 #define MOUNT_PROCFS    "procfs"        /* /proc Filesystem */
  370 #define MOUNT_AFS       "afs"           /* Andrew Filesystem */
  371 #define MOUNT_CD9660    "cd9660"        /* ISO9660 (aka CDROM) Filesystem */
  372 #define MOUNT_EXT2FS    "ext2fs"        /* Second Extended Filesystem */
  373 #define MOUNT_NCPFS     "ncpfs"         /* NetWare Network File System */
  374 #define MOUNT_XFS       "xfs"           /* xfs */
  375 #define MOUNT_NTFS      "ntfs"          /* NTFS */
  376 #define MOUNT_UDF       "udf"           /* UDF */
  377 
  378 /*
  379  * Structure per mounted file system.  Each mounted file system has an
  380  * array of operations and an instance record.  The file systems are
  381  * put on a doubly linked list.
  382  */
  383 LIST_HEAD(vnodelst, vnode);
  384 
  385 struct mount {
  386         CIRCLEQ_ENTRY(mount) mnt_list;          /* mount list */
  387         const struct vfsops *mnt_op;            /* operations on fs */
  388         struct vfsconf  *mnt_vfc;               /* configuration info */
  389         struct vnode    *mnt_vnodecovered;      /* vnode we mounted on */
  390         struct vnode    *mnt_syncer;            /* syncer vnode */
  391         struct vnodelst mnt_vnodelist;          /* list of vnodes this mount */
  392         struct rwlock   mnt_lock;               /* mount structure lock */
  393         int             mnt_flag;               /* flags */
  394         int             mnt_maxsymlinklen;      /* max size of short symlink */
  395         struct statfs   mnt_stat;               /* cache of filesystem stats */
  396         void            *mnt_data;              /* private data */
  397 };
  398 
  399 /*
  400  * Mount flags.
  401  *
  402  * Unmount uses MNT_FORCE flag.
  403  */
  404 #define MNT_RDONLY      0x00000001      /* read only filesystem */
  405 #define MNT_SYNCHRONOUS 0x00000002      /* file system written synchronously */
  406 #define MNT_NOEXEC      0x00000004      /* can't exec from filesystem */
  407 #define MNT_NOSUID      0x00000008      /* don't honor setuid bits on fs */
  408 #define MNT_NODEV       0x00000010      /* don't interpret special files */
  409 #define MNT_ASYNC       0x00000040      /* file system written asynchronously */
  410 
  411 /*
  412  * exported mount flags.
  413  */
  414 #define MNT_EXRDONLY    0x00000080      /* exported read only */
  415 #define MNT_EXPORTED    0x00000100      /* file system is exported */
  416 #define MNT_DEFEXPORTED 0x00000200      /* exported to the world */
  417 #define MNT_EXPORTANON  0x00000400      /* use anon uid mapping for everyone */
  418 #define MNT_EXKERB      0x00000800      /* exported with Kerberos uid mapping */
  419 
  420 /*
  421  * Flags set by internal operations.
  422  */
  423 #define MNT_LOCAL       0x00001000      /* filesystem is stored locally */
  424 #define MNT_QUOTA       0x00002000      /* quotas are enabled on filesystem */
  425 #define MNT_ROOTFS      0x00004000      /* identifies the root filesystem */
  426 
  427 /*
  428  * Extra post 4.4BSD-lite2 mount flags.
  429  */
  430 #define MNT_NOATIME     0x00008000      /* don't update access times on fs */
  431 
  432 /*
  433  * Mask of flags that are visible to statfs()
  434  */
  435 #define MNT_VISFLAGMASK 0x0400ffff
  436 
  437 #define MNT_BITS \
  438     "\010\001RDONLY\002SYNCHRONOUS\003NOEXEC\004NOSUID\005NODEV" \
  439     "\007ASYNC\010EXRDONLY\011EXPORTED\012DEFEXPORTED\013EXPORTANON" \
  440     "\014EXKERB\015LOCAL\016QUOTA\017ROOTFS"
  441 
  442 /*
  443  * filesystem control flags.
  444  */
  445 #define MNT_UPDATE      0x00010000      /* not a real mount, just an update */
  446 #define MNT_DELEXPORT   0x00020000      /* delete export host lists */
  447 #define MNT_RELOAD      0x00040000      /* reload filesystem data */
  448 #define MNT_FORCE       0x00080000      /* force unmount or readonly change */
  449 #define MNT_WANTRDWR    0x02000000      /* want upgrade to read/write */
  450 #define MNT_SOFTDEP     0x04000000      /* soft dependencies being done */
  451 #define MNT_DOOMED      0x08000000      /* device behind filesystem is gone */
  452 
  453 /*
  454  * Sysctl CTL_VFS definitions.
  455  *
  456  * Second level identifier specifies which filesystem. Second level
  457  * identifier VFS_GENERIC returns information about all filesystems.
  458  */
  459 #define VFS_GENERIC     0       /* generic filesystem information */
  460 /*
  461  * Third level identifiers for VFS_GENERIC are given below; third
  462  * level identifiers for specific filesystems are given in their
  463  * mount specific header files.
  464  */
  465 #define VFS_MAXTYPENUM  1       /* int: highest defined filesystem type */
  466 #define VFS_CONF        2       /* struct: vfsconf for filesystem given
  467                                    as next argument */
  468 #define VFS_BCACHESTAT  3       /* struct: buffer cache statistics given 
  469                                    as next argument */
  470 #define CTL_VFSGENCTL_NAMES { \
  471         { 0, 0 }, \
  472         { "maxtypenum", CTLTYPE_INT }, \
  473         { "conf", CTLTYPE_NODE }, \
  474         { "bcachestat", CTLTYPE_STRUCT } \
  475 }
  476 
  477 /*
  478  * Filesystem configuration information. One of these exists for each
  479  * type of filesystem supported by the kernel. These are searched at
  480  * mount time to identify the requested filesystem.
  481  */
  482 struct vfsconf {
  483         const struct vfsops *vfc_vfsops; /* filesystem operations vector */
  484         char    vfc_name[MFSNAMELEN];   /* filesystem type name */
  485         int     vfc_typenum;            /* historic filesystem type number */
  486         int     vfc_refcount;           /* number mounted of this type */
  487         int     vfc_flags;              /* permanent flags */
  488         struct  vfsconf *vfc_next;      /* next in list */
  489 };
  490 
  491 /* buffer cache statistics */
  492 struct bcachestats {
  493         int64_t numbufs;                /* number of buffers allocated */
  494         int64_t freebufs;               /* number of free buffers */
  495         int64_t numbufpages;            /* number of pages in buffer cache */
  496         int64_t numfreepages;           /* number of free pages */
  497         int64_t numdirtypages;          /* number of dirty free pages */
  498         int64_t numcleanpages;          /* number of clean free pages */
  499         int64_t pendingwrites;          /* number of pending writes */
  500         int64_t pendingreads;           /* number of pending reads */
  501         int64_t numwrites;              /* total writes started */
  502         int64_t numreads;               /* total reads started */
  503         int64_t cachehits;              /* total reads found in cache */
  504 };
  505 #ifdef _KERNEL
  506 extern struct bcachestats bcstats;
  507 #define BUFPAGES_DEFICIT (bufpages - bcstats.numbufpages)
  508 #endif
  509 
  510 /*
  511  * Operations supported on mounted file system.
  512  */
  513 #ifdef _KERNEL
  514 #ifdef __STDC__
  515 struct nameidata;
  516 struct mbuf;
  517 #endif
  518 
  519 extern int maxvfsconf;          /* highest defined filesystem type */
  520 extern struct vfsconf *vfsconf; /* head of list of filesystem types */
  521 
  522 struct vfsops {
  523         int     (*vfs_mount)(struct mount *mp, const char *path,
  524                                     void *data,
  525                                     struct nameidata *ndp, struct proc *p);
  526         int     (*vfs_start)(struct mount *mp, int flags,
  527                                     struct proc *p);
  528         int     (*vfs_unmount)(struct mount *mp, int mntflags,
  529                                     struct proc *p);
  530         int     (*vfs_root)(struct mount *mp, struct vnode **vpp);
  531         int     (*vfs_quotactl)(struct mount *mp, int cmds, uid_t uid,
  532                                     caddr_t arg, struct proc *p);
  533         int     (*vfs_statfs)(struct mount *mp, struct statfs *sbp,
  534                                     struct proc *p);
  535         int     (*vfs_sync)(struct mount *mp, int waitfor,
  536                                     struct ucred *cred, struct proc *p);
  537         int     (*vfs_vget)(struct mount *mp, ino_t ino,
  538                                     struct vnode **vpp);
  539         int     (*vfs_fhtovp)(struct mount *mp, struct fid *fhp,
  540                                      struct vnode **vpp);
  541         int     (*vfs_vptofh)(struct vnode *vp, struct fid *fhp);
  542         int     (*vfs_init)(struct vfsconf *);
  543         int     (*vfs_sysctl)(int *, u_int, void *, size_t *, void *,
  544                                      size_t, struct proc *);
  545         int     (*vfs_checkexp)(struct mount *mp, struct mbuf *nam,
  546                                     int *extflagsp, struct ucred **credanonp);
  547 };
  548 
  549 #define VFS_MOUNT(MP, PATH, DATA, NDP, P) \
  550         (*(MP)->mnt_op->vfs_mount)(MP, PATH, DATA, NDP, P)
  551 #define VFS_START(MP, FLAGS, P)   (*(MP)->mnt_op->vfs_start)(MP, FLAGS, P)
  552 #define VFS_UNMOUNT(MP, FORCE, P) (*(MP)->mnt_op->vfs_unmount)(MP, FORCE, P)
  553 #define VFS_ROOT(MP, VPP)         (*(MP)->mnt_op->vfs_root)(MP, VPP)
  554 #define VFS_QUOTACTL(MP,C,U,A,P)  (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, P)
  555 #define VFS_STATFS(MP, SBP, P)    (*(MP)->mnt_op->vfs_statfs)(MP, SBP, P)
  556 #define VFS_SYNC(MP, WAIT, C, P)  (*(MP)->mnt_op->vfs_sync)(MP, WAIT, C, P)
  557 #define VFS_VGET(MP, INO, VPP)    (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP)
  558 #define VFS_FHTOVP(MP, FIDP, VPP) \
  559         (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP)
  560 #define VFS_VPTOFH(VP, FIDP)      (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP)
  561 #define VFS_CHECKEXP(MP, NAM, EXFLG, CRED) \
  562         (*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED)
  563 #endif /* _KERNEL */
  564 
  565 /*
  566  * Flags for various system call interfaces.
  567  *
  568  * waitfor flags to vfs_sync() and getfsstat()
  569  */
  570 #define MNT_WAIT        1       /* synchronously wait for I/O to complete */
  571 #define MNT_NOWAIT      2       /* start all I/O, but do not wait for it */
  572 #define MNT_LAZY        3       /* push data not written by filesystem syncer */
  573 
  574 /*
  575  * Generic file handle
  576  */
  577 struct fhandle {
  578         fsid_t  fh_fsid;        /* File system id of mount point */
  579         struct  fid fh_fid;     /* File sys specific id */
  580 };
  581 typedef struct fhandle  fhandle_t;
  582 
  583 #ifdef _KERNEL
  584 #include <net/radix.h>
  585 #include <sys/socket.h>         /* XXX for AF_MAX */
  586 
  587 /*
  588  * Network address lookup element
  589  */
  590 struct netcred {
  591         struct  radix_node netc_rnodes[2];
  592         int     netc_exflags;
  593         struct  ucred netc_anon;
  594 };
  595 
  596 /*
  597  * Network export information
  598  */
  599 struct netexport {
  600         struct  netcred ne_defexported;               /* Default export */
  601         struct  radix_node_head *ne_rtable[AF_MAX+1]; /* Individual exports */
  602 };
  603 #endif /* _KERNEL */
  604 
  605 #ifdef _KERNEL
  606 /*
  607  * exported vnode operations
  608  */
  609 int     vfs_busy(struct mount *, int);
  610 #define VB_READ         0x01
  611 #define VB_WRITE        0x02
  612 #define VB_NOWAIT       0x04    /* immediately fail on busy lock */
  613 #define VB_WAIT         0x08    /* sleep fail on busy lock */
  614 
  615 int     vfs_isbusy(struct mount *);
  616 int     vfs_mount_foreach_vnode(struct mount *, int (*func)(struct vnode *,
  617                                     void *), void *);
  618 void    vfs_getnewfsid(struct mount *);
  619 struct  mount *vfs_getvfs(fsid_t *);
  620 int     vfs_mountedon(struct vnode *);
  621 int     vfs_rootmountalloc(char *, char *, struct mount **);
  622 void    vfs_unbusy(struct mount *);
  623 void    vfs_unmountall(void);
  624 extern  CIRCLEQ_HEAD(mntlist, mount) mountlist;
  625 
  626 struct  mount *getvfs(fsid_t *);            /* return vfs given fsid */
  627                                             /* process mount export info */
  628 int     vfs_export(struct mount *, struct netexport *, struct export_args *);
  629                                             /* lookup host in fs export list */
  630 struct  netcred *vfs_export_lookup(struct mount *, struct netexport *,
  631             struct mbuf *);
  632 int     vfs_allocate_syncvnode(struct mount *);
  633 int     speedup_syncer(void);
  634 
  635 int     vfs_syncwait(int);      /* sync and wait for complete */
  636 void    vfs_shutdown(void);     /* unmount and sync file systems */
  637 long    makefstype(char *);
  638 int     dounmount(struct mount *, int, struct proc *, struct vnode *);
  639 void    vfsinit(void);
  640 int     vfs_register(struct vfsconf *);
  641 int     vfs_unregister(struct vfsconf *);
  642 #else /* _KERNEL */
  643 
  644 #ifndef _SYS_STAT_H_
  645 struct stat;
  646 #endif
  647 
  648 __BEGIN_DECLS
  649 int     fstatfs(int, struct statfs *);
  650 int     getfh(const char *, fhandle_t *);
  651 int     getfsstat(struct statfs *, size_t, int);
  652 int     getmntinfo(struct statfs **, int);
  653 int     mount(const char *, const char *, int, void *);
  654 int     statfs(const char *, struct statfs *);
  655 int     unmount(const char *, int);
  656 #if __BSD_VISIBLE
  657 int     fhopen(const fhandle_t *, int);
  658 int     fhstat(const fhandle_t *, struct stat *);
  659 int     fhstatfs(const fhandle_t *, struct statfs *);
  660 #endif /* __BSD_VISIBLE */
  661 
  662 __END_DECLS
  663 
  664 #endif /* _KERNEL */
  665 #endif /* !_SYS_MOUNT_H_ */

Cache object: e2c5ae228839c062c8176e139ceacaaa


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