From owner-svn-src-all@FreeBSD.ORG Fri Jul 29 06:15:19 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2277B106567F; Fri, 29 Jul 2011 06:15:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07B418FC23; Fri, 29 Jul 2011 06:15:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6T6FICa035451; Fri, 29 Jul 2011 06:15:18 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6T6FITb035448; Fri, 29 Jul 2011 06:15:18 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201107290615.p6T6FITb035448@svn.freebsd.org> From: Xin LI Date: Fri, 29 Jul 2011 06:15:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224488 - stable/8/sbin/dumpfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2011 06:15:19 -0000 Author: delphij Date: Fri Jul 29 06:15:18 2011 New Revision: 224488 URL: http://svn.freebsd.org/changeset/base/224488 Log: MFC rr224004,224025: Add a -l option to show file system's corresponding /dev/ufsid path. This is useful for scripts that converts existing system's fstab to use their /dev/ufsid devices. Modified: stable/8/sbin/dumpfs/dumpfs.8 stable/8/sbin/dumpfs/dumpfs.c Directory Properties: stable/8/sbin/dumpfs/ (props changed) Modified: stable/8/sbin/dumpfs/dumpfs.8 ============================================================================== --- stable/8/sbin/dumpfs/dumpfs.8 Thu Jul 28 21:00:46 2011 (r224487) +++ stable/8/sbin/dumpfs/dumpfs.8 Fri Jul 29 06:15:18 2011 (r224488) @@ -28,7 +28,7 @@ .\" @(#)dumpfs.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd January 28, 2009 +.Dd Jul 14, 2011 .Dt DUMPFS 8 .Os .Sh NAME @@ -37,6 +37,7 @@ .Sh SYNOPSIS .Nm .Op Fl f +.Op Fl l .Op Fl m .Ar filesys | device .Sh DESCRIPTION @@ -44,7 +45,8 @@ The .Nm utility prints out the super block and cylinder group information for the file system or special device specified, unless the -.Fl f +.Fl f , +.Fl l or .Fl m flag is specified. @@ -64,6 +66,11 @@ Fragment numbers may be converted to raw fragment size, which may be useful when recovering deleted data. .Pp If +.Fl l +is specified, the pathname to the file system's container derived from +its unique identifier is printed. +.Pp +If .Fl m is specified, a .Xr newfs 8 Modified: stable/8/sbin/dumpfs/dumpfs.c ============================================================================== --- stable/8/sbin/dumpfs/dumpfs.c Thu Jul 28 21:00:46 2011 (r224487) +++ stable/8/sbin/dumpfs/dumpfs.c Fri Jul 29 06:15:18 2011 (r224488) @@ -68,6 +68,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -79,6 +80,7 @@ static const char rcsid[] = struct uufsd disk; int dumpfs(const char *); +int dumpfsid(void); int dumpcg(void); int dumpfreespace(const char *, int); void dumpfreespacecg(int); @@ -92,11 +94,11 @@ int main(int argc, char *argv[]) { const char *name; - int ch, dofreespace, domarshal, eval; + int ch, dofreespace, domarshal, dolabel, eval; - dofreespace = domarshal = eval = 0; + dofreespace = domarshal = dolabel = eval = 0; - while ((ch = getopt(argc, argv, "fm")) != -1) { + while ((ch = getopt(argc, argv, "lfm")) != -1) { switch (ch) { case 'f': dofreespace++; @@ -104,6 +106,9 @@ main(int argc, char *argv[]) case 'm': domarshal = 1; break; + case 'l': + dolabel = 1; + break; case '?': default: usage(); @@ -129,6 +134,8 @@ main(int argc, char *argv[]) eval |= dumpfreespace(name, dofreespace); else if (domarshal) eval |= marshal(name); + else if (dolabel) + eval |= dumpfsid(); else eval |= dumpfs(name); ufs_disk_close(&disk); @@ -137,6 +144,14 @@ main(int argc, char *argv[]) } int +dumpfsid(void) +{ + + printf("%sufsid/%08x%08x\n", _PATH_DEV, afs.fs_id[0], afs.fs_id[1]); + return 0; +} + +int dumpfs(const char *name) { time_t fstime;