svn commit: r215940 - stable/8/sbin/geom/class/part

Andrey V. Elsukov ae at FreeBSD.org
Sat Nov 27 13:38:17 UTC 2010


Author: ae
Date: Sat Nov 27 13:38:17 2010
New Revision: 215940
URL: http://svn.freebsd.org/changeset/base/215940

Log:
  r214975 was not fully adapted to stable/8 and in-kernel version of
  "destroy -F" does not work, because g_part_parm_uint assumes that
  parameter is an asci string, but in head/ it is not.
  
  Add gpart_destroy wrapper function to gpart(8). It changes "force"
  parameter and does convert it to string.
  
  This is direct commit to stable/8.

Modified:
  stable/8/sbin/geom/class/part/geom_part.c

Modified: stable/8/sbin/geom/class/part/geom_part.c
==============================================================================
--- stable/8/sbin/geom/class/part/geom_part.c	Sat Nov 27 13:35:19 2010	(r215939)
+++ stable/8/sbin/geom/class/part/geom_part.c	Sat Nov 27 13:38:17 2010	(r215940)
@@ -85,6 +85,7 @@ static int gpart_show_hasopt(struct gctl
 static void gpart_write_partcode(struct ggeom *, int, void *, ssize_t);
 static void gpart_write_partcode_vtoc8(struct ggeom *, int, void *);
 static void gpart_print_error(const char *);
+static void gpart_destroy(struct gctl_req *, unsigned int);
 
 struct g_command PUBSYM(class_commands)[] = {
 	{ "add", 0, gpart_issue, {
@@ -119,7 +120,7 @@ struct g_command PUBSYM(class_commands)[
 		G_OPT_SENTINEL },
 	  "geom", NULL
 	},
-	{ "destroy", 0, gpart_issue, {
+	{ "destroy", 0, gpart_destroy, {
 		{ 'F', "force", NULL, G_TYPE_BOOL },
 		{ 'f', "flags", flags, G_TYPE_STRING },
 		G_OPT_SENTINEL },
@@ -864,6 +865,17 @@ gpart_bootcode(struct gctl_req *req, uns
 }
 
 static void
+gpart_destroy(struct gctl_req *req, unsigned int fl)
+{
+
+	if (gctl_get_int(req, "force"))
+		gctl_change_param(req, "force", -1, "1");
+	else
+		gctl_change_param(req, "force", -1, "0");
+	gpart_issue(req, fl);
+}
+
+static void
 gpart_print_error(const char *errstr)
 {
 	char *errmsg;


More information about the svn-src-all mailing list