Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sbin/gpt Pull up following revision(s) (requested by jnem...
details: https://anonhg.NetBSD.org/src/rev/e4ed00da2139
branches: netbsd-7
changeset: 799448:e4ed00da2139
user: snj <snj%NetBSD.org@localhost>
date: Mon Jun 29 17:24:28 2015 +0000
description:
Pull up following revision(s) (requested by jnemeth in ticket #847):
sbin/gpt/recover.c: revision 1.6
Instruct user to use resizedisk if media size has changed, as
resizedisk will adjust the media size in the headers, whereas
recover simply copies the existing header over the missing one.
XXX recover and resizedisk should probably be merged (even if just
partially, so that recover can properly handle media size changes).
Also, reading in the GPT should probably be centralised so that
error handling can be centralised, and users aren't given misleading
messages (i.e. they aren't told to run recover when they should be
running resizedisk). However, something that can be quickly pulled
up to netbsd-7 was needed, and there isn't time for a major overhaul
or rewrite.
diffstat:
sbin/gpt/recover.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (35 lines):
diff -r 61f09a0f2308 -r e4ed00da2139 sbin/gpt/recover.c
--- a/sbin/gpt/recover.c Mon Jun 29 17:21:27 2015 +0000
+++ b/sbin/gpt/recover.c Mon Jun 29 17:24:28 2015 +0000
@@ -33,7 +33,7 @@
__FBSDID("$FreeBSD: src/sbin/gpt/recover.c,v 1.8 2005/08/31 01:47:19 marcel Exp $");
#endif
#ifdef __RCSID
-__RCSID("$NetBSD: recover.c,v 1.4.20.1 2015/06/02 19:49:38 snj Exp $");
+__RCSID("$NetBSD: recover.c,v 1.4.20.2 2015/06/29 17:24:28 snj Exp $");
#endif
#include <sys/types.h>
@@ -64,7 +64,7 @@
static void
recover(int fd)
{
- off_t last;
+ uint64_t last;
map_t *gpt, *tpg;
map_t *tbl, *lbt;
struct gpt_hdr *hdr;
@@ -92,6 +92,13 @@
last = mediasz / secsz - 1LL;
+ if (gpt != NULL &&
+ ((struct gpt_hdr *)(gpt->map_data))->hdr_lba_alt != last) {
+ warnx("%s: media size has changed, please use 'gpt resizedisk'",
+ device_name);
+ return;
+ }
+
if (tbl != NULL && lbt == NULL) {
lbt = map_add(last - tbl->map_size, tbl->map_size,
MAP_TYPE_SEC_GPT_TBL, tbl->map_data);
Home |
Main Index |
Thread Index |
Old Index