Date: Wed, 09 Apr 2003 10:06:38 -0600 (MDT) From: "M. Warner Losh" <imp@bsdimp.com> To: phk@phk.freebsd.dk Cc: arch@freebsd.org Subject: Re: Sharing code between kernel and userland.... Message-ID: <20030409.100638.128617887.imp@bsdimp.com> In-Reply-To: <32183.1049881186@critter.freebsd.dk> References: <32183.1049881186@critter.freebsd.dk>
index | next in thread | previous in thread | raw e-mail
In message: <32183.1049881186@critter.freebsd.dk>
Poul-Henning Kamp <phk@phk.freebsd.dk> 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 <sys/disklabel.h>
: 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 <bsd.lib.mk>
just have libdisk do the same thing.
Warner
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030409.100638.128617887.imp>
