From: Samuel Thibault Date: Tue, 22 Apr 2008 01:11:48 +0000 (+0100) Subject: mkswap: non-linux support X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff035f67ed16dc205c8c8870de0c0c9ed8816ce6;p=util-linux mkswap: non-linux support GNU/Hurd uses linux-like swapspace, so mkswap makes sense on non-linux platforms too. [kzak@redhat.com: split the original patch to small patches] Signed-off-by: Samuel Thibault Signed-off-by: Karel Zak --- diff --git a/disk-utils/Makefile.am b/disk-utils/Makefile.am index 7fed9d8b..ef9ceab4 100644 --- a/disk-utils/Makefile.am +++ b/disk-utils/Makefile.am @@ -1,6 +1,9 @@ include $(top_srcdir)/config/include-Makefile.am -utils_common = ../lib/linux_version.c ../lib/blkdev.c +utils_common = ../lib/blkdev.c +if LINUX +utils_common += ../lib/linux_version.c +endif dist_man_MANS = blockdev.8 isosize.8 mkfs.8 mkswap.8 \ fsck.minix.8 mkfs.minix.8 mkfs.bfs.8 diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c index 3f58f9c3..8bf358ed 100644 --- a/disk-utils/mkswap.c +++ b/disk-utils/mkswap.c @@ -607,9 +607,12 @@ main(int argc, char ** argv) { version = 1; else /* use version 1 as default, if possible */ +#ifdef __linux__ if (get_linux_version() < KERNEL_VERSION(2,1,117)) version = 0; - else if (pagesize < 2048) + else +#endif + if (pagesize < 2048) version = 0; else version = 1; @@ -629,10 +632,12 @@ main(int argc, char ** argv) { if (version == 0) maxpages = V0_MAX_PAGES; +#ifdef __linux__ else if (get_linux_version() >= KERNEL_VERSION(2,3,4)) maxpages = PAGES; else if (get_linux_version() >= KERNEL_VERSION(2,2,1)) maxpages = V1_MAX_PAGES; +#endif else maxpages = V1_OLD_MAX_PAGES;