From owner-freebsd-arch@FreeBSD.ORG Wed Apr 9 09:08:13 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 35AAB37B401 for ; Wed, 9 Apr 2003 09:08:12 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 22E0443F75 for ; Wed, 9 Apr 2003 09:08:12 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.8/8.12.3) with ESMTP id h39G8AA7011761; Wed, 9 Apr 2003 10:08:11 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 09 Apr 2003 10:06:38 -0600 (MDT) Message-Id: <20030409.100638.128617887.imp@bsdimp.com> To: phk@phk.freebsd.dk From: "M. Warner Losh" In-Reply-To: <32183.1049881186@critter.freebsd.dk> References: <32183.1049881186@critter.freebsd.dk> X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: arch@freebsd.org Subject: Re: Sharing code between kernel and userland.... X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Apr 2003 16:08:13 -0000 In message: <32183.1049881186@critter.freebsd.dk> Poul-Henning Kamp writes: : Amongst the options I see for avoiding code duplication are: : : 1. : put it in sys/geom/bsdlabel_encode.c : have libdisk pull it into userland from there. : : 2. : put it in sys/libkern/disklabel.c : have libdisk pull it from there. : : 3. : put it in some more or less random place in the kernel : have libdisk pull it from there. : : 4. : use static __inline ... in : It is after all a rather trivial bit of code, but not quite : trivial enough to make me comfortable with this. : : What do people think ? Why reinvent a way of doing it. Put the thing in sys somewhere (sys/geom) and use a reachover Makefile like cam does (simplified from the actual Makefile a little): LIB= cam SRCS= camlib.c scsi_cmdparse.c scsi_all.c scsi_da.c scsi_sa.c cam.c INCS= camlib.h .PATH: ${.CURDIR}/../../sys/cam/scsi ${.CURDIR}/../../sys/cam SDIR= ${.CURDIR}/../../sys CFLAGS+= -I${.CURDIR} -I${SDIR} .include just have libdisk do the same thing. Warner