diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-10-03 22:01:49 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-10-03 22:01:49 +0000 |
commit | 8b55bcf0021cb7786125a57c11a8f840a3089a9a (patch) | |
tree | c5b7bd76e7395aa32a6f3f5cb08aca2362caff33 /sbin/disklabel | |
parent | 2847382ad0f79d42676104f5b99c1b14a78a5b90 (diff) |
Add DIOCGPDINFO ioctl and use it in disklabel's new -p mode
Diffstat (limited to 'sbin/disklabel')
-rw-r--r-- | sbin/disklabel/disklabel.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 73791eb7493..2c19bb3eb44 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.c,v 1.55 1998/09/11 04:02:27 millert Exp $ */ +/* $OpenBSD: disklabel.c,v 1.56 1998/10/03 22:01:47 millert Exp $ */ /* $NetBSD: disklabel.c,v 1.30 1996/03/14 19:49:24 ghudson Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -static char rcsid[] = "$OpenBSD: disklabel.c,v 1.55 1998/09/11 04:02:27 millert Exp $"; +static char rcsid[] = "$OpenBSD: disklabel.c,v 1.56 1998/10/03 22:01:47 millert Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -107,6 +107,7 @@ enum { UNSPEC, EDIT, EDITOR, READ, RESTORE, SETWRITEABLE, WRITE, WRITEBOOT } op = UNSPEC; +int pflag; int rflag; int tflag; int nwflag; @@ -147,7 +148,7 @@ main(argc, argv) struct disklabel *lp; FILE *t; - while ((ch = getopt(argc, argv, "BENRWb:enrs:tvw")) != -1) + while ((ch = getopt(argc, argv, "BENRWb:enprs:tvw")) != -1) switch (ch) { #if NUMBOOT > 0 case 'B': @@ -189,6 +190,9 @@ main(argc, argv) usage(); op = EDIT; break; + case 'p': + ++pflag; + break; case 'r': ++rflag; break; @@ -712,6 +716,10 @@ readlabel(f) } warnx(msg); return(NULL); + } else if (pflag) { + lp = &lab; + if (ioctl(f, DIOCGPDINFO, lp) < 0) + err(4, "ioctl DIOCGPDINFO"); } else { lp = &lab; if (ioctl(f, DIOCGDINFO, lp) < 0) |