Source-Changes-HG archive

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

[src/trunk]: src/sbin/fdisk Really don't include ioctl code for tools build.



details:   https://anonhg.NetBSD.org/src/rev/c60031348c43
branches:  trunk
changeset: 356557:c60031348c43
user:      joerg <joerg%NetBSD.org@localhost>
date:      Mon Oct 02 22:02:05 2017 +0000

description:
Really don't include ioctl code for tools build.

diffstat:

 sbin/fdisk/fdisk.c |  24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diffs (90 lines):

diff -r ecb4ac9834bc -r c60031348c43 sbin/fdisk/fdisk.c
--- a/sbin/fdisk/fdisk.c        Mon Oct 02 21:55:35 2017 +0000
+++ b/sbin/fdisk/fdisk.c        Mon Oct 02 22:02:05 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdisk.c,v 1.153 2015/11/22 15:53:10 christos Exp $ */
+/*     $NetBSD: fdisk.c,v 1.154 2017/10/02 22:02:05 joerg Exp $ */
 
 /*
  * Mach Operating System
@@ -39,7 +39,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: fdisk.c,v 1.153 2015/11/22 15:53:10 christos Exp $");
+__RCSID("$NetBSD: fdisk.c,v 1.154 2017/10/02 22:02:05 joerg Exp $");
 #endif /* not lint */
 
 #define MBRPTYPENAMES
@@ -58,6 +58,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <vis.h>
+#include <zlib.h>
 
 #if !HAVE_NBTOOL_CONFIG_H
 #include <sys/disklabel.h>
@@ -67,7 +68,6 @@
 #include <sys/sysctl.h>
 #include <disktab.h>
 #include <util.h>
-#include <zlib.h>
 #else
 #include <nbinclude/sys/disklabel.h>
 #include <nbinclude/sys/disklabel_gpt.h>
@@ -75,15 +75,6 @@
 #include "../../include/disktab.h"
 /* We enforce -F, so none of these possibly undefined items can be needed */
 #define opendisk(path, fl, buf, buflen, cooked) (-1)
-#ifndef DIOCGDEFLABEL
-#define DIOCGDEFLABEL 0
-#endif
-#ifndef DIOCGDINFO
-#define DIOCGDINFO 0
-#endif
-#ifndef DIOCWLABEL
-#define DIOCWLABEL 0
-#endif
 #endif /* HAVE_NBTOOL_CONFIG_H */
 
 #ifndef        DEFAULT_BOOTDIR
@@ -2650,13 +2641,16 @@
                disklabel.d_ntracks = dos_heads;
                disklabel.d_secsize = 512;
                disklabel.d_nsectors = dos_sectors;
-       } else if (ioctl(fd, DIOCGDEFLABEL, &disklabel) == -1) {
+       }
+#if !HAVE_NBTOOL_CONFIG_H
+       else if (ioctl(fd, DIOCGDEFLABEL, &disklabel) == -1) {
                warn("DIOCGDEFLABEL");
                if (ioctl(fd, DIOCGDINFO, &disklabel) == -1) {
                        warn("DIOCGDINFO");
                        return (-1);
                }
        }
+#endif
 
        disksectors = disklabel.d_secperunit;
        cylinders = disklabel.d_ncylinders;
@@ -2813,8 +2807,10 @@
         * sector 0. (e.g. empty disk)
         */
        flag = 1;
+#if !HAVE_NBTOOL_CONFIG_H
        if (wfd == fd && F_flag == 0 && ioctl(wfd, DIOCWLABEL, &flag) < 0)
                warn("DIOCWLABEL");
+#endif
        if (write_disk(0, &mboot) == -1) {
                warn("Can't write fdisk partition table");
                goto protect_label;
@@ -2835,8 +2831,10 @@
        rval = 0;
     protect_label:
        flag = 0;
+#if !HAVE_NBTOOL_CONFIG_H
        if (wfd == fd && F_flag == 0 && ioctl(wfd, DIOCWLABEL, &flag) < 0)
                warn("DIOCWLABEL");
+#endif
        return rval;
 }
 



Home | Main Index | Thread Index | Old Index