]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Fix non-Linux build
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Wed, 8 Aug 2012 15:19:43 +0000 (17:19 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 13 Aug 2012 13:14:13 +0000 (15:14 +0200)
loopdev.c, test_pager, and get_max_number_of_cpus() are linux-specific.
get_linux_version will only work on Linux, let's introduce
system_supports_ext4_ext2() which assumes that mounting ext2 with ext4
is not supported on non-Linux systems.

[kzak@redhat.com: - use #ifdef SYS_sched_getaffinity rather than __linux__]

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/Makemodule.am
lib/cpuset.c
libblkid/src/superblocks/ext.c

index 6a6e9b25931b3836022e636e65eda996b9743e94..33a3eb818296443befcd0f83cae2b89f982b35b5 100644 (file)
@@ -10,7 +10,6 @@ libcommon_la_SOURCES = \
        lib/env.c \
        lib/fileutils.c \
        lib/ismounted.c \
-       lib/loopdev.c \
        lib/mangle.c \
        lib/match.c \
        lib/mbsalign.c \
@@ -27,7 +26,9 @@ libcommon_la_SOURCES = \
        lib/xgetpass.c
 
 if LINUX
-libcommon_la_SOURCES += lib/linux_version.c
+libcommon_la_SOURCES += \
+       lib/linux_version.c \
+       lib/loopdev.c
 endif
 
 if !HAVE_LANGINFO
@@ -41,7 +42,6 @@ check_PROGRAMS += \
        test_fileutils \
        test_ismounted \
        test_mangle \
-       test_pager \
        test_procutils \
        test_randutils \
        test_strutils \
@@ -54,7 +54,8 @@ check_PROGRAMS += test_cpuset
 endif
 check_PROGRAMS += \
        test_sysfs \
-       test_loopdev
+       test_loopdev \
+       test_pager
 endif
 
 test_blkdev_SOURCES = lib/blkdev.c
index 78efd5302d02a28f558ca923b4985eacf79f5e87..26b0a90b7572476cbddbbd367022d77c7c8706e2 100644 (file)
@@ -59,6 +59,7 @@ static const char *nexttoken(const char *q,  int sep)
  */
 int get_max_number_of_cpus(void)
 {
+#ifdef SYS_sched_getaffinity
        int n, cpus = 2048;
        size_t setsize;
        cpu_set_t *set = cpuset_alloc(cpus, &setsize, NULL);
@@ -83,6 +84,7 @@ int get_max_number_of_cpus(void)
                cpuset_free(set);
                return n * 8;
        }
+#endif
        return -1;
 }
 
index 4066347cd5f850ab4c342762df44bd9bf69ca9c8..eff96a066b2dbbf1aa3ef9ddffcc719a7b7be82d 100644 (file)
@@ -257,6 +257,15 @@ static int system_supports_ext4dev(void)
        ret = (fs_proc_check("ext4dev") || check_for_modules("ext4dev"));
        return ret;
 }
+
+static int system_supports_ext4_ext2(void)
+{
+#ifdef __linux__
+       return get_linux_version() >= EXT4_SUPPORTS_EXT2;
+#else
+       return 0;
+#endif
+}
 /*
  * reads superblock and returns:
  *     fc = feature_compat
@@ -352,7 +361,7 @@ static int probe_ext2(blkid_probe pr,
         */
        if (!system_supports_ext2() &&
            (system_supports_ext4() || system_supports_ext4dev()) &&
-           get_linux_version() >= EXT4_SUPPORTS_EXT2)
+           system_supports_ext4_ext2())
                return -BLKID_ERR_PARAM;
 
        ext_get_info(pr, 2, es);
@@ -405,7 +414,7 @@ static int probe_ext4dev(blkid_probe pr,
        if (!(fc & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&
            !system_supports_ext2() && !system_supports_ext4() &&
            system_supports_ext4dev() &&
-           get_linux_version() >= EXT4_SUPPORTS_EXT2)
+           system_supports_ext4_ext2())
                goto force_ext4dev;
 
        /*
@@ -450,7 +459,7 @@ static int probe_ext4(blkid_probe pr,
         */
        if (!(fc & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&
            !system_supports_ext2() && system_supports_ext4() &&
-           get_linux_version() >= EXT4_SUPPORTS_EXT2)
+           system_supports_ext4_ext2())
                goto force_ext4;
 
        /* Ext4 has at least one feature which ext3 doesn't understand */