Add dkwedge_find_by_parent()
This commit is contained in:
parent
33f25f9fb6
commit
f2a7ea8367
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dk.c,v 1.88 2016/01/15 07:48:22 mlelstv Exp $ */
|
||||
/* $NetBSD: dk.c,v 1.89 2016/04/27 02:19:12 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.88 2016/01/15 07:48:22 mlelstv Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.89 2016/04/27 02:19:12 christos Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_dkwedge.h"
|
||||
|
@ -761,6 +761,23 @@ dkwedge_find_by_wname(const char *wname)
|
|||
return dv;
|
||||
}
|
||||
|
||||
device_t
|
||||
dkwedge_find_by_parent(const char *name, size_t *i)
|
||||
{
|
||||
rw_enter(&dkwedges_lock, RW_WRITER);
|
||||
for (; *i < (size_t)ndkwedges; (*i)++) {
|
||||
struct dkwedge_softc *sc;
|
||||
if ((sc = dkwedges[*i]) == NULL)
|
||||
continue;
|
||||
if (strcmp(sc->sc_parent->dk_name, name) != 0)
|
||||
continue;
|
||||
rw_exit(&dkwedges_lock);
|
||||
return sc->sc_dev;
|
||||
}
|
||||
rw_exit(&dkwedges_lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
dkwedge_print_wnames(void)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: disk.h,v 1.66 2015/11/12 15:25:22 christos Exp $ */
|
||||
/* $NetBSD: disk.h,v 1.67 2016/04/27 02:19:12 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 2004 The NetBSD Foundation, Inc.
|
||||
|
@ -547,9 +547,11 @@ int dkwedge_list(struct disk *, struct dkwedge_list *, struct lwp *);
|
|||
void dkwedge_discover(struct disk *);
|
||||
int dkwedge_read(struct disk *, struct vnode *, daddr_t, void *, size_t);
|
||||
device_t dkwedge_find_by_wname(const char *);
|
||||
device_t dkwedge_find_by_parent(const char *, size_t *);
|
||||
const char *dkwedge_get_parent_name(dev_t);
|
||||
void dkwedge_print_wnames(void);
|
||||
device_t dkwedge_find_partition(device_t, daddr_t, uint64_t);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_DISK_H_ */
|
||||
|
|
Loading…
Reference in New Issue