FreeBSD kernel kern code
|
#include "opt_rootdevname.h"
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/cons.h>
#include <sys/eventhandler.h>
#include <sys/fcntl.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/mdioctl.h>
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/namei.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/filedesc.h>
#include <sys/reboot.h>
#include <sys/sbuf.h>
#include <sys/stat.h>
#include <sys/syscallsubr.h>
#include <sys/sysproto.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/sysent.h>
#include <sys/systm.h>
#include <sys/vnode.h>
#include <geom/geom.h>
Go to the source code of this file.
Macros | |
#define | CC_WHITESPACE -1 |
#define | CC_NONWHITESPACE -2 |
#define | PE_EOF -1 |
#define | PE_EOL -2 |
#define | ERRMSGL 255 |
Enumerations | |
enum | rh_flags { RH_FREE , RH_ALLOC , RH_ARG } |
Functions | |
__FBSDID ("$FreeBSD$") | |
static int | parse_mount (char **) |
static struct mntarg * | parse_mountroot_options (struct mntarg *, const char *) |
static int | sysctl_vfs_root_mount_hold (SYSCTL_HANDLER_ARGS) |
static void | vfs_mountroot_wait (void) |
static int | vfs_mountroot_wait_if_neccessary (const char *fs, const char *dev) |
MTX_SYSINIT (root_holds, &root_holds_mtx, "root_holds", MTX_DEF) | |
static | TAILQ_HEAD (root_hold_token) |
TUNABLE_INT ("vfs.mountroot.timeout", &root_mount_timeout) | |
SYSCTL_INT (_vfs, OID_AUTO, root_mount_always_wait, CTLFLAG_RDTUN, &root_mount_always_wait, 0, "Wait for root mount holds even if the root device already exists") | |
SYSCTL_PROC (_vfs, OID_AUTO, root_mount_hold, CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, 0, sysctl_vfs_root_mount_hold, "A", "List of root mount hold tokens") | |
struct root_hold_token * | root_mount_hold (const char *identifier) |
void | root_mount_hold_token (const char *identifier, struct root_hold_token *h) |
void | root_mount_rel (struct root_hold_token *h) |
int | root_mounted (void) |
static void | set_rootvnode (void) |
static int | vfs_mountroot_devfs (struct thread *td, struct mount **mpp) |
static void | vfs_mountroot_shuffle (struct thread *td, struct mount *mpdevfs) |
static __inline int | parse_peek (char **conf) |
static __inline void | parse_poke (char **conf, int c) |
static __inline void | parse_advance (char **conf) |
static int | parse_skipto (char **conf, int mc) |
static int | parse_token (char **conf, char **tok) |
static void | parse_dir_ask_printenv (const char *var) |
static int | parse_dir_ask (char **conf) |
static int | parse_dir_md (char **conf) |
static int | parse_dir_onfail (char **conf) |
static int | parse_dir_timeout (char **conf) |
static int | parse_directive (char **conf) |
static int | parse_mount_dev_present (const char *dev) |
static int | vfs_mountroot_parse (struct sbuf *sb, struct mount *mpdevfs) |
static void | vfs_mountroot_conf0 (struct sbuf *sb) |
static int | vfs_mountroot_readconf (struct thread *td, struct sbuf *sb) |
void | vfs_mountroot (void) |
Variables | |
struct vnode * | rootvnode |
struct mount * | rootdevmp |
char * | rootdevnames [2] = {NULL, NULL} |
struct mtx | root_holds_mtx |
static enum action | root_mount_onfail = A_CONTINUE |
static int | root_mount_mddev |
static int | root_mount_complete |
static int | root_mount_timeout = 3 |
static int | root_mount_always_wait = 0 |
#define CC_NONWHITESPACE -2 |
Definition at line 436 of file vfs_mountroot.c.
#define CC_WHITESPACE -1 |
Definition at line 435 of file vfs_mountroot.c.
#define ERRMSGL 255 |
Definition at line 736 of file vfs_mountroot.c.
#define PE_EOF -1 |
Definition at line 439 of file vfs_mountroot.c.
#define PE_EOL -2 |
Definition at line 440 of file vfs_mountroot.c.
enum rh_flags |
Enumerator | |
---|---|
RH_FREE | |
RH_ALLOC | |
RH_ARG |
Definition at line 124 of file vfs_mountroot.c.
__FBSDID | ( | "$FreeBSD$" | ) |
MTX_SYSINIT | ( | root_holds | , |
& | root_holds_mtx, | ||
"root_holds" | , | ||
MTX_DEF | |||
) |
|
static |
Definition at line 457 of file vfs_mountroot.c.
Referenced by parse_mount(), parse_skipto(), and vfs_mountroot_parse().
|
static |
Definition at line 524 of file vfs_mountroot.c.
References cngets(), hz, name, parse_dir_ask_printenv(), parse_mount(), printf(), and vfs_mountroot_wait().
Referenced by parse_directive().
|
static |
Definition at line 512 of file vfs_mountroot.c.
References freeenv(), kern_getenv(), and printf().
Referenced by parse_dir_ask().
|
static |
Definition at line 576 of file vfs_mountroot.c.
References fd, free(), kern_close(), kern_ioctl(), kern_openat(), kern_statat(), malloc(), parse_token(), path, printf(), and root_mount_mddev.
Referenced by parse_directive().
|
static |
Definition at line 649 of file vfs_mountroot.c.
References free(), parse_token(), printf(), and root_mount_onfail.
Referenced by parse_directive().
|
static |
Definition at line 676 of file vfs_mountroot.c.
References free(), parse_token(), and root_mount_timeout.
Referenced by parse_directive().
|
static |
Definition at line 695 of file vfs_mountroot.c.
References free(), parse_dir_ask(), parse_dir_md(), parse_dir_onfail(), parse_dir_timeout(), parse_skipto(), parse_token(), and printf().
Referenced by vfs_mountroot_parse().
|
static |
Definition at line 738 of file vfs_mountroot.c.
References bootverbose, ERRMSGL, mntarg::error, free(), hz, kernel_mount(), malloc(), mount_arg(), parse_advance(), parse_mountroot_options(), parse_poke(), parse_skipto(), parse_token(), printf(), root_mount_mddev, root_mount_timeout, vfs_byname(), and vfs_mountroot_wait_if_neccessary().
Referenced by parse_dir_ask(), and vfs_mountroot_parse().
|
static |
Definition at line 723 of file vfs_mountroot.c.
References namei(), NDFREE(), and vput().
Referenced by vfs_mountroot_wait_if_neccessary().
Definition at line 1125 of file vfs_mountroot.c.
References free(), mount_arg(), and name.
Referenced by parse_mount().
|
static |
Definition at line 443 of file vfs_mountroot.c.
Referenced by parse_skipto(), and vfs_mountroot_parse().
|
static |
Definition at line 450 of file vfs_mountroot.c.
Referenced by parse_mount().
|
static |
Definition at line 464 of file vfs_mountroot.c.
References CC_NONWHITESPACE, CC_WHITESPACE, parse_advance(), parse_peek(), PE_EOF, and PE_EOL.
Referenced by parse_directive(), parse_mount(), parse_token(), and vfs_mountroot_parse().
|
static |
Definition at line 493 of file vfs_mountroot.c.
References CC_NONWHITESPACE, CC_WHITESPACE, malloc(), and parse_skipto().
Referenced by parse_dir_md(), parse_dir_onfail(), parse_dir_timeout(), parse_directive(), parse_mount(), and vfs_mountroot_conf0().
struct root_hold_token * root_mount_hold | ( | const char * | identifier | ) |
Definition at line 174 of file vfs_mountroot.c.
References malloc(), RH_ALLOC, and root_holds_mtx.
void root_mount_hold_token | ( | const char * | identifier, |
struct root_hold_token * | h | ||
) |
Definition at line 189 of file vfs_mountroot.c.
References panic(), RH_ARG, and root_holds_mtx.
void root_mount_rel | ( | struct root_hold_token * | h | ) |
Definition at line 212 of file vfs_mountroot.c.
References free(), RH_ALLOC, RH_FREE, root_holds_mtx, and wakeup().
int root_mounted | ( | void | ) |
Definition at line 230 of file vfs_mountroot.c.
References root_mount_complete.
|
static |
Definition at line 238 of file vfs_mountroot.c.
References mountlist, panic(), pwd_set_rootvnode(), and rootvnode.
Referenced by vfs_mountroot_devfs(), and vfs_mountroot_shuffle().
SYSCTL_INT | ( | _vfs | , |
OID_AUTO | , | ||
root_mount_always_wait | , | ||
CTLFLAG_RDTUN | , | ||
& | root_mount_always_wait, | ||
0 | , | ||
"Wait for root mount holds even if the root device already exists" | |||
) |
SYSCTL_PROC | ( | _vfs | , |
OID_AUTO | , | ||
root_mount_hold | , | ||
CTLTYPE_STRING|CTLFLAG_RD| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
0 | , | ||
sysctl_vfs_root_mount_hold | , | ||
"A" | , | ||
"List of root mount hold tokens" | |||
) |
|
static |
Definition at line 150 of file vfs_mountroot.c.
References root_holds_mtx, sbuf_data(), sbuf_delete(), sbuf_finish(), sbuf_len(), sbuf_new(), sbuf_printf(), and sbuf_putc().
|
static |
Definition at line 114 of file vfs_mountroot.c.
TUNABLE_INT | ( | "vfs.mountroot.timeout" | , |
& | root_mount_timeout | ||
) |
void vfs_mountroot | ( | void | ) |
Definition at line 1060 of file vfs_mountroot.c.
References Giant, inittodr(), mountlist, mountlist_mtx, prison0, root_holds_mtx, root_mount_complete, rootvnode, sbuf_clear(), sbuf_delete(), sbuf_finish(), vfs_mountroot_conf0(), vfs_mountroot_devfs(), vfs_mountroot_parse(), vfs_mountroot_readconf(), vfs_mountroot_shuffle(), vref(), and wakeup().
Referenced by kern_reroot(), and start_init().
|
static |
Definition at line 896 of file vfs_mountroot.c.
References boothowto, free(), freeenv(), kern_getenv(), parse_token(), root_mount_timeout, rootdevnames, and sbuf_printf().
Referenced by vfs_mountroot().
|
static |
Definition at line 250 of file vfs_mountroot.c.
References kern_symlinkat(), malloc(), mountlist, mountlist_mtx, printf(), rootdevmp, set_rootvnode(), vfs_busy(), vfs_byname(), vfs_mount_alloc(), vfs_op_exit(), and vfsconf.
Referenced by vfs_mountroot().
|
static |
Definition at line 827 of file vfs_mountroot.c.
References CC_NONWHITESPACE, kern_reboot(), panic(), parse_advance(), parse_directive(), parse_mount(), parse_peek(), parse_skipto(), PE_EOL, printf(), root_mount_mddev, root_mount_onfail, and sbuf_data().
Referenced by vfs_mountroot().
|
static |
Definition at line 943 of file vfs_mountroot.c.
References buf, flags, NDFREE(), sbuf_printf(), vn_close(), vn_open(), and vn_rdwr().
Referenced by vfs_mountroot().
|
static |
Definition at line 308 of file vfs_mountroot.c.
References cache_purge(), cache_purgevfs(), kern_funlinkat(), mountlist, mountlist_mtx, namei(), NDFREE(), panic(), printf(), rootvnode, set_rootvnode(), vfs_unbusy(), vinvalbuf(), vn_irflag_set_locked(), vn_irflag_unset_locked(), vput(), and vrele().
Referenced by vfs_mountroot().
|
static |
Definition at line 979 of file vfs_mountroot.c.
References hz, ppsratecheck(), printf(), and root_holds_mtx.
Referenced by parse_dir_ask(), and vfs_mountroot_wait_if_neccessary().
|
static |
Definition at line 1014 of file vfs_mountroot.c.
References hz, parse_mount_dev_present(), printf(), root_mount_always_wait, root_mount_timeout, and vfs_mountroot_wait().
Referenced by parse_mount().
struct mtx root_holds_mtx |
Definition at line 111 of file vfs_mountroot.c.
Referenced by root_mount_hold(), root_mount_hold_token(), root_mount_rel(), sysctl_vfs_root_mount_hold(), vfs_mountroot(), and vfs_mountroot_wait().
|
static |
Definition at line 139 of file vfs_mountroot.c.
Referenced by vfs_mountroot_wait_if_neccessary().
|
static |
Definition at line 133 of file vfs_mountroot.c.
Referenced by root_mounted(), and vfs_mountroot().
|
static |
Definition at line 132 of file vfs_mountroot.c.
Referenced by parse_dir_md(), parse_mount(), and vfs_mountroot_parse().
|
static |
Definition at line 130 of file vfs_mountroot.c.
Referenced by parse_dir_onfail(), and vfs_mountroot_parse().
|
static |
Definition at line 136 of file vfs_mountroot.c.
Referenced by parse_dir_timeout(), parse_mount(), vfs_mountroot_conf0(), and vfs_mountroot_wait_if_neccessary().
struct mount* rootdevmp |
Definition at line 107 of file vfs_mountroot.c.
Referenced by dounmount(), kern_reroot(), vfs_mountroot_devfs(), and vfs_unmountall().
char* rootdevnames[2] = {NULL, NULL} |
Definition at line 109 of file vfs_mountroot.c.
Referenced by vfs_mountroot_conf0().
struct vnode* rootvnode |
Definition at line 102 of file vfs_mountroot.c.
Referenced by cache_fplookup_dotdot(), dounmount(), firmware_modevent(), kern_reroot(), linker_root_mounted(), mountcheckdirs(), pwd_chroot(), pwd_ensure_dirs(), pwd_set_rootvnode(), set_rootvnode(), vfs_lookup(), vfs_mountroot(), vfs_mountroot_shuffle(), vn_fullpath_any_smr(), vn_fullpath_dir(), and vn_fullpath_global().