From nobody@FreeBSD.org  Sat Sep 23 02:05:29 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id BB82C16A407
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 23 Sep 2006 02:05:29 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 3B2B143D46
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 23 Sep 2006 02:05:29 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k8N25S0m062018
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 23 Sep 2006 02:05:28 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k8N25SIE062017;
	Sat, 23 Sep 2006 02:05:28 GMT
	(envelope-from nobody)
Message-Id: <200609230205.k8N25SIE062017@www.freebsd.org>
Date: Sat, 23 Sep 2006 02:05:28 GMT
From: Yoshihiro Ota <ota@j.email.ne.jp>
To: freebsd-gnats-submit@FreeBSD.org
Subject: mdmfs enhancement to allow use in fstab and mount sliced/partitioned md devices
X-Send-Pr-Version: www-2.3

>Number:         103501
>Category:       bin
>Synopsis:       [patch] mdmfs(8) enhancement to allow use in fstab and mount sliced/partitioned md devices
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    matteo
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 23 02:10:21 GMT 2006
>Closed-Date:    Sun Mar 11 18:26:57 GMT 2007
>Last-Modified:  Sun Mar 11 18:30:13 GMT 2007
>Originator:     Yoshihiro Ota
>Release:        5.x and 6.x RELEASE
>Organization:
>Environment:
FreeBSD xxx.yyy.com 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #23: Wed Sep 20 00:16:08 EST 2006     root@xxx.yyy.com:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
This patch helps and enhances to mount md-based device such as uzip,
slice/partitions, and so on.

If mount_md is created with this patch such that we can add md-devices to
fstab, possibilities of md-device will greatly expand.


This is how to take advantage of this patch.  These examples can be written
/etc/fstab as well with mount_md.

# mdmfs -P -F ports-5.4.uzip -oro md.uzip /tmp/test
# df /tmp/test
Filesystem  1K-blocks Used Avail Capacity  Mounted on
/dev/md4.uzip       358126   277934   51542    84%    /tmp/test

# mdmfs -P -F ports-5.4.uzip -oro /dev/md8.uzip /tmp/test
# df | grep test
/dev/md4.uzip       358126   277934   51542    84%    /tmp/test
/dev/md8.uzip       358126   277934   51542    84%    /tmp/test2

# mdmfs -P -F hd10meg.img mds1a /tmp/test3
# df /tmp/test3
Filesystem  1K-blocks Used Avail Capacity  Mounted on
/dev/md9s1a      7526    4  6920     0%    /tmp/test3

# mdmfs -P -F file.md md /tmp/test4
# df /tmp/test4
Filesystem 1K-blocks Used Avail Capacity  Mounted on
/dev/md10        846    4   776     1%    /tmp/test4
>How-To-Repeat:
N/A: current mdmfs does not allow this.
>Fix:
--- mdmfs.c.orig	Thu Feb 16 16:28:54 2006
+++ mdmfs.c	Fri Apr 14 21:27:08 2006
@@ -48,6 +48,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 #include <unistd.h>
 
 typedef enum { false, true } bool;
@@ -67,6 +68,7 @@
 static	bool norun;		/* Actually run the helper programs? */
 static	int unit;      		/* The unit we're working with. */
 static	const char *mdname;	/* Name of memory disk device (e.g., "md"). */
+static	const char *mdsuffix;	/* Suffix of memory disk device (e.g., ".uzip"). */
 static	size_t mdnamelen;	/* Length of mdname. */
 static	const char *path_mdconfig =_PATH_MDCONFIG;
 
@@ -258,13 +260,16 @@
 		unitstr += 5;
 	if (strncmp(unitstr, mdname, mdnamelen) == 0)
 		unitstr += mdnamelen;
-	if (*unitstr == '\0') {
+	if (!isdigit(*unitstr)) {
 		autounit = true;
 		unit = -1;
+		mdsuffix = unitstr;
 	} else {
 		ul = strtoul(unitstr, &p, 10);
-		if (ul == ULONG_MAX || *p != '\0')
+		if (ul == ULONG_MAX)
 			errx(1, "bad device unit: %s", unitstr);
+		if (*p != '\0')
+			mdsuffix = p;
 		unit = ul;
 	}
 
@@ -446,8 +451,8 @@
 {
 	int rv;
 
-	rv = run(NULL, "%s%s /dev/%s%d %s", _PATH_MOUNT, args,
-	    mdname, unit, mtpoint);
+	rv = run(NULL, "%s%s /dev/%s%d%s %s", _PATH_MOUNT, args,
+	    mdname, unit, mdsuffix, mtpoint);
 	if (rv)
 		errx(1, "mount exited with error code %d", rv);
 }



>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->matteo 
Responsible-Changed-By: matteo 
Responsible-Changed-When: Sun Nov 12 10:48:55 UTC 2006 
Responsible-Changed-Why:  
Take this, as I'm interested in md(4)'s use in fstab 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/103501: commit references a PR
Date: Thu, 15 Feb 2007 13:49:50 +0000 (UTC)

 matteo      2007-02-15 13:49:44 UTC
 
   FreeBSD src repository
 
   Modified files:
     sbin/mdmfs           mdmfs.c 
   Log:
   Enhances mdmfs(8) to mount md-based device such as uzip.
   Examples of use can be found in the PR text.
   
   PR: 103501
   MFC after:      1 week
   
   Revision  Changes    Path
   1.29      +9 -4      src/sbin/mdmfs/mdmfs.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: open->patched 
State-Changed-By: matteo 
State-Changed-When: Thu Feb 15 13:50:23 UTC 2007 
State-Changed-Why:  
Patched. I'll MFC this next week. 

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

From: Yar Tikhiy <yar@comp.chem.msu.su>
To: matteo@FreeBSD.org
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/103501: [patch] mdmfs(8) enhancement to allow use in fstab and mount sliced/partitioned md devices
Date: Wed, 7 Mar 2007 14:44:21 +0300

 Please note that there is a bug in the patch.  It is described in
 kern/109863 and has been fixed in mdmfs.c rev. 1.31.  The fix should
 be a part of the MFC so that RELENG_6 isn't buggy from the outset.
 
 -- 
 Yar
State-Changed-From-To: patched->closed 
State-Changed-By: matteo 
State-Changed-When: Sun Mar 11 18:26:34 UTC 2007 
State-Changed-Why:  
MFC'ed to RELENG_6 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/103501: commit references a PR
Date: Sun, 11 Mar 2007 18:24:30 +0000 (UTC)

 matteo      2007-03-11 18:24:23 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     sbin/mdmfs           mdmfs.8 mdmfs.c 
   Log:
   mdmfs.c: MFC revs 1.29-1.31
   mdmfs.8: MFC revs 1.27-1.29
   
   PR:             bin/66763 103501 kern/109863
   
   Revision  Changes    Path
   1.20.8.2  +48 -13    src/sbin/mdmfs/mdmfs.8
   1.23.2.3  +32 -16    src/sbin/mdmfs/mdmfs.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"
 
>Unformatted:
