diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2010-08-12 15:26:35 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2010-08-12 15:26:35 +0000 |
commit | 28df7a8f22deae9662a3826a934c7533f9078393 (patch) | |
tree | edc8ba4521c676be4869d68359d35369e4cc8848 /sbin/fsck_ffs | |
parent | 737100069063b214f67622fd5d165a4528d40623 (diff) |
Print the real device name followed by the disklabel UID in parenthesis
when fsck is run against a disklabel UID. This allows a user to determine
which device is really being scanned.
ok krw@
Diffstat (limited to 'sbin/fsck_ffs')
-rw-r--r-- | sbin/fsck_ffs/main.c | 4 | ||||
-rw-r--r-- | sbin/fsck_ffs/setup.c | 15 |
2 files changed, 13 insertions, 6 deletions
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index 74fecbd750f..b4817ce9626 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.35 2010/07/09 08:06:37 otto Exp $ */ +/* $OpenBSD: main.c,v 1.36 2010/08/12 15:26:34 jsing Exp $ */ /* $NetBSD: main.c,v 1.22 1996/10/11 20:15:48 thorpej Exp $ */ /* @@ -154,7 +154,7 @@ checkfilesys(char *filesys, char *mntpt, long auxdata, int child) if (preen && child) (void)signal(SIGQUIT, voidquit); - setcdevname(filesys, preen); + setcdevname(filesys, NULL, preen); if (debug && preen) pwarn("starting\n"); switch (setup(filesys)) { diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index 896f394b1fd..590c3ea105a 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setup.c,v 1.45 2010/06/15 14:25:09 jsing Exp $ */ +/* $OpenBSD: setup.c,v 1.46 2010/08/12 15:26:34 jsing Exp $ */ /* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */ /* @@ -61,6 +61,7 @@ int calcsb(char *, int, struct fs *); static struct disklabel *getdisklabel(char *, int); static int readsb(int); static int cmpsb(struct fs *, struct fs *); +static char rdevname[MAXPATHLEN]; long numdirs, listmax, inplast; @@ -91,6 +92,11 @@ setup(char *dev) printf("Can't open %s: %s\n", dev, strerror(errno)); return (0); } + if (strncmp(dev, realdev, PATH_MAX) != 0) { + blockcheck(unrawname(realdev)); + strlcpy(rdevname, realdev, sizeof(rdevname)); + setcdevname(rdevname, dev, preen); + } if (fstat(fsreadfd, &statb) < 0) { printf("Can't stat %s: %s\n", realdev, strerror(errno)); close(fsreadfd); @@ -103,10 +109,11 @@ setup(char *dev) return (0); } } - if (strncmp(dev, realdev, PATH_MAX) != 0) - blockcheck(unrawname(realdev)); - if (preen == 0) + if (preen == 0) { printf("** %s", realdev); + if (strncmp(dev, realdev, PATH_MAX) != 0) + printf(" (%s)", dev); + } if (nflag || (fswritefd = opendev(dev, O_WRONLY, 0, NULL)) < 0) { fswritefd = -1; if (preen) |