Module Name: src
Committed By: jnemeth
Date: Wed Nov 27 01:47:53 UTC 2013
Modified Files:
src/sbin/gpt: add.c biosboot.c gpt.c gpt.h label.c remove.c resize.c
Log Message:
Remove FreeBSD specific code as per message to tech-userlevel.
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sbin/gpt/add.c
cvs rdiff -u -r1.6 -r1.7 src/sbin/gpt/biosboot.c
cvs rdiff -u -r1.23 -r1.24 src/sbin/gpt/gpt.c
cvs rdiff -u -r1.7 -r1.8 src/sbin/gpt/gpt.h
cvs rdiff -u -r1.12 -r1.13 src/sbin/gpt/label.c
cvs rdiff -u -r1.10 -r1.11 src/sbin/gpt/remove.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/gpt/resize.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/gpt/add.c
diff -u src/sbin/gpt/add.c:1.19 src/sbin/gpt/add.c:1.20
--- src/sbin/gpt/add.c:1.19 Fri Nov 22 04:21:02 2013
+++ src/sbin/gpt/add.c Wed Nov 27 01:47:53 2013
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: add.c,v 1.19 2013/11/22 04:21:02 jnemeth Exp $");
+__RCSID("$NetBSD: add.c,v 1.20 2013/11/27 01:47:53 jnemeth Exp $");
#endif
#include <sys/types.h>
@@ -182,15 +182,10 @@ add(int fd)
gpt_write(fd, lbt);
gpt_write(fd, tpg);
-#ifdef __FreeBSD__
- printf("%sp%u added\n", device_name, i + 1);
-#endif
-#ifdef __NetBSD__
printf("Partition added, use:\n");
printf("\tdkctl %s addwedge <wedgename> %" PRIu64 " %" PRIu64
" <type>\n", device_arg, map->map_start, map->map_size);
printf("to create a wedge for it\n");
-#endif
}
int
Index: src/sbin/gpt/biosboot.c
diff -u src/sbin/gpt/biosboot.c:1.6 src/sbin/gpt/biosboot.c:1.7
--- src/sbin/gpt/biosboot.c:1.6 Sat Apr 13 18:25:56 2013
+++ src/sbin/gpt/biosboot.c Wed Nov 27 01:47:53 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: biosboot.c,v 1.6 2013/04/13 18:25:56 jakllsch Exp $ */
+/* $NetBSD: biosboot.c,v 1.7 2013/11/27 01:47:53 jnemeth Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#ifdef __RCSID
-__RCSID("$NetBSD: biosboot.c,v 1.6 2013/04/13 18:25:56 jakllsch Exp $");
+__RCSID("$NetBSD: biosboot.c,v 1.7 2013/11/27 01:47:53 jnemeth Exp $");
#endif
#include <sys/stat.h>
@@ -291,7 +291,6 @@ cmd_biosboot(int argc, char *argv[])
start = 0;
size = 0;
-#ifdef __NetBSD__
/*
* If a dk wedge was specified, loader should be
* installed onto parent device
@@ -315,7 +314,6 @@ cmd_biosboot(int argc, char *argv[])
#endif
close:
close(fd);
-#endif /* __NetBSD__*/
fd = gpt_open(dev);
next:
Index: src/sbin/gpt/gpt.c
diff -u src/sbin/gpt/gpt.c:1.23 src/sbin/gpt/gpt.c:1.24
--- src/sbin/gpt/gpt.c:1.23 Sat Nov 23 08:59:04 2013
+++ src/sbin/gpt/gpt.c Wed Nov 27 01:47:53 2013
@@ -31,7 +31,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: gpt.c,v 1.23 2013/11/23 08:59:04 jnemeth Exp $");
+__RCSID("$NetBSD: gpt.c,v 1.24 2013/11/27 01:47:53 jnemeth Exp $");
#endif
#include <sys/param.h>
@@ -49,12 +49,10 @@ __RCSID("$NetBSD: gpt.c,v 1.23 2013/11/2
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#ifdef __NetBSD__
#include <util.h>
#include <ctype.h>
#include <prop/proplib.h>
#include <sys/drvctlio.h>
-#endif
#include "map.h"
#include "gpt.h"
@@ -241,40 +239,6 @@ utf8_to_utf16(const uint8_t *s8, uint16_
} while (c != 0);
}
-#ifndef __NetBSD__
-void
-le_uuid_dec(void const *buf, uuid_t *uuid)
-{
- u_char const *p;
- int i;
-
- p = buf;
- uuid->time_low = le32dec(p);
- uuid->time_mid = le16dec(p + 4);
- uuid->time_hi_and_version = le16dec(p + 6);
- uuid->clock_seq_hi_and_reserved = p[8];
- uuid->clock_seq_low = p[9];
- for (i = 0; i < _UUID_NODE_LEN; i++)
- uuid->node[i] = p[10 + i];
-}
-
-void
-le_uuid_enc(void *buf, uuid_t const *uuid)
-{
- u_char *p;
- int i;
-
- p = buf;
- le32enc(p, uuid->time_low);
- le16enc(p + 4, uuid->time_mid);
- le16enc(p + 6, uuid->time_hi_and_version);
- p[8] = uuid->clock_seq_hi_and_reserved;
- p[9] = uuid->clock_seq_low;
- for (i = 0; i < _UUID_NODE_LEN; i++)
- p[10 + i] = uuid->node[i];
-}
-
-#endif
int
parse_uuid(const char *s, uuid_t *uuid)
{
@@ -486,7 +450,6 @@ gpt_mbr(int fd, off_t lba)
return (0);
}
-#ifdef __NetBSD__
static int
drvctl(const char *name, u_int *sector_size, off_t *media_size)
{
@@ -569,7 +532,6 @@ out:
errno = EINVAL;
return -1;
}
-#endif
static int
gpt_gpt(int fd, off_t lba, int found)
@@ -682,19 +644,6 @@ gpt_open(const char *dev)
mode = readonly ? O_RDONLY : O_RDWR|O_EXCL;
device_arg = dev;
-#ifdef __FreeBSD__
- strlcpy(device_path, dev, sizeof(device_path));
- if ((fd = open(device_path, mode)) != -1)
- goto found;
-
- snprintf(device_path, sizeof(device_path), "%s%s", _PATH_DEV, dev);
- device_name = device_path + strlen(_PATH_DEV);
- if ((fd = open(device_path, mode)) != -1)
- goto found;
- return (-1);
- found:
-#endif
-#ifdef __NetBSD__
fd = opendisk(dev, mode, device_path, sizeof(device_path), 0);
if (fd == -1)
return -1;
@@ -702,7 +651,6 @@ gpt_open(const char *dev)
device_name = device_path + strlen(_PATH_DEV);
else
device_name = device_path;
-#endif
if (fstat(fd, &sb) == -1)
goto close;
@@ -713,10 +661,8 @@ gpt_open(const char *dev)
ioctl(fd, DIOCGMEDIASIZE, &mediasz) == -1)
goto close;
#endif
-#ifdef __NetBSD__
if (drvctl(device_name, &secsz, &mediasz) == -1)
goto close;
-#endif
} else {
secsz = 512; /* Fixed size for files. */
if (sb.st_size % secsz) {
Index: src/sbin/gpt/gpt.h
diff -u src/sbin/gpt/gpt.h:1.7 src/sbin/gpt/gpt.h:1.8
--- src/sbin/gpt/gpt.h:1.7 Wed Nov 20 08:08:47 2013
+++ src/sbin/gpt/gpt.h Wed Nov 27 01:47:53 2013
@@ -30,30 +30,15 @@
#define _GPT_H_
#include <sys/endian.h>
-#ifdef __FreeBSD__
-#include <sys/gpt.h>
-/*
- * XXX struct gpt_hdr is not a multiple of 8 bytes in size and thus
- * contains padding we must not include in the size.
- */
-#define GPT_SIZE offsetof(struct gpt_hdr, padding)
-#endif
-#ifdef __NetBSD__
#include <sys/disklabel_gpt.h>
#define GPT_SIZE GPT_HDR_SIZE
#define hdr_uuid hdr_guid
#define ent_uuid ent_guid
-#endif
#include <uuid.h>
-#ifdef __NetBSD__
#define le_uuid_dec uuid_dec_le
#define le_uuid_enc uuid_enc_le
-#else
-void le_uuid_dec(void const *, uuid_t *);
-void le_uuid_enc(void *, uuid_t const *);
-#endif
int parse_uuid(const char *, uuid_t *);
struct mbr_part {
Index: src/sbin/gpt/label.c
diff -u src/sbin/gpt/label.c:1.12 src/sbin/gpt/label.c:1.13
--- src/sbin/gpt/label.c:1.12 Fri Nov 22 04:21:02 2013
+++ src/sbin/gpt/label.c Wed Nov 27 01:47:53 2013
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/label.c,v 1.3 2006/10/04 18:20:25 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: label.c,v 1.12 2013/11/22 04:21:02 jnemeth Exp $");
+__RCSID("$NetBSD: label.c,v 1.13 2013/11/27 01:47:53 jnemeth Exp $");
#endif
#include <sys/types.h>
@@ -144,13 +144,8 @@ label(int fd)
gpt_write(fd, lbt);
gpt_write(fd, tpg);
-#ifdef __FreeBSD__
- printf("%sp%u labeled\n", device_name, m->map_index);
-#endif
-#ifdef __NetBSD__
printf("partition %d on %s labeled %s\n", m->map_index,
device_name, name);
-#endif
}
}
Index: src/sbin/gpt/remove.c
diff -u src/sbin/gpt/remove.c:1.10 src/sbin/gpt/remove.c:1.11
--- src/sbin/gpt/remove.c:1.10 Fri Nov 22 04:21:02 2013
+++ src/sbin/gpt/remove.c Wed Nov 27 01:47:53 2013
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/remove.c,v 1.10 2006/10/04 18:20:25 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: remove.c,v 1.10 2013/11/22 04:21:02 jnemeth Exp $");
+__RCSID("$NetBSD: remove.c,v 1.11 2013/11/27 01:47:53 jnemeth Exp $");
#endif
#include <sys/types.h>
@@ -143,13 +143,8 @@ rem(int fd)
gpt_write(fd, lbt);
gpt_write(fd, tpg);
-#ifdef __FreeBSD__
- printf("%sp%u removed\n", device_name, m->map_index);
-#endif
-#ifdef __NetBSD__
printf("partition %d removed from %s\n", m->map_index,
device_name);
-#endif
}
}
Index: src/sbin/gpt/resize.c
diff -u src/sbin/gpt/resize.c:1.2 src/sbin/gpt/resize.c:1.3
--- src/sbin/gpt/resize.c:1.2 Fri Nov 22 03:50:05 2013
+++ src/sbin/gpt/resize.c Wed Nov 27 01:47:53 2013
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/add.c,v 1.14 2006/06/22 22:05:28 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: resize.c,v 1.2 2013/11/22 03:50:05 jnemeth Exp $");
+__RCSID("$NetBSD: resize.c,v 1.3 2013/11/27 01:47:53 jnemeth Exp $");
#endif
#include <sys/types.h>
@@ -167,15 +167,10 @@ resize(int fd)
gpt_write(fd, lbt);
gpt_write(fd, tpg);
-#ifdef __FreeBSD__
- printf("%sp%u resized\n", device_name, i + 1);
-#endif
-#ifdef __NetBSD__
printf("Partition resized, use:\n");
printf("\tdkctl %s addwedge <wedgename> %" PRIu64 " %" PRIu64
" <type>\n", device_arg, map->map_start, newsize);
printf("to create a wedge for it\n");
-#endif
}
int