svn commit: r241357 - in projects/mtree: lib lib/libnetbsd lib/libnetbsd/sys usr.bin/install usr.sbin/makefs usr.sbin/nmtree usr.sbin/nmtree/sys

Brooks Davis brooks at FreeBSD.org
Tue Oct 9 06:29:14 UTC 2012


Author: brooks
Date: Mon Oct  8 22:22:05 2012
New Revision: 241357
URL: http://svn.freebsd.org/changeset/base/241357

Log:
  Add a new internal library libnetbsd which contains the shims
  required to build NetBSD's makefs, mtree, and install.  I've not
  yet moved strsuftoll() from makefs.

Added:
  projects/mtree/lib/libnetbsd/
  projects/mtree/lib/libnetbsd/Makefile   (contents, props changed)
  projects/mtree/lib/libnetbsd/rmd160.h
     - copied unchanged from r241356, projects/mtree/usr.sbin/nmtree/rmd160.h
  projects/mtree/lib/libnetbsd/sha1.h
     - copied unchanged from r241356, projects/mtree/usr.sbin/nmtree/sha1.h
  projects/mtree/lib/libnetbsd/sha2.h
     - copied unchanged from r241356, projects/mtree/usr.sbin/nmtree/sha2.h
  projects/mtree/lib/libnetbsd/sys/
     - copied from r241356, projects/mtree/usr.sbin/nmtree/sys/
  projects/mtree/lib/libnetbsd/util.c
     - copied unchanged from r241356, projects/mtree/usr.sbin/nmtree/util.c
  projects/mtree/lib/libnetbsd/util.h
     - copied unchanged from r241356, projects/mtree/usr.sbin/nmtree/util.h
Deleted:
  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/sys/
  projects/mtree/usr.sbin/nmtree/util.c
  projects/mtree/usr.sbin/nmtree/util.h
Modified:
  projects/mtree/lib/Makefile
  projects/mtree/usr.bin/install/Makefile
  projects/mtree/usr.sbin/makefs/Makefile
  projects/mtree/usr.sbin/nmtree/Makefile

Modified: projects/mtree/lib/Makefile
==============================================================================
--- projects/mtree/lib/Makefile	Mon Oct  8 18:33:08 2012	(r241356)
+++ projects/mtree/lib/Makefile	Mon Oct  8 22:22:05 2012	(r241357)
@@ -90,6 +90,7 @@ SUBDIR=	${SUBDIR_ORDERED} \
 	${_libmp} \
 	${_libnandfs} \
 	${_libncp} \
+	libnetbsd \
 	${_libngatm} \
 	libopie \
 	libpam \

Added: projects/mtree/lib/libnetbsd/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/mtree/lib/libnetbsd/Makefile	Mon Oct  8 22:22:05 2012	(r241357)
@@ -0,0 +1,13 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+LIB=	netbsd
+
+CFLAGS+=	-I${.CURDIR}
+
+SRCS+=	util.c util.h
+
+INTERNALLIB=
+
+.include <bsd.lib.mk>

