Module Name:    src
Committed By:   jmcneill
Date:           Sun May 24 14:41:27 UTC 2020

Modified Files:
        src/sbin/resize_ffs: Makefile resize_ffs.c

Log Message:
Use getfsspecname and getrawdiskname so we can resize by NAME= label.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sbin/resize_ffs/Makefile
cvs rdiff -u -r1.54 -r1.55 src/sbin/resize_ffs/resize_ffs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/resize_ffs/Makefile
diff -u src/sbin/resize_ffs/Makefile:1.5 src/sbin/resize_ffs/Makefile:1.6
--- src/sbin/resize_ffs/Makefile:1.5	Mon Apr  6 22:44:04 2015
+++ src/sbin/resize_ffs/Makefile	Sun May 24 14:41:26 2020
@@ -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 @@ SRCS=resize_ffs.c ffs_bswap.c progress.c
 
 CPPFLAGS+=-I${NETBSDSRCDIR}/sbin/fsck
 
+DPADD+= ${LIBUTIL}
+LDADD+= -lutil
+
 .PATH: ${NETBSDSRCDIR}/sys/ufs/ffs
 .PATH: ${NETBSDSRCDIR}/sbin/fsck
 

Index: src/sbin/resize_ffs/resize_ffs.c
diff -u src/sbin/resize_ffs/resize_ffs.c:1.54 src/sbin/resize_ffs/resize_ffs.c:1.55
--- src/sbin/resize_ffs/resize_ffs.c:1.54	Sun Apr 21 11:45:08 2019
+++ src/sbin/resize_ffs/resize_ffs.c	Sun May 24 14:41:26 2020
@@ -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 @@ __RCSID("$NetBSD: resize_ffs.c,v 1.54 20
 #include <stdlib.h>
 #include <strings.h>
 #include <unistd.h>
+#include <util.h>
 
 #include "progress.h"
 
@@ -68,7 +69,7 @@ static int64_t newsize;
 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 @@ checkonly(void)
 }
 
 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 @@ main(int argc, char **argv)
 	int ExpertFlag;
 	int SFlag;
 	size_t i;
+	char specname[MAXPATHLEN];
+	char rawname[MAXPATHLEN];
+	const char *raw;
 
 	char reply[5];
 
@@ -2187,7 +2191,12 @@ main(int argc, char **argv)
 		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 "

Reply via email to