git: 1c7084fe5612 - main - vfs: clean up parse_mount_dev_present
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 17 Sep 2022 12:43:01 UTC
The branch main has been updated by mjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=1c7084fe5612f179517994becb24a4d8f7a23cbe
commit 1c7084fe5612f179517994becb24a4d8f7a23cbe
Author: Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-09-17 12:42:46 +0000
Commit: Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2022-09-17 12:42:46 +0000
vfs: clean up parse_mount_dev_present
---
sys/kern/vfs_mountroot.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/sys/kern/vfs_mountroot.c b/sys/kern/vfs_mountroot.c
index ac0cec44f802..5361f41276a0 100644
--- a/sys/kern/vfs_mountroot.c
+++ b/sys/kern/vfs_mountroot.c
@@ -718,19 +718,19 @@ parse_directive(char **conf)
return (error);
}
-static int
+static bool
parse_mount_dev_present(const char *dev)
{
struct nameidata nd;
int error;
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, dev);
+ NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, dev);
error = namei(&nd);
- if (!error) {
- vput(nd.ni_vp);
- NDFREE_PNBUF(&nd);
- }
- return (error != 0) ? 0 : 1;
+ if (error != 0)
+ return (false);
+ vrele(nd.ni_vp);
+ NDFREE_PNBUF(&nd);
+ return (true);
}
#define ERRMSGL 255