summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Thibault2007-11-28 10:40:32 +0100
committerKarel Zak2007-11-28 10:41:26 +0100
commite460a5bf893227ccd7cdc9b8e5beec1ebc30a858 (patch)
tree0a3e4f29b76835d95a4d890efd935b6a1fdb7297
parentfdisk: non-linux support (MAXPATHLEN) (diff)
downloadkernel-qcow2-util-linux-e460a5bf893227ccd7cdc9b8e5beec1ebc30a858.tar.gz
kernel-qcow2-util-linux-e460a5bf893227ccd7cdc9b8e5beec1ebc30a858.tar.xz
kernel-qcow2-util-linux-e460a5bf893227ccd7cdc9b8e5beec1ebc30a858.zip
build-sys: cleanup usage of linux/major.h
The utils like fdisk or login are usable on non-linux systems. This patch allows to compile on systems without linux/major.h. Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
-rw-r--r--configure.ac2
-rw-r--r--fdisk/fdisksgilabel.c1
-rw-r--r--fdisk/fdisksunlabel.c5
-rw-r--r--login-utils/checktty.c8
4 files changed, 14 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index ed12e60b5..8a1d96d7e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,7 +33,7 @@ AC_PATH_PROG(VOLID, vol_id, [], [$PATH:/lib/udev])
AC_SYS_LARGEFILE
-AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h], [], [], [
+AC_CHECK_HEADERS([linux/compiler.h linux/blkpg.h linux/major.h], [], [], [
#ifdef HAVE_LINUX_COMPILER_H
#include <linux/compiler.h>
#endif
diff --git a/fdisk/fdisksgilabel.c b/fdisk/fdisksgilabel.c
index 5adf64e39..c970c7cf9 100644
--- a/fdisk/fdisksgilabel.c
+++ b/fdisk/fdisksgilabel.c
@@ -22,7 +22,6 @@
#include <endian.h>
#include "nls.h"
-#include <linux/major.h> /* FLOPPY_MAJOR */
#include "blkdev.h"
diff --git a/fdisk/fdisksunlabel.c b/fdisk/fdisksunlabel.c
index ff9a182db..4ed973305 100644
--- a/fdisk/fdisksunlabel.c
+++ b/fdisk/fdisksunlabel.c
@@ -27,7 +27,9 @@
#include <scsi/scsi.h> /* SCSI_IOCTL_GET_IDLUN */
#undef u_char
#endif
+#ifdef HAVE_LINUX_MAJOR_H
#include <linux/major.h> /* FLOPPY_MAJOR */
+#endif
#include "common.h"
#include "fdisk.h"
@@ -69,6 +71,9 @@ static inline __u32 __swap32(__u32 x) {
#define SSWAP32(x) (other_endian ? __swap32(x) \
: (__u32)(x))
+#ifndef FLOPPY_MAJOR
+#define FLOPPY_MAJOR 2
+#endif
#ifndef IDE0_MAJOR
#define IDE0_MAJOR 3
#endif
diff --git a/login-utils/checktty.c b/login-utils/checktty.c
index 16f9f2e88..c28ee833d 100644
--- a/login-utils/checktty.c
+++ b/login-utils/checktty.c
@@ -25,12 +25,18 @@
#include "nls.h"
#include <sys/sysmacros.h>
+#ifdef HAVE_LINUX_MAJOR_H
#include <linux/major.h>
+#endif
#include "pathnames.h"
#include "login.h"
#include "xstrncpy.h"
+#ifndef TTY_MAJOR
+#define TTY_MAJOR 4
+#endif
+
static gid_t mygroups[NGROUPS];
static int num_groups;
@@ -118,6 +124,7 @@ add_to_class(struct ttyclass *tc, char *tty)
static int
isapty(const char *tty)
{
+#ifdef __linux__
char devname[100];
struct stat stb;
@@ -147,6 +154,7 @@ isapty(const char *tty)
#endif
}
+#endif /* __linux__ */
return 0;
}