makefs Sparse Files: NetBSD CLI Compatibility

Glen Barber gjb at FreeBSD.org
Wed Aug 14 14:06:57 UTC 2013


On Wed, Aug 14, 2013 at 08:10:41AM -0500, Eric van Gyzen wrote:
> NetBSD's makefs has a -Z flag to create the image as a sparse file.  In
> FreeBSD, the flag is spelled -p.  Is there a reason for using a
> different flag?  It would be very nice to preserve CLI compatibility
> with NetBSD.
> 
> NetBSD committed first (by one month), and neither change has gone into
> a release yet, so we should change to match NetBSD.  We should do it
> soon, too, since our change will go into 9.2-RELEASE.
> 
> If we agree, I'll gladly make the patches, trivial though they'll be.
> 

Can you please try the attached patch?

Glen

-------------- next part --------------
Index: usr.sbin/makefs/makefs.8
===================================================================
--- usr.sbin/makefs/makefs.8	(revision 254289)
+++ usr.sbin/makefs/makefs.8	(working copy)
@@ -35,7 +35,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 22, 2012
+.Dd August 14, 2013
 .Dt MAKEFS 8
 .Os
 .Sh NAME
@@ -43,7 +43,7 @@
 .Nd create a file system image from a directory tree or a mtree manifest
 .Sh SYNOPSIS
 .Nm
-.Op Fl Dpx
+.Op Fl DpxZ
 .Op Fl B Ar byte-order
 .Op Fl b Ar free-blocks
 .Op Fl d Ar debug-mask
@@ -213,6 +213,10 @@
 .El
 .It Fl x
 Exclude file system nodes not explicitly listed in the specfile.
+.It Fl Z
+Create the image as a sparse file.
+Provided for compatibiltiy with
+.Nx .
 .El
 .Pp
 Where sizes are specified, a decimal number of bytes is expected.
Index: usr.sbin/makefs/makefs.c
===================================================================
--- usr.sbin/makefs/makefs.c	(revision 254289)
+++ usr.sbin/makefs/makefs.c	(working copy)
@@ -113,7 +113,7 @@
 	start_time.tv_sec = start.tv_sec;
 	start_time.tv_nsec = start.tv_usec * 1000;
 
-	while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:o:ps:S:t:x")) != -1) {
+	while ((ch = getopt(argc, argv, "B:b:Dd:f:F:M:m:N:o:ps:S:t:xZ")) != -1) {
 		switch (ch) {
 
 		case 'B':
@@ -233,6 +233,11 @@
 			fsoptions.onlyspec = 1;
 			break;
 
+		case 'Z':
+			/* Compatibility with NetBSD makefs(8) */
+			fsoptions.sparse = 1;
+			break;
+
 		case '?':
 		default:
 			usage();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20130814/498431e2/attachment.sig>


More information about the freebsd-stable mailing list