Date: Wed, 19 Sep 2012 20:43:24 +0000 (UTC) From: Brooks Davis <brooks@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r240709 - in projects/mtree/usr.sbin: . nmtree Message-ID: <201209192043.q8JKhOTx066858@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <bsd.own.mk> + +.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 <bsd.prog.mk> 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 <ripemd.h> + +#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 <sha.h> +#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 <sha256.h> +#include <sha512.h> 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 <sys/cdefs.h> +#include <sys/types.h> + +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <util.h> + +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 <libutil.h> + +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_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209192043.q8JKhOTx066858>