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 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 don't know. Suppose sizeof(vmem_addr_t) == sizeof(uint32_t). Which
of these cases should fail, and on which statement?
Case A:
1 vm = vmem_create("test", 0xffffffff, 1, 0, NULL, NULL, NULL, 1,
2 VM_SLEEP, IPL_NONE);
3 p = vmem_alloc(vm, 1, VM_SLEEP);
Case B:
1 vm = vmem_create("test", 0xfffffffe, 2, 0, NULL, NULL, NULL, 1,
2 VM_SLEEP, IPL_NONE);
3 p = vmem_alloc(vm, 2, VM_SLEEP);
Case C:
1 vm = vmem_create("test", 0xfffffffe, 2, 0, NULL, NULL, NULL, 1,
2 VM_SLEEP, IPL_NONE);
3 p = vmem_alloc(vm, 1, VM_SLEEP);
4 q = vmem_alloc(vm, 1, VM_SLEEP);
Dave
--
David Young OJC Technologies
dyoung%ojctech.com@localhost Urbana, IL * (217) 344-0444 x24
Home |
Main Index |
Thread Index |
Old Index