tech-kern archive

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

Re: UVM typedef struct



Antti Kantee <pooka%cs.hut.fi@localhost> wrote:
> > Just to make this clear, I do not want to typedef structs as pointers.
> > I agree that it is confusing (although it has a good rationale for some
> > cases, eg. when structure size is dynamic).
> 
> The underlying problem is that I do not see any benefit from arbitrary
> typedefs such as struct x -> x_t.  Will we get u32_t next?

I understand that it is a personal preference, but at least to me, it would
increase readability. It would be good to hear opinions of more people who
are working in sys/uvm.

Also, as already mentioned, this would be consistent with other core parts,
eg. various code in sys/kern.

> There are plenty of places in the kernel where _t is a pointer.  How are
> you supposed to distinguish between them?  More specifically to this case,
> when vm_page_t existed in NetBSD with the Mach vm, it was a pointer.

I do not see a necessity to have any _t which would be a pointer in sys/uvm.
Keep things simple. Historical point should not disturb, we have UVM now,
not Mach VM. Solaris VM, for example, has structures typedef'ed.

> > > 2) impossible to provide forward declarations for interfaces using
> > >    silly_t
> > 
> > Why not? Note that struct declarations wont be removed (cf. struct lwp
> > and lwp_t).
> 
> ... see mrg's mail in this thread.

Why do you need typedefs there? What's wrong with struct vm_page; ? As said,
struct definitions stay, eg. your rump would not require any changes.

-- 
Best regards,
Mindaugas


Home | Main Index | Thread Index | Old Index