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.
This commit is contained in:
parent
fc76cc25dd
commit
89d7388021
|
@ -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 *dk, const char *type)
|
|||
if (odisk_info)
|
||||
prop_object_release(odisk_info);
|
||||
}
|
||||
|
||||
int
|
||||
disklabel_dev_unit(dev_t dev)
|
||||
{
|
||||
|
||||
return DISKUNIT(dev);
|
||||
}
|
||||
|
|
|
@ -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 disklabel *, void (*)(struct buf *),
|
|||
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 */
|
||||
|
||||
|
|
Loading…
Reference in New Issue