Source-Changes-HG archive

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

[src/trunk]: src/sys driver(9): New function dev_minor_unit.



details:   https://anonhg.NetBSD.org/src/rev/68d27c10f1bd
branches:  trunk
changeset: 364494:68d27c10f1bd
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Mar 28 12:34:08 2022 +0000

description:
driver(9): New function dev_minor_unit.

diffstat:

 sys/kern/subr_devsw.c |  19 +++++++++++++++++--
 sys/sys/conf.h        |   3 ++-
 2 files changed, 19 insertions(+), 3 deletions(-)

diffs (54 lines):

diff -r e0e488d30645 -r 68d27c10f1bd sys/kern/subr_devsw.c
--- a/sys/kern/subr_devsw.c     Mon Mar 28 12:33:59 2022 +0000
+++ b/sys/kern/subr_devsw.c     Mon Mar 28 12:34:08 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_devsw.c,v 1.41 2022/03/28 12:33:50 riastradh Exp $        */
+/*     $NetBSD: subr_devsw.c,v 1.42 2022/03/28 12:34:08 riastradh 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.41 2022/03/28 12:33:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.42 2022/03/28 12:34:08 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dtrace.h"
@@ -1299,3 +1299,18 @@
 
        return (paddr_t)-1;
 }
+
+/*
+ * dev_minor_unit(dev)
+ *
+ *     Returns minor(dev) as an int.  Intended for use with struct
+ *     bdevsw, cdevsw::d_devtounit for drivers whose /dev nodes are
+ *     implemented by reference to an autoconf instance with the minor
+ *     number.
+ */
+int
+dev_minor_unit(dev_t dev)
+{
+
+       return minor(dev);
+}
diff -r e0e488d30645 -r 68d27c10f1bd sys/sys/conf.h
--- a/sys/sys/conf.h    Mon Mar 28 12:33:59 2022 +0000
+++ b/sys/sys/conf.h    Mon Mar 28 12:34:08 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: conf.h,v 1.156 2022/03/28 12:33:50 riastradh Exp $     */
+/*     $NetBSD: conf.h,v 1.157 2022/03/28 12:34:08 riastradh Exp $     */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -280,6 +280,7 @@
 devmajor_t devsw_name2chr(const char *, char *, size_t);
 dev_t devsw_chr2blk(dev_t);
 dev_t devsw_blk2chr(dev_t);
+int dev_minor_unit(dev_t);
 
 void mm_init(void);
 #endif /* _KERNEL */



Home | Main Index | Thread Index | Old Index