From owner-freebsd-current@FreeBSD.ORG Thu Jun 11 13:17:32 2009 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56501106564A for ; Thu, 11 Jun 2009 13:17:32 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.9.129]) by mx1.freebsd.org (Postfix) with ESMTP id AA0268FC12 for ; Thu, 11 Jun 2009 13:17:31 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 48CC073098; Thu, 11 Jun 2009 15:22:51 +0200 (CEST) Date: Thu, 11 Jun 2009 15:22:51 +0200 From: Luigi Rizzo To: current@freebsd.org Message-ID: <20090611132251.GA22621@onelab2.iet.unipi.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Cc: Subject: kernel/userland separation in headers ? 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: Thu, 11 Jun 2009 13:17:32 -0000 Right now, several headers carry both userland and kernel info, using _KERNEL to tell what should be made visible ---- sys/sys/foo.h --- #ifndef SYS_FOO_H #define SYS_FOO_H ... userland visible stuff #ifdef _KERNEL ... kernel-visible stuff #endif /* _KERNEL */ #endif /* SYS_FOO_H */ This is not completely satisfactory, as there are at least three different pieces of information in foo.h: A kernel-userland API for subsystem foo B kernel API for subsystem foo C private info for subsystem foo, that should not be exported to the rest of the kernel. and I would like to keep them as separate as possible. Do we have any established naming convention for #A, #B and #C, so we can put these pieces in different files (reducing build dependencies, and making it easier to check that changes are backward compatible) ? As an alternative, do we have some standard naming for macros e.g. _FOO_INTERNAL to tell #B from #C ? One example is perhaps in sys/netinet where we have in.h perhaps #A in_systm.h in_var.h but all of them have an "#ifdef _KERNEL" section and i am not even sure which header maps to which category. cheers luigi