how to handle name clashes in linux/freebsd kernel sources ?
rizzo at icir.org
Tue Jun 26 11:38:07 UTC 2007
as part of the linux-kmod-compat code, and also SoC-KVM work,
we are integrating some linux kernel source code with FreeBSD source,
and there are a number of clashes in names (macros, functions, etc.)
used in different ways in the two camps.
Any ideas on how to handle the conflict ? As a temporary workaround we
added a _compat suffix (in the source code) to the linux names,
but this is of course undesirable, especially for widely used names.
E.g. take these two examples:
msleep() - used to be a function in FreeBSD 6.x, but now it is a macro
when it was a function we could make the linux source do the following
#include <sys/systm.h> // bring in the prototype
#define msleep linux_msleep // override for linux source
// now reinclusion of sys/systm.h won't give problems
and then implement the linux function. However this breaks with
FreeBSD macros that call msleep, because they will be expanded using
With the macro version, we have not found a solution yet.
list manipulation macros
these have the same names on linux and FreeBSD, but different
arguments, so they are not compatible. Here the redefinition through
a macro won't even work.
So... any ideas on how to handle this, short of renaming the linux
More information about the freebsd-current