Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 06 Apr 2010 16:34:22 +0400
From:      "Andrey V. Elsukov" <bu7cher@yandex.ru>
To:        geom@freebsd.org
Cc:        Marcel Moolenaar <marcel@FreeBSD.org>
Subject:   [patch] allow undo creating BSD and VTOC8 schemes with gpart(8)
Message-ID:  <4BBB2A4E.7040708@yandex.ru>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------030904000300010601060400
Content-Type: text/plain; charset=KOI8-R; format=flowed
Content-Transfer-Encoding: 7bit

Hi, All and Marcel,

I found that gpart(8) doesn't support undo for "create"
command for BSD and VTOC8 schemes, because they have internal
entries in table. I added this support and it seems it works.
So my question addressed to Marcel: is it correct? :)

-- 
WBR, Andrey V. Elsukov

--------------030904000300010601060400
Content-Type: text/plain;
 name="g_part.c.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="g_part.c.txt"

Index: g_part.c
===================================================================
--- g_part.c	(revision 204945)
+++ g_part.c	(working copy)
@@ -1065,12 +1174,18 @@ g_part_ctl_undo(struct gctl_req *req, struct g_par
 	    table->gpt_created) ? 1 : 0;
 
 	if (reprobe) {
-		if (!LIST_EMPTY(&table->gpt_entry)) {
+		LIST_FOREACH(entry, &table->gpt_entry, gpe_entry) {
+			if (entry->gpe_internal)
+				continue;
 			error = EBUSY;
 			goto fail;
 		}
 		error = g_part_probe(gp, cp, table->gpt_depth);
 		if (error) {
+			while ((entry = LIST_FIRST(&table->gpt_entry)) != NULL) {
+				LIST_REMOVE(entry, gpe_entry);
+				g_free(entry);
+			}
 			g_topology_lock();
 			g_access(cp, -1, -1, -1);
 			g_part_wither(gp, error);

--------------030904000300010601060400--



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