Source-Changes-HG archive

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

[src/trunk]: src/sys disk(9): New function disklabel_dev_unit.



details:   https://anonhg.NetBSD.org/src/rev/e0e488d30645
branches:  trunk
changeset: 364493:e0e488d30645
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Mar 28 12:33:59 2022 +0000

description:
disk(9): New function disklabel_dev_unit.

Maps a dev_t like wd3e to an autoconf instance number like 3, with no
partition.  Same as DISKUNIT macro, but is a symbol whose pointer can
be taken.  Meant for use with struct bdevsw, cdevsw::d_devtounit.

diffstat:

 sys/kern/subr_disk.c |  11 +++++++++--
 sys/sys/disklabel.h  |   3 ++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diffs (46 lines):

diff -r 4c41194fe8cc -r e0e488d30645 sys/kern/subr_disk.c
--- a/sys/kern/subr_disk.c      Mon Mar 28 12:33:50 2022 +0000
+++ b/sys/kern/subr_disk.c      Mon Mar 28 12:33:59 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_disk.c,v 1.133 2021/05/17 08:50:36 mrg Exp $      */
+/*     $NetBSD: subr_disk.c,v 1.134 2022/03/28 12:33:59 riastradh Exp $        */
 
 /*-
  * Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.133 2021/05/17 08:50:36 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.134 2022/03/28 12:33:59 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -728,3 +728,10 @@
        if (odisk_info)
                prop_object_release(odisk_info);
 }
+
+int
+disklabel_dev_unit(dev_t dev)
+{
+
+       return DISKUNIT(dev);
+}
diff -r 4c41194fe8cc -r e0e488d30645 sys/sys/disklabel.h
--- a/sys/sys/disklabel.h       Mon Mar 28 12:33:50 2022 +0000
+++ b/sys/sys/disklabel.h       Mon Mar 28 12:33:59 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel.h,v 1.125 2021/05/17 08:50:36 mrg Exp $      */
+/*     $NetBSD: disklabel.h,v 1.126 2022/03/28 12:33:59 riastradh Exp $        */
 
 /*
  * Copyright (c) 1987, 1988, 1993
@@ -509,6 +509,7 @@
 int     bounds_check_with_label(struct disk *, struct buf *, int);
 int     bounds_check_with_mediasize(struct buf *, int, uint64_t);
 const char *getfstypename(int);
+int    disklabel_dev_unit(dev_t);
 #endif
 #endif /* _LOCORE */
 



Home | Main Index | Thread Index | Old Index