summaryrefslogtreecommitdiff
path: root/sbin/pdisk
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2016-01-16 14:49:29 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2016-01-16 14:49:29 +0000
commit93a7e82b135f84d29c5c05397f36ff9fd8bbcf53 (patch)
tree4c2258baa37a2a2836ff6d82b3a661532ffbf978 /sbin/pdisk
parent6bc6d8a53bb0ed6763c7deedd1b63cb8dc8a086d (diff)
Nuke support for 1024- and 2048-byte sector devices. Error out if
anything other than 512-byte sectors are encountered. Unlink deblock_media.c from the build. ok jasper@
Diffstat (limited to 'sbin/pdisk')
-rw-r--r--sbin/pdisk/Makefile4
-rw-r--r--sbin/pdisk/file_media.c9
-rw-r--r--sbin/pdisk/partition_map.c5
-rw-r--r--sbin/pdisk/validate.c4
4 files changed, 8 insertions, 14 deletions
diff --git a/sbin/pdisk/Makefile b/sbin/pdisk/Makefile
index 8fa9556998a..076e4e00f14 100644
--- a/sbin/pdisk/Makefile
+++ b/sbin/pdisk/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.17 2016/01/15 16:39:20 krw Exp $
+# $Id: Makefile,v 1.18 2016/01/16 14:49:28 krw Exp $
.if ${MACHINE} == "macppc"
PROG= pdisk
@@ -6,7 +6,7 @@ LDADD= -lutil
DPADD= ${LIBUTIL}
CFLAGS+=-Wall
-SRCS= convert.c deblock_media.c dump.c \
+SRCS= convert.c dump.c \
file_media.c io.c media.c partition_map.c \
pdisk.c validate.c
diff --git a/sbin/pdisk/file_media.c b/sbin/pdisk/file_media.c
index e79e08b11e5..1c5074ae38f 100644
--- a/sbin/pdisk/file_media.c
+++ b/sbin/pdisk/file_media.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file_media.c,v 1.20 2016/01/15 23:16:40 krw Exp $ */
+/* $OpenBSD: file_media.c,v 1.21 2016/01/16 14:49:28 krw Exp $ */
/*
* file_media.c -
@@ -71,10 +71,6 @@ struct file_media_globals {
/*
* Global Constants
*/
-int potential_block_sizes[] = {
- 1, 512, 1024, 2048,
- 0
-};
/*
@@ -129,6 +125,9 @@ compute_block_size(int fd, char *name)
if (ioctl(fd, DIOCGPDINFO, &dl) == -1)
err(1, "can't get disklabel for %s", name);
+ if (dl.d_secsize != DEV_BSIZE)
+ err(1, "%u-byte sector size not supported", dl.d_secsize);
+
return (dl.d_secsize);
}
diff --git a/sbin/pdisk/partition_map.c b/sbin/pdisk/partition_map.c
index 516c8194a3d..ca6cc205124 100644
--- a/sbin/pdisk/partition_map.c
+++ b/sbin/pdisk/partition_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: partition_map.c,v 1.20 2016/01/15 23:05:00 krw Exp $ */
+/* $OpenBSD: partition_map.c,v 1.21 2016/01/16 14:49:28 krw Exp $ */
//
// partition_map.c - partition map routines
@@ -52,7 +52,6 @@
#include <errno.h>
#include "partition_map.h"
-#include "deblock_media.h"
#include "io.h"
#include "convert.h"
#include "file_media.h"
@@ -149,7 +148,6 @@ open_partition_map(char *name, int *valid_file)
map->base_order = NULL;
map->physical_block = media_granularity(m); /* preflight */
- m = open_deblock_media(DEV_BSIZE, m);
map->m = m;
map->misc = malloc(DEV_BSIZE);
if (map->misc == NULL) {
@@ -425,7 +423,6 @@ create_partition_map(char *name, partition_map_header *oldmap)
} else {
size = media_granularity(m);
}
- m = open_deblock_media(DEV_BSIZE, m);
map->m = m;
if (map->physical_block > MAXIOSIZE) {
map->physical_block = MAXIOSIZE;
diff --git a/sbin/pdisk/validate.c b/sbin/pdisk/validate.c
index 8afe03c6da8..d2429a0d10c 100644
--- a/sbin/pdisk/validate.c
+++ b/sbin/pdisk/validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: validate.c,v 1.11 2016/01/15 23:05:00 krw Exp $ */
+/* $OpenBSD: validate.c,v 1.12 2016/01/16 14:49:28 krw Exp $ */
//
// validate.c -
@@ -42,7 +42,6 @@
#include <errno.h>
#include "validate.h"
-#include "deblock_media.h"
#include "convert.h"
#include "io.h"
#include "file_media.h"
@@ -360,7 +359,6 @@ validate_map(partition_map_header *map)
if (g < DEV_BSIZE) {
g = DEV_BSIZE;
}
- the_media = open_deblock_media(DEV_BSIZE, the_media);
buffer = malloc(DEV_BSIZE);
if (buffer == NULL) {