diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2009-01-11 19:44:58 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2009-01-11 19:44:58 +0000 |
commit | 8c73d12e4ebe3d849dd814c8d6532a4256cedda9 (patch) | |
tree | 00cbee15f3072fa69cb5af51bce146cda18e30a8 /sbin/disklabel/editor.c | |
parent | f4c08b2bdaae60f2d643527d5821429adcd29729 (diff) |
On *ppc disks shared with MacOS, walk the Apple partition map to find out
the bounds of the OpenBSD area. Should prevent users from shooting themselves
in the feet.
ok krw@
Diffstat (limited to 'sbin/disklabel/editor.c')
-rw-r--r-- | sbin/disklabel/editor.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index 606222b7f87..97a0b3ecf08 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.173 2008/12/07 18:31:29 cnst Exp $ */ +/* $OpenBSD: editor.c,v 1.174 2009/01/11 19:44:57 miod Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com> @@ -17,7 +17,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: editor.c,v 1.173 2008/12/07 18:31:29 cnst Exp $"; +static char rcsid[] = "$OpenBSD: editor.c,v 1.174 2009/01/11 19:44:57 miod Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -1344,6 +1344,8 @@ free_chunks(struct disklabel *lp) void find_bounds(struct disklabel *lp) { + int has_bounds = 0; + /* Defaults */ /* XXX - reserve a cylinder for hp300? */ starting_sector = 0; @@ -1385,16 +1387,29 @@ find_bounds(struct disklabel *lp) starting_sector = 63; } + has_bounds = 1; + } +#endif +#ifdef DPMELABEL + if (dpme_label) { + starting_sector = dpme_obsd_start; + ending_sector = dpme_obsd_start + dpme_obsd_size; + has_bounds = 1; + } +#endif + + if (has_bounds) { printf("Treating sectors %llu-%llu as the OpenBSD portion of the " "disk.\nYou can use the 'b' command to change this.\n\n", starting_sector, ending_sector); - } -#elif (NUMBOOT == 1) - /* Boot blocks take up the first cylinder */ - starting_sector = lp->d_secpercyl; - printf("Reserving the first data cylinder for boot blocks.\n" - "You can use the 'b' command to change this.\n\n"); + } else { +#if (NUMBOOT == 1) + /* Boot blocks take up the first cylinder */ + starting_sector = lp->d_secpercyl; + printf("Reserving the first data cylinder for boot blocks.\n" + "You can use the 'b' command to change this.\n\n"); #endif + } } /* |