Copied: projects/mtree/lib/libnetbsd/rmd160.h (from r241356, projects/mtree/usr.sbin/nmtree/rmd160.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/mtree/lib/libnetbsd/rmd160.h	Mon Oct  8 22:22:05 2012	(r241357, copy of r241356, projects/mtree/usr.sbin/nmtree/rmd160.h)
@@ -0,0 +1,9 @@
+/*	$FreeBSD$	 */
+
+#include <ripemd.h>
+
+#define RMD160_CTX	RIPEMD160_CTX
+#define	RMD160End	RIPEMD160_End
+#define	RMD160File	RIPEMD160_File
+#define	RMD160Init	RIPEMD160_Init
+#define	RMD160Update	RIPEMD160_Update

Copied: projects/mtree/lib/libnetbsd/sha1.h (from r241356, projects/mtree/usr.sbin/nmtree/sha1.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/mtree/lib/libnetbsd/sha1.h	Mon Oct  8 22:22:05 2012	(r241357, copy of r241356, projects/mtree/usr.sbin/nmtree/sha1.h)
@@ -0,0 +1,8 @@
+/*	$FreeBSD$	*/
+
+#include <sha.h>
+
+#define	SHA1End		SHA1_End
+#define	SHA1File	SHA1_File
+#define	SHA1Init	SHA1_Init
+#define	SHA1Update	SHA1_Update

Copied: projects/mtree/lib/libnetbsd/sha2.h (from r241356, projects/mtree/usr.sbin/nmtree/sha2.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/mtree/lib/libnetbsd/sha2.h	Mon Oct  8 22:22:05 2012	(r241357, copy of r241356, projects/mtree/usr.sbin/nmtree/sha2.h)
@@ -0,0 +1,4 @@
+/*	$FreeBSD$	*/
+
+#include <sha256.h>
+#include <sha512.h>

Copied: projects/mtree/lib/libnetbsd/util.c (from r241356, projects/mtree/usr.sbin/nmtree/util.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/mtree/lib/libnetbsd/util.c	Mon Oct  8 22:22:05 2012	(r241357, copy of r241356, projects/mtree/usr.sbin/nmtree/util.c)
@@ -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);
+}

Copied: projects/mtree/lib/libnetbsd/util.h (from r241356, projects/mtree/usr.sbin/nmtree/util.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/mtree/lib/libnetbsd/util.h	Mon Oct  8 22:22:05 2012	(r241357, copy of r241356, projects/mtree/usr.sbin/nmtree/util.h)
@@ -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_ */

Modified: projects/mtree/usr.bin/install/Makefile
==============================================================================
--- projects/mtree/usr.bin/install/Makefile	Mon Oct  8 18:33:08 2012	(r241356)
+++ projects/mtree/usr.bin/install/Makefile	Mon Oct  8 22:22:05 2012	(r241357)
@@ -3,15 +3,19 @@
 .include <bsd.own.mk>
 
 PROG=   ninstall
-SRCS=   xinstall.c getid.c util.c
+SRCS=   xinstall.c getid.c
 MAN=
 
 .PATH: ${.CURDIR}/../../contrib/install
 .PATH: ${.CURDIR}/../../contrib/mtree
 .PATH: ${.CURDIR}/../../usr.sbin/nmtree
 CFLAGS+=	-I${.CURDIR}/../../contrib/mtree \
-		-I${.CURDIR}/../../usr.sbin/nmtree \
+		-I${.CURDIR}/../../lib/libnetbsd \
 		-DNO_SHA384
-LDADD+=	-lmd
+
+LIBNETBSDDIR=	${.OBJDIR}/../../lib/libnetbsd
+LIBNETBSD=	${LIBNETBSDDIR}/libnetbsd.a
+DPADD+=		${LIBNETBSD}
+LDADD+=		-lmd ${LIBNETBSD}
 
 .include <bsd.prog.mk>

Modified: projects/mtree/usr.sbin/makefs/Makefile
==============================================================================
--- projects/mtree/usr.sbin/makefs/Makefile	Mon Oct  8 18:33:08 2012	(r241356)
+++ projects/mtree/usr.sbin/makefs/Makefile	Mon Oct  8 22:22:05 2012	(r241357)
@@ -24,10 +24,6 @@ CFLAGS+=-DHAVE_STRUCT_STAT_ST_GEN=1
 CFLAGS+=-I${.CURDIR}/../../contrib/mtree
 SRCS+=	misc.c spec.c
 
-.PATH:	${.CURDIR}/../nmtree
-CFLAGS+=-I${.CURDIR}/../nmtree
-SRCS+=	util.c
-
 .PATH:	${.CURDIR}/../../contrib/mknod
 CFLAGS+=-I${.CURDIR}/../../contrib/mknod
 SRCS+=	pack_dev.c
@@ -35,7 +31,13 @@ SRCS+=	pack_dev.c
 .PATH:	${.CURDIR}/../../sys/ufs/ffs
 SRCS+=	ffs_tables.c
 
+CFLAGS+=-I${.CURDIR}/../../lib/libnetbsd
 DPADD=  ${LIBSBUF}
 LDADD=  -lsbuf -lutil
 
+LIBNETBSDDIR=   ${.OBJDIR}/../../lib/libnetbsd
+LIBNETBSD=      ${LIBNETBSDDIR}/libnetbsd.a
+DPADD+=         ${LIBNETBSD}
+LDADD+=         ${LIBNETBSD}
+
 .include <bsd.prog.mk>

Modified: projects/mtree/usr.sbin/nmtree/Makefile
==============================================================================
--- projects/mtree/usr.sbin/nmtree/Makefile	Mon Oct  8 18:33:08 2012	(r241356)
+++ projects/mtree/usr.sbin/nmtree/Makefile	Mon Oct  8 22:22:05 2012	(r241357)
@@ -15,9 +15,15 @@ SRCS=   compare.c crc.c create.c exclude
 	verify.c \
         getid.c pack_dev.c
 
-SRCS+=	sha1.h sha2.h util.c util.h
+CFLAGS+=	-I${.CURDIR}/../../lib/libnetbsd
 
 CFLAGS+=	-I${.CURDIR}/../../contrib/mknod
 .PATH:		${.CURDIR}/../../contrib/mknod
 
+LIBNETBSDDIR=   ${.OBJDIR}/../../lib/libnetbsd
+LIBNETBSD=      ${LIBNETBSDDIR}/libnetbsd.a
+DPADD+=         ${LIBNETBSD}
+LDADD+=         ${LIBNETBSD}
+
+
 .include <bsd.prog.mk>


More information about the svn-src-projects mailing list