From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 5 22:59:10 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0B93016A41C for ; Sun, 5 Jun 2005 22:59:10 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from postfix4-1.free.fr (postfix4-1.free.fr [213.228.0.62]) by mx1.FreeBSD.org (Postfix) with ESMTP id 845BE43D1F for ; Sun, 5 Jun 2005 22:59:09 +0000 (GMT) (envelope-from tataz@tataz.chchile.org) Received: from tatooine.tataz.chchile.org (vol75-8-82-233-239-98.fbx.proxad.net [82.233.239.98]) by postfix4-1.free.fr (Postfix) with ESMTP id 0D4D4317ADD for ; Mon, 6 Jun 2005 00:59:08 +0200 (CEST) Received: by tatooine.tataz.chchile.org (Postfix, from userid 1000) id 1F49D407E; Mon, 6 Jun 2005 00:58:56 +0200 (CEST) Date: Mon, 6 Jun 2005 00:58:56 +0200 From: Jeremie Le Hen To: freebsd-hackers@freebsd.org Message-ID: <20050605225855.GD41050@obiwan.tataz.chchile.org> References: <20050525175419.GA87847@dan.emsphone.com> <20050526081738.GI850@obiwan.tataz.chchile.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="VS++wcV0S1rZb1Fb" Content-Disposition: inline In-Reply-To: <20050526081738.GI850@obiwan.tataz.chchile.org> User-Agent: Mutt/1.5.9i Subject: Re: Opening raw disk while mounted in 5.x? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jun 2005 22:59:10 -0000 --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--