Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/mtree Implement FreeBSD's "nochange" keyworld which...



details:   https://anonhg.NetBSD.org/src/rev/95cb288e9fbb
branches:  trunk
changeset: 781883:95cb288e9fbb
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Oct 05 01:31:05 2012 +0000

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

diffstat:

 usr.sbin/mtree/misc.c   |  5 +++--
 usr.sbin/mtree/mtree.8  |  4 +++-
 usr.sbin/mtree/mtree.h  |  4 +++-
 usr.sbin/mtree/verify.c |  7 ++++---
 4 files changed, 13 insertions(+), 7 deletions(-)

diffs (90 lines):

diff -r 77c522936c44 -r 95cb288e9fbb usr.sbin/mtree/misc.c
--- a/usr.sbin/mtree/misc.c     Fri Oct 05 01:30:36 2012 +0000
+++ b/usr.sbin/mtree/misc.c     Fri Oct 05 01:31:05 2012 +0000
@@ -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 @@
        {"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},
diff -r 77c522936c44 -r 95cb288e9fbb usr.sbin/mtree/mtree.8
--- a/usr.sbin/mtree/mtree.8    Fri Oct 05 01:30:36 2012 +0000
+++ b/usr.sbin/mtree/mtree.8    Fri Oct 05 01:31:05 2012 +0000
@@ -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 @@
 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.
diff -r 77c522936c44 -r 95cb288e9fbb usr.sbin/mtree/mtree.h
--- a/usr.sbin/mtree/mtree.h    Fri Oct 05 01:30:36 2012 +0000
+++ b/usr.sbin/mtree/mtree.h    Fri Oct 05 01:31:05 2012 +0000
@@ -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 @@
 #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 */
diff -r 77c522936c44 -r 95cb288e9fbb usr.sbin/mtree/verify.c
--- a/usr.sbin/mtree/verify.c   Fri Oct 05 01:30:36 2012 +0000
+++ b/usr.sbin/mtree/verify.c   Fri Oct 05 01:31:05 2012 +0000
@@ -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 @@
                            !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 &&



Home | Main Index | Thread Index | Old Index