kernel/userland separation in headers ?

From: Luigi Rizzo <rizzo_at_iet.unipi.it>
Date: Thu, 11 Jun 2009 15:22:51 +0200
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
Received on Thu Jun 11 2009 - 11:17:32 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:49 UTC