From owner-freebsd-current@freebsd.org Fri Jan 6 10:33:16 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C583CCA0130 for ; Fri, 6 Jan 2017 10:33:16 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 92C651685 for ; Fri, 6 Jan 2017 10:33:16 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id AAFE31FE025; Fri, 6 Jan 2017 11:33:00 +0100 (CET) Subject: Re: linuxkpi To: blubee blubeeme , freebsd-current@freebsd.org References: From: Hans Petter Selasky Message-ID: <7da11e1b-6193-0489-18ca-06a501c287cb@selasky.org> Date: Fri, 6 Jan 2017 11:32:42 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jan 2017 10:33:16 -0000 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