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 =================================================================== --- walk.c (revision 245563) +++ walk.c (working copy) @@ -305,7 +305,7 @@ if ((fp = fopen(specfile, "r")) == NULL) err(1, "Can't open `%s'", specfile); TIMER_START(start); - root = mtree_readspec(fp); + root = spec(fp); TIMER_RESULTS(start, "spec"); if (fclose(fp) == EOF) err(1, "Can't close `%s'", specfile); @@ -321,33 +321,6 @@ } -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 speconly) { Index: makefs.h =================================================================== --- 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); -/* - * 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 =================================================================== --- Makefile (revision 245563) +++ Makefile (working copy) @@ -5,7 +5,6 @@ CFLAGS+=-I${.CURDIR} SRCS= cd9660.c ffs.c \ - getid.c \ makefs.c \ mtree.c \ walk.c @@ -15,19 +14,28 @@ .include "${.CURDIR}/cd9660/Makefile.inc" .include "${.CURDIR}/ffs/Makefile.inc" -.include "${.CURDIR}/compat/Makefile.inc" CFLAGS+=-DHAVE_STRUCT_STAT_ST_FLAGS=1 CFLAGS+=-DHAVE_STRUCT_STAT_ST_GEN=1 -.PATH: ${.CURDIR}/../mtree -CFLAGS+=-I${.CURDIR}/../mtree -SRCS+= misc.c spec.c +.PATH: ${.CURDIR}/../../contrib/mtree +CFLAGS+=-I${.CURDIR}/../../contrib/mtree +SRCS+= getid.c misc.c spec.c +.PATH: ${.CURDIR}/../../contrib/mknod +CFLAGS+=-I${.CURDIR}/../../contrib/mknod +SRCS+= pack_dev.c + .PATH: ${.CURDIR}/../../sys/ufs/ffs SRCS+= ffs_tables.c -DPADD= ${LIBSBUF} -LDADD= -lsbuf +CFLAGS+= -I${.CURDIR}/../../lib/libnetbsd +LIBNETBSDDIR= ${.OBJDIR}/../../lib/libnetbsd +LIBNETBSD= ${LIBNETBSDDIR}/libnetbsd.a +DPADD+= ${LIBNETBSD} +LDADD+= ${LIBNETBSD} +DPADD+= ${LIBSBUF} ${LIBUTIL} +LDADD+= -lsbuf -lutil + .include