Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add functions to access device flags. This restores sim...
details: https://anonhg.NetBSD.org/src/rev/50513b551d4c
branches: trunk
changeset: 349396:50513b551d4c
user: nat <nat%NetBSD.org@localhost>
date: Fri Dec 09 19:13:47 2016 +0000
description:
Add functions to access device flags. This restores simultaneous audio
open/close.
OK hannken@ christos@
diffstat:
sys/kern/subr_devsw.c | 24 ++++++++++++++++++++++--
sys/miscfs/specfs/spec_vnops.c | 6 +++---
sys/sys/conf.h | 4 +++-
3 files changed, 28 insertions(+), 6 deletions(-)
diffs (98 lines):
diff -r bc2958711ece -r 50513b551d4c sys/kern/subr_devsw.c
--- a/sys/kern/subr_devsw.c Fri Dec 09 17:57:24 2016 +0000
+++ b/sys/kern/subr_devsw.c Fri Dec 09 19:13:47 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_devsw.c,v 1.34 2016/02/01 05:05:43 riz Exp $ */
+/* $NetBSD: subr_devsw.c,v 1.35 2016/12/09 19:13:47 nat Exp $ */
/*-
* Copyright (c) 2001, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.34 2016/02/01 05:05:43 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.35 2016/12/09 19:13:47 nat Exp $");
#ifdef _KERNEL_OPT
#include "opt_dtrace.h"
@@ -796,6 +796,16 @@
}
int
+bdev_flags(dev_t dev)
+{
+ const struct bdevsw *d;
+
+ if ((d = bdevsw_lookup(dev)) == NULL)
+ return 0;
+ return d->d_flag & ~D_TYPEMASK;
+}
+
+int
bdev_type(dev_t dev)
{
const struct bdevsw *d;
@@ -1026,6 +1036,16 @@
}
int
+cdev_flags(dev_t dev)
+{
+ const struct cdevsw *d;
+
+ if ((d = cdevsw_lookup(dev)) == NULL)
+ return 0;
+ return d->d_flag & ~D_TYPEMASK;
+}
+
+int
cdev_type(dev_t dev)
{
const struct cdevsw *d;
diff -r bc2958711ece -r 50513b551d4c sys/miscfs/specfs/spec_vnops.c
--- a/sys/miscfs/specfs/spec_vnops.c Fri Dec 09 17:57:24 2016 +0000
+++ b/sys/miscfs/specfs/spec_vnops.c Fri Dec 09 19:13:47 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spec_vnops.c,v 1.166 2016/12/08 10:28:44 nat Exp $ */
+/* $NetBSD: spec_vnops.c,v 1.167 2016/12/09 19:13:47 nat 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.166 2016/12/08 10:28:44 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.167 2016/12/09 19:13:47 nat Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -1227,7 +1227,7 @@
sd->sd_bdevvp = NULL;
mutex_exit(&device_lock);
- if (count != 0 && (vp->v_type != VCHR || cdev_type(dev) != D_MCLOSE))
+ if (count != 0 && (vp->v_type != VCHR || !(cdev_flags(dev) & D_MCLOSE)))
return 0;
/*
diff -r bc2958711ece -r 50513b551d4c sys/sys/conf.h
--- a/sys/sys/conf.h Fri Dec 09 17:57:24 2016 +0000
+++ b/sys/sys/conf.h Fri Dec 09 19:13:47 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.h,v 1.148 2016/12/08 20:53:12 nat Exp $ */
+/* $NetBSD: conf.h,v 1.149 2016/12/09 19:13:47 nat Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -175,7 +175,9 @@
dev_type_discard(cdev_discard);
int cdev_type(dev_t);
+int cdev_flags(dev_t);
int bdev_type(dev_t);
+int bdev_flags(dev_t);
/* symbolic sleep message strings */
extern const char devopn[], devio[], devwait[], devin[], devout[];
Home |
Main Index |
Thread Index |
Old Index