Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys driver(9): Eliminate D_MCLOSE.



details:   https://anonhg.NetBSD.org/src/rev/5dd608e8d671
branches:  trunk
changeset: 364495:5dd608e8d671
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Mar 28 12:34:17 2022 +0000

description:
driver(9): Eliminate D_MCLOSE.

D_MCLOSE was introduced a few years ago by mistake for audio(4),
which should have used -- and now does use -- fd_clone to create
per-open state.  The semantics was originally to call close once
every time the device node is closed, not only for the last close.
Nothing uses it any more, and it complicates reasoning about the
system, so let's simplify it away.

diffstat:

 sys/miscfs/specfs/spec_vnops.c |  6 +++---
 sys/sys/conf.h                 |  4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r 68d27c10f1bd -r 5dd608e8d671 sys/miscfs/specfs/spec_vnops.c
--- a/sys/miscfs/specfs/spec_vnops.c    Mon Mar 28 12:34:08 2022 +0000
+++ b/sys/miscfs/specfs/spec_vnops.c    Mon Mar 28 12:34:17 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: spec_vnops.c,v 1.184 2022/03/19 13:52:11 hannken Exp $ */
+/*     $NetBSD: spec_vnops.c,v 1.185 2022/03/28 12:34:17 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.184 2022/03/19 13:52:11 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.185 2022/03/28 12:34:17 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -1276,7 +1276,7 @@
                sd->sd_bdevvp = NULL;
        mutex_exit(&device_lock);
 
-       if (count != 0 && (vp->v_type != VCHR || !(cdev_flags(dev) & D_MCLOSE)))
+       if (count != 0)
                return 0;
 
        /*
diff -r 68d27c10f1bd -r 5dd608e8d671 sys/sys/conf.h
--- a/sys/sys/conf.h    Mon Mar 28 12:34:08 2022 +0000
+++ b/sys/sys/conf.h    Mon Mar 28 12:34:17 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: conf.h,v 1.157 2022/03/28 12:34:08 riastradh Exp $     */
+/*     $NetBSD: conf.h,v 1.158 2022/03/28 12:34:17 riastradh Exp $     */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -63,7 +63,7 @@
 #define        D_TYPEMASK      0x00ff
 #define        D_MPSAFE        0x0100
 #define        D_NEGOFFSAFE    0x0200
-#define        D_MCLOSE        0x0400
+#define        D_UNUSED0       0x0400  /* was D_MCLOSE */
 
 /*
  * Block device switch table



Home | Main Index | Thread Index | Old Index