From owner-freebsd-geom@FreeBSD.ORG Tue Apr 6 12:46:56 2010 Return-Path: Delivered-To: geom@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8525106566C for ; Tue, 6 Apr 2010 12:46:56 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward4.mail.yandex.net (forward4.mail.yandex.net [77.88.46.9]) by mx1.freebsd.org (Postfix) with ESMTP id 96B8D8FC1C for ; Tue, 6 Apr 2010 12:46:56 +0000 (UTC) Received: from smtp4.mail.yandex.net (smtp4.mail.yandex.net [77.88.46.104]) by forward4.mail.yandex.net (Yandex) with ESMTP id D92F86AD8BB5; Tue, 6 Apr 2010 16:34:23 +0400 (MSD) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1270557263; bh=uXlar7WXzul9LqxpV2dx71aLmhIm0hwiohnR4jreHmk=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:Content-Type; b=P/pijfoaBv3RIisv+ytIfE2AskPT9rmkIXOVfGqE80DgPRbbIwFzBgyzjUw14wb03 N0gkisFNuY609nHPs/8ErfR6PiEhvEntssk0EIReuzxEkkKnRvSL5Q+WgoJ/ffpZLa JLpfhztPmUj+pj1Nfgjzi90rEy1Ru7di/hEcpKxc= Received: from [127.0.0.1] (ns.kirov.so-cdu.ru [77.72.136.145]) by smtp4.mail.yandex.net (Yandex) with ESMTPSA id A0C78D300F3; Tue, 6 Apr 2010 16:34:23 +0400 (MSD) Message-ID: <4BBB2A4E.7040708@yandex.ru> Date: Tue, 06 Apr 2010 16:34:22 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla Thunderbird 1.5 (FreeBSD/20051231) MIME-Version: 1.0 To: geom@freebsd.org Content-Type: multipart/mixed; boundary="------------030904000300010601060400" X-Yandex-TimeMark: 1270557263 X-Yandex-Spam: 1 X-Yandex-Front: smtp4.mail.yandex.net Cc: Marcel Moolenaar Subject: [patch] allow undo creating BSD and VTOC8 schemes with gpart(8) X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2010 12:46:57 -0000 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--