linuxkpi

Hans Petter Selasky hps at selasky.org
Fri Jan 6 10:33:16 UTC 2017


On 01/06/17 11:04, blubee blubeeme wrote:
> I was looking at the linuxkpi source code in /sys/compat/linuxkpi and I had
> a question.
>
> A lot of those files just look like linux files brought over to FreeBSD, is
> there any reason why those files couldn't be implemented in BSD w/o the
> dependencies on the other Linux headers?
>
> For example this header file:
> sys/compat/linuxkpi/common/include/linux/workqueue.h
>
> the workqueue.h, there doesn't seem to be anything special in there that
> couldn't be implemented in BSD without relying on the Linux import
> statements.
>
> Maybe I'm missing something but why can't these files and functions be
> implemented directly with their BSD equivalents?

Hi Owen,

Many of the conversion macros you find in the LinuxKPI are very simple 
as you've already figured out. The main reason to have them is to avoid 
modifying the OS-shared code, even if this can be scripted.

At the moment tinkering starts with the OS-shared code, applying patches 
from a so-called "upstream" branch will be made harder, depending on if 
the place a patch covers was rewritten to BSD-native API's or not.

The LinuxKPI also allows a shared-code vendor to gradually make code 
more BSD native, if it wishes. In the beginning all kernel APIs used 
might be through the LinuxKPI, but later on this can easily be changed 
for critical areas where there is a substantial difference between BSD 
and Linux.

The LinuxKPI is meant to be a bridge builder. There is also a similar 
"LinuxKPI" in /usr/ports/multimedia/webcamd for user-space if you are 
interested in that.

--HPS


More information about the freebsd-current mailing list