Module Name:    src
Committed By:   riastradh
Date:           Mon Mar 28 12:34:17 UTC 2022

Modified Files:
        src/sys/miscfs/specfs: spec_vnops.c
        src/sys/sys: conf.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/sys/miscfs/specfs/spec_vnops.c
cvs rdiff -u -r1.157 -r1.158 src/sys/sys/conf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/miscfs/specfs/spec_vnops.c
diff -u src/sys/miscfs/specfs/spec_vnops.c:1.184 src/sys/miscfs/specfs/spec_vnops.c:1.185
--- src/sys/miscfs/specfs/spec_vnops.c:1.184	Sat Mar 19 13:52:11 2022
+++ src/sys/miscfs/specfs/spec_vnops.c	Mon Mar 28 12:34:17 2022
@@ -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 @@ spec_close(void *v)
 		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;
 
 	/*

Index: src/sys/sys/conf.h
diff -u src/sys/sys/conf.h:1.157 src/sys/sys/conf.h:1.158
--- src/sys/sys/conf.h:1.157	Mon Mar 28 12:34:08 2022
+++ src/sys/sys/conf.h	Mon Mar 28 12:34:17 2022
@@ -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 @@ struct vnode;
 #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

Reply via email to