tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: UVM typedef struct



On Mon, Jun 15, 2009 at 08:09:56PM +0100, Mindaugas Rasiukevicius wrote:
> I would like to typedef and replace the struct usage in UVM, so that
> struct vm_map would become vm_map_t, struct vm_anon - vm_anon_t, and so
> on. It increases readability and makes UVM consistent in this respect
> with other subsystems (cf. sys/kern). Any concerns?


I can explain why the code is the way it is:

Before I wrote the UVM code, I spent alot of time studying other VM
code.   I found that having these kinds of typedefs for structures 
made the code harder to read (because you don't know if you are dealing
with a structure, or a pointer to a structure --- folks do it both ways).
So when I wrote UVM I attempted to remove as much of this ambiguity as 
possible.  I think the "struct"'s and "*"'s are useful semantic cues
that make it easier for new folks to understand the code.


If we feel typedef structs are important, I would be in favor of
some sort of hungarian notation for the type names, so the semantic
information is not lost (e.g. struct vs struct *).   But is it worth
the effort to do that?


chuck


Home | Main Index | Thread Index | Old Index