Rototil the way disklabel -r reads and writes labels.
In particular the 'read' part plays 'hunt the disklabel' in order to get a label into a local buffer - from where it can be displayed/edited. The 'write' part makes a separate scan of the disk looking for places to write the label. The main changes are: - It can no longer write the first 8k of the mbr to the pbr (or v.v.) - All labels on the disk (that it can find) get updated during a write - With -A all the labels are displayed (inc. those deleted by -D) - Addition of -D which will delete (by one's complimenting dk_magic{2}) and existing labels before writing labels to the expected locations. - -v gives some verbose output to stderr, -vv more etc A better basis for processing incorrect endian labels, or labels from other architectures.
This commit is contained in:
parent
f4737f1020
commit
65151c95f1
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.57 2005/06/23 00:54:47 fvdl Exp $
|
||||
# $NetBSD: Makefile,v 1.58 2005/10/19 21:22:21 dsl Exp $
|
||||
# @(#)Makefile 8.2 (Berkeley) 3/17/94
|
||||
|
||||
PROG= disklabel
|
||||
|
@ -15,11 +15,6 @@ LDADD+= -lutil
|
|||
CPPFLAGS+= -DSTRICT_CYLINDER_ALIGNMENT
|
||||
.endif
|
||||
|
||||
.if (${MACHINE} == "alpha") || (${MACHINE} == "x68k") || (${MACHINE} == "hp700")
|
||||
# preserve the non-disklabel portions of the first 8KB of the disk
|
||||
CPPFLAGS+= -DSAVEBOOTAREA
|
||||
.endif
|
||||
|
||||
.if ( 0 \
|
||||
|| ${MACHINE} == "acorn26" \
|
||||
|| ${MACHINE} == "acorn32" \
|
||||
|
@ -40,8 +35,6 @@ CPPFLAGS+= -DSAVEBOOTAREA
|
|||
)
|
||||
# use MBR partition info
|
||||
CPPFLAGS+= -DUSE_MBR
|
||||
# preserve the non-disklabel portions of the first 8KB of the disk
|
||||
CPPFLAGS+= -DSAVEBOOTAREA
|
||||
# recognize old MBR partition ID for a while
|
||||
CPPFLAGS+= -DCOMPAT_386BSD_MBRPART
|
||||
.endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: extern.h,v 1.8 2001/12/13 13:52:13 reinoud Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.9 2005/10/19 21:22:21 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Christos Zoulas. All rights reserved.
|
||||
|
@ -29,13 +29,12 @@
|
|||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
int writelabel(int, char *, struct disklabel *);
|
||||
int writelabel(int, struct disklabel *);
|
||||
int checklabel(struct disklabel *);
|
||||
void showinfo(FILE *, struct disklabel *, const char *);
|
||||
void showpartitions(FILE *, struct disklabel *, int);
|
||||
void showpartition(FILE *, struct disklabel *, int, int);
|
||||
void interact(struct disklabel *, int);
|
||||
|
||||
extern char bootarea[];
|
||||
extern char *specname;
|
||||
extern char specname[];
|
||||
extern int Cflag;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: interact.c,v 1.26 2005/06/27 01:00:05 christos Exp $ */
|
||||
/* $NetBSD: interact.c,v 1.27 2005/10/19 21:22:21 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Christos Zoulas. All rights reserved.
|
||||
|
@ -35,7 +35,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: interact.c,v 1.26 2005/06/27 01:00:05 christos Exp $");
|
||||
__RCSID("$NetBSD: interact.c,v 1.27 2005/10/19 21:22:21 dsl Exp $");
|
||||
#endif /* lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -571,7 +571,7 @@ cmd_label(struct disklabel *lp, char *s, int fd)
|
|||
return;
|
||||
}
|
||||
|
||||
if (writelabel(fd, bootarea, lp) != 0) {
|
||||
if (writelabel(fd, lp) != 0) {
|
||||
printf("Label not written\n");
|
||||
return;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue