[klibc] Add swap support to fstype, second version

Kay Sievers kay.sievers at vrfy.org
Tue Feb 7 03:48:09 PST 2006


On Thu, Jan 01, 1970 at 12:00:00AM +0000,  wrote:
> 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...

Why are you guys need to reinvent everything again? We have full-featured
klibc ready code for all common fs's in the udev tree:
  http://www.kernel.org/git/?p=linux/hotplug/udev.git;a=blob;hb=HEAD;f=extras/volume_id/README

That code is used for udev to create persistent links in /dev/disk/ in
HAL to provide the desktop with the needed information. On SUSE, it
has replaced libblkid and mount and fsck is linked against it.

If you have any problem with the code let me know and I will fix it.

Thanks,
Kay



More information about the klibc mailing list