Source-Changes-HG archive

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

[src/trunk]: src/sys add dkwedge_get_parent_name().



details:   https://anonhg.NetBSD.org/src/rev/ef8bb6936105
branches:  trunk
changeset: 328435:ef8bb6936105
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Apr 03 15:24:20 2014 +0000

description:
add dkwedge_get_parent_name().

diffstat:

 sys/dev/dkwedge/dk.c |  17 +++++++++++++++--
 sys/sys/disk.h       |   3 ++-
 2 files changed, 17 insertions(+), 3 deletions(-)

diffs (52 lines):

diff -r 282f1fbe538d -r ef8bb6936105 sys/dev/dkwedge/dk.c
--- a/sys/dev/dkwedge/dk.c      Thu Apr 03 15:22:57 2014 +0000
+++ b/sys/dev/dkwedge/dk.c      Thu Apr 03 15:24:20 2014 +0000
@@ -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 @@
        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;
+}
diff -r 282f1fbe538d -r ef8bb6936105 sys/sys/disk.h
--- a/sys/sys/disk.h    Thu Apr 03 15:22:57 2014 +0000
+++ b/sys/sys/disk.h    Thu Apr 03 15:24:20 2014 +0000
@@ -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 @@
 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



Home | Main Index | Thread Index | Old Index