Can't change partition table anymore

Matteo Riondato rionda at gufi.org
Wed Apr 6 11:22:00 PDT 2005


On Wed, Apr 06, 2005 at 09:51:24AM +0200, Poul-Henning Kamp wrote:
> 
> 
> So the sysctl knob is here to stay, one way or another.
> 
> We can argue about what the name of the sysctl should be and where
> it should be documented, and every single one of you are able to
> sit down and write a patch for your preference and submit it to us.

Attached you can find my patch. I'm not a kernel developer so I cannot
be sure if mine is the best way to implement this task. Anyway, it
works.
Best Regards
P.s. I don't absolutely argue wether this is a feature or a bug
because I simply don't know enough to judge.
-- 
Rionda aka Matteo Riondato
Disinformato per default
G.U.F.I. Staff Member (http://www.gufi.org)
FreeSBIE Developer (http://www.freesbie.org)
-------------- next part --------------
--- geom_int.h.orig	Wed Apr  6 18:51:51 2005
+++ geom_int.h	Wed Apr  6 18:51:15 2005
@@ -40,6 +40,7 @@
 
 extern int g_collectstats;
 extern int g_debugflags;
+extern int g_part_table_write;
 /*
  * 1	G_T_TOPOLOGY
  * 2	G_T_BIO
--- geom_kern.c.orig	Wed Apr  6 13:48:53 2005
+++ geom_kern.c	Wed Apr  6 18:51:35 2005
@@ -59,6 +59,7 @@
 static struct proc *g_up_proc;
 
 int g_debugflags;
+int g_part_table_write;
 int g_collectstats = 1;
 int g_shutdown;
 
@@ -223,6 +224,11 @@
 TUNABLE_INT("kern.geom.debugflags", &g_debugflags);
 SYSCTL_INT(_kern_geom, OID_AUTO, debugflags, CTLFLAG_RW,
 	&g_debugflags, 0, "");
+
+TUNABLE_INT("kern.geom.part_table_write", &g_part_table_write);
+SYSCTL_INT(_kern_geom, OID_AUTO, part_table_write, CTLFLAG_RW,
+	&g_part_table_write, 0, "If set to 1, writing to the \
+	partition table is allowed");
 
 SYSCTL_INT(_kern_geom, OID_AUTO, collectstats, CTLFLAG_RW,
 	&g_collectstats, 0, "");
--- geom_subr.c.orig	Wed Apr  6 13:56:04 2005
+++ geom_subr.c	Wed Apr  6 18:51:31 2005
@@ -669,7 +669,7 @@
 	    pp, pp->name);
 
 	/* If foot-shooting is enabled, any open on rank#1 is OK */
-	if ((g_debugflags & 16) && pp->geom->rank == 1)
+	if ((g_part_table_write & 1) && pp->geom->rank == 1)
 		;
 	/* If we try exclusive but already write: fail */
 	else if (dce > 0 && pw > 0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20050406/486e796f/attachment.bin


More information about the freebsd-current mailing list