]> err.no Git - util-linux/commitdiff
mkswap: non-linux support
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Tue, 22 Apr 2008 01:11:48 +0000 (02:11 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 23 Jul 2008 22:52:13 +0000 (00:52 +0200)
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 <samuel.thibault@ens-lyon.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/Makefile.am
disk-utils/mkswap.c

index 7fed9d8b86f102f5c8bc9250dce89327428d8467..ef9ceab412ac537280f9bfde99062635ebdb61a0 100644 (file)
@@ -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
index 3f58f9c303cf5ae342bf85e46e81ad97bc8e0a2b..8bf358ed3a90d6eb842d7698b253cbf83166bb23 100644 (file)
@@ -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;