Module Name:    src
Committed By:   pgoyette
Date:           Sun Jul 31 02:13:26 UTC 2016

Modified Files:
        src/usr.sbin/fssconfig: Makefile fssconfig.c

Log Message:
Add rump.fssconfig


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/fssconfig/Makefile
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/fssconfig/fssconfig.c

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

Modified files:

Index: src/usr.sbin/fssconfig/Makefile
diff -u src/usr.sbin/fssconfig/Makefile:1.1 src/usr.sbin/fssconfig/Makefile:1.2
--- src/usr.sbin/fssconfig/Makefile:1.1	Wed Dec 10 11:40:12 2003
+++ src/usr.sbin/fssconfig/Makefile	Sun Jul 31 02:13:26 2016
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.1 2003/12/10 11:40:12 hannken Exp $
+#	$NetBSD: Makefile,v 1.2 2016/07/31 02:13:26 pgoyette Exp $
 
-PROG=		fssconfig
+RUMPPRG=	fssconfig
 MAN=		fssconfig.8
 DPADD+=		${LIBUTIL}
 LDADD+=		-lutil

Index: src/usr.sbin/fssconfig/fssconfig.c
diff -u src/usr.sbin/fssconfig/fssconfig.c:1.11 src/usr.sbin/fssconfig/fssconfig.c:1.12
--- src/usr.sbin/fssconfig/fssconfig.c:1.11	Sat Jul 30 12:33:27 2016
+++ src/usr.sbin/fssconfig/fssconfig.c	Sun Jul 31 02:13:26 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fssconfig.c,v 1.11 2016/07/30 12:33:27 pgoyette Exp $	*/
+/*	$NetBSD: fssconfig.c,v 1.12 2016/07/31 02:13:26 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -46,6 +46,8 @@
 
 #include <dev/fssvar.h>
 
+#include "prog_ops.h"
+
 static int	vflag = 0;
 static int	xflag = 0;
 
@@ -124,7 +126,8 @@ config(int argc, char **argv)
 	fss.fss_mount = argv[1];
 	fss.fss_bstore = argv[2];
 
-	if (statvfs(argv[1], &fsbuf) != 0 || stat(argv[1], &sbuf) != 0)
+	if (prog_statvfs1(argv[1], &fsbuf, ST_WAIT) != 0 ||
+	    prog_stat(argv[1], &sbuf) != 0)
 		err(1, "stat %s", argv[1]);
 	mountdev = sbuf.st_dev;
 	if (stat(argv[2], &sbuf) == 0 &&
@@ -155,7 +158,8 @@ config(int argc, char **argv)
 	 * Create the backing store. If it is a directory, create a temporary
 	 * file and set the unlink flag.
 	 */
-	if ((fd = open(fss.fss_bstore, O_CREAT|O_TRUNC|O_WRONLY, 0600)) < 0) {
+	fd = prog_open(fss.fss_bstore, O_CREAT|O_TRUNC|O_WRONLY, 0600);
+	if (fd < 0) {
 		if (errno != EISDIR)
 			err(1, "create: %s", fss.fss_bstore);
 		snprintf(path, sizeof(path), "%s/XXXXXXXXXX", fss.fss_bstore);
@@ -164,17 +168,18 @@ config(int argc, char **argv)
 		fss.fss_bstore = path;
 		istmp = 1;
 	}
-	if (fstat(fd, &sbuf) < 0)
+	if (prog_fstat(fd, &sbuf) < 0)
 		err(1, "stat: %s", fss.fss_bstore);
 	if (!ispersistent && sbuf.st_dev == mountdev)
 		ispersistent = 1;
 	isreg = S_ISREG(sbuf.st_mode);
 	if (!ispersistent && isreg && ftruncate(fd, bssize) < 0)
 		err(1, "truncate %s", fss.fss_bstore);
-	close(fd);
+	prog_close(fd);
 
 configure:
-	if ((fd = opendisk(argv[0], O_RDWR, full, sizeof(full), 0)) < 0) {
+	fd = opendisk1(argv[0], O_RDWR, full, sizeof(full), 0, prog_open);
+	if (fd < 0) {
 		if (istmp)
 			unlink(fss.fss_bstore);
 		err(1, "open: %s", argv[0]);
@@ -184,7 +189,7 @@ configure:
 	if ((xflag || istmp) && isreg)
 		fss.fss_flags |= FSS_UNLINK_ON_CREATE;
 
-	if (ioctl(fd, FSSIOCSET, &fss) < 0) {
+	if (prog_ioctl(fd, FSSIOCSET, &fss) < 0) {
 		if (istmp)
 			unlink(fss.fss_bstore);
 		err(1, "%s: FSSIOCSET", full);
@@ -206,10 +211,11 @@ unconfig(int argc, char **argv)
 	if (vflag)
 		list(1, argv);
 
-	if ((fd = opendisk(argv[0], O_RDWR, full, sizeof(full), 0)) < 0)
+	fd = opendisk1(argv[0], O_RDWR, full, sizeof(full), 0, prog_open);
+	if (fd < 0)
 		err(1, "open: %s", argv[0]);
 
-	if (ioctl(fd, FSSIOCCLR) < 0)
+	if (prog_ioctl(fd, FSSIOCCLR) < 0)
 		err(1, "%s: FSSIOCCLR", full);
 }
 
@@ -233,16 +239,17 @@ list(int argc, char **argv)
 	for (n = 0; ; n++) {
 		if (argc == 0)
 			snprintf(path, sizeof(path), "fss%d", n);
-		if ((fd = opendisk(dev, O_RDONLY, full, sizeof(full), 0)) < 0) {
+		fd = opendisk1(dev, O_RDONLY, full, sizeof(full), 0, prog_open);
+		if (fd < 0) {
 			if (argc == 0 && (errno == ENOENT || errno == ENXIO))
 				break;
 			err(1, "open: %s", dev);
 		}
 
-		if (ioctl(fd, FSSIOFGET, &flags) < 0)
+		if (prog_ioctl(fd, FSSIOFGET, &flags) < 0)
 			flags = 0;
 
-		if (ioctl(fd, FSSIOCGET, &fsg) < 0) {
+		if (prog_ioctl(fd, FSSIOCGET, &fsg) < 0) {
 			if (errno == ENXIO)
 				printf("%s: not in use\n", dev);
 			else
@@ -270,7 +277,7 @@ list(int argc, char **argv)
 		} else
 			printf("%s: %s\n", dev, fsg.fsg_mount);
 
-		close(fd);
+		prog_close(fd);
 
 		if (argc > 0)
 			break;

Reply via email to