Subject: Re: Adding /proc/swaps to linux compat code
To: matthew green <mrg@eterna.com.au>
From: Arnaud Lacombe <arnaud.lacombe.1@ulaval.ca>
List: tech-kern
Date: 01/31/2007 16:25:08
matthew green wrote:
>
> 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.
>
>
> se_dev will be NODEV for a file or a device for a partition.
>
>
> sizes are stored in DEV_BSIZE units, so you should adjust the value of
> se_nblks and se_inuse with "/ 1024 * DEV_BSIZE" or something. i'm not
> really sure which order would be best for those two operation, in order
> to avoid integer underflow or overflow issues.
is it OK to do something like :
#define dbtokb(size) ((size)>>(10-DEV_BSHIFT))
There can be issue with negative shift, is which case we can test if
(10-DEV_BSHIFT) is <0, and make the opposite shift.
- Arnaud