summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authormartin <martin@NetBSD.org>2019-09-02 16:16:56 +0000
committermartin <martin@NetBSD.org>2019-09-02 16:16:56 +0000
commitfabfa51bd729faa3fb5a29a881d547727db8b557 (patch)
treed50f93f8a0052af5cb0915dc73e40f825b683ce5 /sbin
parent26d0d37c1b262793e5b9e232c6d36de5d687fc17 (diff)
Pull up following revision(s) (requested by brad in ticket #110):
libexec/lfs_cleanerd/lfs_cleanerd.c: revision 1.59 libexec/lfs_cleanerd/lfs_cleanerd.8: revision 1.19 sbin/resize_lfs/resize_lfs.c: revision 1.15 usr.sbin/puffs/rump_lfs/rump_lfs.c: revision 1.19 libexec/lfs_cleanerd/lfs_cleanerd.c: revision 1.60 lib/libutil/getdiskrawname.c: revision 1.6 tests/fs/common/fstest_lfs.c: revision 1.7 Use getdiskrawname to find the device name. Reviewed by Christos - Teach getdiskrawname and getdiskcookedname about zvols. Reviewed by Christos - Add support for passing the raw device name separate from the filesystem. This is useful in the case where the cleaner is compiled into code, such as rump_lfs and the ATF tests. This helps to fix bin/54488 - The cleaner is compiled into rump_lfs and executed as a thread. Pass in the raw device using the new -J option. This avoids the use of getdiskrawname which is not particularly rump safe in this context and insures that the rump container device is used for cleaning, not the outer device.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/resize_lfs/resize_lfs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sbin/resize_lfs/resize_lfs.c b/sbin/resize_lfs/resize_lfs.c
index c85a5ea8c1e..9ac81dc1b95 100644
--- a/sbin/resize_lfs/resize_lfs.c
+++ b/sbin/resize_lfs/resize_lfs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: resize_lfs.c,v 1.14 2015/08/02 18:18:09 dholland Exp $ */
+/* $NetBSD: resize_lfs.c,v 1.14.18.1 2019/09/02 16:16:56 martin Exp $ */
/*-
* Copyright (c) 2005 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -47,6 +47,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <util.h>
#include "partutil.h"
@@ -98,7 +99,8 @@ main(int argc, char **argv)
err(1, "%s", fsname);
rdevlen = strlen(vfs.f_mntfromname) + 2;
rdev = malloc(rdevlen);
- snprintf(rdev, rdevlen, "/dev/r%s", vfs.f_mntfromname + 5);
+ if (getdiskrawname(rdev, rdevlen, vfs.f_mntfromname) == NULL)
+ err(1, "Could not convert '%s' to raw name", vfs.f_mntfromname);
devfd = open(rdev, O_RDONLY);
if (devfd < 0)
err(1, "open raw device");