]> err.no Git - util-linux/commitdiff
fdisk: don't use get_linux_version() for non-linux
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:52 +0000 (00:52 +0200)
The get_linux_version() function is Linux-specific.
Work around it in a few places.

[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>
fdisk/Makefile.am
fdisk/sfdisk.c
lib/Makefile.am

index 921563f8e0ed49fea64bb08cdd644753fbf9b2dc..b3b5d7e9b09597b619c661220ba0b1994ee23393 100644 (file)
@@ -3,7 +3,11 @@ include $(top_srcdir)/config/include-Makefile.am
 EXTRA_DIST = README.fdisk README.cfdisk sfdisk.examples partitiontype.c
 
 fdisk_common = i386_sys_types.c common.h gpt.c gpt.h \
-       ../lib/blkdev.c ../lib/linux_version.c
+       ../lib/blkdev.c
+
+if LINUX
+fdisk_common += ../lib/linux_version.c
+endif
 
 if !ARCH_M68K
 
index a3b66174f0fabcefc1f569ce1de470c97fa70b20..d737d69d17cbb26ea85c73dc23b7f015658df29c 100644 (file)
@@ -1508,7 +1508,10 @@ msdos_partition(char *dev, int fd, unsigned long start, struct disk_desc *z) {
     struct sector *s;
     struct part_desc *partitions = &(z->partitions[0]);
     int pno = z->partno;
-    int bsd_later = (get_linux_version() >= KERNEL_VERSION(2,3,40));
+    int bsd_later = 1;
+#ifdef __linux__
+    bsd_later = (get_linux_version() >= KERNEL_VERSION(2,3,40));
+#endif
 
     if (!(s = get_sector(dev, fd, start)))
        return 0;
index 0e1321edbcd01f99f3a63789cb2155e56b1573e4..37205dcd686ce319e271dde2b6606a9ae54ffa2e 100644 (file)
@@ -2,8 +2,12 @@ include $(top_srcdir)/config/include-Makefile.am
 
 noinst_PROGRAMS = test_blkdev
 
-test_blkdev_SOURCES =  $(top_srcdir)/lib/blkdev.c \
-                       $(top_srcdir)/lib/linux_version.c
+test_blkdev_SOURCES =  $(top_srcdir)/lib/blkdev.c
+
+if LINUX
+test_blkdev_SOURCES += $(top_srcdir)/lib/linux_version.c
+endif
+
 test_blkdev_CFLAGS = -DMAIN_TEST_BLKDEV