Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Jan 2008 12:40:26 GMT
From:      Simun Mikecin <numisemis@yahoo.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/119976: Add ZFS support to gpt(8)
Message-ID:  <200801251240.m0PCeQwv098467@www.freebsd.org>
Resent-Message-ID: <200801251250.m0PCo29t053495@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         119976
>Category:       bin
>Synopsis:       Add ZFS support to gpt(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 25 12:50:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Simun Mikecin
>Release:        8.0-CURRENT
>Organization:
>Environment:
>Description:
sys/gpt.h has GPT_ENT_TYPE_FREEBSD_ZFS UUID defined, but gpt(8) doesn't recognize those partitions as FreeBSD ZFS.

This patch adds:
1. support for recognizing those partitions ("show" command)
2. keyword "zfs" ("add" command) that can be used when adding new partitions (just like eg. "ufs").
3. support for recognizing ZFS partitions stored in disklabel when migrating ("migrate" command) those partitions to GPT

>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Files gpt.orig/add.o and gpt/add.o differ
Files gpt.orig/boot.o and gpt/boot.o differ
Files gpt.orig/create.o and gpt/create.o differ
Files gpt.orig/destroy.o and gpt/destroy.o differ
diff -urN gpt.orig/gpt.8 gpt/gpt.8
--- gpt.orig/gpt.8	2007-10-24 23:32:57.000000000 +0200
+++ gpt/gpt.8	2008-01-25 13:21:36.392875618 +0100
@@ -130,7 +130,7 @@
 The type is given as an UUID, but
 .Nm
 accepts
-.Cm boot , efi , swap , ufs , hfs , linux
+.Cm boot , efi , swap , ufs , zfs, hfs , linux
 and
 .Cm windows
 as aliases for the most commonly used partition types.
Files gpt.orig/gpt.o and gpt/gpt.o differ
Files gpt.orig/label.o and gpt/label.o differ
Files gpt.orig/map.o and gpt/map.o differ
diff -urN gpt.orig/migrate.c gpt/migrate.c
--- gpt.orig/migrate.c	2005-09-01 04:42:52.000000000 +0200
+++ gpt/migrate.c	2008-01-25 13:39:24.748139255 +0100
@@ -118,6 +118,13 @@
 			    ent->ent_name, 36);
 			break;
 		}
+		case FS_ZFS: {
+			uuid_t zfs = GPT_ENT_TYPE_FREEBSD_ZFS;
+			le_uuid_enc(&ent->ent_type, &zfs);
+			utf8_to_utf16("FreeBSD ZFS partition",
+			    ent->ent_name, 36);
+			break;
+		}
 		default:
 			warnx("%s: warning: unknown FreeBSD partition (%d)",
 			    device_name, dl->d_partitions[i].p_fstype);
diff -urN gpt.orig/show.c gpt/show.c
--- gpt.orig/show.c	2007-10-24 23:32:58.000000000 +0200
+++ gpt/show.c	2008-01-25 13:20:36.902299798 +0100
@@ -64,6 +64,7 @@
 	static uuid_t swap = GPT_ENT_TYPE_FREEBSD_SWAP;
 	static uuid_t ufs = GPT_ENT_TYPE_FREEBSD_UFS;
 	static uuid_t vinum = GPT_ENT_TYPE_FREEBSD_VINUM;
+	static uuid_t zfs = GPT_ENT_TYPE_FREEBSD_ZFS;
 	static char buf[80];
 	char *s;
 
@@ -80,6 +81,8 @@
 		return ("FreeBSD UFS/UFS2");
 	if (uuid_equal(t, &vinum, NULL))
 		return ("FreeBSD vinum");
+	if (uuid_equal(t, &zfs, NULL))
+		return ("FreeBSD ZFS");
 
 	if (uuid_equal(t, &freebsd, NULL))
 		return ("FreeBSD legacy");


>Release-Note:
>Audit-Trail:
>Unformatted:



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