From owner-freebsd-arch@FreeBSD.ORG Thu Jan 17 23:37:02 2013 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 8E5137A8 for ; Thu, 17 Jan 2013 23:37:02 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id D18AAD6A for ; Thu, 17 Jan 2013 23:37:01 +0000 (UTC) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.5/8.14.5) with ESMTP id r0HNaubp056453 for ; Thu, 17 Jan 2013 17:36:56 -0600 (CST) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.5/8.14.5/Submit) id r0HNauPJ056452 for arch@freebsd.org; Thu, 17 Jan 2013 17:36:56 -0600 (CST) (envelope-from brooks) Date: Thu, 17 Jan 2013 17:36:56 -0600 From: Brooks Davis To: arch@freebsd.org Subject: [CFT] switch makefs to use NetBSD mtree Message-ID: <20130117233656.GB55912@lor.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="St7VIuEGZ6dlpu13" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jan 2013 23:37:02 -0000 --St7VIuEGZ6dlpu13 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable The following patch switches makefs to use NetBSD's mtree's file parsing code which adds support for full pathnames. It also replaces the adhoc compatibility code with libnetbsd. Before applying it you should cd to usr.sbin/makefs and run "rm -rf getid.c compat". Please review or test it out and let me know if it works for you. The patch can also be found at: http://people.freebsd.org/~brooks/patches/makefs-nmtree.diff Thanks Brooks Modify the makefs build to use NetBSD's mtree's parsing code rather than FreeBSD's so that full pathnames are supported in mtree files. Also use libnetbsd instead of the existing compat layer. Sponsored by: DARPA, AFRL Before applying this patch run: rm -rf getid.c compat Index: walk.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- walk.c (revision 245563) +++ walk.c (working copy) @@ -305,7 +305,7 @@ if ((fp =3D fopen(specfile, "r")) =3D=3D NULL) err(1, "Can't open `%s'", specfile); TIMER_START(start); - root =3D mtree_readspec(fp); + root =3D spec(fp); TIMER_RESULTS(start, "spec"); if (fclose(fp) =3D=3D EOF) err(1, "Can't close `%s'", specfile); @@ -321,33 +321,6 @@ =20 } =20 -static u_int -nodetoino(u_int type) -{ - - switch (type) { - case F_BLOCK: - return S_IFBLK; - case F_CHAR: - return S_IFCHR; - case F_DIR: - return S_IFDIR; - case F_FIFO: - return S_IFIFO; - case F_FILE: - return S_IFREG; - case F_LINK: - return S_IFLNK; - case F_SOCK: - return S_IFSOCK; - default: - printf("unknown type %d", type); - abort(); - } - /* NOTREACHED */ -} - - static void apply_specdir(const char *dir, NODE *specnode, fsnode *dirnode, int specon= ly) { Index: makefs.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- makefs.h (revision 245563) +++ makefs.h (working copy) @@ -279,22 +279,4 @@ struct fs; void ffs_fragacct_swap(struct fs *, int, int32_t [], int, int); =20 -/* - * Declarations for compat routines. - */ -long long strsuftoll(const char *, const char *, long long, long long); -long long strsuftollx(const char *, const char *, - long long, long long, char *, size_t); - -struct passwd; -int uid_from_user(const char *, uid_t *); -int pwcache_userdb(int (*)(int), void (*)(void), - struct passwd * (*)(const char *), struct passwd * (*)(uid_= t)); -struct group; -int gid_from_group(const char *, gid_t *); -int pwcache_groupdb(int (*)(int), void (*)(void), - struct group * (*)(const char *), struct group * (*)(gid_t)= ); - -int setup_getid(const char *dir); - #endif /* _MAKEFS_H */ Index: Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- Makefile (revision 245563) +++ Makefile (working copy) @@ -5,7 +5,6 @@ CFLAGS+=3D-I${.CURDIR} =20 SRCS=3D cd9660.c ffs.c \ - getid.c \ makefs.c \ mtree.c \ walk.c @@ -15,19 +14,28 @@ =20 .include "${.CURDIR}/cd9660/Makefile.inc" .include "${.CURDIR}/ffs/Makefile.inc" -.include "${.CURDIR}/compat/Makefile.inc" =20 CFLAGS+=3D-DHAVE_STRUCT_STAT_ST_FLAGS=3D1 CFLAGS+=3D-DHAVE_STRUCT_STAT_ST_GEN=3D1 =20 -.PATH: ${.CURDIR}/../mtree -CFLAGS+=3D-I${.CURDIR}/../mtree -SRCS+=3D misc.c spec.c +.PATH: ${.CURDIR}/../../contrib/mtree +CFLAGS+=3D-I${.CURDIR}/../../contrib/mtree +SRCS+=3D getid.c misc.c spec.c =20 +.PATH: ${.CURDIR}/../../contrib/mknod +CFLAGS+=3D-I${.CURDIR}/../../contrib/mknod +SRCS+=3D pack_dev.c + .PATH: ${.CURDIR}/../../sys/ufs/ffs SRCS+=3D ffs_tables.c =20 -DPADD=3D ${LIBSBUF} -LDADD=3D -lsbuf +CFLAGS+=3D -I${.CURDIR}/../../lib/libnetbsd +LIBNETBSDDIR=3D ${.OBJDIR}/../../lib/libnetbsd +LIBNETBSD=3D ${LIBNETBSDDIR}/libnetbsd.a +DPADD+=3D ${LIBNETBSD} +LDADD+=3D ${LIBNETBSD} =20 +DPADD+=3D ${LIBSBUF} ${LIBUTIL} +LDADD+=3D -lsbuf -lutil + .include --St7VIuEGZ6dlpu13 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iD8DBQFQ+IsYXY6L6fI4GtQRAiK3AKC310eWc9sUkuLz6HiaJ0DU2yPLIACfQimL joZ+EApTT8kqBqK+KO9vV/Q= =YWqL -----END PGP SIGNATURE----- --St7VIuEGZ6dlpu13--