Re: non-linux support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

This patch still didn't get applied.  Was there a problem with it?
(yes, GNU/Hurd uses linux-like swapspace, so mkswap makes sense on
non-linux platforms too).

Samuel

Samuel Thibault, le Tue 18 Dec 2007 02:21:49 +0000, a écrit :
> get_linux_version() is Linux-specific.  Work around it in a few places.
> 
Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>

diff --git a/disk-utils/Makefile.am b/disk-utils/Makefile.am
index ec8923c..9a42089 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 = 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 5e62b2d..be70011 100644
--- a/disk-utils/mkswap.c
+++ b/disk-utils/mkswap.c
@@ -545,9 +545,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;
@@ -567,10 +570,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;
 
diff --git a/fdisk/Makefile.am b/fdisk/Makefile.am
index 2246702..c0378ac 100644
--- a/fdisk/Makefile.am
+++ b/fdisk/Makefile.am
@@ -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
 
diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index 2c0b174..f70b162 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -1516,7 +1516,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;
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 0e1321e..37205dc 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -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
 
 
diff --git a/mount/Makefile.am b/mount/Makefile.am
index bba5962..61fea8d 100644
--- a/mount/Makefile.am
+++ b/mount/Makefile.am
@@ -13,9 +13,13 @@ headers_common = fstab.h mount_mntent.h mount_constants.h \
 	getusername.h loop.h sundries.h
 
 mount_common = fstab.c mount_mntent.c getusername.c lomount.c \
-	$(utils_common) $(headers_common) ../lib/env.c ../lib/linux_version.c \
+	$(utils_common) $(headers_common) ../lib/env.c \
 	../lib/blkdev.c
 
+if LINUX
+mount_common += ../lib/linux_version.c 
+endif
+
 mount_SOURCES = mount.c $(mount_common) ../lib/setproctitle.c
 mount_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS)
 mount_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS)
@@ -47,7 +51,10 @@ endif
 
 if HAVE_VOLUME_ID
 utils_common += fsprobe_volumeid.c
-swapon_SOURCES += ../lib/linux_version.c ../lib/blkdev.c
+swapon_SOURCES += ../lib/blkdev.c
+if LINUX
+swapon_SOURCES += ../lib/linux_version.c
+endif
 LDADD_common += -lvolume_id
 endif
 

 
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux