Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sbin Pull up following revision(s) (requested by mlelstv ...
details: https://anonhg.NetBSD.org/src/rev/8717a356f6bb
branches: netbsd-7
changeset: 798537:8717a356f6bb
user: martin <martin%NetBSD.org@localhost>
date: Tue Nov 11 10:21:25 2014 +0000
description:
Pull up following revision(s) (requested by mlelstv in ticket #199):
sbin/newfs/newfs.c: revision 1.112
sbin/fsck/fsck.c: revision 1.52
fix logic that handles command line arguments. Now you can:
fsck /mnt/point
fsck dkX
fsck rdkX
fsck /dev/dkX
fsck /dev/rdkX
fsck NAME=wedge
Support wedge names.
before:
newfs dk1 - formats /dev/rdk1
newfs rdk1 - cannot open /dev/rrdk1
newfs /dev/dk1 - /dev/dk1 is a block-device, use raw device
newfs /dev/rdk1 - formats /dev/rdk1
now:
newfs dk1 - formats /dev/rdk1
newfs rdk1 - cannot open /dev/rrdk1
newfs /dev/dk1 - formats /dev/rdk1 (*)
newfs /dev/rdk1 - formats /dev/rdk1
newfs NAME=wedge - formats /dev/rdk1
(*) getfsspecname() returns the block device which must be translated.
Passing a block device manually cannot be distinguished from this case.
diffstat:
sbin/fsck/fsck.c | 37 ++++++++++++++++++++++++-------------
sbin/newfs/newfs.c | 14 +++++++++++---
2 files changed, 35 insertions(+), 16 deletions(-)
diffs (113 lines):
diff -r 6689eef93fcb -r 8717a356f6bb sbin/fsck/fsck.c
--- a/sbin/fsck/fsck.c Tue Nov 11 09:09:32 2014 +0000
+++ b/sbin/fsck/fsck.c Tue Nov 11 10:21:25 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fsck.c,v 1.51 2012/04/07 04:52:20 christos Exp $ */
+/* $NetBSD: fsck.c,v 1.51.10.1 2014/11/11 10:21:26 martin Exp $ */
/*
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fsck.c,v 1.51 2012/04/07 04:52:20 christos Exp $");
+__RCSID("$NetBSD: fsck.c,v 1.51.10.1 2014/11/11 10:21:26 martin Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -196,23 +196,30 @@
for (; argc--; argv++) {
- const char *spec, *type, *cp;
+ const char *spec, *spec2, *mntpt, *type, *cp;
char device[MAXPATHLEN];
- spec = *argv;
- cp = strrchr(spec, '/');
+ spec = mntpt = *argv;
+ spec2 = getfsspecname(buf, sizeof(buf), spec);
+ if (spec2 == NULL)
+ spec2 = spec;
+
+ cp = strrchr(spec2, '/');
if (cp == 0) {
(void)snprintf(device, sizeof(device), "%s%s",
- _PATH_DEV, spec);
- spec = device;
+ _PATH_DEV, spec2);
+ spec2 = device;
}
- if ((fs = getfsfile(spec)) == NULL &&
- (fs = getfsspec(spec)) == NULL) {
- if (vfstype == NULL)
- vfstype = getfslab(spec);
- type = vfstype;
+
+ fs = getfsfile(spec);
+ if (fs == NULL)
+ fs = getfsspec(spec);
+ if (fs == NULL && spec != spec2) {
+ fs = getfsspec(spec2);
+ spec = spec2;
}
- else {
+
+ if (fs) {
spec = getfsspecname(buf, sizeof(buf), fs->fs_spec);
if (spec == NULL)
err(FSCK_EXIT_CHECK_FAILED, "%s", buf);
@@ -221,6 +228,10 @@
errx(FSCK_EXIT_CHECK_FAILED,
"%s has unknown file system type.",
spec);
+ } else {
+ if (vfstype == NULL)
+ vfstype = getfslab(spec);
+ type = vfstype;
}
rval = checkfs(type, blockcheck(spec), *argv, NULL, NULL);
diff -r 6689eef93fcb -r 8717a356f6bb sbin/newfs/newfs.c
--- a/sbin/newfs/newfs.c Tue Nov 11 09:09:32 2014 +0000
+++ b/sbin/newfs/newfs.c Tue Nov 11 10:21:25 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: newfs.c,v 1.111 2012/06/30 15:34:01 tsutsui Exp $ */
+/* $NetBSD: newfs.c,v 1.111.10.1 2014/11/11 10:21:25 martin Exp $ */
/*
* Copyright (c) 1983, 1989, 1993, 1994
@@ -78,7 +78,7 @@
#if 0
static char sccsid[] = "@(#)newfs.c 8.13 (Berkeley) 5/1/95";
#else
-__RCSID("$NetBSD: newfs.c,v 1.111 2012/06/30 15:34:01 tsutsui Exp $");
+__RCSID("$NetBSD: newfs.c,v 1.111.10.1 2014/11/11 10:21:25 martin Exp $");
#endif
#endif /* not lint */
@@ -242,7 +242,10 @@
struct statvfs *mp;
struct stat sb;
int ch, fsi, fso, len, n, Fflag, Iflag, Zflag;
- char *s1, *s2, *special;
+ const char *s1, *special, *raw;
+ char *s2;
+ char specname[MAXPATHLEN];
+ char rawname[MAXPATHLEN];
const char *opstring;
int byte_sized = 0;
#ifdef MFS
@@ -490,6 +493,11 @@
fso = fsi;
}
} else { /* !Fflag && !mfs */
+ special = getfsspecname(specname, sizeof(specname), special);
+ raw = getdiskrawname(rawname, sizeof(rawname), special);
+ if (raw != NULL)
+ special = raw;
+
fsi = opendisk(special, O_RDONLY, device, sizeof(device), 0);
special = device;
if (fsi < 0 || fstat(fsi, &sb) == -1)
Home |
Main Index |
Thread Index |
Old Index