[klibc] Add swap support to fstype, second version

H. Peter Anvin hpa at zytor.com
Mon Feb 6 19:10:15 PST 2006


David Härdeman wrote:
> +
> +/* The basic structures of the swap super block */
> +#define SWAP_RESERVED_L		BLOCK_SIZE - 10
> +#define SWAP_MAGIC_L		10
> +#define SWAP_MAGIC_1		"SWAP-SPACE"
> +#define SWAP_MAGIC_2		"SWAPSPACE2"
> +/* The super block is the last block in the first page */
> +#define SWAP_OFFSET		((PAGE_SIZE - BLOCK_SIZE) / BLOCK_SIZE)
> +

This is a bit confusing... on some architectures, PAGE_SIZE is 
undefined, because it's variable.  To get the page size, one has to do 
getpagesize(), but it's not even clear to me that that is the right thing.

I've applied the patch, but could you perhaps try to find out how this 
is supposed to work on architectures where page size is variable?

	-hpa



More information about the klibc mailing list