From 2eb68d493f79644a078e988efc54b40de1fb3855 Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Sun, 8 Apr 2007 23:54:01 +0000 Subject: [PATCH] Add root_mounted() function that returns true if the root file system is already mounted. --- sys/kern/vfs_mount.c | 14 ++++++++++++++ sys/sys/systm.h | 1 + 2 files changed, 15 insertions(+) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index cb556a219809..b7dec78b2a8e 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -1383,6 +1383,20 @@ root_mount_done(void) mtx_unlock(&mountlist_mtx); } + /* + * Return true if root is already mounted. + */ +int +root_mounted(void) +{ + int mounted; + + mtx_lock(&mountlist_mtx); + mounted = root_mount_complete; + mtx_unlock(&mountlist_mtx); + return (mounted); +} + /* * Wait until root is mounted. */ diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 673619e13944..817982c90434 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -340,6 +340,7 @@ struct root_hold_token; struct root_hold_token *root_mount_hold(const char *identifier); void root_mount_rel(struct root_hold_token *h); void root_mount_wait(void); +int root_mounted(void); /*