[klibc] Add swap support to fstype, second version

H. Peter Anvin hpa at zytor.com
Mon Feb 6 23:28:59 PST 2006

David Härdeman wrote:
> I grabbed it from include/linux/swap.h which contains:
> union swap_header {
>        struct {
>                char reserved[PAGE_SIZE - 10];
>                char magic[10]; /* SWAP-SPACE or SWAPSPACE2 */
>        } magic;
> swap.h also includes <asm/page.h>, presumably to get the page size. So 
> I'm guessing that the compile-time page-size is used on architectures 
> with variable sizes, but I'll double-check the code to verify that.
> Now, I didn't see any architectures for which PAGE_SIZE is undefined at 
> compile-time...which one(s) are you referring to?

On some architectures PAGE_SIZE is a kernel configuration option or 
otherwise not available to userspace.  I think SPARC, and possibly IA64, 
at the very least.

Anyway... I hacked it up so that it does getpagesize(); however, it's a 
bit creepy that the recognition of a swap partition would change if the 
kernel is modified...


More information about the klibc mailing list