Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/fssconfig Add rump.fssconfig
details: https://anonhg.NetBSD.org/src/rev/583d50f00543
branches: trunk
changeset: 346734:583d50f00543
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Sun Jul 31 02:13:26 2016 +0000
description:
Add rump.fssconfig
diffstat:
usr.sbin/fssconfig/Makefile | 4 ++--
usr.sbin/fssconfig/fssconfig.c | 33 ++++++++++++++++++++-------------
2 files changed, 22 insertions(+), 15 deletions(-)
diffs (125 lines):
diff -r 812ac525dbb5 -r 583d50f00543 usr.sbin/fssconfig/Makefile
--- a/usr.sbin/fssconfig/Makefile Sat Jul 30 23:07:23 2016 +0000
+++ b/usr.sbin/fssconfig/Makefile Sun Jul 31 02:13:26 2016 +0000
@@ -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
diff -r 812ac525dbb5 -r 583d50f00543 usr.sbin/fssconfig/fssconfig.c
--- a/usr.sbin/fssconfig/fssconfig.c Sat Jul 30 23:07:23 2016 +0000
+++ b/usr.sbin/fssconfig/fssconfig.c Sun Jul 31 02:13:26 2016 +0000
@@ -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 @@
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 @@
* 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 @@
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 @@
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 @@
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 @@
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 @@
} else
printf("%s: %s\n", dev, fsg.fsg_mount);
- close(fd);
+ prog_close(fd);
if (argc > 0)
break;
Home |
Main Index |
Thread Index |
Old Index