diff options
author | 2016-01-29 14:26:42 +0000 | |
---|---|---|
committer | 2016-01-29 14:26:42 +0000 | |
commit | 15055065154d3e13bf5a8a5c45d31be616caadd1 (patch) | |
tree | d4577c3b5e9abad4571e26fb26d39998ac23c3fd | |
parent | remove unused field (diff) | |
download | wireguard-openbsd-15055065154d3e13bf5a8a5c45d31be616caadd1.tar.xz wireguard-openbsd-15055065154d3e13bf5a8a5c45d31be616caadd1.zip |
Conform to Apple Mac OS X's behaviour of setting dpme_flags on free
partitions to 0, and setting them to VALID | ALLOCATED on the map
partition.
-rw-r--r-- | sbin/pdisk/partition_map.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sbin/pdisk/partition_map.c b/sbin/pdisk/partition_map.c index d4aafc0ec54..0409a1bab5e 100644 --- a/sbin/pdisk/partition_map.c +++ b/sbin/pdisk/partition_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: partition_map.c,v 1.81 2016/01/29 12:16:41 krw Exp $ */ +/* $OpenBSD: partition_map.c,v 1.82 2016/01/29 14:26:42 krw Exp $ */ /* * partition_map.c - partition map routines @@ -323,10 +323,7 @@ create_partition_map(int fd, char *name, u_int64_t mediasz, uint32_t sectorsz) dpme->dpme_pblocks = map->media_size - 1; strlcpy(dpme->dpme_type, kFreeType, sizeof(dpme->dpme_type)); - dpme->dpme_lblock_start = 0; - dpme->dpme_lblocks = dpme->dpme_pblocks; - dpme->dpme_flags = DPME_WRITABLE | DPME_READABLE | - DPME_VALID; + dpme_init_flags(dpme); if (add_data_to_map(dpme, 1, map) == 0) { free(dpme); @@ -485,12 +482,15 @@ create_dpme(const char *name, const char *dptype, uint32_t base, void dpme_init_flags(struct dpme *dpme) { - /* XXX this is gross, fix it! */ - if (strncasecmp(dpme->dpme_type, kHFSType, DPISTRLEN) == 0) + if (strncasecmp(dpme->dpme_type, kFreeType, DPISTRLEN) == 0) + dpme->dpme_flags = 0; + else if (strncasecmp(dpme->dpme_type, kMapType, DPISTRLEN) == 0) + dpme->dpme_flags = DPME_VALID | DPME_ALLOCATED; + else if (strncasecmp(dpme->dpme_type, kHFSType, DPISTRLEN) == 0) dpme->dpme_flags = APPLE_HFS_FLAGS_VALUE; else - dpme->dpme_flags = DPME_WRITABLE | DPME_READABLE | - DPME_ALLOCATED | DPME_VALID; + dpme->dpme_flags = DPME_VALID | DPME_ALLOCATED | + DPME_READABLE | DPME_WRITABLE; } void |