summaryrefslogtreecommitdiff
path: root/sbin/disklabel
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2013-01-17 18:33:58 +0000
committerchristos <christos@NetBSD.org>2013-01-17 18:33:58 +0000
commit8aede6bfe2eb2800a3899cd28d794d1faef5c320 (patch)
tree897505be6a77a975fe4bb3e328a67c7ff64faf17 /sbin/disklabel
parent6193bbaa8b88a4cc44027e45758f7b77a0f259cb (diff)
move dk_ioctl to a header file for the benefit of x-building.
Diffstat (limited to 'sbin/disklabel')
-rw-r--r--sbin/disklabel/extern.h14
-rw-r--r--sbin/disklabel/interact.c6
-rw-r--r--sbin/disklabel/main.c14
3 files changed, 18 insertions, 16 deletions
diff --git a/sbin/disklabel/extern.h b/sbin/disklabel/extern.h
index de874193737..83e68d9c620 100644
--- a/sbin/disklabel/extern.h
+++ b/sbin/disklabel/extern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.11 2009/10/21 01:07:46 snj Exp $ */
+/* $NetBSD: extern.h,v 1.12 2013/01/17 18:33:58 christos Exp $ */
/*
* Copyright (c) 1997 Christos Zoulas. All rights reserved.
@@ -34,3 +34,15 @@ int list_fs_types(void);
extern char specname[];
extern int Cflag;
+
+#ifdef HAVE_NBTOOL_CONFIG_H
+static int
+dk_ioctl(int f, void *arg)
+{
+ errno = ENOTTY;
+ return -1;
+}
+# define dk_ioctl(f, cmd, arg) dk_ioctl(f, arg)
+#else
+# define dk_ioctl(f, cmd, arg) ioctl(f, cmd, arg)
+#endif /* HAVE_NBTOOL_CONFIG_H */
diff --git a/sbin/disklabel/interact.c b/sbin/disklabel/interact.c
index 87bd1c574d9..5b0fadcb73e 100644
--- a/sbin/disklabel/interact.c
+++ b/sbin/disklabel/interact.c
@@ -1,4 +1,4 @@
-/* $NetBSD: interact.c,v 1.36 2013/01/15 23:52:48 christos Exp $ */
+/* $NetBSD: interact.c,v 1.37 2013/01/17 18:33:58 christos Exp $ */
/*
* Copyright (c) 1997 Christos Zoulas. All rights reserved.
@@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: interact.c,v 1.36 2013/01/15 23:52:48 christos Exp $");
+__RCSID("$NetBSD: interact.c,v 1.37 2013/01/17 18:33:58 christos Exp $");
#endif /* lint */
#include <sys/param.h>
@@ -112,7 +112,7 @@ cmd_adjust(struct disklabel *lp, char *s, int fd)
{
struct disklabel dl;
- if (ioctl(fd, DIOCGDEFLABEL, &dl) == -1) {
+ if (dk_ioctl(fd, DIOCGDEFLABEL, &dl) == -1) {
warn("Cannot get default label");
return;
}
diff --git a/sbin/disklabel/main.c b/sbin/disklabel/main.c
index e17fe62fa90..cec2cfd822d 100644
--- a/sbin/disklabel/main.c
+++ b/sbin/disklabel/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.27 2012/04/08 07:59:53 cyber Exp $ */
+/* $NetBSD: main.c,v 1.28 2013/01/17 18:33:58 christos Exp $ */
/*
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\
static char sccsid[] = "@(#)disklabel.c 8.4 (Berkeley) 5/4/95";
/* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */
#else
-__RCSID("$NetBSD: main.c,v 1.27 2012/04/08 07:59:53 cyber Exp $");
+__RCSID("$NetBSD: main.c,v 1.28 2013/01/17 18:33:58 christos Exp $");
#endif
#endif /* not lint */
@@ -214,16 +214,6 @@ opendisk(const char *path, int flags, char *buf, int buflen, int cooked)
strlcpy(buf, path, buflen);
return f;
}
-
-static int
-dk_ioctl(int f, void *arg)
-{
- errno = ENOTTY;
- return -1;
-}
-#define dk_ioctl(f, cmd, arg) dk_ioctl(f, arg)
-#else
-#define dk_ioctl(f, cmd, arg) ioctl(f, cmd, arg)
#endif /* HAVE_NBTOOL_CONFIG_H */
static daddr_t