Module Name: src Committed By: riastradh Date: Mon Mar 28 12:33:59 UTC 2022
Modified Files: src/sys/kern: subr_disk.c src/sys/sys: disklabel.h Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.133 -r1.134 src/sys/kern/subr_disk.c cvs rdiff -u -r1.125 -r1.126 src/sys/sys/disklabel.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/kern/subr_disk.c diff -u src/sys/kern/subr_disk.c:1.133 src/sys/kern/subr_disk.c:1.134 --- src/sys/kern/subr_disk.c:1.133 Mon May 17 08:50:36 2021 +++ src/sys/kern/subr_disk.c Mon Mar 28 12:33:59 2022 @@ -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 @@ disk_set_info(device_t dev, struct disk if (odisk_info) prop_object_release(odisk_info); } + +int +disklabel_dev_unit(dev_t dev) +{ + + return DISKUNIT(dev); +} Index: src/sys/sys/disklabel.h diff -u src/sys/sys/disklabel.h:1.125 src/sys/sys/disklabel.h:1.126 --- src/sys/sys/disklabel.h:1.125 Mon May 17 08:50:36 2021 +++ src/sys/sys/disklabel.h Mon Mar 28 12:33:59 2022 @@ -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 @@ const char *convertdisklabel(struct disk 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 */