tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: chfs support in makefs



In article <op.wcjmixcobcua1o@localhost.localdomain>,
Tamas Toth <ttoth%inf.u-szeged.hu@localhost> wrote:
>-=-=-=-=-=-
>
>Hi,
>
>I added chfs support to makefs. It's a bit ugly, because I had to copy  
>some parts of sys/vnode.h to chfs/mkfs_chfs.c. (Tools can't be compiled  
>with build.sh if I include the sys/vnode.h.)
>
>Does anyone have a better solution to this problem and/or comments on the  
>code or can I commit it?

I would add:

#ifndef S_IFSOCK
#define ...
#endif

because this is not a portable feature.

Why copy all the header files instead of using them directly via 
CPPFLAGS+= -I${NETBSDSRCDIR}/sys/ufs/chfs?

You are missing a DPADD+=${LIBZ}

Now for the vnode VT stuff, see appended (just include the generated vt.h)

christos

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#       Makefile.inc
#       genvt
#
echo x - Makefile.inc
sed 's/^X//' >Makefile.inc << 'END-of-Makefile.inc'
X
XSYS=${NETBSDSRCDIR}/sys
X.PATH: ${.CURDIR}/chfs ${SYS/ufs/chfs
X
XCPPFLAGS+=-I. -I${SYS/ufs/chfs
X
X
XSRCS+= chfs_mkfs.c
XLDADD+= -lz
XDPADD+= ${LIBZ}
X
Xvt.h:  ${.PARSEDIR}/genvt ${SYS}/sys/vnode.h ${SYS}/kern/vfs_subr.c
X       @rm -f ${.TARGET}
X       ${TOOL_SH} ${.ALLSRC} > ${.TARGET}
X
Xchfs_mkfs.o: vt.h
X
XCLEANFILES+=vt.h
END-of-Makefile.inc
echo x - genvt
sed 's/^X//' >genvt << 'END-of-genvt'
X#!/bin/sh
X# $NetBSD$
X
X# Copyright (c) 2012 The NetBSD Foundation, Inc.
X#
X# This code is derived from software contributed to The NetBSD Foundation
X# by Christos Zoulas.
X#
X# Redistribution and use in source and binary forms, with or without
X# modification, are permitted provided that the following conditions
X# are met:
X# 1. Redistributions of source code must retain the above copyright
X#    notice, this list of conditions and the following disclaimer.
X# 2. Redistributions in binary form must reproduce the above copyright
X#    notice, this list of conditions and the following disclaimer in the
X#    documentation and/or other materials provided with the distribution.
X#
X# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
X# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
X# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
X# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
X# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
X# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
X# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
X# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
X# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
X# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
X
Xset -e
X: ${TOOL_AWK:=awk}
X
XVNODE="${1:-/usr/src/sys/sys/vnode.h}"
XVFS="${2:-/usr/src/sys/kern/vfs_subr.c}"
X
Xgetenum() {
X       "${TOOL_AWK}" '
X/^enum vtype/  { print $0; }
X/IFTOVT/       { print $0; }
X' "${VNODE}"
X}
X
Xgettable() {
X       "${TOOL_AWK}" '
XBEGIN { count = 0; }
X/^const enum vtype iftovt_tab/ { count = 1; }
X{
X       if (count > 0 && count < 5) {
X               print $0;
X               count++
X       }
X}' "${VFS}"
X}
X
Xecho '/* automatically generated file, do not edit */'
Xgetenum
Xgettable
END-of-genvt
exit




Home | Main Index | Thread Index | Old Index