From owner-freebsd-current@FreeBSD.ORG Tue Jun 26 11:38:07 2007 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C321F16A469 for ; Tue, 26 Jun 2007 11:38:07 +0000 (UTC) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.freebsd.org (Postfix) with ESMTP id B1CBC13C45A for ; Tue, 26 Jun 2007 11:38:05 +0000 (UTC) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.11/8.13.6) with ESMTP id l5QB7wrI048680; Tue, 26 Jun 2007 04:07:58 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.11/8.12.3/Submit) id l5QB7wao048679; Tue, 26 Jun 2007 04:07:58 -0700 (PDT) (envelope-from rizzo) Date: Tue, 26 Jun 2007 04:07:58 -0700 From: Luigi Rizzo To: current@freebsd.org Message-ID: <20070626040758.A48170@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Cc: fabio@gandalf.sssup.it Subject: how to handle name clashes in linux/freebsd kernel sources ? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 26 Jun 2007 11:38:07 -0000 hi, 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 // 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 linux msleep. 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 macros ? cheers luigi