From owner-svn-src-projects@FreeBSD.ORG Wed Sep 19 20:43:24 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90A89106566B; Wed, 19 Sep 2012 20:43:24 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 71A8E8FC15; Wed, 19 Sep 2012 20:43:24 +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 q8JKhOVH066867; Wed, 19 Sep 2012 20:43:24 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8JKhOTx066858; Wed, 19 Sep 2012 20:43:24 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201209192043.q8JKhOTx066858@svn.freebsd.org> From: Brooks Davis Date: Wed, 19 Sep 2012 20:43:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240709 - in projects/mtree/usr.sbin: . nmtree X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Sep 2012 20:43:24 -0000 Author: brooks Date: Wed Sep 19 20:43:23 2012 New Revision: 240709 URL: http://svn.freebsd.org/changeset/base/240709 Log: Hook NetBSD's mtree up to the build as nmtree (no manpage for now). Reduce required diffs with shim headers and a simple implmementation of flags_to_string() and string_to_flags() as wrappers around fflagstostr() and strtofflags(). Added: projects/mtree/usr.sbin/nmtree/ projects/mtree/usr.sbin/nmtree/Makefile projects/mtree/usr.sbin/nmtree/rmd160.h projects/mtree/usr.sbin/nmtree/sha1.h projects/mtree/usr.sbin/nmtree/sha2.h projects/mtree/usr.sbin/nmtree/util.c projects/mtree/usr.sbin/nmtree/util.h Modified: projects/mtree/usr.sbin/Makefile Modified: projects/mtree/usr.sbin/Makefile ============================================================================== --- projects/mtree/usr.sbin/Makefile Wed Sep 19 20:42:55 2012 (r240708) +++ projects/mtree/usr.sbin/Makefile Wed Sep 19 20:43:23 2012 (r240709) @@ -56,6 +56,7 @@ SUBDIR= adduser \ nfsdumpstate \ nfsrevoke \ nfsuserd \ + nmtree \ nologin \ pc-sysinstall \ pciconf \ Added: projects/mtree/usr.sbin/nmtree/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/mtree/usr.sbin/nmtree/Makefile Wed Sep 19 20:43:23 2012 (r240709) @@ -0,0 +1,22 @@ +# $NetBSD: Makefile,v 1.32 2009/04/22 15:23:05 lukem Exp $ +# from: @(#)Makefile 8.2 (Berkeley) 4/27/95 + +.include + +.PATH: ${.CURDIR}/../../contrib/mtree + +PROG= nmtree +CFLAGS+= -DMTREE +CFLAGS+= -DNO_SHA384 -I${.CURDIR} +LDADD+= -lmd -lutil +#MAN= mtree.8 +MAN= +SRCS= compare.c crc.c create.c excludes.c misc.c mtree.c spec.c verify.c \ + getid.c pack_dev.c + +SRCS+= sha1.h sha2.h util.c util.h + +CFLAGS+= -I${.CURDIR}/../../contrib/mknod +.PATH: ${.CURDIR}/../../contrib/mknod + +.include Added: projects/mtree/usr.sbin/nmtree/rmd160.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/mtree/usr.sbin/nmtree/rmd160.h Wed Sep 19 20:43:23 2012 (r240709) @@ -0,0 +1,5 @@ +/* $FreeBSD$ */ + +#include + +#define RMD160File RIPEMD160_File Added: projects/mtree/usr.sbin/nmtree/sha1.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/mtree/usr.sbin/nmtree/sha1.h Wed Sep 19 20:43:23 2012 (r240709) @@ -0,0 +1,4 @@ +/* $FreeBSD$ */ + +#include +#define SHA1File SHA1_File Added: projects/mtree/usr.sbin/nmtree/sha2.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/mtree/usr.sbin/nmtree/sha2.h Wed Sep 19 20:43:23 2012 (r240709) @@ -0,0 +1,4 @@ +/* $FreeBSD$ */ + +#include +#include Added: projects/mtree/usr.sbin/nmtree/util.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/mtree/usr.sbin/nmtree/util.c Wed Sep 19 20:43:23 2012 (r240709) @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 2012 SRI International + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include + +#include +#include +#include +#include + +char * +flags_to_string(u_long flags, const char *def) +{ + char *str; + + str = fflagstostr(flags); + if (*str == '\0') { + free(str); + str = strdup(def); + } + return (str); +} + +int +string_to_flags(char **stringp, u_long *setp, u_long *clrp) +{ + + return strtofflags(stringp, setp, clrp); +} Added: projects/mtree/usr.sbin/nmtree/util.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/mtree/usr.sbin/nmtree/util.h Wed Sep 19 20:43:23 2012 (r240709) @@ -0,0 +1,11 @@ +/* $FreeBSD$ */ + +#ifndef _UTIL_H_ +#define _UTIL_H_ + +#include + +char *flags_to_string(u_long flags, const char *def); +int string_to_flags(char **stringp, u_long *setp, u_long *clrp); + +#endif /* _UTIL_H_ */