tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: rfc: vmem(9) API/implementation changes
On Wed, Jul 27, 2011 at 06:10:17PM +0100, David Laight wrote:
> On Wed, Jul 27, 2011 at 04:58:23PM +0000, Eduardo Horvath wrote:
> > On Wed, 27 Jul 2011, David Young wrote:
> >
> > > There are a couple of changes to the API that I would like to make.
> > > First, I don't think that vmem_addr_t 0 should be reserved for error
> > > indications (0 == VMEM_ADDR_NULL), but the API should change from
> > > this:
> >
> > I'd recommend returning -1 on error. 0 is a valid address, but while -1
> > is a valid address, when do you ever use this interface to allocate
> > something that starts at address -1? And it gets around all the noxious
> > problems involved in returning data through reference parameters.
>
> I tend to agree.
> It is probably also worth avoiding allocating address 0 anyway.
> What is it address 0 of? The physical address seen on the bus??
I am pretty sure that I found an ISA-bus driver that allocated address
0 when I tried to convert extent(9) uses to vmem(9) uses in the i386
kernel. I had to hack around it. Looking back at the patches, I don't
think I got the hacks right!
Remember that vmem(9) is supposed to be a general-purpose allocator.
Surely, for some purposes, allocating the 0th or last vmem_addr_t is
going to be desirable?
Gradually I am making my mind up in favor of indicating errors
out-of-band. :-/
Dave
--
David Young OJC Technologies
dyoung%ojctech.com@localhost Urbana, IL * (217) 344-0444 x24
Home |
Main Index |
Thread Index |
Old Index