Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Jun 2005 00:58:56 +0200
From:      Jeremie Le Hen <jeremie@le-hen.org>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Opening raw disk while mounted in 5.x?
Message-ID:  <20050605225855.GD41050@obiwan.tataz.chchile.org>
In-Reply-To: <20050526081738.GI850@obiwan.tataz.chchile.org>
References:  <f7355c61ebfc40d096adb2c862cacf3b@cs.cmu.edu> <20050525175419.GA87847@dan.emsphone.com> <20050526081738.GI850@obiwan.tataz.chchile.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--VS++wcV0S1rZb1Fb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi list,

> I don't want to start the bikeshed again, but would this be ok to create
> a kern.geom.allow_foot_shooting sysctl wrapper for this and reference
> it in geom(4) manual page (and anywhere else it is relevant), at least
> temporaly until a decision is made ?
> 
> I can't find where this is documented and this question goes back
> regularly.

I made the small attached patch which creates the
    kern.geom.allow_foot_shooting
sysctl.

It's no more than an explicit representation of the fifth bit of
debugflags (remember the famous value 16).

If needed, I would be pleased to make a modification to the geom(4)
manual page and also to drop a note about this in fdisk(8) and
boot0cfg(8).

Regards,
-- 
Jeremie Le Hen
< jeremie at le-hen dot org >< ttz at chchile dot org >

--VS++wcV0S1rZb1Fb
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="geom.kern.allow_foot_shooting.patch"

--- geom_kern.c.orig	Sun Jun  5 19:12:22 2005
+++ geom_kern.c	Sun Jun  5 19:21:17 2005
@@ -213,6 +213,31 @@
 	return error;
 }
 
+static int
+sysctl_kern_geom_allow_foot_shooting(SYSCTL_HANDLER_ARGS)
+{
+	int error;
+	int val;
+
+	if (g_debugflags & 16)
+		val = 1;
+	else
+		val = 0;
+
+	error = sysctl_handle_int(oidp, &val, sizeof(int), req);
+	if (error || req->newptr == NULL)
+		return error;
+
+	if (val < 0 || val > 1)
+		return EINVAL;
+
+	if (val)
+		g_debugflags |= 16;
+	else
+		g_debugflags &= ~16;
+	return 0;
+}
+
 SYSCTL_NODE(_kern, OID_AUTO, geom, CTLFLAG_RW, 0, "GEOMetry management");
 
 SYSCTL_PROC(_kern_geom, OID_AUTO, confxml, CTLTYPE_STRING|CTLFLAG_RD,
@@ -230,6 +255,10 @@
 TUNABLE_INT("kern.geom.debugflags", &g_debugflags);
 SYSCTL_INT(_kern_geom, OID_AUTO, debugflags, CTLFLAG_RW,
 	&g_debugflags, 0, "");
+
+SYSCTL_PROC(_kern_geom, OID_AUTO, allow_foot_shooting, CTLTYPE_INT|CTLFLAG_RW,
+	0, sizeof(int), sysctl_kern_geom_allow_foot_shooting, "I",
+	"Allow foot-shooting");
 
 SYSCTL_INT(_kern_geom, OID_AUTO, collectstats, CTLFLAG_RW,
 	&g_collectstats, 0, "");

--VS++wcV0S1rZb1Fb--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050605225855.GD41050>