Subject: Re: rminit()/rmfree() etc.
To: None <firstname.lastname@example.org, tech-kern@NetBSD.ORG>
From: Mike Hibler <email@example.com>
Date: 09/15/1995 14:29:55
> Subject: rminit()/rmfree() etc.
> Date: Sat, 16 Sep 1995 04:16:56 +1000
> From: matthew green <firstname.lastname@example.org>
> the rminit() function from kern/subr_rmap.c doesn't allow an initial
> address of 0 -- it panic's if this is passed. i'm looking at fixing
> the way we're doing swap at the moment, and, i want to be able to
> swap directly to files as well. seeing that files don't have labels
> or bootblocks at the start of them, there is no requirement to ignore
> the start of the file (as is done for a partition), but, to do this
> consistantly, i'd have to pass an address of 0 to rminit().
> the rmap stuff is used 1 or 2 times for each port. once for the
> swapmap, and once for the hp300/sparc/vax ports for other things.
> what's the rationale behind rminit() making 0 an invalid address ?
In the old AT&T encumbered version of subr_rmap.c, the restriction wasn't
aimed at swap space or disks in particular. Zero was just used to signify
the end of the valid entries in the list. I guess this must still be true
in the reimplemented version of rmap. You can always use the old trick of
rminit'ing from 1 to <size>+1 and, when you get a value back from rmalloc,
subtract 1 from that (and of course, add 1 to your value when you rmfree).