From a80f82a4a3c541a35d9b3b41e94e05cc583bb4dd Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Sat, 11 Feb 2006 12:45:01 +0000 Subject: [PATCH] Check rootvnode variable to see if we still want to ask for passphrase on boot. Other methods just don't work properly. MFC after: 3 days --- sys/geom/eli/g_eli.c | 30 ++---------------------------- sys/modules/geom/geom_eli/Makefile | 2 +- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/sys/geom/eli/g_eli.c b/sys/geom/eli/g_eli.c index afc3c867eddc..915f1d0c4641 100644 --- a/sys/geom/eli/g_eli.c +++ b/sys/geom/eli/g_eli.c @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -74,8 +75,6 @@ TUNABLE_INT("kern.geom.eli.threads", &g_eli_threads); SYSCTL_UINT(_kern_geom_eli, OID_AUTO, threads, CTLFLAG_RW, &g_eli_threads, 0, "Number of threads doing crypto work"); -static int g_eli_do_taste = 0; - static int g_eli_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp); static void g_eli_crypto_run(struct g_eli_worker *wr, struct bio *bp); @@ -909,7 +908,7 @@ g_eli_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name); g_topology_assert(); - if (!g_eli_do_taste || g_eli_tries == 0) + if (rootvnode != NULL || g_eli_tries == 0) return (NULL); G_ELI_DEBUG(3, "Tasting %s.", pp->name); @@ -1063,30 +1062,5 @@ g_eli_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, g_eli_algo2str(sc->sc_algo)); } -static void -g_eli_on_boot_start(void *dummy __unused) -{ - - /* This prevents from tasting when module is loaded after boot. */ - if (cold) { - G_ELI_DEBUG(1, "Start tasting."); - g_eli_do_taste = 1; - } else { - G_ELI_DEBUG(1, "Tasting not started."); - } -} -SYSINIT(geli_boot_start, SI_SUB_TUNABLES, SI_ORDER_ANY, g_eli_on_boot_start, NULL) - -static void -g_eli_on_boot_end(void *dummy __unused) -{ - - if (g_eli_do_taste) { - G_ELI_DEBUG(1, "Tasting no more."); - g_eli_do_taste = 0; - } -} -SYSINIT(geli_boot_end, SI_SUB_RUN_SCHEDULER, SI_ORDER_ANY, g_eli_on_boot_end, NULL) - DECLARE_GEOM_CLASS(g_eli_class, g_eli); MODULE_DEPEND(geom_eli, crypto, 1, 1, 1); diff --git a/sys/modules/geom/geom_eli/Makefile b/sys/modules/geom/geom_eli/Makefile index 20db77d5b703..e94fb88307b7 100644 --- a/sys/modules/geom/geom_eli/Makefile +++ b/sys/modules/geom/geom_eli/Makefile @@ -3,7 +3,7 @@ .PATH: ${.CURDIR}/../../../geom/eli KMOD= geom_eli -SRCS= g_eli.c g_eli_crypto.c g_eli_ctl.c g_eli_key.c pkcs5v2.c +SRCS= g_eli.c g_eli_crypto.c g_eli_ctl.c g_eli_key.c pkcs5v2.c vnode_if.h WARNS?= 2 .include