Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/dkwedge dk(4): Simplify dklastclose.
details: https://anonhg.NetBSD.org/src/rev/9c914e221d17
branches: trunk
changeset: 369574:9c914e221d17
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Aug 22 00:20:27 2022 +0000
description:
dk(4): Simplify dklastclose.
No functional change intended.
diffstat:
sys/dev/dkwedge/dk.c | 27 ++++++++++-----------------
1 files changed, 10 insertions(+), 17 deletions(-)
diffs (57 lines):
diff -r 80b8a3ae53c6 -r 9c914e221d17 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c Mon Aug 22 00:20:18 2022 +0000
+++ b/sys/dev/dkwedge/dk.c Mon Aug 22 00:20:27 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dk.c,v 1.119 2022/08/22 00:20:18 riastradh Exp $ */
+/* $NetBSD: dk.c,v 1.120 2022/08/22 00:20:27 riastradh Exp $ */
/*-
* Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.119 2022/08/22 00:20:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.120 2022/08/22 00:20:27 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_dkwedge.h"
@@ -1218,30 +1218,23 @@
static int
dklastclose(struct dkwedge_softc *sc)
{
- struct vnode *vp;
- int error = 0, mode;
KASSERT(mutex_owned(&sc->sc_dk.dk_openlock));
KASSERT(mutex_owned(&sc->sc_parent->dk_rawlock));
KASSERT(sc->sc_parent->dk_rawopens > 0);
-
- mode = sc->sc_mode;
+ KASSERT(sc->sc_parent->dk_rawvp != NULL);
- vp = NULL;
- if (sc->sc_parent->dk_rawopens > 0) {
- if (--sc->sc_parent->dk_rawopens == 0) {
- KASSERT(sc->sc_parent->dk_rawvp != NULL);
- vp = sc->sc_parent->dk_rawvp;
- sc->sc_parent->dk_rawvp = NULL;
- sc->sc_mode = 0;
- }
- }
+ if (--sc->sc_parent->dk_rawopens == 0) {
+ struct vnode *const vp = sc->sc_parent->dk_rawvp;
+ const int mode = sc->sc_mode;
- if (vp) {
+ sc->sc_parent->dk_rawvp = NULL;
+ sc->sc_mode = 0;
+
dk_close_parent(vp, mode);
}
- return error;
+ return 0;
}
/*
Home |
Main Index |
Thread Index |
Old Index