Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/resize_ffs Use getfsspecname and getrawdiskname so we c...
details: https://anonhg.NetBSD.org/src/rev/9371b7c90194
branches: trunk
changeset: 933309:9371b7c90194
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun May 24 14:41:26 2020 +0000
description:
Use getfsspecname and getrawdiskname so we can resize by NAME= label.
diffstat:
sbin/resize_ffs/Makefile | 5 ++++-
sbin/resize_ffs/resize_ffs.c | 19 ++++++++++++++-----
2 files changed, 18 insertions(+), 6 deletions(-)
diffs (87 lines):
diff -r be3c41c2b623 -r 9371b7c90194 sbin/resize_ffs/Makefile
--- a/sbin/resize_ffs/Makefile Sun May 24 14:40:21 2020 +0000
+++ b/sbin/resize_ffs/Makefile Sun May 24 14:41:26 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2015/04/06 22:44:04 jmcneill Exp $
+# $NetBSD: Makefile,v 1.6 2020/05/24 14:41:26 jmcneill Exp $
.include <bsd.own.mk>
@@ -8,6 +8,9 @@
CPPFLAGS+=-I${NETBSDSRCDIR}/sbin/fsck
+DPADD+= ${LIBUTIL}
+LDADD+= -lutil
+
.PATH: ${NETBSDSRCDIR}/sys/ufs/ffs
.PATH: ${NETBSDSRCDIR}/sbin/fsck
diff -r be3c41c2b623 -r 9371b7c90194 sbin/resize_ffs/resize_ffs.c
--- a/sbin/resize_ffs/resize_ffs.c Sun May 24 14:40:21 2020 +0000
+++ b/sbin/resize_ffs/resize_ffs.c Sun May 24 14:41:26 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: resize_ffs.c,v 1.54 2019/04/21 11:45:08 maya Exp $ */
+/* $NetBSD: resize_ffs.c,v 1.55 2020/05/24 14:41:26 jmcneill Exp $ */
/* From sources sent on February 17, 2003 */
/*-
* As its sole author, I explicitly place this code in the public
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: resize_ffs.c,v 1.54 2019/04/21 11:45:08 maya Exp $");
+__RCSID("$NetBSD: resize_ffs.c,v 1.55 2020/05/24 14:41:26 jmcneill Exp $");
#include <sys/disk.h>
#include <sys/disklabel.h>
@@ -58,6 +58,7 @@
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
+#include <util.h>
#include "progress.h"
@@ -68,7 +69,7 @@
static int fd;
/* disk device or file path */
-char *special;
+const char *special;
/* must we break up big I/O operations - see checksmallio() */
static int smallio;
@@ -2110,7 +2111,7 @@
}
static off_t
-get_dev_size(char *dev_name)
+get_dev_size(const char *dev_name)
{
struct dkwedge_info dkw;
struct partition *pp;
@@ -2145,6 +2146,9 @@
int ExpertFlag;
int SFlag;
size_t i;
+ char specname[MAXPATHLEN];
+ char rawname[MAXPATHLEN];
+ const char *raw;
char reply[5];
@@ -2187,7 +2191,12 @@
usage();
}
- special = *argv;
+ special = getfsspecname(specname, sizeof(specname), argv[0]);
+ if (special == NULL)
+ err(EXIT_FAILURE, "%s: %s", argv[0], specname);
+ raw = getdiskrawname(rawname, sizeof(rawname), special);
+ if (raw != NULL)
+ special = raw;
if (ExpertFlag == 0 && CheckOnlyFlag == 0) {
printf("It's required to manually run fsck on file system "
Home |
Main Index |
Thread Index |
Old Index