From nobody@FreeBSD.org  Fri Jan 25 12:42:04 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7DB3016A417
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 25 Jan 2008 12:42:04 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 795BB13C457
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 25 Jan 2008 12:42:04 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m0PCeQFQ098468
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 25 Jan 2008 12:40:26 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m0PCeQwv098467;
	Fri, 25 Jan 2008 12:40:26 GMT
	(envelope-from nobody)
Message-Id: <200801251240.m0PCeQwv098467@www.freebsd.org>
Date: Fri, 25 Jan 2008 12:40:26 GMT
From: Simun Mikecin <numisemis@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Add ZFS support to gpt(8)
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         119976
>Category:       bin
>Synopsis:       [patch] Add ZFS support to gpt(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jhb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 25 12:50:02 UTC 2008
>Closed-Date:    Tue Feb 12 20:28:27 UTC 2008
>Last-Modified:  Wed Apr 23 12:30:01 UTC 2008
>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:
State-Changed-From-To: open->patched 
State-Changed-By: jhb 
State-Changed-When: Tue Feb 5 23:37:53 UTC 2008 
State-Changed-Why:  
Committed to HEAD, will MFC in a week or so. 


Responsible-Changed-From-To: freebsd-bugs->jhb 
Responsible-Changed-By: jhb 
Responsible-Changed-When: Tue Feb 5 23:37:53 UTC 2008 
Responsible-Changed-Why:  
Committed to HEAD, will MFC in a week or so. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=119976 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/119976: commit references a PR
Date: Tue,  5 Feb 2008 23:37:47 +0000 (UTC)

 jhb         2008-02-05 23:37:42 UTC
 
   FreeBSD src repository
 
   Modified files:
     sbin/gpt             gpt.8 migrate.c show.c 
   Log:
   Add ZFS support.
   
   MFC after:      1 week
   PR:             bin/119976
   Submitted by:   Simun Mikecin  numisemis of yahoo.com
   
   Revision  Changes    Path
   1.19      +1 -1      src/sbin/gpt/gpt.8
   1.17      +7 -0      src/sbin/gpt/migrate.c
   1.16      +3 -0      src/sbin/gpt/show.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: jhb 
State-Changed-When: Tue Feb 12 20:28:16 UTC 2008 
State-Changed-Why:  
MFC'd to RELENG_7. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=119976 

From: Cian Hughes <Ci@nHugh.es>
To: bug-followup@FreeBSD.org,
 numisemis@yahoo.com
Cc: jhb@FreeBSD.org
Subject: Re: bin/119976: [patch] Add ZFS support to gpt(8)
Date: Sun, 6 Apr 2008 23:04:16 +0100

 --Apple-Mail-9--568493847
 Content-Type: text/plain;
 	charset=US-ASCII;
 	format=flowed;
 	delsp=yes
 Content-Transfer-Encoding: 7bit
 
 I am running the latest RELENG_7 with the MFC'd gpt patch.
 Today I tried to do:
 # gpt add -t zfs ad6
 usage: gpt add [-b lba] [-i index] [-s lba] [-t uuid] device ...
 and it failed, but:
 # gpt add -s 1024 -t 516e7cba-6ecf-11d6-8ff8-00022d09712b ad6
 succeeded, as did:
 # gpt add -t ufs ad6
 
 A `gpt show ad6` nicely reported "GPT part - FreeBSD ZFS", but the  
 patched man page says -t zfs should have worked.
 
 Looking at src/sbin/gpt/gpt.c it seems like the case/switch doesn't  
 include 'zfs', attached patch solves this problem.
 
 # gpt-fixed add -t zfs ad6
 succeeds.
 
 PS Please forgive me if this should have been a new PR.
 Best Regards,
 ~Cian Hughes
 
 
 --Apple-Mail-9--568493847
 Content-Disposition: attachment;
 	filename=gpt.c_zfs.patch.txt
 Content-Type: text/plain;
 	x-unix-mode=0644;
 	name="gpt.c_zfs.patch.txt"
 Content-Transfer-Encoding: 7bit
 
 --- src/sbin/gpt.orig/gpt.c	2008-04-06 21:55:05.000000000 +0100
 +++ src/sbin/gpt/gpt.c	2008-04-06 21:56:35.000000000 +0100
 @@ -317,6 +317,13 @@
  			return (0);
  		}
  		break;
 +	case 'z':
 +		if (strcmp(s, "zfs") == 0) {
 +			uuid_t zfs = GPT_ENT_TYPE_FREEBSD_ZFS;
 +			*uuid = zfs;
 +			return (0);
 +		}
 +		break;
  	}
  	return (EINVAL);
  }
 
 --Apple-Mail-9--568493847--

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/119976: commit references a PR
Date: Mon,  7 Apr 2008 18:23:37 +0000 (UTC)

 jhb         2008-04-07 18:23:28 UTC
 
   FreeBSD src repository
 
   Modified files:
     sbin/gpt             gpt.c 
   Log:
   Add 'zfs' as an alias for the FreeBSD ZFS UUID.
   
   MFC after:      3 days
   PR:             bin/119976
   Submitted by:   Cian Hughes  Ci of nhugh.es
   
   Revision  Changes    Path
   1.20      +7 -0      src/sbin/gpt/gpt.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: Cian Hughes <Cian.Hughes.07@bristol.ac.uk>
To: bug-followup@FreeBSD.org,
 jhb@FreeBSD.org
Cc:  
Subject: Re: bin/119976: [patch] Add ZFS support to gpt(8)
Date: Wed, 23 Apr 2008 13:05:49 +0100

 Hey,
 sorry to bug you about this but could you MFC it by any chance?
 Many Thanks,
 ~Cian Hughes
>Unformatted:
