Subject: Re: Adding /proc/swaps to linux compat code
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-kern
Date: 01/31/2007 16:43:42
In article <20070131161946.GA978@baal.public.ulaval.ca>,
Arnaud Lacombe  <arnaud.lacombe.1@ulaval.ca> wrote:
>Hi,
>
>I'd like to add a /proc/swaps entry to our linux /proc emulation. It is
>used at least by Oracle 10g to determine swap space available on the
>system. This check is not mandatory and its result could be ignored, but
>it's not worth having it.
>
>A first patch is available here:
>http://www.sigfpe.info/netbsd/proc_swaps.diff
>
>The only one problem is the partition type, I guess I can rely on the
>value of sep->se_dev (ie. if the swap is a valid block dev or not) to
>determine if it's a partition or a file.
>
>Any comments ?

- Don't cast the result of malloc.
- Assign buflen to LBFSZ in the beginning and use buflen from now on,
  instead of of LBFSZ.
- Missing spaces count=nswap, should be changed anyway read on.
- count should be register_t, and you should check it against nswap
  and use it if <= instead of ignoring it.
- it would be nice to have an api to get the blocksize... but this is
  ok for now.

Looks good!

christos