Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jun 2009 15:22:51 +0200
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        current@freebsd.org
Subject:   kernel/userland separation in headers ?
Message-ID:  <20090611132251.GA22621@onelab2.iet.unipi.it>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090611132251.GA22621>