Subject: Re: CVS commit: [elad-kernelauth] src/sys/ufs/ext2fs
To: Jason Thorpe <thorpej@shagadelic.org>
From: Christos Zoulas <christos@zoulas.com>
List: source-changes
Date: 04/20/2006 19:05:40
On Apr 20,  2:47pm, thorpej@shagadelic.org (Jason Thorpe) wrote:
-- Subject: Re: CVS commit: [elad-kernelauth] src/sys/ufs/ext2fs

| 
| On Apr 20, 2006, at 2:18 PM, Christos Zoulas wrote:
| 
| > Let me present a different argument: Imagine a kernel with proc_t,
| > lwp_t, user_t, file_t, socket_t, etc. Where are you going to put
| > all these typedefs? In a single file? Because you will not be able
| > to deal with the circular dependencies otherwise. Each typedef added
| > adds enough pain to maintain...
| 
| I am imagining this, in fact.  If we untangle the mess of  
| dependencies I think that we will have something that is EASIER to  
| maintain going forward.  Even from within the kernel, our headers  
| expose way too much.

So how do you solve:

foo.h:

typedef struct {
	bar_t foo_bar;
} foo_t;


bar.h:

typedef struct {
	foo_t bar_foo;
} bar_t;

I would agree with you that typedefs would be nice to use if the language
fully supported them (if they could be forward declared for example) it
does not, and the next best thing is forward structure declarations.

Look at the mess with size_t, wchar_t etc we currently have:

#ifdef  _BSD_SIZE_T_
typedef _BSD_SIZE_T_    size_t;
#undef  _BSD_SIZE_T_
#endif
 
#ifdef  _BSD_WCHAR_T_
typedef _BSD_WCHAR_T_   wchar_t;
#undef  _BSD_WCHAR_T_
#endif 

Please don't make it worse.

christos