From c1b3d37c2c0ee35d99bb2518c4469cbaac12c1b8 Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Thu, 30 Apr 2009 00:45:01 +0000 Subject: Prime mountpoint info with any fstab info that is available, with or without the '-f' option being present. Now you can see in Editor mode or 'disklabel ' where the partitions that exist will be mounted in the current configuration. Tweaks (and libc fixes) from, and ok deraadt@ --- sbin/disklabel/disklabel.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'sbin/disklabel/disklabel.c') diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 7b6ca373533..36eabd82977 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.c,v 1.151 2009/04/12 01:01:24 krw Exp $ */ +/* $OpenBSD: disklabel.c,v 1.152 2009/04/30 00:45:00 krw Exp $ */ /* * Copyright (c) 1987, 1993 @@ -39,7 +39,7 @@ static const char copyright[] = #endif /* not lint */ #ifndef lint -static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.151 2009/04/12 01:01:24 krw Exp $"; +static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.152 2009/04/30 00:45:00 krw Exp $"; #endif /* not lint */ #include @@ -62,6 +62,7 @@ static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.151 2009/04/12 01:01:24 k #include #include #include +#include #include "pathnames.h" #include "extern.h" @@ -139,9 +140,11 @@ u_int64_t getnum(char *, u_int64_t, u_int64_t, const char **); int main(int argc, char *argv[]) { - int ch, f, writeable, error = 0; + int ch, f, i, writeable, error = 0; struct disklabel *lp; + struct fstab *fsent; FILE *t; + char *partname; while ((ch = getopt(argc, argv, "ABEf:NRWb:cdenp:s:tvw")) != -1) switch (ch) { @@ -241,6 +244,17 @@ main(int argc, char *argv[]) if (f < 0) err(4, "%s", specname); + asprintf(&partname, "/dev/%s%c", dkname, 'a'); + setfsent(); + for (i = 0; i < MAXPARTITIONS; i++) { + partname[strlen(dkname)+5] = 'a'+i; + fsent = getfsspec(partname); + if (fsent) + mountpoints[i] = strdup(fsent->fs_file); + } + endfsent(); + free(partname); + #ifdef DOSLABEL /* * Check for presence of DOS partition table in -- cgit v1.2.3