Opening raw disk while mounted in 5.x?
Jeremie Le Hen
jeremie at le-hen.org
Sun Jun 5 22:59:10 GMT 2005
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 >
-------------- next part --------------
--- 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, "");
More information about the freebsd-hackers
mailing list