svn commit: r247041 - head/usr.sbin/makefs

Brooks Davis brooks at FreeBSD.org
Wed Feb 20 15:18:44 UTC 2013


Author: brooks
Date: Wed Feb 20 15:18:42 2013
New Revision: 247041
URL: http://svnweb.freebsd.org/changeset/base/247041

Log:
  Add a -D flag that causes duplicate entries in an mtree manifest to be
  treated as warnings rather than errors.
  
  Reviewed by:	marcel
  Sponsored by:	DARPA, AFRL

Modified:
  head/usr.sbin/makefs/makefs.8
  head/usr.sbin/makefs/makefs.c
  head/usr.sbin/makefs/makefs.h
  head/usr.sbin/makefs/mtree.c

Modified: head/usr.sbin/makefs/makefs.8
==============================================================================
--- head/usr.sbin/makefs/makefs.8	Wed Feb 20 14:26:51 2013	(r247040)
+++ head/usr.sbin/makefs/makefs.8	Wed Feb 20 15:18:42 2013	(r247041)
@@ -43,7 +43,7 @@
 .Nd create a file system image from a directory tree or a mtree manifest
 .Sh SYNOPSIS
 .Nm
-.Op Fl px
+.Op Fl Dpx
 .Op Fl B Ar byte-order
 .Op Fl b Ar free-blocks
 .Op Fl d Ar debug-mask
@@ -106,6 +106,8 @@ An optional
 suffix may be provided to indicate that
 .Ar free-blocks
 indicates a percentage of the calculated image size.
+.It Fl D
+Treat duplicate paths in an mtree manifest as warnings not error.
 .It Fl d Ar debug-mask
 Enable various levels of debugging, depending upon which bits are
 set in

Modified: head/usr.sbin/makefs/makefs.c
==============================================================================
--- head/usr.sbin/makefs/makefs.c	Wed Feb 20 14:26:51 2013	(r247040)
+++ head/usr.sbin/makefs/makefs.c	Wed Feb 20 15:18:42 2013	(r247041)
@@ -73,6 +73,7 @@ static fstype_t fstypes[] = {
 };
 
 u_int		debug;
+int		dupsok;
 struct timespec	start_time;
 
 static	fstype_t *get_fstype(const char *);
@@ -112,7 +113,7 @@ main(int argc, char *argv[])
 	start_time.tv_sec = start.tv_sec;
 	start_time.tv_nsec = start.tv_usec * 1000;
 
-	while ((ch = getopt(argc, argv, "B:b:d: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:x")) != -1) {
 		switch (ch) {
 
 		case 'B':
@@ -148,6 +149,10 @@ main(int argc, char *argv[])
 			}
 			break;
 
+		case 'D':
+			dupsok = 1;
+			break;
+
 		case 'd':
 			debug = strtoll(optarg, NULL, 0);
 			break;

Modified: head/usr.sbin/makefs/makefs.h
==============================================================================
--- head/usr.sbin/makefs/makefs.h	Wed Feb 20 14:26:51 2013	(r247040)
+++ head/usr.sbin/makefs/makefs.h	Wed Feb 20 15:18:42 2013	(r247041)
@@ -169,6 +169,7 @@ void		cd9660_makefs(const char *, const 
 
 
 extern	u_int		debug;
+extern	int		dupsok;
 extern	struct timespec	start_time;
 
 /*

Modified: head/usr.sbin/makefs/mtree.c
==============================================================================
--- head/usr.sbin/makefs/mtree.c	Wed Feb 20 14:26:51 2013	(r247040)
+++ head/usr.sbin/makefs/mtree.c	Wed Feb 20 15:18:42 2013	(r247041)
@@ -881,8 +881,14 @@ read_mtree_spec1(FILE *fp, bool def, con
 
 		if (strcmp(name, node->name) == 0) {
 			if (def == true) {
-				mtree_error("duplicate definition of %s",
-				    name);
+				if (!dupsok)
+					mtree_error(
+					    "duplicate definition of %s",
+					    name);
+				else
+					mtree_warning(
+					    "duplicate definition of %s",
+					    name);
 				return (0);
 			}
 


More information about the svn-src-head mailing list