Module Name: src Committed By: christos Date: Thu Apr 3 15:24:20 UTC 2014
Modified Files: src/sys/dev/dkwedge: dk.c src/sys/sys: disk.h Log Message: add dkwedge_get_parent_name(). To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/dev/dkwedge/dk.c cvs rdiff -u -r1.59 -r1.60 src/sys/sys/disk.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/dev/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.68 src/sys/dev/dkwedge/dk.c:1.69 --- src/sys/dev/dkwedge/dk.c:1.68 Sun Mar 16 01:20:27 2014 +++ src/sys/dev/dkwedge/dk.c Thu Apr 3 11:24:20 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.68 2014/03/16 05:20:27 dholland Exp $ */ +/* $NetBSD: dk.c,v 1.69 2014/04/03 15:24:20 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.68 2014/03/16 05:20:27 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.69 2014/04/03 15:24:20 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -1461,3 +1461,16 @@ dkwedge_find_partition(device_t parent, return wedge; } +const char * +dkwedge_get_parent_name(dev_t dev) +{ + /* XXX: perhaps do this in lookup? */ + int bmaj = bdevsw_lookup_major(&dk_bdevsw); + int cmaj = cdevsw_lookup_major(&dk_cdevsw); + if (major(dev) != bmaj && major(dev) != cmaj) + return NULL; + struct dkwedge_softc *sc = dkwedge_lookup(dev); + if (sc == NULL) + return NULL; + return sc->sc_parent->dk_name; +} Index: src/sys/sys/disk.h diff -u src/sys/sys/disk.h:1.59 src/sys/sys/disk.h:1.60 --- src/sys/sys/disk.h:1.59 Wed May 29 11:22:19 2013 +++ src/sys/sys/disk.h Thu Apr 3 11:24:20 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: disk.h,v 1.59 2013/05/29 15:22:19 martin Exp $ */ +/* $NetBSD: disk.h,v 1.60 2014/04/03 15:24:20 christos Exp $ */ /*- * Copyright (c) 1996, 1997, 2004 The NetBSD Foundation, Inc. @@ -534,6 +534,7 @@ int dkwedge_list(struct disk *, struct d 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 *); +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