Module Name:    src
Committed By:   christos
Date:           Fri Oct  5 01:31:05 UTC 2012

Modified Files:
        src/usr.sbin/mtree: misc.c mtree.8 mtree.h verify.c

Log Message:
Implement FreeBSD's "nochange" keyworld which causes the existance of a
filesystem object to be checked but none of its attiributes.(brooks)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/mtree/misc.c
cvs rdiff -u -r1.61 -r1.62 src/usr.sbin/mtree/mtree.8
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/mtree/mtree.h
cvs rdiff -u -r1.42 -r1.43 src/usr.sbin/mtree/verify.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/mtree/misc.c
diff -u src/usr.sbin/mtree/misc.c:1.31 src/usr.sbin/mtree/misc.c:1.32
--- src/usr.sbin/mtree/misc.c:1.31	Thu Oct  4 20:59:35 2012
+++ src/usr.sbin/mtree/misc.c	Thu Oct  4 21:31:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.31 2012/10/05 00:59:35 christos Exp $	*/
+/*	$NetBSD: misc.c,v 1.32 2012/10/05 01:31:05 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: misc.c,v 1.31 2012/10/05 00:59:35 christos Exp $");
+__RCSID("$NetBSD: misc.c,v 1.32 2012/10/05 01:31:05 christos Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -71,6 +71,7 @@ static KEY keylist[] = {
 	{"md5digest",	F_MD5,		NEEDVALUE},
 	{"mode",	F_MODE,		NEEDVALUE},
 	{"nlink",	F_NLINK,	NEEDVALUE},
+	{"nochange",	F_NOCHANGE,	0},
 	{"optional",	F_OPT,		0},
 	{"ripemd160digest", F_RMD160,	NEEDVALUE},
 	{"rmd160digest",F_RMD160,	NEEDVALUE},

Index: src/usr.sbin/mtree/mtree.8
diff -u src/usr.sbin/mtree/mtree.8:1.61 src/usr.sbin/mtree/mtree.8:1.62
--- src/usr.sbin/mtree/mtree.8:1.61	Thu Oct  4 21:30:36 2012
+++ src/usr.sbin/mtree/mtree.8	Thu Oct  4 21:31:05 2012
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mtree.8,v 1.61 2012/10/05 01:30:36 christos Exp $
+.\"	$NetBSD: mtree.8,v 1.62 2012/10/05 01:31:05 christos Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -450,6 +450,8 @@ The current file's permissions as a nume
 value.
 .It Sy nlink
 The number of hard links the file is expected to have.
+.It Sy nochange
+Make sure this file or directory exists but otherwise ignore all attributes.
 .It Sy optional
 The file is optional; don't complain about the file if it's
 not in the file hierarchy.

Index: src/usr.sbin/mtree/mtree.h
diff -u src/usr.sbin/mtree/mtree.h:1.29 src/usr.sbin/mtree/mtree.h:1.30
--- src/usr.sbin/mtree/mtree.h:1.29	Thu Oct  4 21:26:56 2012
+++ src/usr.sbin/mtree/mtree.h	Thu Oct  4 21:31:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mtree.h,v 1.29 2012/10/05 01:26:56 christos Exp $	*/
+/*	$NetBSD: mtree.h,v 1.30 2012/10/05 01:31:05 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -86,6 +86,8 @@ typedef struct _node {
 #define	F_UID		0x00080000		/* uid */
 #define	F_UNAME		0x00100000		/* user name */
 #define	F_VISIT		0x00200000		/* file visited */
+#define	F_NOCHANGE	0x00400000		/* check existance, but not */
+						/* other properties */
 #define	F_SHA256	0x00800000		/* SHA256 digest */
 #define	F_SHA384	0x01000000		/* SHA384 digest */
 #define	F_SHA512	0x02000000		/* SHA512 digest */

Index: src/usr.sbin/mtree/verify.c
diff -u src/usr.sbin/mtree/verify.c:1.42 src/usr.sbin/mtree/verify.c:1.43
--- src/usr.sbin/mtree/verify.c:1.42	Thu Oct  4 21:26:56 2012
+++ src/usr.sbin/mtree/verify.c	Thu Oct  4 21:31:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: verify.c,v 1.42 2012/10/05 01:26:56 christos Exp $	*/
+/*	$NetBSD: verify.c,v 1.43 2012/10/05 01:31:05 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)verify.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: verify.c,v 1.42 2012/10/05 01:26:56 christos Exp $");
+__RCSID("$NetBSD: verify.c,v 1.43 2012/10/05 01:31:05 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -124,7 +124,8 @@ vwalk(void)
 			    !fnmatch(ep->name, p->fts_name, FNM_PATHNAME)) ||
 			    !strcmp(ep->name, p->fts_name)) {
 				ep->flags |= F_VISIT;
-				if (compare(ep, p))
+				if ((ep->flags & F_NOCHANGE) == 0 &&
+				    compare(ep, p))
 					rval = MISMATCHEXIT;
 				if (!(ep->flags & F_IGN) &&
 				    ep->type == F_DIR &&

Reply via email to