/*-
* Copyright (c) 1989, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)mount.h 8.21 (Berkeley) 5/20/95
* $FreeBSD$
*/
#ifndef _SYS_MOUNT_H_
#define _SYS_MOUNT_H_
#ifdef _KERNEL
#endif
/*
* NOTE: When changing statfs structure, mount structure, MNT_* flags or
* MNTK_* flags also update DDB show mount command in vfs_subr.c.
*/
/*
* File identifier.
* These are unique per filesystem on a single machine.
*/
struct fid {
};
/*
* filesystem statistics
*/
struct statfs {
};
#ifdef _KERNEL
/* XXX getfsstat.2 is out of date with write and read counter changes here. */
/* XXX statfs.2 is out of date with read counter changes here. */
struct ostatfs {
/*
* XXX on machines where longs are aligned to 8-byte boundaries, there
* is an unnamed int32_t here. This spare was after the apparent end
* of the struct until we bit off the read counters from f_mntonname.
*/
};
/* Mount options list */
struct vfsopt {
char *name;
void *value;
int len;
int pos;
int seen;
};
/*
* Structure per mounted filesystem. Each mounted filesystem has an
* array of operations and an instance record. The filesystems are
* put on a doubly linked list.
*
* Lock reference:
* m - mountlist_mtx
* i - interlock
* v - vnode freelist mutex
*
* Unmarked fields are considered stable as long as a ref is held.
*
*/
struct mount {
};
/*
* Definitions for MNT_VNODE_FOREACH_ALL.
*/
do { \
/* MNT_IUNLOCK(mp); -- done in above function */ \
} while (0)
/*
* Definitions for MNT_VNODE_FOREACH_ACTIVE.
*/
} while (0)
#endif /* _KERNEL */
/*
* User specifiable flags, stored in mnt_flag.
*/
/*
* NFS export related mount flags.
*/
/*
* Flags set by internal operations,
* but visible to the user.
* XXX some of these are not quite right.. (I've never seen the root flag set)
*/
/*
* Mask of flags that are visible to statfs().
* XXX I think that this could now become (~(MNT_CMDFLAGS))
* but the 'mount' program may need changing to handle this.
*/
/* Mask of flags that can be updated. */
MNT_NOATIME | \
MNT_NOSYMFOLLOW | MNT_IGNORE | \
/*
* External filesystem command modifier flags.
* Unmount can use the MNT_FORCE flag.
* XXX: These are not STATES and really should be somewhere else.
* XXX: MNT_BYFSID collides with MNT_ACLS, but because MNT_ACLS is only used for
* mount(2) and MNT_BYFSID is only used for unmount(2) it's harmless.
*/
/*
* Internal filesystem control flags stored in mnt_kern_flag.
*
* MNTK_UNMOUNT locks the mount entry so that name lookup cannot proceed
* past the mount point. This keeps the subtree stable during mounts
* and unmounts.
*
* MNTK_UNMOUNTF permits filesystems to detect a forced unmount while
* dounmount() is still waiting to lock the mountpoint. This allows
* the filesystem to cancel operations that might otherwise deadlock
* with the unmount attempt (used by NFS).
*
* MNTK_NOINSMNTQ is strict subset of MNTK_UNMOUNT. They are separated
* to allow for failed unmount attempt to restore the syncer vnode for
* the mount.
*/
and writes. Filesystem shall properly
handle i/o state on EFAULT. */
#ifdef _KERNEL
static inline int
{
}
static inline int
{
}
#endif
/*
* Sysctl CTL_VFS definitions.
*
* Second level identifier specifies which filesystem. Second level
* identifier VFS_VFSCONF returns information about all filesystems.
* Second level identifier VFS_GENERIC is non-terminal.
*/
/*
* Third level identifiers for VFS_GENERIC are given below; third
* level identifiers for specific filesystems are given in their
* mount specific header files.
*/
as next argument */
/*
* Flags for various system call interfaces.
*
* waitfor flags to vfs_sync() and getfsstat()
*/
/*
* Generic file handle
*/
struct fhandle {
};
/*
* Old export arguments without security flavor list
*/
struct oexport_args {
};
/*
* Export arguments for local filesystem mount calls.
*/
struct export_args {
};
/*
* Structure holding information for a publicly exported filesystem
* (WebNFS). Currently the specs allow just for one such filesystem.
*/
struct nfs_public {
};
/*
* Filesystem configuration information. One of these exists for each
* type of filesystem supported by the kernel. These are searched at
* mount time to identify the requested filesystem.
*
* XXX: Never change the first two arguments!
*/
struct vfsconf {
};
/* Userland version of the struct vfsconf. */
struct xvfsconf {
};
#ifndef BURN_BRIDGES
struct ovfsconf {
void *vfc_vfsops;
int vfc_index;
int vfc_refcount;
int vfc_flags;
};
#endif
/*
* NB: these flags refer to IMPLEMENTATION properties, not properties of
* any actual mounts; i.e., it does not make sense to change the flags.
*/
struct vfsidctl {
/* type of fs 'nfs' or '*' */
};
/* vfsidctl API version. */
/*
* private sysctls.
* All "global" sysctl ops have the 33rd bit set:
* 0x...1....
* Private sysctl ops should have the 33rd bit unset.
*/
struct vfsquery {
};
/* vfsquery flags */
program */
#ifdef _KERNEL
/* Point a sysctl request at a vfsidctl's data. */
do { \
} while (0)
#endif
struct iovec;
struct uio;
#ifdef _KERNEL
/*
* vfs_busy specific flags and mask.
*/
#ifdef MALLOC_DECLARE
#endif
extern int maxvfsconf; /* highest defined filesystem type */
extern struct vfsconfhead vfsconf;
/*
* Operations supported on mounted filesystem.
*/
struct mount_args;
struct nameidata;
struct sysctl_req;
struct mntarg;
int *numsecflavors, int **secflavors);
const char *attrname);
struct sysctl_req *req);
struct vfsops {
};
int _enable_stops; \
\
if (_enable_stops) \
sigallowstop(); \
} while (0)
int _rc; \
\
VFS_PROLOGUE(MP); \
VFS_EPILOGUE(MP); \
_rc; })
int _rc; \
\
VFS_PROLOGUE(MP); \
VFS_EPILOGUE(MP); \
_rc; })
int _rc; \
\
VFS_PROLOGUE(MP); \
VFS_EPILOGUE(MP); \
_rc; })
int _rc; \
\
VFS_PROLOGUE(MP); \
VFS_EPILOGUE(MP); \
_rc; })
int _rc; \
\
VFS_PROLOGUE(MP); \
VFS_EPILOGUE(MP); \
_rc; })
int _rc; \
\
VFS_PROLOGUE(MP); \
VFS_EPILOGUE(MP); \
_rc; })
int _rc; \
\
VFS_PROLOGUE(MP); \
VFS_EPILOGUE(MP); \
_rc; })
int _rc; \
\
VFS_PROLOGUE(MP); \
VFS_EPILOGUE(MP); \
_rc; })
int _rc; \
\
VFS_PROLOGUE(MP); \
SEC); \
VFS_EPILOGUE(MP); \
_rc; })
int _rc; \
\
VFS_PROLOGUE(MP); \
VFS_EPILOGUE(MP); \
_rc; })
int _rc; \
\
VFS_PROLOGUE(MP); \
VFS_EPILOGUE(MP); \
_rc; })
VFS_PROLOGUE(MP); \
VFS_EPILOGUE(MP); \
} \
} while (0)
VFS_PROLOGUE(MP); \
VFS_EPILOGUE(MP); \
} \
} while (0)
VFS_PROLOGUE(MP); \
VFS_EPILOGUE(MP); \
} \
} while (0)
VFS_PROLOGUE(MP); \
VFS_EPILOGUE(MP); \
} \
} while (0)
{ \
} while (0)
{ \
} while (0)
/*
* Version numbers.
*/
.vfc_version = VFS_VERSION, \
.vfc_vfsops = &vfsops, \
.vfc_typenum = -1, \
}; \
#fsname, \
vfs_modevent, \
}; \
/*
* exported vnode operations
*/
int kernel_vmount(int flags, ...);
struct vfsconf *vfs_byname(const char *);
void vfs_mount_destroy(struct mount *);
int vfs_getopt(struct vfsoptlist *, const char *, void **, int *);
int vfs_copyopt(struct vfsoptlist *, const char *, void *, int);
int len);
int len);
const char *value);
int vfs_setpublicfs /* set publicly exported fs */
int vfs_export /* process mount export info */
(struct mount *, struct export_args *);
void vfs_allocate_syncvnode(struct mount *);
void vfs_deallocate_syncvnode(struct mount *);
void vfs_getnewfsid(struct mount *);
int vfs_modevent(module_t, int, void *);
void vfs_mount_error(struct mount *, const char *, ...);
void vfs_mountroot(void); /* mount our root filesystem */
void vfs_notify_upper(struct vnode *, int);
struct export_args *exp);
struct ucred *);
void vfs_unbusy(struct mount *);
void vfs_unmountall(void);
extern struct mtx mountlist_mtx;
extern struct nfs_public nfs_pub;
extern struct sx vfsconf_sx;
/*
* Declarations for these vfs default operations are located in
* kern/vfs_default.c. They will be automatically used to replace
* null entries in VFS ops tables when registering a new filesystem
* type in the global table.
*/
void syncer_suspend(void);
void syncer_resume(void);
#else /* !_KERNEL */
struct stat;
int getmntinfo(struct statfs **, int);
int mount(const char *, const char *, int, void *);
int unmount(const char *, int);
/* C library stuff */
int getvfsbyname(const char *, struct xvfsconf *);
#endif /* _KERNEL */
#endif /* !_SYS_MOUNT_H_ */